1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.itracker.model;
20
21 import org.apache.commons.lang.builder.CompareToBuilder;
22 import org.apache.commons.lang.builder.ToStringBuilder;
23
24 import java.io.Serializable;
25 import java.util.Comparator;
26
27
28
29
30
31
32 public class ProjectScript extends AbstractEntity {
33
34 public static final FieldPriorityComparator FIELD_PRIORITY_COMPARATOR = new FieldPriorityComparator();
35 public static final FieldPriorityComparator PRIORITY_COMPARATOR = new FieldPriorityComparator();
36
37
38
39 private static final long serialVersionUID = 1L;
40
41
42
43
44 private Project project;
45
46
47
48
49
50
51
52
53
54
55 private Integer fieldId;
56 private Configuration.Type fieldType;
57
58
59
60
61 private WorkflowScript script;
62
63 private int priority;
64
65
66
67
68
69
70
71
72
73
74 public ProjectScript() {
75 }
76
77 public Project getProject() {
78 return project;
79 }
80
81 public void setProject(Project project) {
82 this.project = project;
83 }
84
85 public WorkflowScript getScript() {
86 return script;
87 }
88
89 public void setScript(WorkflowScript script) {
90 this.script = script;
91 }
92
93 public Integer getFieldId() {
94 return fieldId;
95 }
96
97 public void setFieldId(Integer fieldId) {
98 this.fieldId = fieldId;
99 }
100
101 public int getPriority() {
102 return priority;
103 }
104
105 public void setPriority(int priority) {
106 this.priority = priority;
107 }
108
109 public Configuration.Type getFieldType() {
110 return fieldType;
111 }
112
113 public void setFieldType(Configuration.Type fieldType) {
114 this.fieldType = fieldType;
115 }
116
117 public static class FieldPriorityComparator implements
118 Comparator<ProjectScript>, Serializable {
119
120
121
122 private static final long serialVersionUID = 1L;
123
124 public int compare(ProjectScript../../../org/itracker/model/ProjectScript.html#ProjectScript">ProjectScript a, ProjectScript b) {
125
126 return new CompareToBuilder().append(a.getFieldId(), b.getFieldId()).append(a.getPriority(), b.getPriority()).toComparison();
127 }
128
129 }
130 public static class ScriptPriorityComparator implements
131 Comparator<ProjectScript>, Serializable {
132
133
134
135 private static final long serialVersionUID = 1L;
136
137 public int compare(ProjectScript../../../org/itracker/model/ProjectScript.html#ProjectScript">ProjectScript a, ProjectScript b) {
138
139 return new CompareToBuilder().append(a.getPriority(), b.getPriority()).toComparison();
140 }
141
142 }
143
144
145 @Override
146 public String toString() {
147 return new ToStringBuilder(this).append("id", getId()).append("script", getScript()).append(
148 "fieldId", getFieldId()).append("priority", getPriority()).append(
149 "project", getProject()).toString();
150 }
151
152 }