| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.itracker.services.util; |
| 20 |
|
|
| 21 |
|
import java.util.ArrayList; |
| 22 |
|
import java.util.Collections; |
| 23 |
|
import java.util.EnumMap; |
| 24 |
|
import java.util.Hashtable; |
| 25 |
|
import java.util.List; |
| 26 |
|
import java.util.Locale; |
| 27 |
|
import java.util.Map; |
| 28 |
|
|
| 29 |
|
import org.itracker.core.resources.ITrackerResources; |
| 30 |
|
import org.itracker.model.Status; |
| 31 |
|
|
| 32 |
|
|
|
|
|
| 19.6% |
Uncovered Elements: 45 (56) |
Complexity: 18 |
Complexity Density: 0.58 |
|
| 33 |
|
public class ProjectUtilities { |
| 34 |
|
|
| 35 |
|
public static final int OPTION_SURPRESS_HISTORY_HTML = 1; |
| 36 |
|
public static final int OPTION_ALLOW_ASSIGN_TO_CLOSE = 2; |
| 37 |
|
public static final int OPTION_PREDEFINED_RESOLUTIONS = 4; |
| 38 |
|
public static final int OPTION_ALLOW_SELF_REGISTERED_CREATE = 8; |
| 39 |
|
public static final int OPTION_ALLOW_SELF_REGISTERED_VIEW_ALL = 16; |
| 40 |
|
public static final int OPTION_NO_ATTACHMENTS = 32; |
| 41 |
|
public static final int OPTION_LITERAL_HISTORY_HTML = 64; |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
private static Map<Locale, Map<Status, String>> statusNames = |
| 51 |
|
new Hashtable<Locale, Map<Status, String>>(); |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 56 |
0
|
private ProjectUtilities() {... |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
@param |
| 64 |
|
@return |
| 65 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 66 |
0
|
public static String getStatusName(Status status) {... |
| 67 |
0
|
return getStatusName(status, ITrackerResources.getLocale()); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
@param |
| 74 |
|
@param |
| 75 |
|
@return |
| 76 |
|
|
| 77 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
4
|
public static String getStatusName(Status status, Locale locale) {... |
| 79 |
4
|
return ITrackerResources.getString( |
| 80 |
|
ITrackerResources.KEY_BASE_PROJECT_STATUS + status.getCode(), |
| 81 |
|
locale); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
@return |
| 86 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 87 |
0
|
public static Map<Status, String> getStatusNames() {... |
| 88 |
0
|
return getStatusNames(ITrackerResources.getLocale()); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
@param |
| 98 |
|
@return |
| 99 |
|
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 100 |
1
|
public static Map<Status, String> getStatusNames(Locale locale) {... |
| 101 |
1
|
Map<Status, String> statuses = statusNames.get(locale); |
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
1
|
if (statuses == null) { |
| 106 |
|
|
| 107 |
1
|
statuses = new EnumMap<Status, String>(Status.class); |
| 108 |
|
|
| 109 |
1
|
for (Status status : Status.values()) { |
| 110 |
4
|
statuses.put(status, getStatusName(status, locale)); |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
} |
| 114 |
1
|
statusNames.put(locale, Collections.unmodifiableMap(statuses)); |
| 115 |
|
|
| 116 |
|
} |
| 117 |
1
|
return statuses; |
| 118 |
|
|
| 119 |
|
} |
| 120 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 121 |
0
|
public static boolean hasOption(int option, int currentOptions) {... |
| 122 |
0
|
return ((option & currentOptions) == option); |
| 123 |
|
} |
| 124 |
|
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 8 |
Complexity Density: 0.44 |
|
| 125 |
0
|
public static Integer[] getOptions(int currentOptions) {... |
| 126 |
0
|
List<Integer> options = new ArrayList<Integer>(); |
| 127 |
0
|
if(hasOption(OPTION_SURPRESS_HISTORY_HTML, currentOptions)) { |
| 128 |
0
|
options.add(OPTION_SURPRESS_HISTORY_HTML); |
| 129 |
|
} |
| 130 |
0
|
if(hasOption(OPTION_ALLOW_ASSIGN_TO_CLOSE, currentOptions)) { |
| 131 |
0
|
options.add(OPTION_ALLOW_ASSIGN_TO_CLOSE); |
| 132 |
|
} |
| 133 |
0
|
if(hasOption(OPTION_PREDEFINED_RESOLUTIONS, currentOptions)) { |
| 134 |
0
|
options.add(OPTION_PREDEFINED_RESOLUTIONS); |
| 135 |
|
} |
| 136 |
0
|
if(hasOption(OPTION_ALLOW_SELF_REGISTERED_CREATE, currentOptions)) { |
| 137 |
0
|
options.add(OPTION_ALLOW_SELF_REGISTERED_CREATE); |
| 138 |
|
} |
| 139 |
0
|
if(hasOption(OPTION_ALLOW_SELF_REGISTERED_VIEW_ALL, currentOptions)) { |
| 140 |
0
|
options.add(OPTION_ALLOW_SELF_REGISTERED_VIEW_ALL); |
| 141 |
|
} |
| 142 |
0
|
if(hasOption(OPTION_NO_ATTACHMENTS, currentOptions)) { |
| 143 |
0
|
options.add(OPTION_NO_ATTACHMENTS); |
| 144 |
|
} |
| 145 |
0
|
if(hasOption(OPTION_LITERAL_HISTORY_HTML, currentOptions)) { |
| 146 |
0
|
options.add(OPTION_LITERAL_HISTORY_HTML); |
| 147 |
|
} |
| 148 |
0
|
Integer[] optionsArray = new Integer[options.size()]; |
| 149 |
0
|
options.toArray(optionsArray); |
| 150 |
0
|
return optionsArray; |
| 151 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 152 |
0
|
public static String getScriptPriorityLabelKey(Integer fieldId) {... |
| 153 |
0
|
return ITrackerResources.getString(ITrackerResources.KEY_BASE_PRIORITY + fieldId + ITrackerResources.KEY_BASE_PRIORITY_LABEL); |
| 154 |
|
} |
| 155 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 156 |
0
|
public static String getScriptPrioritySize() {... |
| 157 |
0
|
return ITrackerResources.getString(ITrackerResources.KEY_BASE_PRIORITY + ITrackerResources.KEY_BASE_PRIORITY_SIZE); |
| 158 |
|
} |
| 159 |
|
} |