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 package org.imixs.workflow.plugins;
29
30 import java.util.logging.Logger;
31
32 import org.imixs.workflow.ExtendedModel;
33 import org.imixs.workflow.ItemCollection;
34 import org.imixs.workflow.Plugin;
35 import org.imixs.workflow.exceptions.PluginException;
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 public class ApplicationPlugin extends AbstractPlugin {
73 ItemCollection documentContext;
74
75 private String sEditorID;
76 private String sType;
77 private String sImageURL;
78 private String sStatus;
79 private String sGroup;
80 private String sAbstract;
81 private String sSummary;
82 private static Logger logger = Logger.getLogger("org.imixs.workflow");
83
84 public int run(ItemCollection adocumentContext,
85 ItemCollection adocumentActivity) throws PluginException {
86
87 documentContext = adocumentContext;
88
89 sEditorID = null;
90 sImageURL = null;
91 sAbstract = null;
92 sSummary = null;
93
94
95
96 if (!"1".equals(adocumentActivity.getItemValueString("keyFollowUp"))) {
97
98
99 int iNextProcessID = adocumentActivity
100 .getItemValueInteger("numNextProcessID");
101
102
103 ItemCollection itemColNextProcess = null;
104
105
106 if (ctx.getModel() instanceof ExtendedModel) {
107 String aModelVersion = adocumentActivity
108 .getItemValueString("$modelVersion");
109
110 itemColNextProcess = ((ExtendedModel) ctx.getModel())
111 .getProcessEntityByVersion(iNextProcessID,
112 aModelVersion);
113 } else
114 itemColNextProcess = ctx.getModel().getProcessEntity(
115 iNextProcessID);
116
117
118 if (itemColNextProcess == null) {
119 System.out
120 .println("[ApplicationPlugin] Warning - processEntity '"
121 + iNextProcessID
122 + "' was not found in the model! ");
123 return Plugin.PLUGIN_WARNING;
124 }
125
126
127 sEditorID = itemColNextProcess.getItemValueString("txtEditorID");
128 sImageURL = itemColNextProcess.getItemValueString("txtImageURL");
129
130
131 sStatus = itemColNextProcess.getItemValueString("txtname");
132 sGroup = itemColNextProcess.getItemValueString("txtworkflowgroup");
133 sType = itemColNextProcess.getItemValueString("txttype");
134
135
136 sAbstract = itemColNextProcess
137 .getItemValueString("txtworkflowabstract");
138 if (!"".equals(sAbstract))
139 sAbstract = this.replaceDynamicValues(sAbstract,
140 documentContext);
141
142
143 sSummary = itemColNextProcess
144 .getItemValueString("txtworkflowsummary");
145 if (!"".equals(sSummary))
146 sSummary = this.replaceDynamicValues(sSummary, documentContext);
147
148
149
150 documentContext.replaceItemValue("txtWorkflowStatus", sStatus);
151 documentContext.replaceItemValue("txtworkflowgroup", sGroup);
152
153
154 if (sEditorID != null && !"".equals(sEditorID))
155 documentContext.replaceItemValue("txtWorkflowEditorID",
156 sEditorID);
157
158
159 if (sImageURL != null && !"".equals(sImageURL))
160 documentContext.replaceItemValue("txtWorkflowImageURL",
161 sImageURL);
162
163
164 if (sType != null && !"".equals(sType))
165 documentContext.replaceItemValue("type", sType);
166
167
168 if (sAbstract != null)
169 documentContext.replaceItemValue("txtworkflowabstract",
170 sAbstract);
171
172
173 if (sSummary != null)
174 documentContext
175 .replaceItemValue("txtworkflowsummary", sSummary);
176
177 }
178
179 return Plugin.PLUGIN_OK;
180 }
181
182 public void close(int status) throws PluginException {
183
184 }
185
186 }