1 package org.itracker.web.ptos;
2
3 import org.itracker.core.resources.ITrackerResources;
4 import org.itracker.model.Configuration;
5 import org.itracker.model.ProjectScript;
6 import org.itracker.model.util.CustomFieldUtilities;
7 import org.itracker.model.util.WorkflowUtilities;
8
9 import java.util.Locale;
10
11 public class ProjectScriptPTO {
12
13 private final ProjectScript script;
14 private final Locale locale;
15
16 public ProjectScriptPTO(ProjectScript script, Locale locale) {
17 this.script = script;
18 this.locale = locale;
19 }
20
21 public String getFieldName() {
22 if (script.getFieldType() == Configuration.Type.customfield)
23 return CustomFieldUtilities.getCustomFieldName(this.script.getFieldId(), locale);
24 else {
25 return ITrackerResources.getString("itracker.web.attr." + script.getFieldType().name());
26 }
27 }
28 public Boolean isBuiltinField() {
29 return script.getFieldType() == Configuration.Type.customfield;
30 }
31
32 public String getEventName() {
33 return WorkflowUtilities.getEventName(script.getScript().getEvent(), locale);
34 }
35
36 @Deprecated
37 public ProjectScript getVO() {
38 return this.script;
39 }
40
41 public ProjectScript getScript() {
42 return this.script;
43 }
44
45 }