{
if (doctype == null) throw new MissedPropertyException("type");
}
+
+ /**
+ * Get the publisher.
+ * @return the publisher
+ */
+ public User getPublisher() {
+ return publisher;
+ }
+
+ /**
+ * Get the reviewer.
+ * @return the reviewer
+ */
+ public User getReviewer() {
+ return reviewer;
+ }
+
+ /**
+ * Get the approver.
+ * @return the approver
+ */
+ public User getApprover() {
+ return approver;
+ }
+
+ /**
+ * Get the signatory.
+ * @return the signatory
+ */
+ public User getSignatory() {
+ return signatory;
+ }
}
// Database fetch constructor
- protected ValidationCycle () {
- }
-// Internal constructors
- protected ValidationCycle (Study from, ProjectSettingsServiceImpl.ProjectSettingsValidationCycle cycle) {
-// -----------------------------------------------------------------------------
- Actor[] actype = cycle.getActorTypes();
- User.Properties uprop = new User.Properties();
-
- mytype = Document.selectType(cycle.getName()); // Null in case of default validation cycle
-// context = new ValidationCycleRelation(from, this);
- context = null; // Validation cycle defined in the workflow
- for (int i=0; i<actype.length; i++) {
- User actor = null;
- if (actype[i] != null)
- try {
- if (actype[i] == Actor.manager) {
- actor = from.getAuthor();
- } else
- if (actype[i] == Actor.Nx1) {
- List<User> manager = UserDirectory.selectUsersWhere(uprop.setOrganizationName("Nx1"));
- if (manager.size() == 1) actor = manager.get(0);
- } else
- if (actype[i] == Actor.Nx2) {
- List<User> manager = UserDirectory.selectUsersWhere(uprop.setOrganizationName("Nx2"));
- if (manager.size() == 1) actor = manager.get(0);
- } else { /* Actor.customer */
- actor = from.getAuthor();
-//TODO: Get the customer of the study, if exists
- }
- } catch (Exception e) { // Should not happen
- actor = null;
- }
- if (i == 0) reviewer = actor;
- else if (i == 1) approver = actor;
- else if (i == 2) signatory = actor;
- }
+ public ValidationCycle () {
}
public ValidationCycle (Study from, Properties vprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
// --------------------------------------------------------
* @see #isDefault()
*/
public DocumentType getDocumentType () {
-// --------------------------------------
- return mytype; // May be null
+ // --------------------------------------
+ return mytype; // May be null
+ }
+
+ /**
+ * Set a document type for the validation cycle.
+ * @param aType the document type
+ */
+ public void setDocumentType (DocumentType aType) {
+ mytype = aType; // May be null
}
/**
// -----------------------------------------------
return context;
}
-
- protected void remove (ValidationStep step) {
-// ------------------------------------------
- if (step == ValidationStep.REVIEW) reviewer = null;
- else if (step == ValidationStep.APPROVAL) approver = null;
- else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) signatory = null;
- if (this.isSaved()) Database.getSession().update(this);
- }
-
- public void resetActors (Properties vprop) {
-// ---------------------------------------------
- publisher = vprop.publisher; // May be null
- reviewer = vprop.reviewer; // May be null
- approver = vprop.approver; // May be null
- signatory = vprop.signatory; // May be null
- if (this.isSaved()) Database.getSession().update(this);
- }
-
- protected void setActor (ValidationStep step, User actor) {
-// --------------------------------------------------------
- if (step == ValidationStep.PROMOTION) publisher = actor;
- else if (step == ValidationStep.REVIEW) reviewer = actor;
- else if (step == ValidationStep.APPROVAL) approver = actor;
- else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) signatory = actor;
- if (this.isSaved()) Database.getSession().update(this);
- }
+ /**
+ * Set the publisher.
+ * @param publisher the publisher to set
+ */
+ public void setPublisher(User publisher) {
+ this.publisher = publisher;
+ }
+ /**
+ * Set the reviewer.
+ * @param reviewer the reviewer to set
+ */
+ public void setReviewer(User reviewer) {
+ this.reviewer = reviewer;
+ }
+ /**
+ * Set the approver.
+ * @param approver the approver to set
+ */
+ public void setApprover(User approver) {
+ this.approver = approver;
+ }
+ /**
+ * Set the signatory.
+ * @param signatory the signatory to set
+ */
+ public void setSignatory(User signatory) {
+ this.signatory = signatory;
+ }
}
\ No newline at end of file