import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.SimulationContextType;
import org.splat.service.SimulationContextService;
+import org.splat.service.SimulationContextTypeService;
import org.splat.service.StepService;
import org.splat.service.StudyService;
import org.splat.som.Step;
* Injected simulation context service.
*/
private SimulationContextService _simulationContextService;
+ /**
+ * Injected simulation context type service.
+ */
+ private SimulationContextTypeService _simulationContextTypeService;
/**
* Get the stepService.
SimulationContext.Properties cprop = new SimulationContext.Properties();
SimulationContext contex = null;
- type = getSimulationContextService().createType(newtype,
+ type = getSimulationContextTypeService().createType(newtype,
step.getStep());
cprop.setType(type).setValue(value);
if (owner instanceof Study)
SimulationContextService simulationContextService) {
_simulationContextService = simulationContextService;
}
+
+ /**
+ * Get the simulationContextTypeService.
+ * @return the simulationContextTypeService
+ */
+ public SimulationContextTypeService getSimulationContextTypeService() {
+ return _simulationContextTypeService;
+ }
+
+ /**
+ * Set the simulationContextTypeService.
+ * @param simulationContextTypeService the simulationContextTypeService to set
+ */
+ public void setSimulationContextTypeService(
+ SimulationContextTypeService simulationContextTypeService) {
+ _simulationContextTypeService = simulationContextTypeService;
+ }
}
\ No newline at end of file
import java.util.ResourceBundle;
import java.util.Vector;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
import org.splat.dal.bo.kernel.User;
import org.splat.manox.Reader;
import org.splat.manox.Toolbox;
-import org.splat.dal.dao.som.Database;
import org.splat.dal.bo.som.Document;
import org.splat.dal.bo.som.ProgressState;
import org.splat.service.DocumentService;
import org.splat.som.Revision;
import org.splat.som.Step;
+/**
+ * Action for adding a document into a study step.
+ */
public class ImportDocumentAction extends UploadBaseNextAction {
/**
* @return SUCCESS in success, otherwise - ERROR
*/
public String doInitialize() {
- // -----------------------------
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
User user = getConnectedUser();
File updir = getRepositoryService().getDownloadDirectory(user);
File upfile = new File(updir.getPath() + "/" + filename);
Arrays.sort(types, compare);
doctypes = Arrays.asList(types);
- transax.commit();
return SUCCESS;
}
setErrorCode("import.type");
return ERROR;
}
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
try {
// Getting user inputs
mystudy = getOpenStudy();
// Converter send = ApplicationSettings.getConverter(ndoc.getType(), ndoc.getFormat());
//
// if (send != null) send.converts(addoc); // Asynchronous process
- transax.commit();
mystudy.add(addoc); // Updates the presentation
return SUCCESS;
logger.error("Reason:", error);
setErrorCode("internal");
}
- if (transax != null && transax.isActive()) { // Probably useless test
- // Second try-catch as the rollback could fail as well
- try {
- transax.rollback();
- } catch (HibernateException backerror) {
- logger.debug("Error rolling back transaction", backerror);
- }
- }
return ERROR;
}
<property name="projectSettings" ref="projectSettings" />
<property name="publicationService" ref="publicationService" />
<property name="repositoryService" ref="repositoryService" />
- <property name="documentTypeService" ref="documentTypeService" />
+ <property name="documentService" ref="documentService" />
+ <property name="documentTypeService" ref="documentTypeService" />
</bean>
<bean id="displayStudyStepAction"
class="org.splat.simer.EditSimulationContextAction" scope="prototype"
parent="displayStudyStepAction">
<property name="stepService" ref="stepService" />
- <property name="simulationContextService"
- ref="simulationContextService" />
+ <property name="simulationContextService"
+ ref="simulationContextService" />
+ <property name="simulationContextTypeService"
+ ref="simulationContextTypeService" />
</bean>
<bean id="editDocumentAction"