62e96e463dfd59670073e717c94f54667b195b97.svn-base
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.act.utils;
import java.util.Map;
import org.apache.commons.beanutils.ConvertUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.utils.StringUtils;
/**
* 流程变量对象
* @author ThinkGem
* @version 2013-11-03
*/
public class Variable {
private Map<String, Object> map = Maps.newHashMap();
private String keys;
private String values;
private String types;
public Variable (){
}
public Variable (Map<String, Object> map){
this.map = map;
}
public String getKeys() {
return keys;
}
public void setKeys(String keys) {
this.keys = keys;
}
public String getValues() {
return values;
}
public void setValues(String values) {
this.values = values;
}
public String getTypes() {
return types;
}
public void setTypes(String types) {
this.types = types;
}
@JsonIgnore
public Map<String, Object> getVariableMap() {
ConvertUtils.register(new DateConverter(), java.util.Date.class);
if (StringUtils.isBlank(keys)) {
return map;
}
String[] arrayKey = keys.split(",");
String[] arrayValue = values.split(",");
String[] arrayType = types.split(",");
for (int i = 0; i < arrayKey.length; i++) {
String key = arrayKey[i];
String value = arrayValue[i];
String type = arrayType[i];
Class<?> targetType = Enum.valueOf(PropertyType.class, type).getValue();
Object objectValue = ConvertUtils.convert(value, targetType);
map.put(key, objectValue);
}
return map;
}
public Map<String, Object> getMap() {
return map;
}
}