@Override public void writeXML(final Document document, final Element currentElement, final String outputFolder) { final Element customAction = document.createElement(XML_TAG_NAME); super.writeXML(document, customAction, outputFolder); customAction.setAttribute(XML_ACTION_TYPE_ATT, ((CustomAction) element).getType()); customAction.setAttribute(XML_IS_HIT_ATT, String.valueOf(((CustomAction) element).isHit())); ((CustomAction) element).getParameters().forEach(p -> CustomActionParameterWriter.writeXML(document, customAction, p)); currentElement.appendChild(customAction); ((CustomAction) element).getLibraryPath().ifPresent(p -> copyFileToExtlib(p.toFile(), Paths.get(outputFolder, "lib", "extlib").toFile())); }
private static String getVariableSyntax(final CustomAction customAction) { for(final CustomActionParameter parameter : customAction.getParameters()){ if(CUSTOM_ACTION_VARIABLE_PARAMETER.equals(parameter.getName())){ return MethodUtils.getVariableSyntax(parameter.getValue()); } } return ""; } }
private void from(Object object) { if (object instanceof Element) { Element instance = (Element) object; name(instance.getName()); Optional<String> descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } if (object instanceof CustomAction) { CustomAction instance = (CustomAction) object; isHit(instance.isHit()); type(instance.getType()); addAllParameters(instance.getParameters()); Optional<Path> libraryPathOptional = instance.getLibraryPath(); if (libraryPathOptional.isPresent()) { libraryPath(libraryPathOptional); } } }