import org.splat.dal.bo.kernel.User;
import org.splat.service.PublicationService;
import org.splat.service.ScenarioService;
+import org.splat.service.SimulationContextService;
import org.splat.service.StepService;
+import org.splat.service.technical.RepositoryService;
import org.splat.simer.Action;
import org.splat.simer.OpenStudy;
import org.splat.dal.bo.som.ConvertsRelation;
public class SaveDocumentAction extends Action {
+ /**
+ * Serial version ID.
+ */
+ private static final long serialVersionUID = -3364960833373200115L;
+
+ /**
+ * Current open study.
+ */
private OpenStudy mystudy = null;
private int doctype = 0;
private String filename = null;
private ProgressState state = null;
private List<Document> defuses = null;
private String summary = null; // Summary of changes in the new version
+ /**
+ * Injected scenario service.
+ */
private ScenarioService _scenarioService;
+ /**
+ * Injected publication service.
+ */
private PublicationService _publicationService;
+ /**
+ * Injected step service.
+ */
private StepService _stepService;
-
- private static final long serialVersionUID = -3364960833373200115L;
+ /**
+ * Injected repository service.
+ */
+ private RepositoryService _repositoryService;
+ /**
+ * Injected simulation context service.
+ */
+ private SimulationContextService _simulationContextService;
// ==============================================================================================================================
// Action methods
DocumentType type = Document.selectType(doctype);
// File updir = Database.getDownloadDirectory(user);
// File upfile = new File(updir.getPath() + "/" + filename);
- String upath = Database.getTemplatePath(); // Instead of DownloadDirectory for sharing the "uploaded" file between users
+ String upath = getRepositoryService().getTemplatePath(); // Instead of DownloadDirectory for sharing the "uploaded" file
+ // between users
File upfile = new File(upath + filename);
String[] table = filename.split("\\x2E");
String format = table[table.length - 1];
connex.flush();
Document.Properties dprop = new Document.Properties();
- Publication credoc = getStepService().createDocument(step, dprop.setName(docname)
- .setType(type).setFormat(format).setAuthor(user));
+ Publication credoc = getStepService().createDocument(
+ step,
+ dprop.setName(docname).setType(type).setFormat(format)
+ .setAuthor(user));
// Writing the uploaded file into the created document
File target = credoc.getSourceFile().asFile();
if (target.exists())
// 2. Addition of simulation contexts
if (type.equals("model")) { // Set the characteristics of the mesh
SimulationContext.Properties cprop = new SimulationContext.Properties();
- SimulationContextType ctype = SimulationContext
+ SimulationContextType ctype = getSimulationContextService()
.selectType("model");
- SimulationContext context = Database.selectSimulationContext(
- ctype, "Éléments finis");
+ SimulationContext context = getSimulationContextService()
+ .selectSimulationContext(ctype, "Éléments finis");
if (context == null) {
getStepService().addSimulationContext(step,
cprop.setType(ctype).setValue("Éléments finis"));
} else {
getStepService().addSimulationContext(step, context);
}
- ctype = SimulationContext.selectType("element");
- context = Database.selectSimulationContext(ctype, "Surfacique");
+ ctype = getSimulationContextService().selectType("element");
+ context = getSimulationContextService()
+ .selectSimulationContext(ctype, "Surfacique");
if (context == null) {
getStepService().addSimulationContext(step,
cprop.setType(ctype).setValue("Surfacique"));
} else {
getStepService().addSimulationContext(step, context);
}
- ctype = SimulationContext.selectType("shape");
- context = Database.selectSimulationContext(ctype, "Triangles");
+ ctype = getSimulationContextService().selectType("shape");
+ context = getSimulationContextService()
+ .selectSimulationContext(ctype, "Triangles");
if (context == null) {
getStepService().addSimulationContext(step,
cprop.setType(ctype).setValue("Triangles"));
Step step = mystudy.getSelectedStep();
// File updir = Database.getDownloadDirectory(user);
// File upfile = new File(updir.getPath() + "/" + filename);
- String upath = Database.getTemplatePath(); // Instead of DownloadDirectory for sharing the "uploaded" file between users
+ String upath = getRepositoryService().getTemplatePath(); // Instead of DownloadDirectory for sharing the "uploaded" file
+ // between users
File upfile = new File(upath + filename);
String[] table = filename.split("\\x2E");
String format = table[table.length - 1];
if (summary.length() > 0)
dprop.setDescription(summary);
- Publication next = getStepService().versionDocument(step, current, dprop);
+ Publication next = getStepService().versionDocument(step, current,
+ dprop);
// Writing the uploaded file into the created document
File target = next.getSourceFile().asFile();
defuses.addAll(usedoc);
}
}
+
+ /**
+ * Get the repositoryService.
+ *
+ * @return the repositoryService
+ */
+ public RepositoryService getRepositoryService() {
+ return _repositoryService;
+ }
+
+ /**
+ * Set the repositoryService.
+ *
+ * @param repositoryService
+ * the repositoryService to set
+ */
+ public void setRepositoryService(RepositoryService repositoryService) {
+ _repositoryService = repositoryService;
+ }
+
+ /**
+ * Get the simulationContextService.
+ *
+ * @return the simulationContextService
+ */
+ public SimulationContextService getSimulationContextService() {
+ return _simulationContextService;
+ }
+
+ /**
+ * Set the simulationContextService.
+ *
+ * @param simulationContextService
+ * the simulationContextService to set
+ */
+ public void setSimulationContextService(
+ SimulationContextService simulationContextService) {
+ _simulationContextService = simulationContextService;
+ }
}
\ No newline at end of file