use of org.kie.workbench.common.stunner.core.util.StringUtils in project kie-wb-common by kiegroup.
the class GenericServiceTaskPropertyReader method getGenericServiceTask.
public GenericServiceTaskValue getGenericServiceTask() {
GenericServiceTaskValue value = new GenericServiceTaskValue();
final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()).filter(StringUtils::nonEmpty).orElseGet(() -> task.getImplementation());
value.setServiceImplementation(getServiceImplementation(implementation));
final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()).filter(StringUtils::nonEmpty).orElseGet(() -> Optional.ofNullable(task.getOperationRef()).map(Operation::getName).orElse(null));
value.setServiceOperation(operation);
value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()).map(Operation::getInMessageRef).map(Message::getItemRef).map(ItemDefinition::getStructureRef).orElse(null));
value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()).map(Operation::getOutMessageRef).map(Message::getItemRef).map(ItemDefinition::getStructureRef).orElse(null));
final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()).filter(StringUtils::nonEmpty).orElseGet(() -> Optional.ofNullable(task.getOperationRef()).map(Operation::eContainer).filter(container -> container instanceof Interface).map(container -> (Interface) container).map(Interface::getName).orElse(null));
value.setServiceInterface(serviceInterface);
return value;
}
Aggregations