@Override public CommandMediator createNode(IGraphicalEditPart part, AbstractMediator object) { Assert.isTrue( object instanceof POJOCommandMediatorExt, "Unsupported mediator passed in for deserialization"); POJOCommandMediatorExt mediator = (POJOCommandMediatorExt) object; CommandMediator mediatorModel = (CommandMediator) DeserializerUtils.createNode(part, EsbElementTypes.CommandMediator_3511); setElementToEdit(mediatorModel); setCommonProperties(mediator, mediatorModel); executeSetValueCommand(COMMAND_MEDIATOR__CLASS_NAME, mediator.getPojoClass()); Map<String, CommandProperty> properties = new HashMap<String, CommandProperty>(); for (String propName : mediator.getStaticSetterProperties().keySet()) { CommandProperty property = EsbFactory.eINSTANCE.createCommandProperty(); property.setPropertyName(propName); Object value = mediator.getStaticSetterProperties().get(propName); property.setValueLiteral(value.toString()); if (mediator.getContextGetterProperties().containsKey(propName)) { property.setValueContextPropertyName( mediator.getContextGetterProperties().get(propName).toString()); } else if (mediator.getMessageGetterProperties().containsKey(propName)) { property.setValueMessageElementXpath( createNamespacedProperty(mediator.getMessageGetterProperties().get(propName))); } property.setValueType(CommandPropertyValueType.LITERAL); properties.put(propName, property); } for (String propName : mediator.getMessageSetterProperties().keySet()) { CommandProperty property = EsbFactory.eINSTANCE.createCommandProperty(); property.setPropertyName(propName); property.setValueMessageElementXpath( createNamespacedProperty(mediator.getMessageGetterProperties().get(propName))); property.setValueType(CommandPropertyValueType.MESSAGE_ELEMENT); if (mediator.getMessageGetterProperties().containsKey(propName)) { property.setMessageAction(CommandPropertyMessageAction.READ_AND_UPDATE_MESSAGE); } else if (mediator.getContextGetterProperties().containsKey(propName)) { property.setValueContextPropertyName(mediator.getContextGetterProperties().get(propName)); property.setMessageAction(CommandPropertyMessageAction.READ_MESSAGE); } else { property.setMessageAction(CommandPropertyMessageAction.READ_MESSAGE); } properties.put(propName, property); } for (String propName : mediator.getContextSetterProperties().keySet()) { CommandProperty property = EsbFactory.eINSTANCE.createCommandProperty(); property.setPropertyName(propName); property.setValueContextPropertyName(mediator.getContextSetterProperties().get(propName)); if (mediator.getContextGetterProperties().containsKey(propName)) { property.setContextAction(CommandPropertyContextAction.READ_AND_UPDATE_CONTEXT); } else if (mediator.getMessageGetterProperties().containsKey(propName)) { property.setContextAction(CommandPropertyContextAction.READ_CONTEXT); property.setValueMessageElementXpath( createNamespacedProperty(mediator.getMessageGetterProperties().get(propName))); } else { property.setContextAction(CommandPropertyContextAction.READ_CONTEXT); } property.setValueType(CommandPropertyValueType.CONTEXT_PROPERTY); properties.put(propName, property); } for (String propName : mediator.getContextGetterProperties().keySet()) { if (!isSerialized(propName, mediator)) { String value = mediator.getContextGetterProperties().get(propName); CommandProperty property = EsbFactory.eINSTANCE.createCommandProperty(); property.setPropertyName(propName); property.setValueContextPropertyName(value); property.setContextAction(CommandPropertyContextAction.UPDATE_CONTEXT); properties.put(propName, property); } } for (String propName : mediator.getMessageGetterProperties().keySet()) { if (!isSerialized(propName, mediator)) { CommandProperty property = EsbFactory.eINSTANCE.createCommandProperty(); property.setPropertyName(propName); property.setMessageAction(CommandPropertyMessageAction.UPDATE_MESSAGE); property.setValueMessageElementXpath( createNamespacedProperty(mediator.getMessageGetterProperties().get(propName))); properties.put(propName, property); } } for (CommandProperty property : properties.values()) { executeAddValueCommand(mediatorModel.getProperties(), property); } return mediatorModel; }
private boolean isSerialized(String propName, POJOCommandMediatorExt m) { return m.getContextSetterProperties().containsKey(propName) || m.getStaticSetterProperties().containsKey(propName) || m.getMessageSetterProperties().containsKey(propName); }