use of com.adobe.acs.commons.mcp.ProcessDefinitionFactory in project acs-aem-commons by Adobe-Consulting-Services.
the class AvailableProcessDefinitions method activate.
@Override
@SuppressWarnings("checkstyle:parametername")
public void activate() throws Exception {
SlingScriptHelper sling = getSlingScriptHelper();
User user = sling.getRequest().getResourceResolver().adaptTo(User.class);
ProcessDefinitionFactory[] allDefinitionFactories = sling.getServices(ProcessDefinitionFactory.class, null);
definitions = Stream.of(allDefinitionFactories).filter(o -> o.isAllowed(user)).collect(Collectors.toMap(ProcessDefinitionFactory::getName, o -> o, (a, b) -> a, TreeMap::new));
String processDefinitionName = get("processDefinition", String.class);
if (StringUtils.isEmpty(processDefinitionName)) {
processDefinitionName = getRequest().getParameter("processDefinition");
}
if (StringUtils.isNotEmpty(processDefinitionName) && definitions.containsKey(processDefinitionName)) {
Class clazz = definitions.get(processDefinitionName).createProcessDefinition().getClass();
fieldComponents = AnnotatedFieldDeserializer.getFormFields(clazz, sling);
}
}
Aggregations