Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
10   126   11   0.91
0   52   1.1   5.5
11     1  
2    
 
 
  ProjectScript       Line # 32 9 10 0% 0.0
  ProjectScript.FieldPriorityComparator       Line # 105 1 1 0% 0.0
 
No Tests
 
1    /*
2    * This software was designed and created by Jason Carroll.
3    * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4    * The author can be reached at jcarroll@cowsultants.com
5    * ITracker website: http://www.cowsultants.com
6    * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7    *
8    * This program is free software; you can redistribute it and/or modify
9    * it only under the terms of the GNU General Public License as published by
10    * the Free Software Foundation; either version 2 of the License, or
11    * (at your option) any later version.
12    *
13    * This program is distributed in the hope that it will be useful,
14    * but WITHOUT ANY WARRANTY; without even the implied warranty of
15    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16    * GNU General Public License for more details.
17    */
18   
19    package org.itracker.model;
20   
21    import java.io.Serializable;
22    import java.util.Comparator;
23   
24    import org.apache.commons.lang.builder.CompareToBuilder;
25    import org.apache.commons.lang.builder.ToStringBuilder;
26   
27    /**
28    * A Beanshell script configured to be executed for a specific Project field.
29    *
30    * @author ready
31    */
 
32    public class ProjectScript extends AbstractEntity {
33   
34    public static final FieldPriorityComparator FIELD_PRIORITY_COMPARATOR = new FieldPriorityComparator();
35    /**
36    *
37    */
38    private static final long serialVersionUID = 1L;
39   
40    /**
41    * The Project for which the script must be executed.
42    */
43    private Project project;
44   
45    /**
46    * The ID of the built-in or custom field for which the script must be
47    * executed.
48    *
49    * <p>
50    * If the ID represents a CustomField, then the CustomField should be
51    * configured for the Project or the script will never be executed.
52    * </p>
53    */
54    private Integer fieldId;
55   
56    /** The Beanshell script to execute. */
57    private WorkflowScript script;
58   
59    private int priority;
60   
61    /**
62    * Default constructor (required by Hibernate).
63    *
64    * <p>
65    * PENDING: should be <code>private</code> so that it can only be used by
66    * Hibernate, to ensure that the fields which form an instance's identity
67    * are always initialized/never <tt>null</tt>.
68    * </p>
69    */
 
70  0 toggle public ProjectScript() {
71    }
72   
 
73  0 toggle public Project getProject() {
74  0 return project;
75    }
76   
 
77  0 toggle public void setProject(Project project) {
78  0 this.project = project;
79    }
80   
 
81  0 toggle public WorkflowScript getScript() {
82  0 return script;
83    }
84   
 
85  0 toggle public void setScript(WorkflowScript script) {
86  0 this.script = script;
87    }
88   
 
89  0 toggle public Integer getFieldId() {
90  0 return fieldId;
91    }
92   
 
93  0 toggle public void setFieldId(Integer fieldId) {
94  0 this.fieldId = fieldId;
95    }
96   
 
97  0 toggle public int getPriority() {
98  0 return priority;
99    }
100   
 
101  0 toggle public void setPriority(int priority) {
102  0 this.priority = priority;
103    }
104   
 
105    public static class FieldPriorityComparator implements
106    Comparator<ProjectScript>, Serializable {
107    /**
108    *
109    */
110    private static final long serialVersionUID = 1L;
111   
 
112  0 toggle public int compare(ProjectScript a, ProjectScript b) {
113   
114  0 return new CompareToBuilder().append(a.getFieldId(), b.getFieldId()).append(a.getPriority(), b.getPriority()).toComparison();
115    }
116   
117    }
118   
 
119  0 toggle @Override
120    public String toString() {
121  0 return new ToStringBuilder(this).append("id", getId()).append("script", getScript()).append(
122    "fieldId", getFieldId()).append("priority", getPriority()).append(
123    "project", getProject()).toString();
124    }
125   
126    }