import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.Study;
+import org.splat.exception.InvalidParameterException;
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.ScenarioDTO;
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.
+ * Get a list of scenarios of a study with the given id.
*
+ * @param studyId
+ * the study id
+ * @return list of scenario DTOs
+ */
+ List<ScenarioDTO> getStudyScenarios(final Long studyId);
+
+ /**
+ * Get a new id to document arriver after check-out.
+ * Return two several values: -1 or ID of the existing document.
+ *
+ * @param scenId
+ * the scenario id
+ * @param activityNumber
+ * the number of activity
+ * @param docId
+ * the document id
+ * @param fileExt
+ * the file extension
+ * @return new document id or -1 if same document do nor exist.
+ *
+ * @throws InvalidPropertyException if activityNumber is incorrect.
+ */
+
+ long getNewDocumentId(final long scenId,
+ final int activityNumber, final Long docId,
+ final String fileExt) throws InvalidPropertyException;
+
+ /**
+ * Copy content of a source study into the given study up to the given step.
+ *
+ * @param fromStudyId
+ * the source study id
+ * @param fromScenId
+ * the source scenario id
+ * @param finalStepNum
+ * the final source step number
+ * @param toStudyId
+ * the target study
+ * @throws InvalidParameterException
+ * if study, scenario or step is not found
+ * @throws MissedPropertyException
+ * if document creation is failed
+ * @throws InvalidPropertyException
+ * if document creation is failed
+ * @throws MultiplyDefinedException
+ * if document creation is failed
+ * @throws IOException
+ * if document file creation is failed
+ * @throws NotApplicableException
+ * if document state is not applicable
+ */
+ void copyStudyContent(final long fromStudyId, final long fromScenId,
+ final int finalStepNum, final long toStudyId)
+ throws InvalidParameterException, MissedPropertyException,
+ InvalidPropertyException, MultiplyDefinedException,
+ NotApplicableException, IOException;
+
+ /**
+ * 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.
- *
+ * Assign context to the study.
+ *
+ * @param studyId
+ * study id
+ * @param ctxType
+ * context type name
+ * @param ctxValue
+ * context value
+ * @throws InvalidPropertyException
+ * if an invalid value is passed to a property
+ * @throws MissedPropertyException
+ * if a mandatory property is missed
+ * @throws MultiplyDefinedException
+ * if some property is defined several times
+ */
+ void assignStudyContext(final Long studyId, final String ctxType,
+ final String ctxValue) throws MissedPropertyException,
+ InvalidPropertyException, MultiplyDefinedException;
+
+ /**
+ * Create a new study.
+ *
+ * @param username
+ * user login
+ * @param title
+ * study title
+ * @param productName
+ * study product simulation context value
+ * @param description
+ * study summary
+ * @return the created study id
+ * @throws InvalidPropertyException
+ * if an invalid value is passed to a property
+ * @throws MissedPropertyException
+ * if a mandatory property is missed
+ * @throws MultiplyDefinedException
+ * if some property is defined several times
+ */
+ long createStudy(final String username, final String title,
+ final String productName, final String description)
+ throws InvalidPropertyException,
+ MissedPropertyException,
+ MultiplyDefinedException;
+
+ /**
+ * Create a new study with one scenario and "product"
+ * simulation context.
+ *
* @param sprop
* the study properties
* @param oprop
* @throws MissedPropertyException
* if a mandatory property is missed
* @throws InvalidPropertyException
- * if some property doesn't exist
+ * if an invalid value is passed to a property
* @throws MultiplyDefinedException
* if some property occurs several times
*/
* @throws MissedPropertyException
* if a mandatory property is missed
* @throws InvalidPropertyException
- * if some property doesn't exist
+ * if an invalid value is passed to a property
* @throws MultiplyDefinedException
* if some property is defined several times
*/
* @throws InvalidPropertyException
* if the scenario is not found in the database
*/
- public void checkin(final long scenarioId) throws InvalidPropertyException;
+ void checkin(final long scenarioId) throws InvalidPropertyException;
/**
* Check out the scenario.
* @throws NotApplicableException
* if the given user can not check out the scenario
*/
- public void checkout(final long scenarioId, final long userId)
+ void checkout(final long scenarioId, final long userId)
throws InvalidPropertyException, NotApplicableException;
/**
* @return true if removal succeeded
*/
boolean removeKnowledgeElement(Scenario scenario, KnowledgeElement kelm);
-
+
/**
* Rename the scenario.
- * @param scenario - the scenario with a new title.
+ *
+ * @param scenario -
+ * the scenario with a new title.
*/
void renameScenario(final Scenario scenario);
+
+ /**
+ * Remove the scenario.
+ *
+ * @param scenarioId -
+ * the id of the scenario to remove.
+ */
+ void removeScenario(final long scenarioId);
}