package org.splat.service;
+import java.io.IOException;
+import java.util.List;
+
import org.splat.dal.bo.kernel.User;
import org.splat.dal.bo.som.KnowledgeElement;
import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.Study;
import org.splat.kernel.InvalidPropertyException;
+import org.splat.kernel.MismatchException;
import org.splat.kernel.MissedPropertyException;
import org.splat.kernel.MultiplyDefinedException;
+import org.splat.kernel.NotApplicableException;
+import org.splat.service.dto.StepDTO;
import org.splat.som.Step;
/**
*/
public interface ScenarioService {
+ /**
+ * Get lists of scenario steps, documents and files for building siman-salome.conf file.
+ *
+ * @param scenarioId
+ * scenario id
+ * @return list of step DTOs
+ */
+ List<StepDTO> getScenarioInfo(long scenarioId);
+
/**
* Create a new study with one scenario and "product" simulation context.
*
* @throws MultiplyDefinedException
* if some property occurs several times
*/
- public Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
+ Study createStudy(Study.Properties sprop, Scenario.Properties oprop,
SimulationContext.Properties cprop) throws MissedPropertyException,
InvalidPropertyException, MultiplyDefinedException;
* @throws MultiplyDefinedException
* if some property occurs several times
*/
- public Scenario addScenario(Study aStudy, Scenario.Properties sprop)
+ Scenario addScenario(Study aStudy, Scenario.Properties sprop)
throws MissedPropertyException, InvalidPropertyException,
MultiplyDefinedException;
* @throws MultiplyDefinedException
* if some property is defined several times
*/
- public KnowledgeElement addKnowledgeElement(Scenario aScenario,
+ KnowledgeElement addKnowledgeElement(Scenario aScenario,
KnowledgeElement.Properties kprop) throws MissedPropertyException,
InvalidPropertyException, MultiplyDefinedException;
+ /**
+ * Check-in the scenario after SALOME session. If a document to be checked in already exists then create a new version of it. Otherwise
+ * create a new document of the appropriate step result type.
+ * <ul>
+ * <li>For each new created document version we copy Uses relations from the previous document version. If used document has been also
+ * versioned during this check-in operation then refer to its new version.</li>
+ * <li>For each new document create uses relation to the last versions of results of a previous step.</li>
+ * </ul>
+ * <b>NOTE:</b> Only the first attached file is processed for each document. <br/>All new documents/versions are created in inWORK
+ * state.
+ *
+ * @param scenId
+ * the scenario id
+ * @param userId
+ * the id of the user who modified documents
+ * @param scInfo
+ * the list of scenario steps DTO
+ * @throws InvalidPropertyException
+ * if the scenario hasn't some of given steps or documents
+ * @throws IOException
+ * if a file can't be moved into the vault
+ * @throws MismatchException
+ * if version creation in some of steps is failed
+ * @throws MissedPropertyException
+ * if some mandatory property is missed when new document or new document version is created
+ * @throws MultiplyDefinedException
+ * if some property is defined several times when new document or new document version is created
+ * @throws NotApplicableException
+ * if failed saving of a new publication with a given state
+ */
+ void checkin(final long scenId, final long userId,
+ final List<StepDTO> scInfo) throws InvalidPropertyException,
+ MissedPropertyException, MultiplyDefinedException,
+ MismatchException, IOException, NotApplicableException;
+
/**
* Check in the scenario.
*
- * @param aScenario
- * the scenario to check in
+ * @param scenarioId
+ * the id of the scenario to check in
+ * @throws InvalidPropertyException
+ * if the scenario is not found in the database
*/
- public void checkin(Scenario aScenario);
+ public void checkin(final long scenarioId) throws InvalidPropertyException;
/**
* Check out the scenario.
* the current user
* @return true if check out operation succeeded
*/
- public boolean checkout(Scenario aScenario, User user);
+ boolean checkout(Scenario aScenario, User user);
+
+ /**
+ * Mark the given scenario as checked out by the given user.
+ *
+ * @param scenarioId
+ * the scenario id
+ * @param userId
+ * the id of the user performing the check out
+ * @throws InvalidPropertyException
+ * if the user or the scenario is not found in the database
+ * @throws NotApplicableException
+ * if the given user can not check out the scenario
+ */
+ public void checkout(final long scenarioId, final long userId)
+ throws InvalidPropertyException, NotApplicableException;
/**
* Copy contents from other scenario up to its given step into the given scenario.
* @param lastep
* the last processed step of the source scenario
*/
- public void copyContentsUpTo(Scenario scenario, Step lastep);
+ void copyContentsUpTo(Scenario scenario, Step lastep);
/**
* Check if the scenario is empty, i.d. no one of its steps doesn't contain any knowledge elements or documents.
* the scenario to check
* @return true if the scenario is empty
*/
- public boolean isEmpty(Scenario scenario);
+ boolean isEmpty(Scenario scenario);
/**
* Remove a knowledge element from a scenario.
* the knowledge element to remove
* @return true if removal succeeded
*/
- public boolean removeKnowledgeElement(Scenario scenario,
- KnowledgeElement kelm);
+ boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm);
+
+ /**
+ * Rename the scenario.
+ * @param scenario - the scenario with a new title.
+ */
+ void renameScenario(final Scenario scenario);
}