Skip to content

Commit

Permalink
fixed correct handling of messaging field mappings
Browse files Browse the repository at this point in the history
Issue #71
  • Loading branch information
rsoika committed Jun 24, 2020
1 parent 6563a22 commit 4f75965
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,28 @@ private void updateDeprecatedValue(String deprecatedValue, String newValue) {
allItems.addAll(ImixsBPMNPlugin.findAllItemsByName((Definitions) imixsElement, "keyAddReadFields"));
allItems.addAll(ImixsBPMNPlugin.findAllItemsByName((Definitions) imixsElement, "keyAddWriteFields"));

// test messaging settings.
allItems.addAll(ImixsBPMNPlugin.findAllItemsByName((Definitions) imixsElement, "keymailreceiverfields"));
allItems.addAll(ImixsBPMNPlugin.findAllItemsByName((Definitions) imixsElement, "keymailreceiverfieldscc"));
allItems.addAll(ImixsBPMNPlugin.findAllItemsByName((Definitions) imixsElement, "keymailreceiverfieldsbcc"));

// time compare filed
allItems.addAll(ImixsBPMNPlugin.findAllItemsByName((Definitions) imixsElement, "keytimecomparefield"));


for (Item item: allItems) {

// test if the value is part of this item...
EList<Value> valueList = item.getValuelist();
for (Value value : valueList) {
if (value.getValue().equals(deprecatedValue)) {
if (newValue == null) {
logger.info("...remove drepecated value '" + deprecatedValue + "' from item " + item.getName()
logger.info("...remove deprecated value '" + deprecatedValue + "' from item " + item.getName()
+ "...");
valueList.remove(value);
break;
} else {
logger.fine("...update drepecated value '" + deprecatedValue + "' from item " + item.getName()
logger.fine("...update deprecated value '" + deprecatedValue + "' from item " + item.getName()
+ " -> " + newValue + "...");
// we need to update the deprecated value with the new value!
int i = valueList.indexOf(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,37 @@ public void notify(LifecycleEvent event) {
*/
private void validateDeprecatedFieldMappings(EObject object) {

// test for deprecated fieldMappings...
// test for deprecated fieldMappings for Task elements...
if (ImixsBPMNPlugin.isImixsTask(object) || ImixsBPMNPlugin.isImixsCatchEvent(object)) {
removeDeprecatedActorEntries(object, "keyownershipfields", "txtFieldMapping");
removeDeprecatedActorEntries(object, "keyaddwritefields", "txtFieldMapping");
removeDeprecatedActorEntries(object, "keyaddreadfields", "txtFieldMapping");
removeDeprecatedFieldMappings(object, "keyownershipfields", "txtFieldMapping");
removeDeprecatedFieldMappings(object, "keyaddwritefields", "txtFieldMapping");
removeDeprecatedFieldMappings(object, "keyaddreadfields", "txtFieldMapping");
}

// test for deprecated time fields...
// test for deprecated fieldMappings for Event elements

if (ImixsBPMNPlugin.isImixsCatchEvent(object)) {
removeDeprecatedActorEntries(object, "keytimecomparefield", "txttimefieldmapping");
// test timer settings
removeDeprecatedFieldMappings(object, "keytimecomparefield", "txttimefieldmapping");
// test messaging settings.
removeDeprecatedFieldMappings(object, "keymailreceiverfields", "txtFieldMapping");
removeDeprecatedFieldMappings(object, "keymailreceiverfieldscc", "txtFieldMapping");
removeDeprecatedFieldMappings(object, "keymailreceiverfieldsbcc", "txtFieldMapping");
}

}

/**
* Validates a specific item for deprecated FieldMappings. The method can
* validate field mappings from different soruces. Currently 'txtFieldMapping'
* validate field mappings from different sources. Currently 'txtFieldMapping'
* for actors and 'txttimefieldmapping' for Time Fields are known.
*
* @param object
* - task or event entity
* @param itenName
* - name of the value to validate
*/
private void removeDeprecatedActorEntries(EObject object, String itenName, String mappingSource) {
private void removeDeprecatedFieldMappings(EObject object, String itenName, String mappingSource) {

// we can not cache the fieldMapping here!
// We need to load for each BaseElement separately because we do not know in
Expand All @@ -143,7 +149,15 @@ private void removeDeprecatedActorEntries(EObject object, String itenName, Strin

// test if value still is defined
if (!fieldMappings.containsKey(entry.getValue())) {
logger.info("...remove deprecated fieldmapping '" + itenName + "' : " + entry.getValue());
String objectType="";
if (ImixsBPMNPlugin.isImixsTask(object)) {
objectType="ImixsTask";
}

if (ImixsBPMNPlugin.isImixsCatchEvent(object)) {
objectType="ImixsEvent";
}
logger.info("... " + objectType + ": remove deprecated fieldmapping '" + itenName + "' : " + entry.getValue());
deprecatedList.add(entry);
}
}
Expand Down

0 comments on commit 4f75965

Please sign in to comment.