import org.splat.dal.bo.som.SimulationContextType;
import org.splat.dal.bo.som.Study;
import org.splat.dal.bo.som.Timestamp;
+import org.splat.dal.bo.som.UsedByRelation;
import org.splat.dal.bo.som.ValidationCycle;
import org.splat.dal.bo.som.ValidationStep;
+import org.splat.dal.dao.som.Database;
import org.splat.dal.dao.som.ProjectElementDAO;
import org.splat.dal.dao.som.PublicationDAO;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.NotApplicableException;
import org.splat.manox.Reader;
import org.splat.manox.Toolbox;
+import org.splat.som.DocumentRights;
import org.splat.som.Revision;
import org.splat.som.Step;
import org.springframework.transaction.annotation.Transactional;
ValidationCycle cycle = getStudyService().getValidationCycleOf(owner,
type);
User approver = cycle.getActor(ValidationStep.APPROVAL);
- Timestamp stamp = new Timestamp(ValidationStep.APPROVAL, aPublication
- .value(), approver, adate);
+ Timestamp stamp = new Timestamp(ValidationStep.APPROVAL,
+ aPublication.value(), approver, adate);
if (!getDocumentService().promote(aPublication.value(), stamp))
return null;
if (getDocumentService().isStudyResult(type)
ValidationCycle cycle = getStudyService().getValidationCycleOf(owner,
type);
User reviewer = cycle.getActor(ValidationStep.REVIEW);
- Timestamp stamp = new Timestamp(ValidationStep.REVIEW, aPublication
- .value(), reviewer, rdate);
+ Timestamp stamp = new Timestamp(ValidationStep.REVIEW,
+ aPublication.value(), reviewer, rdate);
if (!getDocumentService().promote(aPublication.value(), stamp))
return null;
if (getDocumentService().isStudyResult(type)
return; // No properties extractor available for this type of document
SimulationContextType.Properties sprop = new SimulationContextType.Properties()
- .setStep(to.getStep()).setState(ProgressState.APPROVED);
+ .setStep(to.getStep()).setProgressState(ProgressState.APPROVED);
List<SimulationContextType> contype = getSimulationContextService()
.selectTypesWhere(sprop);
if (contype.isEmpty())
return aPublication.getStep();
}
+ /**
+ * Undo the out-date operation.
+ *
+ * @param aPublication
+ * the publication
+ * @return true if the acceptance succeeds
+ * @see #outdate()
+ * @see DocumentRights#canAccept()
+ */
+ public boolean actualize(Publication aPublication) {
+ if (!aPublication.isOutdated())
+ return false;
+ aPublication.setIsnew('Y');
+ getPublicationDAO().update(aPublication);
+ return true;
+ }
+
+ /**
+ * Out-dates this publication and recursively all publications using this one. Typically, a publication is out-dated when modifying a
+ * document to which it depends.
+ *
+ * @param aPublication
+ * the publication
+ * @see #isOutdated()
+ * @see #getProgressState()
+ * @see #actualize()
+ */
+ public void outdate(Publication aPublication) {
+ if (aPublication.isOutdated())
+ return;
+
+ List<Publication> relist = aPublication
+ .getRelations(UsedByRelation.class);
+ for (Iterator<Publication> i = relist.iterator(); i.hasNext();) {
+ outdate(i.next());
+ }
+ aPublication.setIsnew('O');
+ getPublicationDAO().update(aPublication);
+ }
+
/**
* Create "Converts" relation for the given document publication and format.
*