use of org.apache.syncope.common.lib.to.WorkflowFormPropertyTO in project syncope by apache.
the class FlowableUserWorkflowAdapter method getHistoricFormTO.
protected WorkflowFormTO getHistoricFormTO(final String processInstanceId, final String taskId, final String formKey, final List<HistoricFormPropertyEntity> props) {
WorkflowFormTO formTO = new WorkflowFormTO();
User user = userDAO.findByWorkflowId(processInstanceId);
if (user == null) {
throw new NotFoundException("User with workflow id " + processInstanceId);
}
formTO.setUsername(user.getUsername());
formTO.setTaskId(taskId);
formTO.setKey(formKey);
formTO.setUserTO(engine.getRuntimeService().getVariable(processInstanceId, USER_TO, UserTO.class));
formTO.setUserPatch(engine.getRuntimeService().getVariable(processInstanceId, USER_PATCH, UserPatch.class));
props.stream().map(prop -> {
WorkflowFormPropertyTO propertyTO = new WorkflowFormPropertyTO();
propertyTO.setId(prop.getPropertyId());
propertyTO.setName(prop.getPropertyId());
propertyTO.setValue(prop.getPropertyValue());
return propertyTO;
}).forEachOrdered(propertyTO -> {
formTO.getProperties().add(propertyTO);
});
return formTO;
}
use of org.apache.syncope.common.lib.to.WorkflowFormPropertyTO in project syncope by apache.
the class IdentityRecertificationITCase method recertification.
@Test
public void recertification() {
execTask(taskService, TaskType.SCHEDULED, "e95555d2-1b09-42c8-b25b-f4c4ec598989", "JOB_FIRED", 50, false);
List<WorkflowFormTO> forms = userWorkflowService.getForms();
assertFalse(forms.isEmpty());
for (WorkflowFormTO form : forms) {
userWorkflowService.claimForm(form.getTaskId());
WorkflowFormPropertyTO approve = form.getProperty("approve").get();
approve.setValue("true");
userWorkflowService.submitForm(form);
}
forms = userWorkflowService.getForms();
assertTrue(forms.isEmpty());
}
use of org.apache.syncope.common.lib.to.WorkflowFormPropertyTO in project syncope by apache.
the class FlowableUserWorkflowAdapter method getFormTO.
@SuppressWarnings("unchecked")
protected WorkflowFormTO getFormTO(final String processInstanceId, final String taskId, final String formKey, final List<FormProperty> properties) {
WorkflowFormTO formTO = new WorkflowFormTO();
User user = userDAO.findByWorkflowId(processInstanceId);
if (user == null) {
throw new NotFoundException("User with workflow id " + processInstanceId);
}
formTO.setUsername(user.getUsername());
formTO.setTaskId(taskId);
formTO.setKey(formKey);
formTO.setUserTO(engine.getRuntimeService().getVariable(processInstanceId, USER_TO, UserTO.class));
formTO.setUserPatch(engine.getRuntimeService().getVariable(processInstanceId, USER_PATCH, UserPatch.class));
properties.stream().map(fProp -> {
WorkflowFormPropertyTO propertyTO = new WorkflowFormPropertyTO();
BeanUtils.copyProperties(fProp, propertyTO, PROPERTY_IGNORE_PROPS);
propertyTO.setType(fromFlowableFormType(fProp.getType()));
if (propertyTO.getType() == WorkflowFormPropertyType.Date) {
propertyTO.setDatePattern((String) fProp.getType().getInformation("datePattern"));
}
if (propertyTO.getType() == WorkflowFormPropertyType.Enum) {
propertyTO.getEnumValues().putAll((Map<String, String>) fProp.getType().getInformation("values"));
}
return propertyTO;
}).forEachOrdered(propertyTO -> {
formTO.getProperties().add(propertyTO);
});
return formTO;
}
use of org.apache.syncope.common.lib.to.WorkflowFormPropertyTO in project syncope by apache.
the class JSONTest method map.
@Test
public void map() throws IOException {
WorkflowFormPropertyTO prop = new WorkflowFormPropertyTO();
prop.getEnumValues().put("key1", "value1");
prop.getEnumValues().put("key2", "value2");
ObjectMapper mapper = new ObjectMapper();
StringWriter writer = new StringWriter();
mapper.writeValue(writer, prop);
WorkflowFormPropertyTO unserializedProp = mapper.readValue(writer.toString(), WorkflowFormPropertyTO.class);
assertEquals(prop, unserializedProp);
}
Aggregations