本文整理汇总了Java中org.activiti.engine.form.FormProperty.getType方法的典型用法代码示例。如果您正苦于以下问题:Java FormProperty.getType方法的具体用法?Java FormProperty.getType怎么用?Java FormProperty.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.form.FormProperty
的用法示例。
在下文中一共展示了FormProperty.getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVariable
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Override
public Object getVariable(FormProperty formProperty, String value) {
value = StrUtil.isEmpty(value) ? formProperty.getValue() : value;
FormType formType = formProperty.getType();
if (formType.getClass().equals(DateFormType.class)) {
DateFormType dateType = (DateFormType) formType;
return dateType.convertFormValueToModelValue(value);
} else if (formType.getClass().equals(BooleanFormType.class)) {
BooleanFormType boolType = (BooleanFormType) formType;
return boolType.convertFormValueToModelValue(value);
} else if (formType.getClass().equals(EnumFormType.class)) {
EnumFormType enumType = (EnumFormType) formType;
return enumType.convertFormValueToModelValue(value);
} else if (formType.getClass().equals(DoubleFormType.class)) {
DoubleFormType doubleType = (DoubleFormType) formType;
return doubleType.convertFormValueToModelValue(value);
} else if (formType.getClass().equals(LongFormType.class)) {
LongFormType longType = (LongFormType) formType;
return longType.convertFormValueToModelValue(value);
} else {
return value;
}
}
示例2: getRenderer
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
protected FormPropertyRenderer getRenderer(FormProperty formProperty) {
FormType formPropertyType = formProperty.getType();
if(formPropertyType == null) {
return formPropertyRendererManager.getTypeLessFormPropertyRenderer();
} else {
return formPropertyRendererManager.getPropertyRendererForType(formProperty.getType());
}
}
示例3: getStartFormProperties
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@GET
@Path("/{processDefinitionId}/properties")
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
public Response getStartFormProperties(@PathParam("processDefinitionId") String processDefinitionId) {
FormService formService = BPMNOSGIService.getFormService();
StartFormData startFormData = formService.getStartFormData(processDefinitionId);
FormPropertyResponseCollection formPropertyResponseCollection = new FormPropertyResponseCollection();
if(startFormData != null) {
List<FormProperty> properties = startFormData.getFormProperties();
List<FormPropertyResponse> formPropertyResponseList = new ArrayList<>();
for (FormProperty property : properties) {
// ObjectNode propertyJSON = objectMapper.createObjectNode();
FormPropertyResponse formPropertyResponse = new FormPropertyResponse();
formPropertyResponse.setId(property.getId());
formPropertyResponse.setName(property.getName());
if (property.getValue() != null) {
formPropertyResponse.setValue(property.getValue());
} else {
formPropertyResponse.setValue(null);
}
if(property.getType() != null) {
formPropertyResponse.setType(property.getType().getName());
if (property.getType() instanceof EnumFormType) {
@SuppressWarnings("unchecked")
Map<String, String> valuesMap = (Map<String, String>) property.getType().getInformation("values");
if (valuesMap != null) {
List<FormPropertyEnumDataHolder> formPropertyEnumDataHoldersList = new ArrayList<>();
for (String key : valuesMap.keySet()) {
FormPropertyEnumDataHolder formPropertyEnumDataHolder = new
FormPropertyEnumDataHolder();
formPropertyEnumDataHolder.setId(key);
formPropertyEnumDataHolder.setName(valuesMap.get(key));
formPropertyEnumDataHoldersList.add(formPropertyEnumDataHolder);
}
formPropertyResponse.setEnumValues(formPropertyEnumDataHoldersList);
}
}
} else {
formPropertyResponse.setType("String");
}
formPropertyResponse.setRequired(property.isRequired());
formPropertyResponse.setReadable(property.isReadable());
formPropertyResponse.setWritable(property.isWritable());
formPropertyResponseList.add(formPropertyResponse);
}
formPropertyResponseCollection.setData(formPropertyResponseList);
}
return Response.ok().entity(formPropertyResponseCollection).build();
}
示例4: createFormDataResponse
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
public FormDataResponse createFormDataResponse(FormData formData, String baseUri) {
FormDataResponse result = new FormDataResponse();
result.setDeploymentId(formData.getDeploymentId());
result.setFormKey(formData.getFormKey());
if (formData.getFormProperties() != null) {
for (FormProperty formProp : formData.getFormProperties()) {
RestFormProperty restFormProp = new RestFormProperty();
restFormProp.setId(formProp.getId());
restFormProp.setName(formProp.getName());
if (formProp.getType() != null) {
restFormProp.setType(formProp.getType().getName());
}
restFormProp.setValue(formProp.getValue());
restFormProp.setReadable(formProp.isReadable());
restFormProp.setRequired(formProp.isRequired());
restFormProp.setWritable(formProp.isWritable());
if ("enum".equals(restFormProp.getType())) {
Object values = formProp.getType().getInformation("values");
if (values != null) {
@SuppressWarnings("unchecked")
Map<String, String> enumValues = (Map<String, String>) values;
for (String enumId : enumValues.keySet()) {
RestEnumFormProperty enumProperty = new RestEnumFormProperty();
enumProperty.setId(enumId);
enumProperty.setName(enumValues.get(enumId));
restFormProp.addEnumValue(enumProperty);
}
}
} else if ("date".equals(restFormProp.getType())) {
restFormProp.setDatePattern((String) formProp.getType().getInformation("datePattern"));
}
result.addFormProperty(restFormProp);
}
}
RestUrlBuilder urlBuilder = createUrlBuilder(baseUri);
if (formData instanceof StartFormData) {
StartFormData startFormData = (StartFormData) formData;
if (startFormData.getProcessDefinition() != null) {
result.setProcessDefinitionId(startFormData.getProcessDefinition().getId());
result.setProcessDefinitionUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_DEFINITION, startFormData.getProcessDefinition().getId()));
}
} else if (formData instanceof TaskFormData) {
TaskFormData taskFormData = (TaskFormData) formData;
if (taskFormData.getTask() != null) {
result.setTaskId(taskFormData.getTask().getId());
result.setTaskUrl(urlBuilder.buildUrl(RestUrls.URL_TASK, taskFormData.getTask().getId()));
}
}
return result;
}
示例5: getStartFormProperties
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Get
public ObjectNode getStartFormProperties() {
if(authenticate() == false) return null;
String processDefinitionId = (String) getRequest().getAttributes().get("processDefinitionId");
StartFormData startFormData = ActivitiUtil.getFormService().getStartFormData(processDefinitionId);
ObjectNode responseJSON = new ObjectMapper().createObjectNode();
ArrayNode propertiesJSON = new ObjectMapper().createArrayNode();
if(startFormData != null) {
List<FormProperty> properties = startFormData.getFormProperties();
for (FormProperty property : properties) {
ObjectNode propertyJSON = new ObjectMapper().createObjectNode();
propertyJSON.put("id", property.getId());
propertyJSON.put("name", property.getName());
if(property.getValue() != null) {
propertyJSON.put("value", property.getValue());
} else {
propertyJSON.put("value", "null");
}
if(property.getType() != null) {
propertyJSON.put("type", property.getType().getName());
if(property.getType() instanceof EnumFormType) {
@SuppressWarnings("unchecked")
Map<String, String> valuesMap = (Map<String, String>) property.getType().getInformation("values");
if(valuesMap != null) {
ArrayNode valuesArray = new ObjectMapper().createArrayNode();
propertyJSON.put("enumValues", valuesArray);
for (String key : valuesMap.keySet()) {
ObjectNode valueJSON = new ObjectMapper().createObjectNode();
valueJSON.put("id", key);
valueJSON.put("name", valuesMap.get(key));
valuesArray.add(valueJSON);
}
}
}
} else {
propertyJSON.put("type", "String");
}
propertyJSON.put("required", property.isRequired());
propertyJSON.put("readable", property.isReadable());
propertyJSON.put("writable", property.isWritable());
propertiesJSON.add(propertyJSON);
}
}
responseJSON.put("data", propertiesJSON);
return responseJSON;
}
示例6: getTaskProperties
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Get
public ObjectNode getTaskProperties() {
if(authenticate() == false) return null;
String taskId = (String) getRequest().getAttributes().get("taskId");
TaskFormData taskFormData = ActivitiUtil.getFormService().getTaskFormData(taskId);
ObjectNode responseJSON = new ObjectMapper().createObjectNode();
ArrayNode propertiesJSON = new ObjectMapper().createArrayNode();
if(taskFormData != null) {
List<FormProperty> properties = taskFormData.getFormProperties();
for (FormProperty property : properties) {
ObjectNode propertyJSON = new ObjectMapper().createObjectNode();
propertyJSON.put("id", property.getId());
propertyJSON.put("name", property.getName());
if(property.getValue() != null) {
propertyJSON.put("value", property.getValue());
} else {
propertyJSON.put("value", "null");
}
if(property.getType() != null) {
propertyJSON.put("type", property.getType().getName());
if(property.getType() instanceof EnumFormType) {
@SuppressWarnings("unchecked")
Map<String, String> valuesMap = (Map<String, String>) property.getType().getInformation("values");
if(valuesMap != null) {
ArrayNode valuesArray = new ObjectMapper().createArrayNode();
propertyJSON.put("enumValues", valuesArray);
for (String key : valuesMap.keySet()) {
ObjectNode valueJSON = new ObjectMapper().createObjectNode();
valueJSON.put("id", key);
valueJSON.put("name", valuesMap.get(key));
valuesArray.add(valueJSON);
}
}
}
} else {
propertyJSON.put("type", "String");
}
propertyJSON.put("required", property.isRequired());
propertyJSON.put("readable", property.isReadable());
propertyJSON.put("writable", property.isWritable());
propertiesJSON.add(propertyJSON);
}
}
responseJSON.put("data", propertiesJSON);
return responseJSON;
}