]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Each document type now uses itself. So default uses iincludes documents of the type...
authorrkv <rkv@opencascade.com>
Mon, 21 Jan 2013 08:55:44 +0000 (08:55 +0000)
committerrkv <rkv@opencascade.com>
Mon, 21 Jan 2013 08:55:44 +0000 (08:55 +0000)
Workspace/Siman-Common/src/org/splat/service/DocumentTypeServiceImpl.java
Workspace/Siman-Common/src/org/splat/service/technical/ProjectSettingsServiceImpl.java
Workspace/Siman/src/org/splat/simer/OpenStudy.java
Workspace/Siman/src/org/splat/simer/UploadBaseNextAction.java

index 33b15cf69f8ba509eac70e958feb9c109b801b3c..7a6d5e378ed0912745948315b4d91beb80f9bef1 100644 (file)
@@ -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());
index 08feeae8374fa27a8a524ce55efe817358a6e02f..88a779e22122e348703cf7650dd2e55a16fa29d8 100644 (file)
@@ -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<DocumentType> usesTypesList = new ArrayList<DocumentType>();
+                                               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);
index 86aaf534495bbe544ec3204ed31d06ddc8c4fd9a..d0241558c138fba61c1601a58b9f90b21a7c63ee 100644 (file)
@@ -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);
                }
        }
 
index bdea14f849f55080380a821d0186c089ffffd784..30918510857fa37b1a182b5600d29b127d51c498 100644 (file)
@@ -92,7 +92,7 @@ public abstract class UploadBaseNextAction extends Action {
                for (Iterator<DocumentType> i = uses.iterator(); i.hasNext();) {
                        DocumentType usetype = i.next();
                        List<Document> usedoc = mystudy.collectInvolvedDocuments(usetype);
-                       if (usedoc.isEmpty()) {
+                       if (usedoc.isEmpty() && (!usetype.equals(type))) {
                                setupDefaultUses(usetype);
                        } else {
                                defuses.addAll(usedoc);