@Override public void prepareMessage() throws ActionException { validate(); try { Object velocityParams = params; if (((ComputerSystem) modelToUpdate).getElementName() != null) { // is logicalRouter, add LRName param if (velocityParams == null) velocityParams = new ComputerSystem(); ((ManagedElement) velocityParams) .setElementName(((ComputerSystem) modelToUpdate).getElementName()); // TODO If we don't have a ManagedElement initialized // check params } else if (params != null && params instanceof ManagedElement && ((ManagedElement) params).getElementName() == null) { ((ManagedElement) velocityParams).setElementName(""); } else if (params == null) { velocityParams = "null"; } setVelocityMessage(prepareVelocityCommand(velocityParams, template)); } catch (Exception e) { throw new ActionException(e); } }