From: rkv Date: Mon, 21 Jan 2013 08:55:44 +0000 (+0000) Subject: Each document type now uses itself. So default uses iincludes documents of the type... X-Git-Tag: Root_Delivery2_2013_04_22~165 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=17ef512246e46a57473d79407d4a9bf08c45bcb7;p=tools%2Fsiman.git Each document type now uses itself. So default uses iincludes documents of the type of the document to be imported. NOTE: The database must be reinitialized to create necessary docuses dependencies. --- diff --git a/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java index 33b15cf..7a6d5e3 100644 --- a/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java @@ -115,6 +115,7 @@ public class DocumentTypeServiceImpl implements DocumentTypeService { Restrictions.eq("name", tprop.getName())); if (type == null) { type = new DocumentType(tprop); + type.getDefaultUses().add(type); //RKV getDocumentTypeDAO().create(type); } else { LOG.info(MessageKeyEnum.DCT_000001.toString(), tprop.getName()); diff --git a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java index 08feeae..88a779e 100644 --- a/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java @@ -801,13 +801,21 @@ public class ProjectSettingsServiceImpl implements ProjectSettingsService { slist.toArray(new ProjectSettingsService.Step[slist .size()])); if (uses != null) { - tdoc = maptype.get(uses); - if (tdoc == null) { - LOG.warn("Undefined \"" + uses - + "\" document type."); - } else { - tprop.setUses(tdoc); + // Parse uses attribute + String[] usesArr = uses.split(","); + List usesTypesList = new ArrayList(); + for (String usesType: usesArr) { + tdoc = maptype.get(usesType.trim()); + if (tdoc == null) { + LOG.warn("Undefined \"" + usesType.trim() + + "\" document type."); + } else { + if (!usesTypesList.contains(tdoc)) { + usesTypesList.add(tdoc); + } + } } + tprop.setUses(usesTypesList.toArray(new DocumentType[]{})); } if (step != null) { tprop.setResult(step); diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java index 86aaf53..d024155 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -521,10 +521,9 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { step = getProjectElementService().getSteps(_mystudy); for (int i = step.length - 1; i > -1; i--) { Step firstep = step[i]; - if (firstep.getNumber() > base) { - continue; + if (firstep.getNumber() <= base) { + _involving.add(0, firstep); } - _involving.add(0, firstep); } } diff --git a/Workspace/Siman/src/org/splat/simer/UploadBaseNextAction.java b/Workspace/Siman/src/org/splat/simer/UploadBaseNextAction.java index bdea14f..3091851 100644 --- a/Workspace/Siman/src/org/splat/simer/UploadBaseNextAction.java +++ b/Workspace/Siman/src/org/splat/simer/UploadBaseNextAction.java @@ -92,7 +92,7 @@ public abstract class UploadBaseNextAction extends Action { for (Iterator i = uses.iterator(); i.hasNext();) { DocumentType usetype = i.next(); List usedoc = mystudy.collectInvolvedDocuments(usetype); - if (usedoc.isEmpty()) { + if (usedoc.isEmpty() && (!usetype.equals(type))) { setupDefaultUses(usetype); } else { defuses.addAll(usedoc);