本文整理汇总了Java中org.activiti.engine.form.FormProperty.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java FormProperty.getValue方法的具体用法?Java FormProperty.getValue怎么用?Java FormProperty.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.form.FormProperty
的用法示例。
在下文中一共展示了FormProperty.getValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: convertFormData
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<FormAttribute> convertFormData(FormData formData) {
List<FormAttribute> props = new ArrayList<FormAttribute>();
for (FormProperty formProperty : formData.getFormProperties()) {
FormAttribute fa = new FormAttribute(formProperty.getId(), formProperty.getName(), formProperty.getValue(),
formProperty.getType().getName());
fa.setDatePattern(Objects.toString(formProperty.getType().getInformation("datePattern")));
fa.setItems((Map<String, String>) formProperty.getType().getInformation("values"));
fa.setReadable(formProperty.isReadable());
fa.setWriteable(formProperty.isWritable());
fa.setRequired(formProperty.isRequired());
props.add(fa);
}
return props;
}
示例3: getPropertyField
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
final TextField textField = new TextField(getPropertyLabel(formProperty));
textField.setRequired(formProperty.isRequired());
textField.setEnabled(formProperty.isWritable());
textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
if (formProperty.getValue() != null) {
textField.setValue(formProperty.getValue());
}
// Add validation of numeric value
textField.addValidator(new LongValidator("Value must be a long"));
textField.setImmediate(true);
return textField;
}
示例4: getPropertyField
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
// Writable string
PopupDateField dateField = new PopupDateField(getPropertyLabel(formProperty));
String datePattern = (String) formProperty.getType().getInformation("datePattern");
dateField.setDateFormat(datePattern);
dateField.setRequired(formProperty.isRequired());
dateField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
dateField.setEnabled(formProperty.isWritable());
if (formProperty.getValue() != null) {
// Try parsing the current value
SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
try {
Date date = dateFormat.parse(formProperty.getValue());
dateField.setValue(date);
} catch (ParseException e) {
// TODO: what happens if current value is illegal date?
}
}
return dateField;
}
示例5: FormPropertyVo
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public FormPropertyVo(FormProperty formProperty) {
this.id = formProperty.getId();
this.name = formProperty.getName();
this.value = formProperty.getValue();
this.type = formProperty.getType().getName();
this.datePattern = StringUtils.toString(formProperty.getType().getInformation("datePattern"));
this.setItems(((Map<String, String>) formProperty.getType().getInformation("values")));
this.readable = formProperty.isReadable();
this.writeable = formProperty.isWritable();
this.required = formProperty.isRequired();
}
示例6: getPropertyField
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
TextField textField = new TextField(getPropertyLabel(formProperty));
textField.setRequired(formProperty.isRequired());
textField.setEnabled(formProperty.isWritable());
textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
if (formProperty.getValue() != null) {
textField.setValue(formProperty.getValue());
}
return textField;
}
示例7: getPropertyField
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
CheckBox checkBox = new CheckBox(getPropertyLabel(formProperty));
checkBox.setRequired(formProperty.isRequired());
checkBox.setEnabled(formProperty.isWritable());
if (formProperty.getValue() != null) {
checkBox.setValue(formProperty.getValue());
}
return checkBox;
}
示例8: getPropertyField
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
SelectUserField selectUserField = new SelectUserField(getPropertyLabel(formProperty));
selectUserField.setRequired(formProperty.isRequired());
selectUserField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
selectUserField.setEnabled(formProperty.isWritable());
if (formProperty.getValue() != null) {
selectUserField.setValue(formProperty.getValue());
}
return selectUserField;
}
示例9: dealTask
import org.activiti.engine.form.FormProperty; //导入方法依赖的package包/类
/**
* 办理任务 TODO 考虑撤回
*/
@RequestMapping(value = "/task/deal/{taskId}", method = RequestMethod.GET)
public String dealTask(@PathVariable("taskId") String taskId, HttpServletRequest request) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
//流程实例ID
request.setAttribute("processInstanceId", task.getProcessInstanceId());
//流程内置表单变量,因为这种方式,在页面展示困难,所以这里只存储相关变量
//页面展示的内容从formKey中.form获取,以减少流程模型的配置工作量
List<FormProperty> formProperties = formService.getTaskFormData(task.getId()).getFormProperties();
request.setAttribute("formProperties", formProperties);
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task
.getProcessInstanceId()).singleResult();
String businessKey = processInstance.getBusinessKey();
String formUrl = null;
//获取业务url,外嵌表单展示,注入业务url 可通过local_form_url 设置,也可设置在formKey中
for (FormProperty formProperty : formProperties) {
if (formProperty.getId().equals(Constants.VAR_FORM_URL)) {
formUrl = formProperty.getValue();
if (!StrUtil.isEmpty(formUrl)) {
if (!formUrl.endsWith(businessKey)) {
formUrl = formUrl + businessKey;
}
}
}
}
String formKey = formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
if (StrUtil.isEmpty(formUrl) && !StrUtil.isEmpty(formKey) && !formKey.endsWith(".form")) {
formUrl = formKey;
if (!formUrl.endsWith(businessKey)) {
formUrl = formUrl + businessKey;
}
}
if (!StrUtil.isEmpty(formUrl)) {
request.setAttribute("formUrl", formUrl);
}
request.setAttribute("formName", processInstance.getName());
//通过formKey获取通用审批字段(审批结果、审批意见) 适用于通用审批表单
if (!StrUtil.isEmpty(formKey) && formKey.endsWith(".form")) {
Object formData = formService.getRenderedTaskForm(task.getId());
if (formData != null) {
request.setAttribute("formData", formData);
}
}
request.setAttribute("taskId", taskId);
return "activiti/task_todo";
}
示例10: 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();
}
示例11: 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;
}
示例12: 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;
}