Skip to content

Commit 8c98e5d

Browse files
author
w.tscheschner
committed
Trunk:
- Fixed bug in the java implementation of the bpmn migration function. Defaults values of properties where store in a set where the key was the name of the property. For obvious reason, I added the stencil/propertypackage name as prefix of those keys. git-svn-id: http://oryx-editor.googlecode.com/svn/branches/prod@3441 d672c736-503d-0410-a38a-9366997c882b
1 parent 1674c4a commit 8c98e5d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

editor/server/src/de/hpi/bpmn2_0/migration/BPMN2Migrator.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class BPMN2Migrator {
4545

4646
private Diagram diagram;
4747
private String path;
48+
private MigrationHelper helper;
4849

4950
private HashSet<Shape> activityShapes = new HashSet<Shape>();
5051
private HashSet<Shape> gatewayShapes = new HashSet<Shape>();
@@ -488,9 +489,10 @@ private void migrateActivities() throws BpmnMigrationException {
488489
* @throws MigrationHelperException
489490
*/
490491
private void updateProperties(Shape shape) throws MigrationHelperException {
491-
MigrationHelper helper = new MigrationHelper(path);
492+
if (this.helper == null)
493+
this.helper = new MigrationHelper(path);
492494

493-
HashMap<String, String> properties = helper.getProperties(shape.getStencilId());
495+
HashMap<String, String> properties = this.helper.getProperties(shape.getStencilId());
494496

495497
/* find the properties and add them */
496498
for(String property : properties.keySet()) {

editor/server/src/de/hpi/bpmn2_0/migration/MigrationHelper.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ public HashMap<String, String> getProperties(String key) {
231231
for(String propertyPackage : propertyPackages)
232232
if(this.propertiesForPackage.containsKey(propertyPackage))
233233
for(String property : this.propertiesForPackage.get(propertyPackage))
234-
properties.put(property, this.defaultsForProperty.get(property));
234+
properties.put(property, this.defaultsForProperty.get(propertyPackage + property));
235235

236236
/* find all properties that are declared at the stencil */
237237
if(this.propertiesForStencil.containsKey(key))
238238
for(String property : this.propertiesForStencil.get(key))
239-
properties.put(property, this.defaultsForProperty.get(property));
239+
properties.put(property, this.defaultsForProperty.get(key + property));
240240

241241
return properties;
242242
}
@@ -273,7 +273,7 @@ private void parseStencils(JSONArray stencils) throws JSONException {
273273

274274
properties.add(currentProperty.getString("id"));
275275

276-
this.setDefinitionsForProperty(currentProperty);
276+
this.setDefinitionsForProperty(currentStencil.getString("id"), currentProperty);
277277
}
278278

279279
this.propertiesForStencil.put(currentStencil.getString("id"), properties);
@@ -303,7 +303,7 @@ private void parsePropertyPackages(JSONArray propertyPackages) throws JSONExcept
303303

304304
propertyIds.add(currentProperty.getString("id"));
305305

306-
this.setDefinitionsForProperty(currentProperty);
306+
this.setDefinitionsForProperty(packageName, currentProperty);
307307
}
308308

309309
this.propertiesForPackage.put(packageName, propertyIds);
@@ -314,10 +314,11 @@ private void parsePropertyPackages(JSONArray propertyPackages) throws JSONExcept
314314
/**
315315
* Associates the properties with their types and initial values
316316
*
317+
* @param prefix
317318
* @param property
318319
* @throws JSONException
319320
*/
320-
private void setDefinitionsForProperty(JSONObject property) throws JSONException {
321+
private void setDefinitionsForProperty(String prefix, JSONObject property) throws JSONException {
321322
String id = property.getString("id");
322323
String type = property.getString("type");
323324

@@ -329,6 +330,6 @@ private void setDefinitionsForProperty(JSONObject property) throws JSONException
329330
value = property.optString("value");
330331

331332
if(!this.defaultsForProperty.containsKey(id))
332-
this.defaultsForProperty.put(id, value.toString());
333+
this.defaultsForProperty.put(prefix+id, value.toString());
333334
}
334335
}

0 commit comments

Comments
 (0)