com.llsfw.activiti.common.ProcessUtils Maven / Gradle / Ivy
The newest version!
/**
* ProcessUtils.java
* Created at 2016-03-01
* Created by Administrator
* Copyright (C) 2016 LLSFW, All rights reserved.
*/
package com.llsfw.activiti.common;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.activiti.engine.form.FormProperty;
import org.apache.commons.collections4.CollectionUtils;
/**
*
* ClassName: ProcessUtils
*
*
* Description: 工作流工具类
*
*
* Author: Administrator
*
*
* Date: 2016年3月24日
*
*/
public class ProcessUtils {
/**
*
* Field LABLE_START_TD: 常量
*
*/
private static final String LABLE_START_TD = " ");
sb.append(START_TD);
sb.append(MessageFormat.format(
"",
formProperty.getId(), formProperty.getId(),
formProperty.getValue() == null ? "" : formProperty.getValue(), C_1 + formProperty.getName() + C_1,
formProperty.isRequired(), formProperty.isWritable(), !formProperty.isWritable(),
!formProperty.isWritable()));
sb.append(END_TD);
sb.append("");
}
return sb.toString();
}
/**
*
* Description: 格式化Long字段
*
*
* @param formProperty 表单参数
* @return 结果
*/
private static String formatLongInput(FormProperty formProperty) {
// 构造字段
StringBuilder sb = new StringBuilder();
// 判断字段是否可读
if (formProperty.isReadable()) {
sb.append(START_TR);
sb.append(LABLE_START_TD);
sb.append(formProperty.getName());
sb.append(":" + "");
sb.append(START_TD);
sb.append(MessageFormat.format(
"",
formProperty.getId(), formProperty.getId(),
formProperty.getValue() == null ? "" : formProperty.getValue(), C_1 + formProperty.getName() + C_1,
formProperty.isRequired(), formProperty.isWritable(), !formProperty.isWritable(),
!formProperty.isWritable()));
sb.append(END_TD);
sb.append(START_TR);
}
return sb.toString();
}
/**
*
* Description: 格式化boolean参数
*
*
* @param formProperty 表单参数
* @return 结果
*/
private static String formatBooleanInput(FormProperty formProperty) {
// 构造字段
StringBuilder sb = new StringBuilder();
// 判断字段是否可读
if (formProperty.isReadable()) {
sb.append(START_TR);
sb.append(LABLE_START_TD);
sb.append(formProperty.getName());
sb.append(":" + "");
sb.append(START_TD);
String value = formProperty.getValue() == null ? ""
: Boolean.parseBoolean(formProperty.getValue()) ? "checked=\"checked\"" : "";
String disabled = formProperty.isWritable() ? "" : "disabled=\"disabled\" readonly=\"readonly\"";
sb.append(MessageFormat.format("",
formProperty.getId(), formProperty.getId(), value, disabled));
sb.append(END_TD);
sb.append("");
}
return sb.toString();
}
/**
*
* Description: 格式化date
*
*
* @param formProperty 表单参数
* @return 结果
*/
private static String formatDateInput(FormProperty formProperty) {
// 构造字段
StringBuilder sb = new StringBuilder();
// 判断字段是否可读
if (formProperty.isReadable()) {
sb.append(START_TR);
sb.append(LABLE_START_TD);
sb.append(formProperty.getName());
sb.append(":" + "");
sb.append(START_TD);
sb.append(MessageFormat.format(
"",
formProperty.getId(), formProperty.getId(),
formProperty.getValue() == null ? "" : formProperty.getValue(), C_1 + formProperty.getName() + C_1,
formProperty.isRequired(), formProperty.isWritable(), !formProperty.isWritable(),
!formProperty.isWritable()));
sb.append(END_TD);
sb.append("");
}
return sb.toString();
}
/**
*
* Description: 格式化枚举
*
*
* @param formProperty 表单参数
* @return 结果
*/
@SuppressWarnings("unchecked")
private static String formatEnmuInput(FormProperty formProperty) {
// 构造字段
StringBuilder sb = new StringBuilder();
// 判断字段是否可读
if (formProperty.isReadable()) {
sb.append(START_TR);
sb.append(LABLE_START_TD);
sb.append(formProperty.getName());
sb.append(":" + "");
sb.append(START_TD);
sb.append(MessageFormat.format(
"");
sb.append(END_TD);
sb.append("");
}
return sb.toString();
}
}