import org.hibernate.Transaction;
import org.splat.kernel.Do;
import org.splat.dal.bo.kernel.User;
+import org.splat.service.DocumentTypeService;
import org.splat.service.PublicationService;
import org.splat.service.ScenarioService;
import org.splat.service.SimulationContextService;
* Injected step service.
*/
private StepService _stepService;
+ /**
+ * Injected document type service.
+ */
+ private DocumentTypeService _documentTypeService;
/**
* Injected repository service.
*/
public String doSave() {
// -----------------------
- Session connex = Database.getSession();
+ Session connex = Database.getCurSession();
Transaction transax = connex.beginTransaction();
try {
// Getting user inputs
mystudy = getOpenStudy();
User user = getConnectedUser();
Step step = mystudy.getSelectedStep();
- DocumentType type = Document.selectType(doctype);
+ DocumentType type = getDocumentTypeService().selectType(doctype);
// File updir = Database.getDownloadDirectory(user);
// File upfile = new File(updir.getPath() + "/" + filename);
String upath = getRepositoryService().getTemplatePath(); // Instead of DownloadDirectory for sharing the "uploaded" file
- // between users
+ // between users
File upfile = new File(upath + filename);
String[] table = filename.split("\\x2E");
String format = table[table.length - 1];
// 1. Conversion of the document to internal format, if required
// TODO: The following code is temporary, waiting for the support of converters
if (format.equals("part")) {
- ConvertsRelation export = credoc.attach("brep");
+ ConvertsRelation export = getPublicationService().attach(
+ credoc, "brep");
target = export.getTo().asFile();
if (target.exists())
public String doVersion() {
// --------------------------
- Session connex = Database.getSession();
+ Session connex = Database.getCurSession();
Transaction transax = connex.beginTransaction();
try {
// Getting user inputs
// File updir = Database.getDownloadDirectory(user);
// File upfile = new File(updir.getPath() + "/" + filename);
String upath = getRepositoryService().getTemplatePath(); // Instead of DownloadDirectory for sharing the "uploaded" file
- // between users
+ // between users
File upfile = new File(upath + filename);
String[] table = filename.split("\\x2E");
String format = table[table.length - 1];
// 1. Conversion of the document to internal format, if required
// TODO: The following code is temporary, waiting for the support of converters
if (format.equals("part")) {
- ConvertsRelation export = next.attach("brep");
+ ConvertsRelation export = getPublicationService().attach(next,
+ "brep");
String fname = table[0];
for (int i = 1; i < table.length - 1; i++)
// ==============================================================================================================================
private void setupDefaultUses(DocumentType type) {
- // -------------------------------------------------
Set<DocumentType> uses = type.getDefaultUses();
for (Iterator<DocumentType> i = uses.iterator(); i.hasNext();) {
SimulationContextService simulationContextService) {
_simulationContextService = simulationContextService;
}
+
+ /**
+ * Get the documentTypeService.
+ *
+ * @return the documentTypeService
+ */
+ public DocumentTypeService getDocumentTypeService() {
+ return _documentTypeService;
+ }
+
+ /**
+ * Set the documentTypeService.
+ *
+ * @param documentTypeService
+ * the documentTypeService to set
+ */
+ public void setDocumentTypeService(DocumentTypeService documentTypeService) {
+ _documentTypeService = documentTypeService;
+ }
}
\ No newline at end of file