* @copyright OPEN CASCADE 2012
*/
-import java.util.List;
import java.util.Vector;
import org.splat.dal.bo.kernel.Persistent;
import org.splat.dal.bo.kernel.User;
-import org.splat.dal.dao.som.Database;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
import org.splat.kernel.MultiplyDefinedException;
-import org.splat.kernel.UserDirectory;
-import org.splat.service.technical.ProjectSettingsServiceImpl;
public class ValidationCycle extends Persistent {
// - Public services
- public void clear () {
+ @Override
+ public void clear () {
super.clear();
doctype = null;
publisher = null;
}
// - Protected services
- public Properties setDocumentType (DocumentType type)
+ public Properties setDocumentType (final DocumentType type)
{
doctype = type;
return this;
}
// - Properties setter
- public Properties setActor (ValidationStep step, User actor)
+ public Properties setActor (final ValidationStep step, final 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 (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;
+ }
return this;
}
// - Global validity check
public void checkValidity() throws MissedPropertyException
{
- if (doctype == null) throw new MissedPropertyException("type");
+ if (doctype == null) {
+ throw new MissedPropertyException("type");
+ }
}
/**
// Database fetch constructor
public ValidationCycle () {
}
- public ValidationCycle (Study from, Properties vprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
-// --------------------------------------------------------
+ public ValidationCycle (final Study from, final Properties vprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
super(vprop); // Throws one of the above exception if not valid
mytype = vprop.doctype;
publisher = vprop.publisher; // May be null
* @param step the validation step checked.
* @return true if the given validation step is enabled.
*/
- public boolean enables (ValidationStep step) {
-// -------------------------------------------
- if (step == ValidationStep.PROMOTION) return true;
- else if (step == ValidationStep.REVIEW) return (reviewer != null);
- else if (step == ValidationStep.APPROVAL) return (approver != null);
- else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) return (signatory != null);
+ public boolean enables (final ValidationStep step) {
+ if (step == ValidationStep.PROMOTION) {
+ return true;
+ } else if (step == ValidationStep.REVIEW) {
+ return (reviewer != null);
+ } else if (step == ValidationStep.APPROVAL) {
+ return (approver != null);
+ } else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) {
+ return (signatory != null);
+ }
return false;
}
* @see #getAllActors()
* @see #enables
*/
- public User getActor (ValidationStep step) {
-// -----------------------------------------
- if (step == ValidationStep.PROMOTION) return publisher;
- else if (step == ValidationStep.REVIEW) return reviewer;
- else if (step == ValidationStep.APPROVAL) return approver;
- else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) return signatory;
+ public User getActor (final ValidationStep step) {
+ if (step == ValidationStep.PROMOTION) {
+ return publisher;
+ } else if (step == ValidationStep.REVIEW) {
+ return reviewer;
+ } else if (step == ValidationStep.APPROVAL) {
+ return approver;
+ } else if (step == ValidationStep.ACCEPTANCE || step == ValidationStep.REFUSAL) {
+ return signatory;
+ }
return null;
}
public User[] getAllActors () {
// -----------------------------
Vector<User> result = new Vector<User>();
- if (publisher != null) result.add(publisher);
- if (reviewer != null) result.add(reviewer);
- if (approver != null) result.add(approver);
- if (signatory != null) result.add(signatory);
+ if (publisher != null) {
+ result.add(publisher);
+ }
+ if (reviewer != null) {
+ result.add(reviewer);
+ }
+ if (approver != null) {
+ result.add(approver);
+ }
+ if (signatory != null) {
+ result.add(signatory);
+ }
return result.toArray(new User[result.size()]);
}
* @see #isDefault()
*/
public DocumentType getDocumentType () {
- // --------------------------------------
return mytype; // May be null
}
* Set a document type for the validation cycle.
* @param aType the document type
*/
- public void setDocumentType (DocumentType aType) {
+ public void setDocumentType (final DocumentType aType) {
mytype = aType; // May be null
}
* @return true if this validation cycle is assigned to a study.
*/
public boolean isAssigned () {
-// ----------------------------
return (context != null);
}
*
* @return true if this validation cycle is a default one.
* @see #getDocumentType()
- * @see ProjectSettingsServiceImpl#getNewValidationCycle()
*/
public boolean isDefault () {
-// ---------------------------
return (mytype == null);
}
-// ==============================================================================================================================
-// Protected services
-// ==============================================================================================================================
-
public ValidationCycleRelation getContext () {
// -----------------------------------------------
return context;
* Set the publisher.
* @param publisher the publisher to set
*/
- public void setPublisher(User publisher) {
+ public void setPublisher(final User publisher) {
this.publisher = publisher;
}
/**
* Set the reviewer.
* @param reviewer the reviewer to set
*/
- public void setReviewer(User reviewer) {
+ public void setReviewer(final User reviewer) {
this.reviewer = reviewer;
}
/**
* Set the approver.
* @param approver the approver to set
*/
- public void setApprover(User approver) {
+ public void setApprover(final User approver) {
this.approver = approver;
}
/**
* Set the signatory.
* @param signatory the signatory to set
*/
- public void setSignatory(User signatory) {
+ public void setSignatory(final User signatory) {
this.signatory = signatory;
}
}
\ No newline at end of file