1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.lum.lu.service.impl; |
17 |
|
|
18 |
|
import java.util.ArrayList; |
19 |
|
import java.util.Collections; |
20 |
|
import java.util.Comparator; |
21 |
|
import java.util.Date; |
22 |
|
import java.util.HashMap; |
23 |
|
import java.util.HashSet; |
24 |
|
import java.util.Iterator; |
25 |
|
import java.util.List; |
26 |
|
import java.util.Map; |
27 |
|
import java.util.Map.Entry; |
28 |
|
import java.util.Set; |
29 |
|
|
30 |
|
import javax.jws.WebService; |
31 |
|
import javax.persistence.NoResultException; |
32 |
|
|
33 |
|
import org.apache.log4j.Logger; |
34 |
|
import org.kuali.student.common.dictionary.dto.ObjectStructureDefinition; |
35 |
|
import org.kuali.student.common.dictionary.service.DictionaryService; |
36 |
|
import org.kuali.student.common.dto.CurrencyAmountInfo; |
37 |
|
import org.kuali.student.common.dto.DtoConstants; |
38 |
|
import org.kuali.student.common.dto.StatusInfo; |
39 |
|
import org.kuali.student.common.entity.Amount; |
40 |
|
import org.kuali.student.common.entity.TimeAmount; |
41 |
|
import org.kuali.student.common.entity.Version; |
42 |
|
import org.kuali.student.common.entity.VersionEntity; |
43 |
|
import org.kuali.student.common.exceptions.AlreadyExistsException; |
44 |
|
import org.kuali.student.common.exceptions.CircularRelationshipException; |
45 |
|
import org.kuali.student.common.exceptions.DataValidationErrorException; |
46 |
|
import org.kuali.student.common.exceptions.DependentObjectsExistException; |
47 |
|
import org.kuali.student.common.exceptions.DoesNotExistException; |
48 |
|
import org.kuali.student.common.exceptions.IllegalVersionSequencingException; |
49 |
|
import org.kuali.student.common.exceptions.InvalidParameterException; |
50 |
|
import org.kuali.student.common.exceptions.MissingParameterException; |
51 |
|
import org.kuali.student.common.exceptions.OperationFailedException; |
52 |
|
import org.kuali.student.common.exceptions.PermissionDeniedException; |
53 |
|
import org.kuali.student.common.exceptions.UnsupportedActionException; |
54 |
|
import org.kuali.student.common.exceptions.VersionMismatchException; |
55 |
|
import org.kuali.student.common.search.dto.SearchCriteriaTypeInfo; |
56 |
|
import org.kuali.student.common.search.dto.SearchParam; |
57 |
|
import org.kuali.student.common.search.dto.SearchRequest; |
58 |
|
import org.kuali.student.common.search.dto.SearchResult; |
59 |
|
import org.kuali.student.common.search.dto.SearchResultCell; |
60 |
|
import org.kuali.student.common.search.dto.SearchResultRow; |
61 |
|
import org.kuali.student.common.search.dto.SearchResultTypeInfo; |
62 |
|
import org.kuali.student.common.search.dto.SearchTypeInfo; |
63 |
|
import org.kuali.student.common.search.dto.SortDirection; |
64 |
|
import org.kuali.student.common.search.service.SearchDispatcher; |
65 |
|
import org.kuali.student.common.search.service.SearchManager; |
66 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
67 |
|
import org.kuali.student.common.validator.Validator; |
68 |
|
import org.kuali.student.common.validator.ValidatorFactory; |
69 |
|
import org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo; |
70 |
|
import org.kuali.student.lum.lu.dao.LuDao; |
71 |
|
import org.kuali.student.lum.lu.dto.AccreditationInfo; |
72 |
|
import org.kuali.student.lum.lu.dto.AdminOrgInfo; |
73 |
|
import org.kuali.student.lum.lu.dto.AffiliatedOrgInfo; |
74 |
|
import org.kuali.student.lum.lu.dto.CluCluRelationInfo; |
75 |
|
import org.kuali.student.lum.lu.dto.CluFeeRecordInfo; |
76 |
|
import org.kuali.student.lum.lu.dto.CluIdentifierInfo; |
77 |
|
import org.kuali.student.lum.lu.dto.CluInfo; |
78 |
|
import org.kuali.student.lum.lu.dto.CluInstructorInfo; |
79 |
|
import org.kuali.student.lum.lu.dto.CluLoRelationInfo; |
80 |
|
import org.kuali.student.lum.lu.dto.CluLoRelationTypeInfo; |
81 |
|
import org.kuali.student.lum.lu.dto.CluPublicationInfo; |
82 |
|
import org.kuali.student.lum.lu.dto.CluResultInfo; |
83 |
|
import org.kuali.student.lum.lu.dto.CluResultTypeInfo; |
84 |
|
import org.kuali.student.lum.lu.dto.CluSetInfo; |
85 |
|
import org.kuali.student.lum.lu.dto.CluSetTreeViewInfo; |
86 |
|
import org.kuali.student.lum.lu.dto.CluSetTypeInfo; |
87 |
|
import org.kuali.student.lum.lu.dto.DeliveryMethodTypeInfo; |
88 |
|
import org.kuali.student.lum.lu.dto.FieldInfo; |
89 |
|
import org.kuali.student.lum.lu.dto.InstructionalFormatTypeInfo; |
90 |
|
import org.kuali.student.lum.lu.dto.LuCodeInfo; |
91 |
|
import org.kuali.student.lum.lu.dto.LuCodeTypeInfo; |
92 |
|
import org.kuali.student.lum.lu.dto.LuLuRelationTypeInfo; |
93 |
|
import org.kuali.student.lum.lu.dto.LuPublicationTypeInfo; |
94 |
|
import org.kuali.student.lum.lu.dto.LuTypeInfo; |
95 |
|
import org.kuali.student.lum.lu.dto.LuiInfo; |
96 |
|
import org.kuali.student.lum.lu.dto.LuiLuiRelationInfo; |
97 |
|
import org.kuali.student.lum.lu.dto.MembershipQueryInfo; |
98 |
|
import org.kuali.student.lum.lu.dto.ResultOptionInfo; |
99 |
|
import org.kuali.student.lum.lu.dto.ResultUsageTypeInfo; |
100 |
|
import org.kuali.student.lum.lu.entity.Clu; |
101 |
|
import org.kuali.student.lum.lu.entity.CluAccounting; |
102 |
|
import org.kuali.student.lum.lu.entity.CluAccountingAttribute; |
103 |
|
import org.kuali.student.lum.lu.entity.CluAccreditation; |
104 |
|
import org.kuali.student.lum.lu.entity.CluAccreditationAttribute; |
105 |
|
import org.kuali.student.lum.lu.entity.CluAdminOrg; |
106 |
|
import org.kuali.student.lum.lu.entity.CluAdminOrgAttribute; |
107 |
|
import org.kuali.student.lum.lu.entity.CluAtpTypeKey; |
108 |
|
import org.kuali.student.lum.lu.entity.CluAttribute; |
109 |
|
import org.kuali.student.lum.lu.entity.CluCampusLocation; |
110 |
|
import org.kuali.student.lum.lu.entity.CluCluRelation; |
111 |
|
import org.kuali.student.lum.lu.entity.CluCluRelationAttribute; |
112 |
|
import org.kuali.student.lum.lu.entity.CluFee; |
113 |
|
import org.kuali.student.lum.lu.entity.CluIdentifier; |
114 |
|
import org.kuali.student.lum.lu.entity.CluInstructor; |
115 |
|
import org.kuali.student.lum.lu.entity.CluInstructorAttribute; |
116 |
|
import org.kuali.student.lum.lu.entity.CluLoRelation; |
117 |
|
import org.kuali.student.lum.lu.entity.CluLoRelationAttribute; |
118 |
|
import org.kuali.student.lum.lu.entity.CluLoRelationType; |
119 |
|
import org.kuali.student.lum.lu.entity.CluPublication; |
120 |
|
import org.kuali.student.lum.lu.entity.CluPublicationAttribute; |
121 |
|
import org.kuali.student.lum.lu.entity.CluPublicationType; |
122 |
|
import org.kuali.student.lum.lu.entity.CluPublicationVariant; |
123 |
|
import org.kuali.student.lum.lu.entity.CluResult; |
124 |
|
import org.kuali.student.lum.lu.entity.CluResultType; |
125 |
|
import org.kuali.student.lum.lu.entity.CluSet; |
126 |
|
import org.kuali.student.lum.lu.entity.CluSetAttribute; |
127 |
|
import org.kuali.student.lum.lu.entity.CluSetJoinVersionIndClu; |
128 |
|
import org.kuali.student.lum.lu.entity.CluSetType; |
129 |
|
import org.kuali.student.lum.lu.entity.DeliveryMethodType; |
130 |
|
import org.kuali.student.lum.lu.entity.InstructionalFormatType; |
131 |
|
import org.kuali.student.lum.lu.entity.LuCode; |
132 |
|
import org.kuali.student.lum.lu.entity.LuCodeAttribute; |
133 |
|
import org.kuali.student.lum.lu.entity.LuCodeType; |
134 |
|
import org.kuali.student.lum.lu.entity.LuLuRelationType; |
135 |
|
import org.kuali.student.lum.lu.entity.LuPublicationType; |
136 |
|
import org.kuali.student.lum.lu.entity.LuRichText; |
137 |
|
import org.kuali.student.lum.lu.entity.LuType; |
138 |
|
import org.kuali.student.lum.lu.entity.Lui; |
139 |
|
import org.kuali.student.lum.lu.entity.LuiAttribute; |
140 |
|
import org.kuali.student.lum.lu.entity.LuiLuiRelation; |
141 |
|
import org.kuali.student.lum.lu.entity.LuiLuiRelationAttribute; |
142 |
|
import org.kuali.student.lum.lu.entity.MembershipQuery; |
143 |
|
import org.kuali.student.lum.lu.entity.ResultOption; |
144 |
|
import org.kuali.student.lum.lu.entity.ResultUsageType; |
145 |
|
import org.kuali.student.lum.lu.service.LuService; |
146 |
|
import org.kuali.student.lum.lu.service.LuServiceConstants; |
147 |
|
import org.springframework.beans.BeanUtils; |
148 |
|
import org.springframework.transaction.annotation.Transactional; |
149 |
|
|
150 |
|
@WebService(endpointInterface = "org.kuali.student.lum.lu.service.LuService", serviceName = "LuService", portName = "LuService", targetNamespace = "http://student.kuali.org/wsdl/lu") |
|
|
| 60.5% |
Uncovered Elements: 891 (2,257) |
Complexity: 455 |
Complexity Density: 0.28 |
|
151 |
|
public class LuServiceImpl implements LuService { |
152 |
|
|
153 |
|
private static final String SEARCH_KEY_DEPENDENCY_ANALYSIS = "lu.search.dependencyAnalysis"; |
154 |
|
private static final String SEARCH_KEY_BROWSE_PROGRAM = "lu.search.browseProgram"; |
155 |
|
private static final String SEARCH_KEY_BROWSE_VARIATIONS = "lu.search.browseVariations"; |
156 |
|
private static final String SEARCH_KEY_LRC_RESULT_COMPONENT = "lrc.search.resultComponent"; |
157 |
|
private static final String SEARCH_KEY_PROPOSALS_BY_COURSE_CODE = "lu.search.proposalsByCourseCode"; |
158 |
|
private static final String SEARCH_KEY_BROWSE_VERSIONS = "lu.search.clu.versions"; |
159 |
|
private static final String SEARCH_KEY_LU_RESULT_COMPONENTS = "lu.search.resultComponents"; |
160 |
|
|
161 |
|
final Logger logger = Logger.getLogger(LuServiceImpl.class); |
162 |
|
|
163 |
|
private LuDao luDao; |
164 |
|
private SearchManager searchManager; |
165 |
|
private SearchDispatcher searchDispatcher; |
166 |
|
private DictionaryService dictionaryServiceDelegate; |
167 |
|
private ValidatorFactory validatorFactory; |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
5
|
public void setSearchManager(SearchManager searchManager) {... |
170 |
5
|
this.searchManager = searchManager; |
171 |
|
} |
172 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
3
|
public void setDictionaryServiceDelegate(... |
174 |
|
DictionaryService dictionaryServiceDelegate) { |
175 |
3
|
this.dictionaryServiceDelegate = dictionaryServiceDelegate; |
176 |
|
} |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
178 |
0
|
public DictionaryService getDictionaryServiceDelegate() {... |
179 |
0
|
return dictionaryServiceDelegate; |
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
187 |
0
|
@Override... |
188 |
|
@Transactional(readOnly=true) |
189 |
|
public List<DeliveryMethodTypeInfo> getDeliveryMethodTypes() |
190 |
|
throws OperationFailedException { |
191 |
0
|
return LuServiceAssembler.toDeliveryMethodTypeInfos(luDao |
192 |
|
.find(DeliveryMethodType.class)); |
193 |
|
} |
194 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
195 |
0
|
@Override... |
196 |
|
@Transactional(readOnly=true) |
197 |
|
public DeliveryMethodTypeInfo getDeliveryMethodType( |
198 |
|
String deliveryMethodTypeKey) throws DoesNotExistException, |
199 |
|
InvalidParameterException, MissingParameterException, |
200 |
|
OperationFailedException { |
201 |
|
|
202 |
0
|
checkForMissingParameter(deliveryMethodTypeKey, "deliveryMethodTypeKey"); |
203 |
|
|
204 |
0
|
return LuServiceAssembler.toDeliveryMethodTypeInfo(luDao.fetch( |
205 |
|
DeliveryMethodType.class, deliveryMethodTypeKey)); |
206 |
|
} |
207 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
208 |
0
|
@Override... |
209 |
|
@Transactional(readOnly=true) |
210 |
|
public List<InstructionalFormatTypeInfo> getInstructionalFormatTypes() |
211 |
|
throws OperationFailedException { |
212 |
0
|
return LuServiceAssembler.toInstructionalFormatTypeInfos(luDao |
213 |
|
.find(InstructionalFormatType.class)); |
214 |
|
} |
215 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
216 |
0
|
@Override... |
217 |
|
@Transactional(readOnly=true) |
218 |
|
public InstructionalFormatTypeInfo getInstructionalFormatType( |
219 |
|
String instructionalFormatTypeKey) throws DoesNotExistException, |
220 |
|
InvalidParameterException, MissingParameterException, |
221 |
|
OperationFailedException { |
222 |
0
|
checkForMissingParameter(instructionalFormatTypeKey, |
223 |
|
"instructionalFormatTypeKey"); |
224 |
|
|
225 |
0
|
return LuServiceAssembler.toInstructionalFormatTypeInfo(luDao.fetch( |
226 |
|
InstructionalFormatType.class, instructionalFormatTypeKey)); |
227 |
|
} |
228 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
229 |
0
|
@Override... |
230 |
|
@Transactional(readOnly=true) |
231 |
|
public List<LuTypeInfo> getLuTypes() throws OperationFailedException { |
232 |
0
|
return LuServiceAssembler.toLuTypeInfos(luDao.find(LuType.class)); |
233 |
|
} |
234 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
235 |
0
|
@Override... |
236 |
|
@Transactional(readOnly=true) |
237 |
|
public LuTypeInfo getLuType(String luTypeKey) throws DoesNotExistException, |
238 |
|
InvalidParameterException, MissingParameterException, |
239 |
|
OperationFailedException { |
240 |
0
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
241 |
|
|
242 |
0
|
return LuServiceAssembler.toLuTypeInfo(luDao.fetch(LuType.class, |
243 |
|
luTypeKey)); |
244 |
|
} |
245 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
246 |
0
|
@Override... |
247 |
|
@Transactional(readOnly=true) |
248 |
|
public LuCodeTypeInfo getLuCodeType(String luCodeTypeKey) |
249 |
|
throws DoesNotExistException, InvalidParameterException, |
250 |
|
MissingParameterException, OperationFailedException { |
251 |
0
|
checkForMissingParameter(luCodeTypeKey, "luCodeTypeKey"); |
252 |
0
|
return LuServiceAssembler.toLuCodeTypeInfo(luDao.fetch( |
253 |
|
LuCodeType.class, luCodeTypeKey)); |
254 |
|
} |
255 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
256 |
0
|
@Override... |
257 |
|
@Transactional(readOnly=true) |
258 |
|
public List<LuCodeTypeInfo> getLuCodeTypes() |
259 |
|
throws OperationFailedException { |
260 |
0
|
return LuServiceAssembler.toLuCodeTypeInfos(luDao |
261 |
|
.find(LuCodeType.class)); |
262 |
|
} |
263 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
264 |
1
|
@Override... |
265 |
|
@Transactional(readOnly=true) |
266 |
|
public List<LuLuRelationTypeInfo> getLuLuRelationTypes() |
267 |
|
throws OperationFailedException { |
268 |
1
|
return LuServiceAssembler.toLuLuRelationTypeInfos(luDao |
269 |
|
.find(LuLuRelationType.class)); |
270 |
|
} |
271 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
272 |
4
|
@Override... |
273 |
|
@Transactional(readOnly=true) |
274 |
|
public LuLuRelationTypeInfo getLuLuRelationType(String luLuRelationTypeKey) |
275 |
|
throws OperationFailedException, MissingParameterException, |
276 |
|
DoesNotExistException { |
277 |
4
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
278 |
|
|
279 |
3
|
LuLuRelationType luLuRelationType = luDao.fetch(LuLuRelationType.class, |
280 |
|
luLuRelationTypeKey); |
281 |
2
|
return LuServiceAssembler.toLuLuRelationTypeInfo(luLuRelationType); |
282 |
|
} |
283 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
284 |
0
|
@Override... |
285 |
|
@Transactional(readOnly=true) |
286 |
|
public List<String> getAllowedLuLuRelationTypesForLuType(String luTypeKey, |
287 |
|
String relatedLuTypeKey) throws DoesNotExistException, |
288 |
|
InvalidParameterException, MissingParameterException, |
289 |
|
OperationFailedException { |
290 |
0
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
291 |
0
|
checkForMissingParameter(relatedLuTypeKey, "relatedLuTypeKey"); |
292 |
|
|
293 |
0
|
return luDao.getAllowedLuLuRelationTypesForLuType(luTypeKey, |
294 |
|
relatedLuTypeKey); |
295 |
|
} |
296 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
297 |
0
|
@Override... |
298 |
|
@Transactional(readOnly=true) |
299 |
|
public List<LuPublicationTypeInfo> getLuPublicationTypes() |
300 |
|
throws OperationFailedException { |
301 |
0
|
return LuServiceAssembler.toLuPublicationTypeInfos(luDao |
302 |
|
.find(LuPublicationType.class)); |
303 |
|
} |
304 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
305 |
0
|
@Override... |
306 |
|
@Transactional(readOnly=true) |
307 |
|
public LuPublicationTypeInfo getLuPublicationType( |
308 |
|
String luPublicationTypeKey) throws DoesNotExistException, |
309 |
|
InvalidParameterException, MissingParameterException, |
310 |
|
OperationFailedException { |
311 |
0
|
checkForMissingParameter(luPublicationTypeKey, "luPublicationTypeKey"); |
312 |
|
|
313 |
0
|
return LuServiceAssembler.toLuPublicationTypeInfo(luDao.fetch( |
314 |
|
LuPublicationType.class, luPublicationTypeKey)); |
315 |
|
} |
316 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
317 |
0
|
@Override... |
318 |
|
@Transactional(readOnly=true) |
319 |
|
public List<String> getLuPublicationTypesForLuType(String luTypeKey) |
320 |
|
throws DoesNotExistException, InvalidParameterException, |
321 |
|
MissingParameterException, OperationFailedException { |
322 |
0
|
throw new UnsupportedOperationException("getLuPublicationTypesForLuType"); |
323 |
|
} |
324 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
325 |
0
|
@Override... |
326 |
|
@Transactional(readOnly=true) |
327 |
|
public List<CluResultTypeInfo> getCluResultTypes() |
328 |
|
throws OperationFailedException { |
329 |
0
|
return LuServiceAssembler.toCluResultTypeInfos(luDao |
330 |
|
.find(CluResultType.class)); |
331 |
|
} |
332 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
333 |
0
|
@Override... |
334 |
|
@Transactional(readOnly=true) |
335 |
|
public CluResultTypeInfo getCluResultType(String cluResultTypeKey) |
336 |
|
throws DoesNotExistException, InvalidParameterException, |
337 |
|
MissingParameterException, OperationFailedException { |
338 |
0
|
return LuServiceAssembler.toCluResultTypeInfo(luDao.fetch( |
339 |
|
CluResultType.class, cluResultTypeKey)); |
340 |
|
} |
341 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
342 |
0
|
@Override... |
343 |
|
@Transactional(readOnly=true) |
344 |
|
public List<CluResultTypeInfo> getCluResultTypesForLuType(String luTypeKey) |
345 |
|
throws DoesNotExistException, InvalidParameterException, |
346 |
|
MissingParameterException, OperationFailedException { |
347 |
0
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
348 |
0
|
return LuServiceAssembler.toCluResultTypeInfos((luDao |
349 |
|
.getAllowedCluResultTypesForLuType(luTypeKey))); |
350 |
|
} |
351 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
352 |
1
|
@Override... |
353 |
|
@Transactional(readOnly=true) |
354 |
|
public List<ResultUsageTypeInfo> getResultUsageTypes() |
355 |
|
throws OperationFailedException { |
356 |
1
|
return LuServiceAssembler.toResultUsageTypeInfos(luDao |
357 |
|
.find(ResultUsageType.class)); |
358 |
|
} |
359 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
360 |
1
|
@Override... |
361 |
|
@Transactional(readOnly=true) |
362 |
|
public ResultUsageTypeInfo getResultUsageType(String resultUsageTypeKey) |
363 |
|
throws DoesNotExistException, InvalidParameterException, |
364 |
|
MissingParameterException, OperationFailedException { |
365 |
1
|
checkForMissingParameter(resultUsageTypeKey, "resultUsageTypeKey"); |
366 |
1
|
return LuServiceAssembler.toResultUsageTypeInfo(luDao.fetch( |
367 |
|
ResultUsageType.class, resultUsageTypeKey)); |
368 |
|
} |
369 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
370 |
0
|
@Override... |
371 |
|
@Transactional(readOnly=true) |
372 |
|
public List<String> getAllowedResultUsageTypesForLuType(String luTypeKey) |
373 |
|
throws DoesNotExistException, InvalidParameterException, |
374 |
|
MissingParameterException, OperationFailedException { |
375 |
0
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
376 |
|
|
377 |
0
|
return luDao.getAllowedResultUsageTypesForLuType(luTypeKey); |
378 |
|
} |
379 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
380 |
0
|
@Override... |
381 |
|
@Transactional(readOnly=true) |
382 |
|
public List<String> getAllowedResultComponentTypesForResultUsageType( |
383 |
|
String resultUsageTypeKey) throws DoesNotExistException, |
384 |
|
InvalidParameterException, MissingParameterException, |
385 |
|
OperationFailedException { |
386 |
|
|
387 |
0
|
checkForMissingParameter(resultUsageTypeKey, "resultUsageTypeKey"); |
388 |
|
|
389 |
0
|
return luDao |
390 |
|
.getAllowedResultComponentTypesForResultUsageType(resultUsageTypeKey); |
391 |
|
} |
392 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
393 |
0
|
@Override... |
394 |
|
@Transactional(readOnly=true) |
395 |
|
public CluLoRelationTypeInfo getCluLoRelationType( |
396 |
|
String cluLoRelationTypeKey) throws DoesNotExistException, |
397 |
|
InvalidParameterException, MissingParameterException, |
398 |
|
OperationFailedException { |
399 |
0
|
checkForMissingParameter(cluLoRelationTypeKey, "cluLoRelationTypeKey"); |
400 |
|
|
401 |
0
|
CluLoRelationType cluLoRelationType = luDao.fetch( |
402 |
|
CluLoRelationType.class, cluLoRelationTypeKey); |
403 |
0
|
return LuServiceAssembler.toCluLoRelationTypeInfo(cluLoRelationType); |
404 |
|
} |
405 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
406 |
0
|
@Override... |
407 |
|
@Transactional(readOnly=true) |
408 |
|
public List<CluLoRelationTypeInfo> getCluLoRelationTypes() |
409 |
|
throws OperationFailedException { |
410 |
0
|
return LuServiceAssembler.toCluLoRelationTypeInfos(luDao |
411 |
|
.find(CluLoRelationType.class)); |
412 |
|
} |
413 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
414 |
0
|
@Override... |
415 |
|
@Transactional(readOnly=true) |
416 |
|
public List<String> getAllowedCluLoRelationTypesForLuType(String luTypeKey) |
417 |
|
throws DoesNotExistException, InvalidParameterException, |
418 |
|
MissingParameterException, OperationFailedException { |
419 |
|
|
420 |
0
|
checkForMissingParameter(luTypeKey, luTypeKey); |
421 |
|
|
422 |
0
|
return luDao.getAllowedCluLoRelationTypesForLuType(luTypeKey); |
423 |
|
} |
424 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
425 |
0
|
@Override... |
426 |
|
@Transactional(readOnly=true) |
427 |
|
public List<CluSetTypeInfo> getCluSetTypes() |
428 |
|
throws OperationFailedException { |
429 |
0
|
return LuServiceAssembler.toCluSetTypeInfos(luDao |
430 |
|
.find(CluSetType.class)); |
431 |
|
} |
432 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
433 |
0
|
@Override... |
434 |
|
@Transactional(readOnly=true) |
435 |
|
public CluSetTypeInfo getCluSetType(String cluSetTypeKey) |
436 |
|
throws DoesNotExistException, InvalidParameterException, |
437 |
|
MissingParameterException, OperationFailedException { |
438 |
0
|
checkForMissingParameter(cluSetTypeKey, "cluSetTypeKey"); |
439 |
0
|
return LuServiceAssembler.toCluSetTypeInfo(luDao.fetch( |
440 |
|
CluSetType.class, cluSetTypeKey)); |
441 |
|
} |
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
448 |
181
|
@Override... |
449 |
|
@Transactional(readOnly=true) |
450 |
|
public CluInfo getClu(String cluId) throws DoesNotExistException, |
451 |
|
InvalidParameterException, MissingParameterException, |
452 |
|
OperationFailedException { |
453 |
|
|
454 |
181
|
checkForMissingParameter(cluId, "cluId"); |
455 |
|
|
456 |
180
|
Clu clu = luDao.fetch(Clu.class, cluId); |
457 |
175
|
return LuServiceAssembler.toCluInfo(clu); |
458 |
|
} |
459 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
460 |
3
|
@Override... |
461 |
|
@Transactional(readOnly=true) |
462 |
|
public List<CluInfo> getClusByIdList(List<String> cluIdList) |
463 |
|
throws DoesNotExistException, InvalidParameterException, |
464 |
|
MissingParameterException, OperationFailedException { |
465 |
3
|
checkForMissingParameter(cluIdList, "cluIdList"); |
466 |
2
|
checkForEmptyList(cluIdList, "cluIdList"); |
467 |
2
|
List<Clu> clus = luDao.getClusByIdList(cluIdList); |
468 |
2
|
return LuServiceAssembler.toCluInfos(clus); |
469 |
|
} |
470 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
471 |
5
|
@Override... |
472 |
|
@Transactional(readOnly=true) |
473 |
|
public List<CluInfo> getClusByLuType(String luTypeKey, String luState) |
474 |
|
throws DoesNotExistException, InvalidParameterException, |
475 |
|
MissingParameterException, OperationFailedException { |
476 |
5
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
477 |
4
|
checkForMissingParameter(luState, "lustate"); |
478 |
3
|
List<Clu> clus = luDao.getClusByLuType(luTypeKey, luState); |
479 |
3
|
return LuServiceAssembler.toCluInfos(clus); |
480 |
|
} |
481 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
482 |
5
|
@Override... |
483 |
|
@Transactional(readOnly=true) |
484 |
|
public List<String> getCluIdsByLuType(String luTypeKey, String luState) |
485 |
|
throws DoesNotExistException, InvalidParameterException, |
486 |
|
MissingParameterException, OperationFailedException { |
487 |
5
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
488 |
4
|
checkForMissingParameter(luState, "luState"); |
489 |
3
|
List<Clu> clus = luDao.getClusByLuType(luTypeKey, luState); |
490 |
3
|
List<String> ids = new ArrayList<String>(clus.size()); |
491 |
3
|
for (Clu clu : clus) { |
492 |
1
|
ids.add(clu.getId()); |
493 |
|
} |
494 |
3
|
return ids; |
495 |
|
} |
496 |
|
|
497 |
|
|
498 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
499 |
0
|
@Override... |
500 |
|
@Transactional(readOnly=true) |
501 |
|
public List<String> getAllowedLuLuRelationTypesByCluId(String cluId, |
502 |
|
String relatedCluId) throws DoesNotExistException, |
503 |
|
InvalidParameterException, MissingParameterException, |
504 |
|
OperationFailedException { |
505 |
0
|
checkForMissingParameter(cluId, "cluId"); |
506 |
0
|
checkForMissingParameter(relatedCluId, "relatedCluId"); |
507 |
|
|
508 |
0
|
return luDao.getAllowedLuLuRelationTypesByCluId(cluId, relatedCluId); |
509 |
|
} |
510 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
511 |
5
|
@Override... |
512 |
|
@Transactional(readOnly=true) |
513 |
|
public List<CluInfo> getClusByRelation(String relatedCluId, |
514 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
515 |
|
InvalidParameterException, MissingParameterException, |
516 |
|
OperationFailedException { |
517 |
5
|
checkForMissingParameter(relatedCluId, "relatedCluId"); |
518 |
4
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
519 |
|
|
520 |
3
|
List<Clu> clus = luDao.getClusByRelation(relatedCluId, |
521 |
|
luLuRelationTypeKey); |
522 |
3
|
List<CluInfo> result = LuServiceAssembler.toCluInfos(clus); |
523 |
3
|
return result; |
524 |
|
|
525 |
|
} |
526 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
527 |
19
|
@Override... |
528 |
|
@Transactional(readOnly=true) |
529 |
|
public List<String> getCluIdsByRelation(String relatedCluId, |
530 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
531 |
|
InvalidParameterException, MissingParameterException, |
532 |
|
OperationFailedException { |
533 |
19
|
checkForMissingParameter(relatedCluId, "relatedCluId"); |
534 |
18
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
535 |
|
|
536 |
17
|
List<String> cluIds = luDao.getCluIdsByRelatedCluId(relatedCluId, luLuRelationTypeKey); |
537 |
17
|
return cluIds; |
538 |
|
} |
539 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
540 |
64
|
@Override... |
541 |
|
@Transactional(readOnly=true) |
542 |
|
public List<CluInfo> getRelatedClusByCluId(String cluId, |
543 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
544 |
|
InvalidParameterException, MissingParameterException, |
545 |
|
OperationFailedException { |
546 |
64
|
checkForMissingParameter(cluId, "cluId"); |
547 |
64
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
548 |
64
|
List<Clu> relatedClus = luDao.getRelatedClusByCluId(cluId, |
549 |
|
luLuRelationTypeKey); |
550 |
64
|
return LuServiceAssembler.toCluInfos(relatedClus); |
551 |
|
} |
552 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
553 |
85
|
@Override... |
554 |
|
@Transactional(readOnly=true) |
555 |
|
public List<String> getRelatedCluIdsByCluId(String cluId, |
556 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
557 |
|
InvalidParameterException, MissingParameterException, |
558 |
|
OperationFailedException { |
559 |
85
|
checkForMissingParameter(cluId, "cluId"); |
560 |
85
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
561 |
85
|
List<String> relatedCluIds = luDao.getRelatedCluIdsByCluId(cluId, |
562 |
|
luLuRelationTypeKey); |
563 |
85
|
return relatedCluIds; |
564 |
|
} |
565 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
566 |
2
|
@Override... |
567 |
|
@Transactional(readOnly=true) |
568 |
|
public CluCluRelationInfo getCluCluRelation(String cluCluRelationId) |
569 |
|
throws DoesNotExistException, InvalidParameterException, |
570 |
|
MissingParameterException, OperationFailedException { |
571 |
2
|
checkForMissingParameter(cluCluRelationId, "cluCluRelationId"); |
572 |
2
|
return LuServiceAssembler.toCluCluRelationInfo(luDao.fetch( |
573 |
|
CluCluRelation.class, cluCluRelationId)); |
574 |
|
} |
575 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
576 |
81
|
@Override... |
577 |
|
@Transactional(readOnly=true) |
578 |
|
public List<CluCluRelationInfo> getCluCluRelationsByClu(String cluId) |
579 |
|
throws DoesNotExistException, InvalidParameterException, |
580 |
|
MissingParameterException, OperationFailedException { |
581 |
81
|
checkForMissingParameter(cluId, "cluId"); |
582 |
80
|
List<CluCluRelation> cluCluRelations = luDao |
583 |
|
.getCluCluRelationsByClu(cluId); |
584 |
80
|
return LuServiceAssembler.toCluCluRelationInfos(cluCluRelations); |
585 |
|
} |
586 |
|
|
587 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
588 |
185
|
@Override... |
589 |
|
@Transactional(readOnly=true) |
590 |
|
public List<CluPublicationInfo> getCluPublicationsByCluId(String cluId) |
591 |
|
throws DoesNotExistException, InvalidParameterException, |
592 |
|
MissingParameterException, OperationFailedException { |
593 |
185
|
checkForMissingParameter(cluId, "cluId"); |
594 |
185
|
List<CluPublication> cluPublications = luDao.getCluPublicationsByCluId(cluId); |
595 |
185
|
return LuServiceAssembler.toCluPublicationInfos(cluPublications); |
596 |
|
} |
597 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
598 |
1
|
@Override... |
599 |
|
@Transactional(readOnly=true) |
600 |
|
public List<CluPublicationInfo> getCluPublicationsByType( |
601 |
|
String luPublicationTypeKey) throws DoesNotExistException, |
602 |
|
InvalidParameterException, MissingParameterException, |
603 |
|
OperationFailedException { |
604 |
1
|
checkForMissingParameter(luPublicationTypeKey, "luPublicationTypeKey"); |
605 |
1
|
List<CluPublication> cluPublications = luDao.getCluPublicationsByType(luPublicationTypeKey); |
606 |
1
|
return LuServiceAssembler.toCluPublicationInfos(cluPublications); |
607 |
|
} |
608 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
609 |
1
|
@Override... |
610 |
|
@Transactional(readOnly=true) |
611 |
|
public CluPublicationInfo getCluPublication(String cluPublicationId) |
612 |
|
throws DoesNotExistException, InvalidParameterException, |
613 |
|
MissingParameterException, OperationFailedException { |
614 |
1
|
checkForMissingParameter(cluPublicationId, "cluPublicationId"); |
615 |
1
|
CluPublication cluPublication = luDao.fetch(CluPublication.class, cluPublicationId); |
616 |
1
|
return LuServiceAssembler.toCluPublicationInfo(cluPublication); |
617 |
|
} |
618 |
|
|
619 |
|
|
620 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
621 |
4
|
@Override... |
622 |
|
@Transactional(readOnly=true) |
623 |
|
public CluResultInfo getCluResult(String cluResultId) |
624 |
|
throws DoesNotExistException, InvalidParameterException, |
625 |
|
MissingParameterException, OperationFailedException { |
626 |
|
|
627 |
4
|
checkForMissingParameter(cluResultId, "cluResultId"); |
628 |
|
|
629 |
4
|
CluResult cluResult = luDao.fetch(CluResult.class, cluResultId); |
630 |
4
|
return LuServiceAssembler.toCluResultInfo(cluResult); |
631 |
|
} |
632 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
633 |
124
|
@Override... |
634 |
|
@Transactional(readOnly=true) |
635 |
|
public List<CluResultInfo> getCluResultByClu(String cluId) |
636 |
|
throws DoesNotExistException, InvalidParameterException, |
637 |
|
MissingParameterException, OperationFailedException { |
638 |
|
|
639 |
124
|
checkForMissingParameter(cluId, "cluId"); |
640 |
|
|
641 |
124
|
return LuServiceAssembler.toCluResultInfos(luDao |
642 |
|
.getCluResultByClu(cluId)); |
643 |
|
} |
644 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
645 |
0
|
@Override... |
646 |
|
@Transactional(readOnly=true) |
647 |
|
public List<String> getCluIdsByResultUsageType(String resultUsageTypeKey) |
648 |
|
throws DoesNotExistException, InvalidParameterException, |
649 |
|
MissingParameterException, OperationFailedException { |
650 |
0
|
return luDao.getCluIdsByResultUsageType(resultUsageTypeKey); |
651 |
|
} |
652 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
653 |
0
|
@Override... |
654 |
|
@Transactional(readOnly=true) |
655 |
|
public List<String> getCluIdsByResultComponent(String resultComponentId) |
656 |
|
throws DoesNotExistException, InvalidParameterException, |
657 |
|
MissingParameterException, OperationFailedException { |
658 |
0
|
return luDao.getCluIdsByResultComponentId(resultComponentId); |
659 |
|
} |
660 |
|
|
661 |
|
|
662 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
663 |
1
|
@Override... |
664 |
|
@Transactional(readOnly=true) |
665 |
|
public CluLoRelationInfo getCluLoRelation(String cluLoRelationId) |
666 |
|
throws DoesNotExistException, InvalidParameterException, |
667 |
|
MissingParameterException, OperationFailedException, |
668 |
|
PermissionDeniedException { |
669 |
|
|
670 |
1
|
checkForMissingParameter(cluLoRelationId, "cluLoRelationId"); |
671 |
|
|
672 |
1
|
CluLoRelation reltn = luDao.fetch(CluLoRelation.class, cluLoRelationId); |
673 |
1
|
return LuServiceAssembler.toCluLoRelationInfo(reltn); |
674 |
|
|
675 |
|
} |
676 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
677 |
184
|
@Override... |
678 |
|
@Transactional(readOnly=true) |
679 |
|
public List<CluLoRelationInfo> getCluLoRelationsByClu(String cluId) |
680 |
|
throws DoesNotExistException, InvalidParameterException, |
681 |
|
MissingParameterException, OperationFailedException { |
682 |
|
|
683 |
184
|
checkForMissingParameter(cluId, "cluId"); |
684 |
184
|
List<CluLoRelation> cluLoRelations = luDao |
685 |
|
.getCluLoRelationsByClu(cluId); |
686 |
184
|
return LuServiceAssembler.toCluLoRelationInfos(cluLoRelations); |
687 |
|
|
688 |
|
} |
689 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
690 |
1
|
@Override... |
691 |
|
@Transactional(readOnly=true) |
692 |
|
public List<CluLoRelationInfo> getCluLoRelationsByLo(String loId) |
693 |
|
throws DoesNotExistException, InvalidParameterException, |
694 |
|
MissingParameterException, OperationFailedException { |
695 |
1
|
checkForMissingParameter(loId, "loId"); |
696 |
1
|
List<CluLoRelation> cluLoRelations = luDao.getCluLoRelationsByLo(loId); |
697 |
1
|
return LuServiceAssembler.toCluLoRelationInfos(cluLoRelations); |
698 |
|
} |
699 |
|
|
700 |
|
|
701 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
702 |
0
|
@Override... |
703 |
|
public List<String> getResourceRequirementsForCluId(String cluId) |
704 |
|
throws DoesNotExistException, InvalidParameterException, |
705 |
|
MissingParameterException, OperationFailedException { |
706 |
0
|
throw new UnsupportedOperationException("Method not yet implemented!"); |
707 |
|
} |
708 |
|
|
709 |
|
|
710 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
711 |
126
|
@Override... |
712 |
|
@Transactional(readOnly=true) |
713 |
|
public CluSetInfo getCluSetInfo(String cluSetId) |
714 |
|
throws DoesNotExistException, InvalidParameterException, |
715 |
|
MissingParameterException, OperationFailedException, |
716 |
|
PermissionDeniedException { |
717 |
126
|
checkForMissingParameter(cluSetId, "cluSetId"); |
718 |
125
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
719 |
122
|
CluSetInfo cluSetInfo = LuServiceAssembler.toCluSetInfo(cluSet); |
720 |
122
|
setMembershipQuerySearchResult(cluSetInfo); |
721 |
122
|
return cluSetInfo; |
722 |
|
} |
723 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
724 |
49
|
@Override... |
725 |
|
@Transactional(readOnly=true) |
726 |
|
public CluSetTreeViewInfo getCluSetTreeView(String cluSetId) |
727 |
|
throws DoesNotExistException, InvalidParameterException, |
728 |
|
MissingParameterException, OperationFailedException, |
729 |
|
PermissionDeniedException { |
730 |
|
|
731 |
49
|
checkForMissingParameter(cluSetId, "cluSetId"); |
732 |
48
|
CluSetInfo cluSet = getCluSetInfo(cluSetId); |
733 |
47
|
if (cluSet == null) { |
734 |
0
|
return null; |
735 |
|
} |
736 |
|
|
737 |
47
|
CluSetTreeViewInfo cluSetTreeView = new CluSetTreeViewInfo(); |
738 |
47
|
getCluSetTreeViewHelper(cluSet, cluSetTreeView); |
739 |
47
|
return cluSetTreeView; |
740 |
|
} |
741 |
|
|
742 |
|
|
743 |
|
|
744 |
|
|
745 |
|
|
746 |
|
@param |
747 |
|
@param |
748 |
|
@throws |
749 |
|
@throws |
750 |
|
@throws |
751 |
|
@throws |
752 |
|
@throws |
753 |
|
|
|
|
| 97.2% |
Uncovered Elements: 1 (36) |
Complexity: 4 |
Complexity Density: 0.13 |
|
754 |
51
|
private void getCluSetTreeViewHelper(CluSetInfo cluSetInfo,... |
755 |
|
CluSetTreeViewInfo cluSetTreeViewInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
756 |
51
|
cluSetTreeViewInfo.setName(cluSetInfo.getName()); |
757 |
51
|
cluSetTreeViewInfo.setDescr(cluSetInfo.getDescr()); |
758 |
51
|
cluSetTreeViewInfo.setEffectiveDate(cluSetInfo.getEffectiveDate()); |
759 |
51
|
cluSetTreeViewInfo.setExpirationDate(cluSetInfo.getExpirationDate()); |
760 |
51
|
cluSetTreeViewInfo.setAdminOrg(cluSetInfo.getAdminOrg()); |
761 |
51
|
cluSetTreeViewInfo.setIsReusable(cluSetInfo.getIsReusable()); |
762 |
51
|
cluSetTreeViewInfo.setIsReferenceable(cluSetInfo.getIsReferenceable()); |
763 |
51
|
cluSetTreeViewInfo.setMetaInfo(cluSetInfo.getMetaInfo()); |
764 |
51
|
cluSetTreeViewInfo.setAttributes(cluSetInfo.getAttributes()); |
765 |
51
|
cluSetTreeViewInfo.setType(cluSetInfo.getType()); |
766 |
51
|
cluSetTreeViewInfo.setState(cluSetInfo.getState()); |
767 |
51
|
cluSetTreeViewInfo.setId(cluSetInfo.getId()); |
768 |
|
|
769 |
51
|
if (!cluSetInfo.getCluSetIds().isEmpty()) { |
770 |
2
|
for (String cluSetId : cluSetInfo.getCluSetIds()) { |
771 |
4
|
CluSetInfo subCluSet = getCluSetInfo(cluSetId); |
772 |
4
|
List<CluSetTreeViewInfo> cluSets = |
773 |
4
|
cluSetTreeViewInfo.getCluSets() == null ? |
774 |
|
new ArrayList<CluSetTreeViewInfo>(0) : cluSetTreeViewInfo.getCluSets(); |
775 |
|
|
776 |
4
|
CluSetTreeViewInfo subCluSetTreeViewInfo = new CluSetTreeViewInfo(); |
777 |
4
|
getCluSetTreeViewHelper(subCluSet, subCluSetTreeViewInfo); |
778 |
4
|
cluSets.add(subCluSetTreeViewInfo); |
779 |
|
|
780 |
4
|
cluSetTreeViewInfo.setCluSets(cluSets); |
781 |
|
} |
782 |
|
} |
783 |
51
|
List<CluInfo> clus = new ArrayList<CluInfo>(); |
784 |
51
|
for (String cluId : cluSetInfo.getCluIds()) { |
785 |
194
|
if(cluId!=null){ |
786 |
|
|
787 |
|
|
788 |
194
|
Clu clu = luDao.getCurrentCluVersion(cluId); |
789 |
194
|
CluInfo cluInfo = new CluInfo(); |
790 |
194
|
cluInfo.setId(clu.getId()); |
791 |
194
|
cluInfo.setType(clu.getLuType().getId()); |
792 |
194
|
cluInfo.setOfficialIdentifier(LuServiceAssembler.toCluIdentifierInfo(clu.getOfficialIdentifier())); |
793 |
194
|
clus.add(cluInfo); |
794 |
|
} |
795 |
|
} |
796 |
51
|
cluSetTreeViewInfo.setClus(clus); |
797 |
|
} |
798 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
799 |
5
|
@Override... |
800 |
|
@Transactional(readOnly=true) |
801 |
|
public List<CluSetInfo> getCluSetInfoByIdList(List<String> cluSetIdList) |
802 |
|
throws DoesNotExistException, InvalidParameterException, |
803 |
|
MissingParameterException, OperationFailedException, |
804 |
|
PermissionDeniedException { |
805 |
5
|
checkForMissingParameter(cluSetIdList, "cluSetIdList"); |
806 |
4
|
checkForEmptyList(cluSetIdList, "cluSetIdList"); |
807 |
4
|
List<CluSet> cluSets = luDao.getCluSetInfoByIdList(cluSetIdList); |
808 |
4
|
return LuServiceAssembler.toCluSetInfos(cluSets); |
809 |
|
} |
810 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
811 |
0
|
@Override... |
812 |
|
@Transactional(readOnly=true) |
813 |
|
public List<String> getCluSetIdsFromCluSet(String cluSetId) |
814 |
|
throws DoesNotExistException, InvalidParameterException, |
815 |
|
MissingParameterException, OperationFailedException, |
816 |
|
PermissionDeniedException { |
817 |
0
|
checkForMissingParameter(cluSetId, "cluSetId"); |
818 |
0
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
819 |
0
|
List<String> ids = new ArrayList<String>(cluSet.getCluVerIndIds().size()); |
820 |
0
|
if(cluSet.getCluSets()!=null){ |
821 |
0
|
for (CluSet cluSet2 : cluSet.getCluSets()) { |
822 |
0
|
ids.add(cluSet2.getId()); |
823 |
|
} |
824 |
|
} |
825 |
0
|
return ids; |
826 |
|
} |
827 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
828 |
0
|
@Override... |
829 |
|
public Boolean isCluSetDynamic(String cluSetId) |
830 |
|
throws DoesNotExistException, InvalidParameterException, |
831 |
|
MissingParameterException, OperationFailedException, |
832 |
|
PermissionDeniedException { |
833 |
0
|
throw new UnsupportedOperationException("Method not yet implemented!"); |
834 |
|
} |
835 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
836 |
3
|
@Override... |
837 |
|
@Transactional(readOnly=true) |
838 |
|
public List<CluInfo> getClusFromCluSet(String cluSetId) |
839 |
|
throws DoesNotExistException, InvalidParameterException, |
840 |
|
MissingParameterException, OperationFailedException, |
841 |
|
PermissionDeniedException { |
842 |
3
|
checkForMissingParameter(cluSetId, "cluSetId"); |
843 |
2
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
844 |
1
|
List<CluInfo> clus = new ArrayList<CluInfo>(cluSet.getCluVerIndIds().size()); |
845 |
1
|
for (CluSetJoinVersionIndClu cluSetJnClu : cluSet.getCluVerIndIds()) { |
846 |
2
|
clus.add(LuServiceAssembler.toCluInfo(luDao.getCurrentCluVersion(cluSetJnClu.getCluVersionIndId()))); |
847 |
|
} |
848 |
1
|
return clus; |
849 |
|
} |
850 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
851 |
3
|
@Override... |
852 |
|
@Transactional(readOnly=true) |
853 |
|
public List<String> getCluIdsFromCluSet(String cluSetId) |
854 |
|
throws DoesNotExistException, InvalidParameterException, |
855 |
|
MissingParameterException, OperationFailedException, |
856 |
|
PermissionDeniedException { |
857 |
3
|
checkForMissingParameter(cluSetId, "cluSetId"); |
858 |
2
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
859 |
1
|
List<String> ids = new ArrayList<String>(cluSet.getCluVerIndIds().size()); |
860 |
1
|
for (CluSetJoinVersionIndClu cluSetJnClu : cluSet.getCluVerIndIds()) { |
861 |
2
|
ids.add(cluSetJnClu.getCluVersionIndId()); |
862 |
|
} |
863 |
1
|
return ids; |
864 |
|
} |
865 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
866 |
2
|
@Override... |
867 |
|
@Transactional(readOnly=true) |
868 |
|
public List<CluInfo> getAllClusInCluSet(String cluSetId) |
869 |
|
throws DoesNotExistException, InvalidParameterException, |
870 |
|
MissingParameterException, OperationFailedException, |
871 |
|
PermissionDeniedException { |
872 |
2
|
checkForMissingParameter(cluSetId, "cluSetId"); |
873 |
2
|
List<String> cluIndIds = new ArrayList<String>(); |
874 |
2
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
875 |
2
|
findClusInCluSet(cluIndIds, cluSet); |
876 |
2
|
List<CluInfo> infos = new ArrayList<CluInfo>(cluIndIds.size()); |
877 |
2
|
for (String cluIndId : cluIndIds) { |
878 |
5
|
infos.add(LuServiceAssembler.toCluInfo(luDao.getCurrentCluVersion(cluIndId))); |
879 |
|
} |
880 |
2
|
return infos; |
881 |
|
} |
882 |
|
|
|
|
| 20% |
Uncovered Elements: 4 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
883 |
1
|
@Override... |
884 |
|
@Transactional(readOnly=true) |
885 |
|
public List<String> getAllCluIdsInCluSet(String cluSetId) |
886 |
|
throws DoesNotExistException, InvalidParameterException, |
887 |
|
MissingParameterException, OperationFailedException, |
888 |
|
PermissionDeniedException { |
889 |
1
|
checkForMissingParameter(cluSetId, "cluSetId"); |
890 |
0
|
List<String> ids = new ArrayList<String>(); |
891 |
0
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
892 |
0
|
findClusInCluSet(ids, cluSet); |
893 |
0
|
return ids; |
894 |
|
} |
895 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
896 |
6
|
@Override... |
897 |
|
@Transactional(readOnly=true) |
898 |
|
public Boolean isCluInCluSet(String cluId, String cluSetId) |
899 |
|
throws DoesNotExistException, InvalidParameterException, |
900 |
|
MissingParameterException, OperationFailedException, |
901 |
|
PermissionDeniedException { |
902 |
6
|
checkForMissingParameter(cluId, "cluId"); |
903 |
5
|
checkForMissingParameter(cluSetId, "cluSetId"); |
904 |
4
|
return luDao.isCluInCluSet(cluId, cluSetId); |
905 |
|
} |
906 |
|
|
907 |
|
|
908 |
|
|
909 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
910 |
4
|
@Override... |
911 |
|
@Transactional(readOnly=true) |
912 |
|
public LuiInfo getLui(String luiId) throws DoesNotExistException, |
913 |
|
InvalidParameterException, MissingParameterException, |
914 |
|
OperationFailedException { |
915 |
|
|
916 |
4
|
checkForMissingParameter(luiId, "luiId"); |
917 |
|
|
918 |
3
|
Lui lui = luDao.fetch(Lui.class, luiId); |
919 |
2
|
return LuServiceAssembler.toLuiInfo(lui); |
920 |
|
} |
921 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
922 |
3
|
@Override... |
923 |
|
@Transactional(readOnly=true) |
924 |
|
public List<LuiInfo> getLuisByIdList(List<String> luiIdList) |
925 |
|
throws DoesNotExistException, InvalidParameterException, |
926 |
|
MissingParameterException, OperationFailedException { |
927 |
3
|
checkForMissingParameter(luiIdList, "luiIdList"); |
928 |
2
|
checkForEmptyList(luiIdList, "luiIdList"); |
929 |
2
|
List<Lui> luis = luDao.getLuisByIdList(luiIdList); |
930 |
2
|
return LuServiceAssembler.toLuiInfos(luis); |
931 |
|
} |
932 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
933 |
0
|
@Override... |
934 |
|
public List<LuiInfo> getLuisInAtpByCluId(String cluId, String atpKey) |
935 |
|
throws DoesNotExistException, InvalidParameterException, |
936 |
|
MissingParameterException, OperationFailedException { |
937 |
0
|
throw new UnsupportedOperationException("Method not yet implemented!"); |
938 |
|
} |
939 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
940 |
4
|
@Override... |
941 |
|
@Transactional(readOnly=true) |
942 |
|
public List<String> getLuiIdsByCluId(String cluId) |
943 |
|
throws DoesNotExistException, InvalidParameterException, |
944 |
|
MissingParameterException, OperationFailedException { |
945 |
|
|
946 |
4
|
checkForMissingParameter(cluId, "cluId"); |
947 |
|
|
948 |
3
|
return luDao.getLuiIdsByCluId(cluId); |
949 |
|
} |
950 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
951 |
6
|
@Override... |
952 |
|
@Transactional(readOnly=true) |
953 |
|
public List<String> getLuiIdsInAtpByCluId(String cluId, String atpKey) |
954 |
|
throws DoesNotExistException, InvalidParameterException, |
955 |
|
MissingParameterException, OperationFailedException { |
956 |
|
|
957 |
6
|
checkForMissingParameter(cluId, "cluId"); |
958 |
5
|
checkForMissingParameter(atpKey, "atpKey"); |
959 |
4
|
return luDao.getLuiIdsInAtpByCluId(cluId, atpKey); |
960 |
|
} |
961 |
|
|
962 |
|
|
963 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
964 |
0
|
@Override... |
965 |
|
@Transactional(readOnly=true) |
966 |
|
public List<String> getAllowedLuLuRelationTypesByLuiId(String luiId, |
967 |
|
String relatedLuiId) throws DoesNotExistException, |
968 |
|
InvalidParameterException, MissingParameterException, |
969 |
|
OperationFailedException { |
970 |
|
|
971 |
0
|
checkForMissingParameter(luiId, "luiId"); |
972 |
0
|
checkForMissingParameter(relatedLuiId, "relatedLuiId"); |
973 |
|
|
974 |
0
|
return luDao.getAllowedLuLuRelationTypesByLuiId(luiId, relatedLuiId); |
975 |
|
} |
976 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
977 |
2
|
@Override... |
978 |
|
@Transactional(readOnly=true) |
979 |
|
public List<LuiInfo> getLuisByRelation(String luiId, |
980 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
981 |
|
InvalidParameterException, MissingParameterException, |
982 |
|
OperationFailedException { |
983 |
2
|
checkForMissingParameter(luiId, "luiId"); |
984 |
2
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
985 |
|
|
986 |
2
|
return LuServiceAssembler.toLuiInfos(luDao.getLuisByRelationType(luiId, |
987 |
|
luLuRelationTypeKey)); |
988 |
|
} |
989 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
990 |
2
|
@Override... |
991 |
|
@Transactional(readOnly=true) |
992 |
|
public List<String> getLuiIdsByRelation(String luiId, |
993 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
994 |
|
InvalidParameterException, MissingParameterException, |
995 |
|
OperationFailedException { |
996 |
2
|
checkForMissingParameter(luiId, "luiId"); |
997 |
2
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
998 |
|
|
999 |
2
|
return luDao.getLuiIdsByRelationType(luiId, luLuRelationTypeKey); |
1000 |
|
} |
1001 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1002 |
1
|
@Override... |
1003 |
|
@Transactional(readOnly=true) |
1004 |
|
public List<LuiInfo> getRelatedLuisByLuiId(String luiId, |
1005 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
1006 |
|
InvalidParameterException, MissingParameterException, |
1007 |
|
OperationFailedException { |
1008 |
1
|
checkForMissingParameter(luiId, "luiId"); |
1009 |
1
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
1010 |
1
|
List<Lui> relatedLuis = luDao.getRelatedLuisByLuiId(luiId, |
1011 |
|
luLuRelationTypeKey); |
1012 |
1
|
return LuServiceAssembler.toLuiInfos(relatedLuis); |
1013 |
|
} |
1014 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1015 |
1
|
@Override... |
1016 |
|
@Transactional(readOnly=true) |
1017 |
|
public List<String> getRelatedLuiIdsByLuiId(String luiId, |
1018 |
|
String luLuRelationTypeKey) throws DoesNotExistException, |
1019 |
|
InvalidParameterException, MissingParameterException, |
1020 |
|
OperationFailedException { |
1021 |
1
|
checkForMissingParameter(luiId, "luiId"); |
1022 |
1
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
1023 |
1
|
List<String> relatedLuiIds = luDao.getRelatedLuiIdsByLuiId(luiId, |
1024 |
|
luLuRelationTypeKey); |
1025 |
1
|
return relatedLuiIds; |
1026 |
|
} |
1027 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1028 |
2
|
@Override... |
1029 |
|
@Transactional(readOnly=true) |
1030 |
|
public LuiLuiRelationInfo getLuiLuiRelation(String luiLuiRelationId) |
1031 |
|
throws DoesNotExistException, InvalidParameterException, |
1032 |
|
MissingParameterException, OperationFailedException { |
1033 |
2
|
checkForMissingParameter(luiLuiRelationId, "luiLuiRelationId"); |
1034 |
2
|
LuiLuiRelation luiLuiRelation = luDao.fetch(LuiLuiRelation.class, |
1035 |
|
luiLuiRelationId); |
1036 |
1
|
return LuServiceAssembler.toLuiLuiRelationInfo(luiLuiRelation); |
1037 |
|
} |
1038 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1039 |
3
|
@Override... |
1040 |
|
@Transactional(readOnly=true) |
1041 |
|
public List<LuiLuiRelationInfo> getLuiLuiRelationsByLui(String luiId) |
1042 |
|
throws DoesNotExistException, InvalidParameterException, |
1043 |
|
MissingParameterException, OperationFailedException { |
1044 |
3
|
checkForMissingParameter(luiId, "luiId"); |
1045 |
3
|
List<LuiLuiRelation> entities = luDao.getLuiLuiRelations(luiId); |
1046 |
3
|
return LuServiceAssembler.toLuiLuiRelationInfos(entities); |
1047 |
|
} |
1048 |
|
|
1049 |
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1053 |
240
|
@Override... |
1054 |
|
public List<ValidationResultInfo> validateClu(String validationType, |
1055 |
|
CluInfo cluInfo) throws DoesNotExistException, |
1056 |
|
InvalidParameterException, MissingParameterException, |
1057 |
|
OperationFailedException { |
1058 |
240
|
checkForMissingParameter(validationType, "validationType"); |
1059 |
240
|
checkForMissingParameter(cluInfo, "cluInfo"); |
1060 |
|
|
1061 |
240
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CluInfo.class.getName()); |
1062 |
240
|
Validator defaultValidator = validatorFactory.getValidator(); |
1063 |
240
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluInfo, objStructure); |
1064 |
|
|
1065 |
240
|
return validationResults; |
1066 |
|
} |
1067 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
1068 |
171
|
@Override... |
1069 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1070 |
|
public CluInfo createClu(String luTypeKey, CluInfo cluInfo) |
1071 |
|
throws AlreadyExistsException, DataValidationErrorException, |
1072 |
|
DoesNotExistException, InvalidParameterException, |
1073 |
|
MissingParameterException, OperationFailedException, |
1074 |
|
PermissionDeniedException { |
1075 |
171
|
Clu clu = toCluForCreate(luTypeKey,cluInfo); |
1076 |
|
|
1077 |
171
|
if(clu.getVersion() == null){ |
1078 |
171
|
clu.setVersion(new Version()); |
1079 |
|
} |
1080 |
171
|
clu.getVersion().setCurrentVersionStart(new Date()); |
1081 |
171
|
luDao.create(clu); |
1082 |
171
|
return LuServiceAssembler.toCluInfo(clu); |
1083 |
|
} |
1084 |
|
|
|
|
| 92.4% |
Uncovered Elements: 9 (118) |
Complexity: 19 |
Complexity Density: 0.22 |
|
1085 |
189
|
public Clu toCluForCreate(String luTypeKey, CluInfo cluInfo)... |
1086 |
|
throws AlreadyExistsException, DataValidationErrorException, |
1087 |
|
DoesNotExistException, InvalidParameterException, |
1088 |
|
MissingParameterException, OperationFailedException, |
1089 |
|
PermissionDeniedException { |
1090 |
189
|
checkForMissingParameter(luTypeKey, "luTypeKey"); |
1091 |
189
|
checkForMissingParameter(cluInfo, "cluInfo"); |
1092 |
|
|
1093 |
|
|
1094 |
189
|
List<ValidationResultInfo> val = validateClu("SYSTEM", cluInfo); |
1095 |
189
|
if(null != val && val.size() > 0) { |
1096 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1097 |
|
} |
1098 |
|
|
1099 |
189
|
Clu clu = new Clu(); |
1100 |
|
|
1101 |
189
|
LuType luType = luDao.fetch(LuType.class, luTypeKey); |
1102 |
189
|
clu.setLuType(luType); |
1103 |
|
|
1104 |
189
|
if (cluInfo.getOfficialIdentifier() != null) { |
1105 |
57
|
clu.setOfficialIdentifier(LuServiceAssembler.createOfficialIdentifier(cluInfo, luDao)); |
1106 |
|
} |
1107 |
189
|
clu.setAlternateIdentifiers(LuServiceAssembler.createAlternateIdentifiers(cluInfo, luDao)); |
1108 |
189
|
if (cluInfo.getDescr() != null) { |
1109 |
57
|
LuRichText descr = LuServiceAssembler.toRichText(LuRichText.class, cluInfo.getDescr()); |
1110 |
57
|
if (descr.getPlain() != null || descr.getFormatted() != null) { |
1111 |
57
|
clu.setDescr(descr); |
1112 |
|
} |
1113 |
|
} |
1114 |
|
|
1115 |
189
|
if (clu.getAdminOrgs() == null) { |
1116 |
189
|
clu.setAdminOrgs(new ArrayList<CluAdminOrg>(0)); |
1117 |
|
} |
1118 |
189
|
List<CluAdminOrg> adminOrgs = clu.getAdminOrgs(); |
1119 |
189
|
for (AdminOrgInfo orgInfo : cluInfo.getAdminOrgs()) { |
1120 |
484
|
CluAdminOrg instructor = new CluAdminOrg(); |
1121 |
484
|
BeanUtils.copyProperties(orgInfo, instructor, |
1122 |
|
new String[] { "attributes" }); |
1123 |
484
|
instructor.setAttributes(LuServiceAssembler.toGenericAttributes( |
1124 |
|
CluAdminOrgAttribute.class, orgInfo.getAttributes(), |
1125 |
|
instructor, luDao)); |
1126 |
484
|
instructor.setClu(clu); |
1127 |
484
|
adminOrgs.add(instructor); |
1128 |
|
} |
1129 |
|
|
1130 |
189
|
if (cluInfo.getPrimaryInstructor() != null) { |
1131 |
26
|
CluInstructor primaryInstructor = new CluInstructor(); |
1132 |
26
|
BeanUtils.copyProperties(cluInfo.getPrimaryInstructor(), |
1133 |
|
primaryInstructor, new String[] { "attributes" }); |
1134 |
26
|
primaryInstructor.setAttributes(LuServiceAssembler |
1135 |
|
.toGenericAttributes(CluInstructorAttribute.class, cluInfo |
1136 |
|
.getPrimaryInstructor().getAttributes(), |
1137 |
|
primaryInstructor, luDao)); |
1138 |
26
|
clu.setPrimaryInstructor(primaryInstructor); |
1139 |
|
} |
1140 |
|
|
1141 |
189
|
if (clu.getInstructors() == null) { |
1142 |
189
|
clu.setInstructors(new ArrayList<CluInstructor>(0)); |
1143 |
|
} |
1144 |
189
|
List<CluInstructor> instructors = clu.getInstructors(); |
1145 |
189
|
for (CluInstructorInfo instructorInfo : cluInfo.getInstructors()) { |
1146 |
62
|
CluInstructor instructor = new CluInstructor(); |
1147 |
62
|
BeanUtils.copyProperties(instructorInfo, instructor, |
1148 |
|
new String[] { "attributes" }); |
1149 |
62
|
instructor.setAttributes(LuServiceAssembler.toGenericAttributes( |
1150 |
|
CluInstructorAttribute.class, instructorInfo |
1151 |
|
.getAttributes(), instructor, luDao)); |
1152 |
62
|
instructors.add(instructor); |
1153 |
|
} |
1154 |
|
|
1155 |
189
|
if (cluInfo.getStdDuration() != null) { |
1156 |
169
|
clu.setStdDuration(LuServiceAssembler.toTimeAmount(cluInfo |
1157 |
|
.getStdDuration())); |
1158 |
|
} |
1159 |
|
|
1160 |
189
|
if (clu.getLuCodes() == null) { |
1161 |
189
|
clu.setLuCodes(new ArrayList<LuCode>(0)); |
1162 |
|
} |
1163 |
189
|
List<LuCode> luCodes = clu.getLuCodes(); |
1164 |
189
|
for (LuCodeInfo luCodeInfo : cluInfo.getLuCodes()) { |
1165 |
101
|
LuCode luCode = new LuCode(); |
1166 |
101
|
luCode.setAttributes(LuServiceAssembler.toGenericAttributes( |
1167 |
|
LuCodeAttribute.class, luCodeInfo.getAttributes(), luCode, |
1168 |
|
luDao)); |
1169 |
101
|
BeanUtils.copyProperties(luCodeInfo, luCode, new String[] { |
1170 |
|
"attributes", "metaInfo" }); |
1171 |
101
|
luCode.setDescr(luCodeInfo.getDescr()); |
1172 |
101
|
luCode.setClu(clu); |
1173 |
101
|
luCodes.add(luCode); |
1174 |
|
} |
1175 |
|
|
1176 |
189
|
if (clu.getOfferedAtpTypes() == null) { |
1177 |
189
|
clu.setOfferedAtpTypes(new ArrayList<CluAtpTypeKey>(0)); |
1178 |
|
} |
1179 |
189
|
List<CluAtpTypeKey> offeredAtpTypes = clu.getOfferedAtpTypes(); |
1180 |
189
|
for (String atpTypeKey : cluInfo.getOfferedAtpTypes()) { |
1181 |
137
|
CluAtpTypeKey cluAtpTypeKey = new CluAtpTypeKey(); |
1182 |
137
|
cluAtpTypeKey.setAtpTypeKey(atpTypeKey); |
1183 |
137
|
cluAtpTypeKey.setClu(clu); |
1184 |
137
|
offeredAtpTypes.add(cluAtpTypeKey); |
1185 |
|
} |
1186 |
|
|
1187 |
|
|
1188 |
189
|
if (cluInfo.getFeeInfo() != null) { |
1189 |
26
|
CluFee cluFee = null; |
1190 |
26
|
try { |
1191 |
26
|
cluFee = LuServiceAssembler.toCluFee(clu, false, cluInfo |
1192 |
|
.getFeeInfo(), luDao); |
1193 |
|
} catch (VersionMismatchException e) { |
1194 |
|
|
1195 |
|
} |
1196 |
26
|
clu.setFee(cluFee); |
1197 |
|
} |
1198 |
|
|
1199 |
189
|
if (cluInfo.getAccountingInfo() != null) { |
1200 |
26
|
CluAccounting cluAccounting = new CluAccounting(); |
1201 |
26
|
cluAccounting.setAttributes(LuServiceAssembler.toGenericAttributes( |
1202 |
|
CluAccountingAttribute.class, cluInfo.getAccountingInfo() |
1203 |
|
.getAttributes(), cluAccounting, luDao)); |
1204 |
26
|
cluAccounting.setAffiliatedOrgs(LuServiceAssembler |
1205 |
|
.toAffiliatedOrgs(false, cluAccounting.getAffiliatedOrgs(), |
1206 |
|
cluInfo.getAccountingInfo().getAffiliatedOrgs(), |
1207 |
|
luDao)); |
1208 |
26
|
clu.setAccounting(cluAccounting); |
1209 |
|
} |
1210 |
|
|
1211 |
189
|
clu.setAttributes(LuServiceAssembler.toGenericAttributes( |
1212 |
|
CluAttribute.class, cluInfo.getAttributes(), clu, luDao)); |
1213 |
|
|
1214 |
|
|
1215 |
189
|
if (cluInfo.getIntensity() != null) { |
1216 |
126
|
clu.setIntensity(LuServiceAssembler |
1217 |
|
.toAmount(cluInfo.getIntensity())); |
1218 |
|
} |
1219 |
|
|
1220 |
189
|
if (clu.getCampusLocations() == null) { |
1221 |
189
|
clu.setCampusLocations(new ArrayList<CluCampusLocation>(0)); |
1222 |
|
} |
1223 |
189
|
List<CluCampusLocation> locations = clu.getCampusLocations(); |
1224 |
189
|
for (String locationName : cluInfo.getCampusLocations()) { |
1225 |
84
|
CluCampusLocation location = new CluCampusLocation(); |
1226 |
84
|
location.setCampusLocation(locationName); |
1227 |
84
|
location.setClu(clu); |
1228 |
84
|
locations.add(location); |
1229 |
|
} |
1230 |
|
|
1231 |
189
|
if (clu.getAccreditations() == null) { |
1232 |
189
|
clu.setAccreditations(new ArrayList<CluAccreditation>(0)); |
1233 |
|
} |
1234 |
189
|
List<CluAccreditation> accreditations = clu.getAccreditations(); |
1235 |
189
|
for (AccreditationInfo accreditationInfo : cluInfo.getAccreditations()) { |
1236 |
18
|
CluAccreditation accreditation = new CluAccreditation(); |
1237 |
18
|
BeanUtils.copyProperties(accreditationInfo, accreditation, |
1238 |
|
new String[] { "attributes" }); |
1239 |
18
|
accreditation.setAttributes(LuServiceAssembler.toGenericAttributes( |
1240 |
|
CluAccreditationAttribute.class, accreditationInfo |
1241 |
|
.getAttributes(), accreditation, luDao)); |
1242 |
18
|
accreditations.add(accreditation); |
1243 |
|
} |
1244 |
|
|
1245 |
|
|
1246 |
189
|
BeanUtils.copyProperties(cluInfo, clu, new String[] { "luType", |
1247 |
|
"officialIdentifier", "alternateIdentifiers", "descr", |
1248 |
|
"luCodes", "primaryInstructor", "instructors", "stdDuration", |
1249 |
|
"offeredAtpTypes", "feeInfo", "accountingInfo", "attributes", |
1250 |
|
"metaInfo", "versionInfo", "intensity", |
1251 |
|
"campusLocations", "accreditations", |
1252 |
|
"adminOrgs" }); |
1253 |
|
|
1254 |
189
|
return clu; |
1255 |
|
} |
1256 |
|
|
|
|
| 84.3% |
Uncovered Elements: 34 (217) |
Complexity: 37 |
Complexity Density: 0.24 |
|
1257 |
50
|
@Override... |
1258 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1259 |
|
public CluInfo updateClu(String cluId, CluInfo cluInfo) |
1260 |
|
throws DataValidationErrorException, DoesNotExistException, |
1261 |
|
InvalidParameterException, MissingParameterException, |
1262 |
|
OperationFailedException, PermissionDeniedException, |
1263 |
|
VersionMismatchException { |
1264 |
|
|
1265 |
50
|
checkForMissingParameter(cluId, "cluId"); |
1266 |
50
|
checkForMissingParameter(cluInfo, "cluInfo"); |
1267 |
|
|
1268 |
|
|
1269 |
50
|
List<ValidationResultInfo> val = validateClu("SYSTEM", cluInfo); |
1270 |
50
|
if(null != val && val.size() > 0) { |
1271 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1272 |
|
} |
1273 |
|
|
1274 |
50
|
Clu clu = luDao.fetch(Clu.class, cluId); |
1275 |
|
|
1276 |
50
|
if (!String.valueOf(clu.getVersionNumber()).equals( |
1277 |
|
cluInfo.getMetaInfo().getVersionInd())) { |
1278 |
2
|
throw new VersionMismatchException( |
1279 |
|
"Clu to be updated is not the current version."); |
1280 |
|
} |
1281 |
|
|
1282 |
48
|
LuType luType = luDao.fetch(LuType.class, cluInfo.getType()); |
1283 |
48
|
clu.setLuType(luType); |
1284 |
|
|
1285 |
48
|
if (cluInfo.getOfficialIdentifier() != null) { |
1286 |
46
|
LuServiceAssembler.updateOfficialIdentifier(clu, cluInfo, luDao); |
1287 |
2
|
} else if (clu.getOfficialIdentifier() != null) { |
1288 |
0
|
luDao.delete(clu.getOfficialIdentifier()); |
1289 |
|
} |
1290 |
|
|
1291 |
|
|
1292 |
|
|
1293 |
|
|
1294 |
48
|
Map<String, CluIdentifier> oldAltIdMap = new HashMap<String, CluIdentifier>(); |
1295 |
48
|
LuServiceAssembler.updateAlternateIdentifier(oldAltIdMap, clu, cluInfo, luDao); |
1296 |
|
|
1297 |
48
|
for (Entry<String, CluIdentifier> entry : oldAltIdMap.entrySet()) { |
1298 |
1
|
luDao.delete(entry.getValue()); |
1299 |
|
} |
1300 |
|
|
1301 |
48
|
if (cluInfo.getDescr() != null && (cluInfo.getDescr().getPlain() != null || cluInfo.getDescr().getFormatted() != null)) { |
1302 |
46
|
if (clu.getDescr() == null) { |
1303 |
0
|
clu.setDescr(new LuRichText()); |
1304 |
|
} |
1305 |
46
|
BeanUtils.copyProperties(cluInfo.getDescr(), clu.getDescr()); |
1306 |
2
|
} else if (clu.getDescr() != null) { |
1307 |
0
|
luDao.delete(clu.getDescr()); |
1308 |
0
|
clu.setDescr(null); |
1309 |
|
} |
1310 |
|
|
1311 |
48
|
if (cluInfo.getPrimaryInstructor() != null) { |
1312 |
36
|
if (clu.getPrimaryInstructor() == null) { |
1313 |
0
|
clu.setPrimaryInstructor(new CluInstructor()); |
1314 |
|
} |
1315 |
36
|
BeanUtils.copyProperties(cluInfo.getPrimaryInstructor(), clu |
1316 |
|
.getPrimaryInstructor(), new String[] { "attributes" }); |
1317 |
36
|
clu.getPrimaryInstructor().setAttributes( |
1318 |
|
LuServiceAssembler.toGenericAttributes( |
1319 |
|
CluInstructorAttribute.class, cluInfo |
1320 |
|
.getPrimaryInstructor().getAttributes(), |
1321 |
|
clu.getPrimaryInstructor(), luDao)); |
1322 |
12
|
} else if (clu.getPrimaryInstructor() != null) { |
1323 |
0
|
luDao.delete(clu.getPrimaryInstructor()); |
1324 |
|
} |
1325 |
|
|
1326 |
|
|
1327 |
|
|
1328 |
|
|
1329 |
48
|
Map<String, CluInstructor> oldInstructorMap = new HashMap<String, CluInstructor>(); |
1330 |
48
|
for (CluInstructor cluInstructor : clu.getInstructors()) { |
1331 |
30
|
oldInstructorMap.put(cluInstructor.getOrgId() + "_" |
1332 |
|
+ cluInstructor.getPersonId(), cluInstructor); |
1333 |
|
} |
1334 |
48
|
clu.getInstructors().clear(); |
1335 |
|
|
1336 |
|
|
1337 |
|
|
1338 |
|
|
1339 |
48
|
for (CluInstructorInfo instructorInfo : cluInfo.getInstructors()) { |
1340 |
30
|
CluInstructor cluInstructor = oldInstructorMap |
1341 |
|
.remove(instructorInfo.getOrgId() + "_" |
1342 |
|
+ instructorInfo.getPersonId()); |
1343 |
30
|
if (cluInstructor == null) { |
1344 |
3
|
cluInstructor = new CluInstructor(); |
1345 |
|
} |
1346 |
|
|
1347 |
30
|
BeanUtils.copyProperties(instructorInfo, cluInstructor, |
1348 |
|
new String[] { "attributes" }); |
1349 |
30
|
cluInstructor.setAttributes(LuServiceAssembler.toGenericAttributes( |
1350 |
|
CluInstructorAttribute.class, instructorInfo |
1351 |
|
.getAttributes(), cluInstructor, luDao)); |
1352 |
30
|
clu.getInstructors().add(cluInstructor); |
1353 |
|
} |
1354 |
|
|
1355 |
|
|
1356 |
48
|
for (Entry<String, CluInstructor> entry : oldInstructorMap.entrySet()) { |
1357 |
1
|
luDao.delete(entry.getValue()); |
1358 |
|
} |
1359 |
|
|
1360 |
48
|
if (cluInfo.getStdDuration() != null) { |
1361 |
37
|
if (clu.getStdDuration() == null) { |
1362 |
0
|
clu.setStdDuration(new TimeAmount()); |
1363 |
|
} |
1364 |
37
|
BeanUtils.copyProperties(cluInfo.getStdDuration(), clu |
1365 |
|
.getStdDuration()); |
1366 |
11
|
} else if (clu.getStdDuration() != null) { |
1367 |
0
|
luDao.delete(clu.getStdDuration()); |
1368 |
|
} |
1369 |
|
|
1370 |
|
|
1371 |
|
|
1372 |
|
|
1373 |
48
|
Map<String, LuCode> oldLuCodeMap = new HashMap<String, LuCode>(); |
1374 |
48
|
for (LuCode luCode : clu.getLuCodes()) { |
1375 |
138
|
oldLuCodeMap.put(luCode.getId(), luCode); |
1376 |
|
} |
1377 |
48
|
clu.getLuCodes().clear(); |
1378 |
|
|
1379 |
|
|
1380 |
|
|
1381 |
|
|
1382 |
48
|
for (LuCodeInfo luCodeInfo : cluInfo.getLuCodes()) { |
1383 |
136
|
LuCode luCode = oldLuCodeMap.remove(luCodeInfo.getId()); |
1384 |
136
|
if (luCode == null) { |
1385 |
135
|
luCode = new LuCode(); |
1386 |
|
} else { |
1387 |
1
|
if (!String.valueOf(luCode.getVersionNumber()).equals( |
1388 |
|
luCodeInfo.getMetaInfo().getVersionInd())) { |
1389 |
0
|
throw new VersionMismatchException( |
1390 |
|
"LuCode to be updated is not the current version"); |
1391 |
|
} |
1392 |
|
} |
1393 |
|
|
1394 |
136
|
luCode.setAttributes(LuServiceAssembler.toGenericAttributes( |
1395 |
|
LuCodeAttribute.class, luCodeInfo.getAttributes(), luCode, |
1396 |
|
luDao)); |
1397 |
136
|
BeanUtils.copyProperties(luCodeInfo, luCode, new String[] { |
1398 |
|
"attributes", "metaInfo" }); |
1399 |
136
|
luCode.setDescr(luCodeInfo.getDescr()); |
1400 |
136
|
luCode.setClu(clu); |
1401 |
136
|
clu.getLuCodes().add(luCode); |
1402 |
|
} |
1403 |
|
|
1404 |
|
|
1405 |
48
|
for (Entry<String, LuCode> entry : oldLuCodeMap.entrySet()) { |
1406 |
137
|
luDao.delete(entry.getValue()); |
1407 |
|
} |
1408 |
|
|
1409 |
|
|
1410 |
|
|
1411 |
|
|
1412 |
48
|
Map<String, CluAtpTypeKey> oldOfferedAtpTypesMap = new HashMap<String, CluAtpTypeKey>(); |
1413 |
48
|
for (CluAtpTypeKey cluAtpTypeKey : clu.getOfferedAtpTypes()) { |
1414 |
22
|
oldOfferedAtpTypesMap.put(cluAtpTypeKey.getAtpTypeKey(), |
1415 |
|
cluAtpTypeKey); |
1416 |
|
} |
1417 |
48
|
clu.getOfferedAtpTypes().clear(); |
1418 |
|
|
1419 |
|
|
1420 |
|
|
1421 |
|
|
1422 |
48
|
for (String atpTypeKey : cluInfo.getOfferedAtpTypes()) { |
1423 |
22
|
CluAtpTypeKey cluAtpTypeKey = oldOfferedAtpTypesMap |
1424 |
|
.remove(atpTypeKey); |
1425 |
22
|
if (cluAtpTypeKey == null) { |
1426 |
1
|
cluAtpTypeKey = new CluAtpTypeKey(); |
1427 |
|
} |
1428 |
|
|
1429 |
22
|
cluAtpTypeKey.setAtpTypeKey(atpTypeKey); |
1430 |
22
|
cluAtpTypeKey.setClu(clu); |
1431 |
22
|
clu.getOfferedAtpTypes().add(cluAtpTypeKey); |
1432 |
|
} |
1433 |
|
|
1434 |
|
|
1435 |
48
|
for (Entry<String, CluAtpTypeKey> entry : oldOfferedAtpTypesMap |
1436 |
|
.entrySet()) { |
1437 |
1
|
luDao.delete(entry.getValue()); |
1438 |
|
} |
1439 |
|
|
1440 |
48
|
if (cluInfo.getFeeInfo() != null) { |
1441 |
10
|
if (clu.getFee() == null) { |
1442 |
0
|
clu.setFee(LuServiceAssembler.toCluFee(clu, false, cluInfo |
1443 |
|
.getFeeInfo(), luDao)); |
1444 |
|
} else { |
1445 |
10
|
clu.setFee(LuServiceAssembler.toCluFee(clu, true, cluInfo |
1446 |
|
.getFeeInfo(), luDao)); |
1447 |
|
} |
1448 |
38
|
} else if (clu.getFee() != null) { |
1449 |
0
|
luDao.delete(clu.getFee()); |
1450 |
0
|
clu.setFee(null); |
1451 |
|
} |
1452 |
|
|
1453 |
48
|
if (cluInfo.getAccountingInfo() != null) { |
1454 |
10
|
if (clu.getAccounting() == null) { |
1455 |
0
|
clu.setAccounting(new CluAccounting()); |
1456 |
|
} |
1457 |
10
|
clu.getAccounting().setAttributes( |
1458 |
|
LuServiceAssembler.toGenericAttributes( |
1459 |
|
CluAccountingAttribute.class, cluInfo |
1460 |
|
.getAccountingInfo().getAttributes(), clu |
1461 |
|
.getAccounting(), luDao)); |
1462 |
10
|
clu.getAccounting().setAffiliatedOrgs(LuServiceAssembler |
1463 |
|
.toAffiliatedOrgs(true, clu.getAccounting().getAffiliatedOrgs(), |
1464 |
|
cluInfo.getAccountingInfo().getAffiliatedOrgs(), |
1465 |
|
luDao)); |
1466 |
|
|
1467 |
38
|
} else if (clu.getAccounting() != null) { |
1468 |
0
|
clu.setAccounting(null); |
1469 |
|
} |
1470 |
|
|
1471 |
48
|
clu.setAttributes(LuServiceAssembler.toGenericAttributes( |
1472 |
|
CluAttribute.class, cluInfo.getAttributes(), clu, luDao)); |
1473 |
|
|
1474 |
48
|
if (cluInfo.getIntensity() != null) { |
1475 |
36
|
if (clu.getIntensity() == null) { |
1476 |
0
|
clu.setIntensity(new Amount()); |
1477 |
|
} |
1478 |
36
|
BeanUtils |
1479 |
|
.copyProperties(cluInfo.getIntensity(), clu.getIntensity()); |
1480 |
12
|
} else if (clu.getIntensity() != null) { |
1481 |
0
|
luDao.delete(clu.getIntensity()); |
1482 |
|
} |
1483 |
|
|
1484 |
|
|
1485 |
|
|
1486 |
|
|
1487 |
48
|
Map<String, CluCampusLocation> oldLocationsMap = new HashMap<String, CluCampusLocation>(); |
1488 |
48
|
for (CluCampusLocation campus : clu.getCampusLocations()) { |
1489 |
75
|
oldLocationsMap.put(campus.getCampusLocation(), campus); |
1490 |
|
} |
1491 |
48
|
clu.getCampusLocations().clear(); |
1492 |
|
|
1493 |
|
|
1494 |
|
|
1495 |
|
|
1496 |
48
|
for (String locationName : cluInfo.getCampusLocations()) { |
1497 |
77
|
CluCampusLocation location = oldLocationsMap.remove(locationName); |
1498 |
77
|
if (location == null) { |
1499 |
4
|
location = new CluCampusLocation(); |
1500 |
|
} |
1501 |
|
|
1502 |
77
|
location.setCampusLocation(locationName); |
1503 |
77
|
location.setClu(clu); |
1504 |
77
|
clu.getCampusLocations().add(location); |
1505 |
|
} |
1506 |
|
|
1507 |
|
|
1508 |
48
|
for (Entry<String, CluCampusLocation> entry : oldLocationsMap |
1509 |
|
.entrySet()) { |
1510 |
2
|
luDao.delete(entry.getValue()); |
1511 |
|
} |
1512 |
|
|
1513 |
|
|
1514 |
|
|
1515 |
|
|
1516 |
48
|
Map<String, CluAccreditation> oldAccreditationMap = new HashMap<String, CluAccreditation>(); |
1517 |
48
|
for (CluAccreditation cluAccreditation : clu.getAccreditations()) { |
1518 |
12
|
oldAccreditationMap.put(cluAccreditation.getId(), |
1519 |
|
cluAccreditation); |
1520 |
|
} |
1521 |
48
|
clu.getAccreditations().clear(); |
1522 |
|
|
1523 |
|
|
1524 |
|
|
1525 |
|
|
1526 |
48
|
for (AccreditationInfo accreditationInfo : cluInfo.getAccreditations()) { |
1527 |
13
|
CluAccreditation cluAccreditation = null; |
1528 |
13
|
if(accreditationInfo.getId()!=null){ |
1529 |
11
|
cluAccreditation = oldAccreditationMap.remove(accreditationInfo.getId()); |
1530 |
|
} |
1531 |
|
|
1532 |
13
|
if (cluAccreditation == null) { |
1533 |
2
|
cluAccreditation = new CluAccreditation(); |
1534 |
|
} |
1535 |
|
|
1536 |
13
|
BeanUtils.copyProperties(accreditationInfo, cluAccreditation, |
1537 |
|
new String[] { "attributes" }); |
1538 |
13
|
cluAccreditation.setAttributes(LuServiceAssembler |
1539 |
|
.toGenericAttributes(CluAccreditationAttribute.class, |
1540 |
|
accreditationInfo.getAttributes(), |
1541 |
|
cluAccreditation, luDao)); |
1542 |
13
|
clu.getAccreditations().add(cluAccreditation); |
1543 |
|
} |
1544 |
|
|
1545 |
|
|
1546 |
48
|
for (Entry<String, CluAccreditation> entry : oldAccreditationMap |
1547 |
|
.entrySet()) { |
1548 |
1
|
luDao.delete(entry.getValue()); |
1549 |
|
} |
1550 |
|
|
1551 |
|
|
1552 |
|
|
1553 |
|
|
1554 |
48
|
Map<String, CluAdminOrg> oldAdminOrgsMap = new HashMap<String, CluAdminOrg>(); |
1555 |
48
|
if(clu.getAdminOrgs()!=null){ |
1556 |
48
|
for (CluAdminOrg cluOrg : clu.getAdminOrgs()) { |
1557 |
413
|
oldAdminOrgsMap.put(cluOrg.getId(), cluOrg); |
1558 |
|
} |
1559 |
|
} |
1560 |
48
|
clu.setAdminOrgs(new ArrayList<CluAdminOrg>()); |
1561 |
|
|
1562 |
|
|
1563 |
|
|
1564 |
|
|
1565 |
48
|
for (AdminOrgInfo orgInfo : cluInfo.getAdminOrgs()) { |
1566 |
412
|
CluAdminOrg cluOrg = null; |
1567 |
412
|
if(orgInfo.getId() != null){ |
1568 |
2
|
cluOrg = oldAdminOrgsMap.remove(orgInfo.getId()); |
1569 |
|
} |
1570 |
|
|
1571 |
412
|
if (cluOrg == null) { |
1572 |
410
|
cluOrg = new CluAdminOrg(); |
1573 |
|
} |
1574 |
|
|
1575 |
|
|
1576 |
412
|
BeanUtils.copyProperties(orgInfo, cluOrg, |
1577 |
|
new String[] { "attributes","id" }); |
1578 |
412
|
cluOrg.setAttributes(LuServiceAssembler.toGenericAttributes( |
1579 |
|
CluAdminOrgAttribute.class, orgInfo.getAttributes(), |
1580 |
|
cluOrg, luDao)); |
1581 |
412
|
cluOrg.setClu(clu); |
1582 |
412
|
clu.getAdminOrgs().add(cluOrg); |
1583 |
|
} |
1584 |
|
|
1585 |
48
|
for (Entry<String, CluAdminOrg> entry : oldAdminOrgsMap.entrySet()) { |
1586 |
411
|
luDao.delete(entry.getValue()); |
1587 |
|
} |
1588 |
|
|
1589 |
|
|
1590 |
48
|
BeanUtils.copyProperties(cluInfo, clu, new String[] { "luType", |
1591 |
|
"officialIdentifier", "alternateIdentifiers", "descr", |
1592 |
|
"luCodes", "primaryInstructor", "instructors", "stdDuration", |
1593 |
|
"offeredAtpTypes", "feeInfo", "accountingInfo", "attributes", |
1594 |
|
"metaInfo","intensity", |
1595 |
|
"campusLocations", "accreditations", |
1596 |
|
"adminOrgs" }); |
1597 |
48
|
Clu updated = null; |
1598 |
48
|
try { |
1599 |
48
|
updated = luDao.update(clu); |
1600 |
|
} catch (Exception e) { |
1601 |
0
|
logger.error("Exception occured: ", e); |
1602 |
|
} |
1603 |
48
|
return LuServiceAssembler.toCluInfo(updated); |
1604 |
|
} |
1605 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1606 |
14
|
@Override... |
1607 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1608 |
|
public StatusInfo deleteClu(String cluId) throws DoesNotExistException, |
1609 |
|
InvalidParameterException, MissingParameterException, |
1610 |
|
DependentObjectsExistException, OperationFailedException, |
1611 |
|
PermissionDeniedException { |
1612 |
14
|
checkForMissingParameter(cluId, "cluId"); |
1613 |
|
|
1614 |
14
|
luDao.delete(Clu.class, cluId); |
1615 |
|
|
1616 |
14
|
StatusInfo statusInfo = new StatusInfo(); |
1617 |
14
|
statusInfo.setSuccess(true); |
1618 |
|
|
1619 |
14
|
return statusInfo; |
1620 |
|
} |
1621 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1622 |
0
|
@Override... |
1623 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1624 |
|
public CluInfo updateCluState(String cluId, String luState) |
1625 |
|
throws DataValidationErrorException, DoesNotExistException, |
1626 |
|
InvalidParameterException, MissingParameterException, |
1627 |
|
OperationFailedException, PermissionDeniedException { |
1628 |
|
|
1629 |
0
|
checkForMissingParameter(cluId, "cluId"); |
1630 |
0
|
checkForMissingParameter(luState, "luState"); |
1631 |
0
|
Clu clu = luDao.fetch(Clu.class, cluId); |
1632 |
0
|
clu.setState(luState); |
1633 |
0
|
Clu updated = luDao.update(clu); |
1634 |
0
|
return LuServiceAssembler.toCluInfo(updated); |
1635 |
|
} |
1636 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1637 |
184
|
@Override... |
1638 |
|
public List<ValidationResultInfo> validateCluCluRelation( |
1639 |
|
String validationType, CluCluRelationInfo cluCluRelationInfo) |
1640 |
|
throws DoesNotExistException, InvalidParameterException, |
1641 |
|
MissingParameterException, OperationFailedException { |
1642 |
184
|
checkForMissingParameter(validationType, "validationType"); |
1643 |
184
|
checkForMissingParameter(cluCluRelationInfo, "cluCluRelationInfo"); |
1644 |
|
|
1645 |
184
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CluCluRelationInfo.class.getName()); |
1646 |
184
|
Validator defaultValidator = validatorFactory.getValidator(); |
1647 |
184
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluCluRelationInfo, objStructure); |
1648 |
|
|
1649 |
184
|
return validationResults; |
1650 |
|
} |
1651 |
|
|
|
|
| 85.2% |
Uncovered Elements: 4 (27) |
Complexity: 5 |
Complexity Density: 0.24 |
|
1652 |
182
|
@Override... |
1653 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1654 |
|
public CluCluRelationInfo createCluCluRelation(String cluId, |
1655 |
|
String relatedCluId, String luLuRelationTypeKey, |
1656 |
|
CluCluRelationInfo cluCluRelationInfo) |
1657 |
|
throws AlreadyExistsException, DataValidationErrorException, |
1658 |
|
DoesNotExistException, InvalidParameterException, |
1659 |
|
MissingParameterException, OperationFailedException, |
1660 |
|
PermissionDeniedException, CircularRelationshipException { |
1661 |
182
|
checkForMissingParameter(cluId, "cluId"); |
1662 |
182
|
checkForMissingParameter(relatedCluId, "relatedCluId"); |
1663 |
182
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
1664 |
182
|
checkForMissingParameter(cluCluRelationInfo, "cluCluRelationInfo"); |
1665 |
|
|
1666 |
182
|
if (cluId.equals(relatedCluId)) { |
1667 |
0
|
throw new CircularRelationshipException( |
1668 |
|
"Can not relate a Clu to itself"); |
1669 |
|
} |
1670 |
|
|
1671 |
|
|
1672 |
182
|
List<ValidationResultInfo> val = validateCluCluRelation("SYSTEM", cluCluRelationInfo); |
1673 |
182
|
if(null != val && val.size() > 0) { |
1674 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1675 |
|
} |
1676 |
|
|
1677 |
|
|
1678 |
182
|
Clu clu = luDao.fetch(Clu.class, cluId); |
1679 |
182
|
Clu relatedClu = luDao.fetch(Clu.class, relatedCluId); |
1680 |
|
|
1681 |
182
|
CluCluRelation cluCluRelation = new CluCluRelation(); |
1682 |
182
|
BeanUtils.copyProperties(cluCluRelationInfo, cluCluRelation, |
1683 |
|
new String[] { "cluId", "relatedCluId", |
1684 |
|
"isCluRelationRequired", "attributes", "metaInfo" }); |
1685 |
|
|
1686 |
182
|
cluCluRelation.setClu(clu); |
1687 |
182
|
cluCluRelation.setRelatedClu(relatedClu); |
1688 |
182
|
cluCluRelation.setCluRelationRequired(cluCluRelationInfo |
1689 |
|
.getIsCluRelationRequired() == null ? true : cluCluRelationInfo |
1690 |
|
.getIsCluRelationRequired()); |
1691 |
|
|
1692 |
182
|
cluCluRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
1693 |
|
CluCluRelationAttribute.class, cluCluRelationInfo |
1694 |
|
.getAttributes(), cluCluRelation, luDao)); |
1695 |
|
|
1696 |
182
|
LuLuRelationType luLuRelationType = luDao.fetch(LuLuRelationType.class, |
1697 |
|
luLuRelationTypeKey); |
1698 |
|
|
1699 |
182
|
cluCluRelation.setLuLuRelationType(luLuRelationType); |
1700 |
|
|
1701 |
182
|
luDao.create(cluCluRelation); |
1702 |
|
|
1703 |
182
|
return LuServiceAssembler.toCluCluRelationInfo(cluCluRelation); |
1704 |
|
} |
1705 |
|
|
|
|
| 83.3% |
Uncovered Elements: 3 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
1706 |
2
|
@Override... |
1707 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1708 |
|
public CluCluRelationInfo updateCluCluRelation( |
1709 |
|
final String cluCluRelationId, |
1710 |
|
final CluCluRelationInfo cluCluRelationInfo) |
1711 |
|
throws DataValidationErrorException, DoesNotExistException, |
1712 |
|
InvalidParameterException, MissingParameterException, |
1713 |
|
OperationFailedException, PermissionDeniedException, |
1714 |
|
VersionMismatchException { |
1715 |
2
|
checkForMissingParameter(cluCluRelationId, "cluCluRelationId"); |
1716 |
2
|
checkForMissingParameter(cluCluRelationInfo, "cluCluRelationInfo"); |
1717 |
|
|
1718 |
|
|
1719 |
2
|
List<ValidationResultInfo> val = validateCluCluRelation("SYSTEM", cluCluRelationInfo); |
1720 |
2
|
if(null != val && val.size() > 0) { |
1721 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1722 |
|
} |
1723 |
|
|
1724 |
2
|
final CluCluRelation cluCluRelation = luDao.fetch(CluCluRelation.class, |
1725 |
|
cluCluRelationId); |
1726 |
2
|
BeanUtils.copyProperties(cluCluRelationInfo, cluCluRelation, |
1727 |
|
new String[] { "cluId", "relatedCluId", |
1728 |
|
"isCluRelationRequired", "attributes", "metaInfo" }); |
1729 |
|
|
1730 |
2
|
cluCluRelation.setClu(luDao.fetch(Clu.class, cluCluRelationInfo |
1731 |
|
.getCluId())); |
1732 |
2
|
cluCluRelation.setRelatedClu(luDao.fetch(Clu.class, cluCluRelationInfo |
1733 |
|
.getRelatedCluId())); |
1734 |
2
|
cluCluRelation.setCluRelationRequired(cluCluRelationInfo |
1735 |
|
.getIsCluRelationRequired() == null ? true : cluCluRelationInfo |
1736 |
|
.getIsCluRelationRequired()); |
1737 |
|
|
1738 |
2
|
cluCluRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
1739 |
|
CluCluRelationAttribute.class, cluCluRelationInfo |
1740 |
|
.getAttributes(), cluCluRelation, luDao)); |
1741 |
|
|
1742 |
2
|
cluCluRelation.setLuLuRelationType(luDao.fetch(LuLuRelationType.class, |
1743 |
|
cluCluRelationInfo.getType())); |
1744 |
|
|
1745 |
2
|
final CluCluRelation update = luDao.update(cluCluRelation); |
1746 |
|
|
1747 |
2
|
return LuServiceAssembler.toCluCluRelationInfo(update); |
1748 |
|
} |
1749 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1750 |
20
|
@Override... |
1751 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1752 |
|
public StatusInfo deleteCluCluRelation(String cluCluRelationId) |
1753 |
|
throws DoesNotExistException, InvalidParameterException, |
1754 |
|
MissingParameterException, OperationFailedException, |
1755 |
|
PermissionDeniedException { |
1756 |
20
|
checkForMissingParameter(cluCluRelationId, "cluCluRelationId"); |
1757 |
|
|
1758 |
20
|
luDao.delete(CluCluRelation.class, cluCluRelationId); |
1759 |
|
|
1760 |
20
|
StatusInfo statusInfo = new StatusInfo(); |
1761 |
20
|
statusInfo.setSuccess(true); |
1762 |
|
|
1763 |
20
|
return statusInfo; |
1764 |
|
} |
1765 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1766 |
90
|
@Override... |
1767 |
|
public List<ValidationResultInfo> validateCluPublication( |
1768 |
|
String validationType, CluPublicationInfo cluPublicationInfo) |
1769 |
|
throws DoesNotExistException, InvalidParameterException, |
1770 |
|
MissingParameterException, OperationFailedException { |
1771 |
|
|
1772 |
90
|
checkForMissingParameter(validationType, "validationType"); |
1773 |
90
|
checkForMissingParameter(cluPublicationInfo, "cluPublicationInfo"); |
1774 |
|
|
1775 |
90
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CluPublicationInfo.class.getName()); |
1776 |
90
|
Validator defaultValidator = validatorFactory.getValidator(); |
1777 |
90
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluPublicationInfo, objStructure); |
1778 |
90
|
return validationResults; |
1779 |
|
} |
1780 |
|
|
|
|
| 84.4% |
Uncovered Elements: 5 (32) |
Complexity: 6 |
Complexity Density: 0.2 |
|
1781 |
58
|
@Override... |
1782 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1783 |
|
public CluPublicationInfo createCluPublication(String cluId, |
1784 |
|
String luPublicationType, CluPublicationInfo cluPublicationInfo) |
1785 |
|
throws AlreadyExistsException, DataValidationErrorException, |
1786 |
|
InvalidParameterException, MissingParameterException, |
1787 |
|
OperationFailedException, PermissionDeniedException { |
1788 |
58
|
checkForMissingParameter(cluId, "cluId"); |
1789 |
58
|
checkForMissingParameter(luPublicationType, "luPublicationType"); |
1790 |
58
|
checkForMissingParameter(cluPublicationInfo, "cluPublicationInfo"); |
1791 |
|
|
1792 |
|
|
1793 |
58
|
List<ValidationResultInfo> val; |
1794 |
58
|
try { |
1795 |
58
|
val = validateCluPublication("SYSTEM", cluPublicationInfo); |
1796 |
58
|
if(null != val && val.size() > 0) { |
1797 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1798 |
|
} |
1799 |
|
} catch (DoesNotExistException e) { |
1800 |
0
|
throw new OperationFailedException("Error creating clu",e); |
1801 |
|
} |
1802 |
|
|
1803 |
|
|
1804 |
58
|
CluPublication cluPub = new CluPublication(); |
1805 |
58
|
Clu clu; |
1806 |
58
|
try { |
1807 |
58
|
clu = luDao.fetch(Clu.class, cluId); |
1808 |
|
} catch (DoesNotExistException e) { |
1809 |
0
|
throw new InvalidParameterException("Clu does not exist for id:"+cluId); |
1810 |
|
} |
1811 |
|
|
1812 |
58
|
CluPublicationType type; |
1813 |
58
|
try{ |
1814 |
58
|
type = luDao.fetch(CluPublicationType.class, luPublicationType); |
1815 |
|
} catch (DoesNotExistException e) { |
1816 |
0
|
throw new InvalidParameterException("CluPublication Type does not exist for id:" + luPublicationType); |
1817 |
|
} |
1818 |
|
|
1819 |
58
|
cluPub.setClu(clu); |
1820 |
58
|
cluPub.setId(cluPublicationInfo.getId()); |
1821 |
58
|
cluPub.setEndCycle(cluPublicationInfo.getEndCycle()); |
1822 |
58
|
cluPub.setStartCycle(cluPublicationInfo.getStartCycle()); |
1823 |
58
|
cluPub.setEffectiveDate(cluPublicationInfo.getEffectiveDate()); |
1824 |
58
|
cluPub.setExpirationDate(cluPublicationInfo.getExpirationDate()); |
1825 |
58
|
cluPub.setState(cluPublicationInfo.getState()); |
1826 |
58
|
cluPub.setType(type); |
1827 |
58
|
cluPub.setAttributes(LuServiceAssembler.toGenericAttributes(CluPublicationAttribute.class, cluPublicationInfo.getAttributes(), cluPub, luDao)); |
1828 |
58
|
cluPub.setVariants(LuServiceAssembler.toCluPublicationVariants(cluPublicationInfo.getVariants(), cluPub, luDao)); |
1829 |
|
|
1830 |
58
|
luDao.create(cluPub); |
1831 |
|
|
1832 |
58
|
return LuServiceAssembler.toCluPublicationInfo(cluPub); |
1833 |
|
} |
1834 |
|
|
|
|
| 90.2% |
Uncovered Elements: 5 (51) |
Complexity: 8 |
Complexity Density: 0.18 |
|
1835 |
32
|
@Override... |
1836 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1837 |
|
public CluPublicationInfo updateCluPublication(String cluPublicationId, |
1838 |
|
CluPublicationInfo cluPublicationInfo) |
1839 |
|
throws DataValidationErrorException, DoesNotExistException, |
1840 |
|
InvalidParameterException, MissingParameterException, |
1841 |
|
OperationFailedException, PermissionDeniedException, |
1842 |
|
VersionMismatchException { |
1843 |
32
|
checkForMissingParameter(cluPublicationId, "cluPublicationId"); |
1844 |
32
|
checkForMissingParameter(cluPublicationInfo, "cluPublicationInfo"); |
1845 |
|
|
1846 |
|
|
1847 |
32
|
List<ValidationResultInfo> val; |
1848 |
32
|
try { |
1849 |
32
|
val = validateCluPublication("SYSTEM", cluPublicationInfo); |
1850 |
32
|
if(null != val && val.size() > 0) { |
1851 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1852 |
|
} |
1853 |
|
} catch (DoesNotExistException e) { |
1854 |
0
|
throw new OperationFailedException("Error creating clu",e); |
1855 |
|
} |
1856 |
|
|
1857 |
32
|
CluPublication cluPub = luDao.fetch(CluPublication.class, cluPublicationId); |
1858 |
|
|
1859 |
32
|
if (!String.valueOf(cluPub.getVersionNumber()).equals( |
1860 |
|
cluPublicationInfo.getMetaInfo().getVersionInd())) { |
1861 |
1
|
throw new VersionMismatchException( |
1862 |
|
"CluPublication to be updated is not the current version"); |
1863 |
|
} |
1864 |
|
|
1865 |
31
|
Clu clu; |
1866 |
31
|
try { |
1867 |
31
|
clu = luDao.fetch(Clu.class, cluPublicationInfo.getCluId()); |
1868 |
|
} catch (DoesNotExistException e) { |
1869 |
0
|
throw new InvalidParameterException("Clu does not exist for id:"+cluPublicationInfo.getCluId()); |
1870 |
|
} |
1871 |
|
|
1872 |
31
|
CluPublicationType type; |
1873 |
31
|
try{ |
1874 |
31
|
type = luDao.fetch(CluPublicationType.class, cluPublicationInfo.getType()); |
1875 |
|
} catch (DoesNotExistException e) { |
1876 |
0
|
throw new InvalidParameterException("CluPublication Type does not exist for id:" + cluPublicationInfo.getType()); |
1877 |
|
} |
1878 |
|
|
1879 |
|
|
1880 |
|
|
1881 |
|
|
1882 |
31
|
Map<String, CluPublicationVariant> oldVariantMap = new HashMap<String, CluPublicationVariant>(); |
1883 |
31
|
for (CluPublicationVariant variant : cluPub.getVariants()) { |
1884 |
21
|
oldVariantMap.put(variant.getKey(), variant); |
1885 |
|
} |
1886 |
31
|
cluPub.getVariants().clear(); |
1887 |
|
|
1888 |
|
|
1889 |
|
|
1890 |
31
|
CluPublicationVariant variant = null; |
1891 |
31
|
for (FieldInfo fieldInfo : cluPublicationInfo.getVariants()) { |
1892 |
21
|
if (!oldVariantMap.containsKey(fieldInfo.getId())) { |
1893 |
|
|
1894 |
2
|
variant = new CluPublicationVariant(); |
1895 |
2
|
variant.setKey(fieldInfo.getId()); |
1896 |
2
|
variant.setValue(fieldInfo.getValue()); |
1897 |
|
} else { |
1898 |
|
|
1899 |
19
|
variant = oldVariantMap.get(fieldInfo.getId()); |
1900 |
19
|
variant.setValue(fieldInfo.getValue()); |
1901 |
19
|
oldVariantMap.remove(fieldInfo.getId()); |
1902 |
|
} |
1903 |
|
|
1904 |
21
|
cluPub.getVariants().add(variant); |
1905 |
|
} |
1906 |
|
|
1907 |
|
|
1908 |
31
|
for (Entry<String, CluPublicationVariant> entry : oldVariantMap.entrySet()) { |
1909 |
2
|
luDao.delete(entry.getValue()); |
1910 |
|
} |
1911 |
|
|
1912 |
31
|
cluPub.setClu(clu); |
1913 |
31
|
cluPub.setEndCycle(cluPublicationInfo.getEndCycle()); |
1914 |
31
|
cluPub.setStartCycle(cluPublicationInfo.getStartCycle()); |
1915 |
31
|
cluPub.setEffectiveDate(cluPublicationInfo.getEffectiveDate()); |
1916 |
31
|
cluPub.setExpirationDate(cluPublicationInfo.getExpirationDate()); |
1917 |
31
|
cluPub.setState(cluPublicationInfo.getState()); |
1918 |
31
|
cluPub.setType(type); |
1919 |
31
|
cluPub.setAttributes(LuServiceAssembler.toGenericAttributes(CluPublicationAttribute.class, cluPublicationInfo.getAttributes(), cluPub, luDao)); |
1920 |
|
|
1921 |
31
|
CluPublication updated = luDao.update(cluPub); |
1922 |
|
|
1923 |
31
|
return LuServiceAssembler.toCluPublicationInfo(updated); |
1924 |
|
} |
1925 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1926 |
0
|
@Override... |
1927 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1928 |
|
public StatusInfo deleteCluPublication(String cluPublicationId) |
1929 |
|
throws DoesNotExistException, InvalidParameterException, |
1930 |
|
MissingParameterException, DependentObjectsExistException, |
1931 |
|
OperationFailedException, PermissionDeniedException { |
1932 |
0
|
checkForMissingParameter(cluPublicationId, "cluPublicationId"); |
1933 |
|
|
1934 |
0
|
luDao.delete(CluPublication.class, cluPublicationId); |
1935 |
|
|
1936 |
0
|
StatusInfo statusInfo = new StatusInfo(); |
1937 |
0
|
statusInfo.setSuccess(true); |
1938 |
|
|
1939 |
0
|
return statusInfo; } |
1940 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1941 |
110
|
@Override... |
1942 |
|
public List<ValidationResultInfo> validateCluResult(String validationType, |
1943 |
|
CluResultInfo cluResultInfo) throws DoesNotExistException, |
1944 |
|
InvalidParameterException, MissingParameterException, |
1945 |
|
OperationFailedException { |
1946 |
110
|
checkForMissingParameter(validationType, "validationType"); |
1947 |
110
|
checkForMissingParameter(cluResultInfo, "cluResultInfo"); |
1948 |
|
|
1949 |
110
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CluResultInfo.class.getName()); |
1950 |
110
|
Validator defaultValidator = validatorFactory.getValidator(); |
1951 |
110
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluResultInfo, objStructure); |
1952 |
110
|
return validationResults; |
1953 |
|
} |
1954 |
|
|
|
|
| 84.4% |
Uncovered Elements: 5 (32) |
Complexity: 4 |
Complexity Density: 0.14 |
|
1955 |
89
|
@Override... |
1956 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
1957 |
|
public CluResultInfo createCluResult(String cluId, String cluResultTypeKey, |
1958 |
|
CluResultInfo cluResultInfo) throws AlreadyExistsException, |
1959 |
|
DataValidationErrorException, InvalidParameterException, |
1960 |
|
MissingParameterException, OperationFailedException, |
1961 |
|
PermissionDeniedException, DoesNotExistException { |
1962 |
|
|
1963 |
89
|
checkForMissingParameter(cluId, "cluId"); |
1964 |
89
|
checkForMissingParameter(cluResultTypeKey, "cluResultTypeKey"); |
1965 |
89
|
checkForMissingParameter(cluResultInfo, "cluResultInfo"); |
1966 |
|
|
1967 |
|
|
1968 |
89
|
List<ValidationResultInfo> val = validateCluResult("SYSTEM", cluResultInfo); |
1969 |
89
|
if(null != val && val.size() > 0) { |
1970 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
1971 |
|
} |
1972 |
|
|
1973 |
89
|
cluResultInfo.setType(cluResultTypeKey); |
1974 |
89
|
cluResultInfo.setCluId(cluId); |
1975 |
|
|
1976 |
89
|
List<ResultOption> resOptList = new ArrayList<ResultOption>(); |
1977 |
89
|
for (ResultOptionInfo resOptInfo : cluResultInfo.getResultOptions()) { |
1978 |
125
|
ResultOption resOpt = new ResultOption(); |
1979 |
125
|
BeanUtils.copyProperties(resOptInfo, resOpt, new String[] { "id", |
1980 |
|
"metaInfo", "resultUsageType", "desc" }); |
1981 |
|
|
1982 |
125
|
if(resOptInfo.getResultUsageTypeKey() != null) { |
1983 |
0
|
ResultUsageType resUsageType = luDao.fetch(ResultUsageType.class, |
1984 |
|
resOptInfo.getResultUsageTypeKey()); |
1985 |
0
|
resOpt.setResultUsageType(resUsageType); |
1986 |
|
} |
1987 |
125
|
resOpt.setDesc(LuServiceAssembler.toRichText(LuRichText.class, resOptInfo.getDesc())); |
1988 |
125
|
luDao.create(resOpt); |
1989 |
125
|
resOptList.add(resOpt); |
1990 |
|
} |
1991 |
|
|
1992 |
89
|
CluResult cluResult = new CluResult(); |
1993 |
89
|
BeanUtils.copyProperties(cluResultInfo, cluResult, new String[] { "id", |
1994 |
|
"desc", "resultOptions", "metaInfo" }); |
1995 |
|
|
1996 |
89
|
cluResult.setDesc(LuServiceAssembler |
1997 |
|
.toRichText(LuRichText.class, cluResultInfo.getDesc())); |
1998 |
89
|
cluResult.setResultOptions(resOptList); |
1999 |
|
|
2000 |
89
|
Clu clu = luDao.fetch(Clu.class, cluId); |
2001 |
89
|
cluResult.setClu(clu); |
2002 |
|
|
2003 |
89
|
CluResultType type = luDao.fetch(CluResultType.class, cluResultTypeKey); |
2004 |
89
|
cluResult.setCluResultType(type); |
2005 |
|
|
2006 |
89
|
luDao.create(cluResult); |
2007 |
|
|
2008 |
89
|
return LuServiceAssembler.toCluResultInfo(cluResult); |
2009 |
|
} |
2010 |
|
|
|
|
| 90% |
Uncovered Elements: 4 (40) |
Complexity: 7 |
Complexity Density: 0.22 |
|
2011 |
21
|
@Override... |
2012 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2013 |
|
public CluResultInfo updateCluResult(String cluResultId, |
2014 |
|
CluResultInfo cluResultInfo) throws DataValidationErrorException, |
2015 |
|
DoesNotExistException, InvalidParameterException, |
2016 |
|
MissingParameterException, OperationFailedException, |
2017 |
|
PermissionDeniedException, VersionMismatchException { |
2018 |
|
|
2019 |
21
|
checkForMissingParameter(cluResultId, "cluResultId"); |
2020 |
21
|
checkForMissingParameter(cluResultInfo, "cluResultInfo"); |
2021 |
|
|
2022 |
|
|
2023 |
21
|
List<ValidationResultInfo> val = validateCluResult("SYSTEM", cluResultInfo); |
2024 |
21
|
if(null != val && val.size() > 0) { |
2025 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2026 |
|
} |
2027 |
|
|
2028 |
21
|
CluResult result = luDao.fetch(CluResult.class, cluResultId); |
2029 |
21
|
if (!String.valueOf(result.getVersionNumber()).equals( |
2030 |
|
cluResultInfo.getMetaInfo().getVersionInd())) { |
2031 |
0
|
throw new VersionMismatchException( |
2032 |
|
"CluResult to be updated is not the current version"); |
2033 |
|
} |
2034 |
|
|
2035 |
|
|
2036 |
|
|
2037 |
|
|
2038 |
21
|
Map<String, ResultOption> oldResultOptionMap = new HashMap<String, ResultOption>(); |
2039 |
21
|
for (ResultOption opt : result.getResultOptions()) { |
2040 |
28
|
oldResultOptionMap.put(opt.getId(), opt); |
2041 |
|
} |
2042 |
21
|
result.getResultOptions().clear(); |
2043 |
|
|
2044 |
|
|
2045 |
|
|
2046 |
21
|
for (ResultOptionInfo resOptInfo : cluResultInfo.getResultOptions()) { |
2047 |
27
|
ResultOption opt = oldResultOptionMap.remove(resOptInfo.getId()); |
2048 |
27
|
if (opt == null) { |
2049 |
|
|
2050 |
1
|
opt = new ResultOption(); |
2051 |
|
|
2052 |
1
|
BeanUtils.copyProperties(resOptInfo, opt, new String[] { |
2053 |
|
"resultUsageType", "desc" }); |
2054 |
|
} else { |
2055 |
|
|
2056 |
26
|
opt = luDao.fetch(ResultOption.class, resOptInfo.getId()); |
2057 |
|
|
2058 |
26
|
BeanUtils.copyProperties(resOptInfo, opt, new String[] { |
2059 |
|
"id", "resultUsageType", "desc" }); |
2060 |
|
} |
2061 |
27
|
if(resOptInfo.getResultUsageTypeKey() != null && !resOptInfo.getResultUsageTypeKey().isEmpty()) { |
2062 |
1
|
ResultUsageType resUsageType = luDao.fetch(ResultUsageType.class, |
2063 |
|
resOptInfo.getResultUsageTypeKey()); |
2064 |
1
|
opt.setResultUsageType(resUsageType); |
2065 |
|
} |
2066 |
27
|
opt.setDesc(LuServiceAssembler.toRichText(LuRichText.class, resOptInfo.getDesc())); |
2067 |
27
|
result.getResultOptions().add(opt); |
2068 |
|
} |
2069 |
|
|
2070 |
|
|
2071 |
21
|
for (Entry<String, ResultOption> entry : oldResultOptionMap.entrySet()) { |
2072 |
2
|
luDao.delete(entry.getValue()); |
2073 |
|
} |
2074 |
|
|
2075 |
21
|
BeanUtils.copyProperties(cluResultInfo, result, new String[] { "id", |
2076 |
|
"desc", "resultOptions" }); |
2077 |
|
|
2078 |
21
|
result.setDesc(LuServiceAssembler.toRichText(LuRichText.class, cluResultInfo.getDesc())); |
2079 |
21
|
CluResultType type = luDao.fetch(CluResultType.class, cluResultInfo.getType()); |
2080 |
21
|
result.setCluResultType(type); |
2081 |
|
|
2082 |
21
|
CluResult updated = luDao.update(result); |
2083 |
|
|
2084 |
21
|
return LuServiceAssembler.toCluResultInfo(updated); |
2085 |
|
} |
2086 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
2087 |
4
|
@Override... |
2088 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2089 |
|
public StatusInfo deleteCluResult(String cluResultId) |
2090 |
|
throws DoesNotExistException, InvalidParameterException, |
2091 |
|
MissingParameterException, DependentObjectsExistException, |
2092 |
|
OperationFailedException, PermissionDeniedException { |
2093 |
|
|
2094 |
4
|
checkForMissingParameter(cluResultId, "cluResultId"); |
2095 |
|
|
2096 |
4
|
luDao.delete(CluResult.class, cluResultId); |
2097 |
|
|
2098 |
4
|
StatusInfo statusInfo = new StatusInfo(); |
2099 |
4
|
statusInfo.setSuccess(true); |
2100 |
|
|
2101 |
4
|
return statusInfo; |
2102 |
|
} |
2103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
2104 |
104
|
@Override... |
2105 |
|
public List<ValidationResultInfo> validateCluLoRelation( |
2106 |
|
String validationType, CluLoRelationInfo cluLoRelationInfo) |
2107 |
|
throws DoesNotExistException, InvalidParameterException, |
2108 |
|
MissingParameterException, OperationFailedException { |
2109 |
|
|
2110 |
104
|
checkForMissingParameter(validationType, "validationType"); |
2111 |
104
|
checkForMissingParameter(cluLoRelationInfo, "cluLoRelationInfo"); |
2112 |
|
|
2113 |
104
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CluLoRelation.class.getName()); |
2114 |
104
|
Validator defaultValidator = validatorFactory.getValidator(); |
2115 |
104
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluLoRelationInfo, objStructure); |
2116 |
104
|
return validationResults; |
2117 |
|
} |
2118 |
|
|
|
|
| 80.6% |
Uncovered Elements: 6 (31) |
Complexity: 6 |
Complexity Density: 0.26 |
|
2119 |
103
|
@Override... |
2120 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2121 |
|
public CluLoRelationInfo createCluLoRelation(String cluId, String loId, |
2122 |
|
String cluLoRelationType, CluLoRelationInfo cluLoRelationInfo) |
2123 |
|
throws AlreadyExistsException, DoesNotExistException, |
2124 |
|
InvalidParameterException, MissingParameterException, |
2125 |
|
OperationFailedException, PermissionDeniedException, DataValidationErrorException { |
2126 |
103
|
checkForMissingParameter(loId, "loId"); |
2127 |
103
|
checkForMissingParameter(cluId, "cluId"); |
2128 |
103
|
checkForEmptyList(cluLoRelationType, "cluLoRelationType"); |
2129 |
103
|
checkForEmptyList(cluLoRelationInfo, "cluLoRelationInfo"); |
2130 |
|
|
2131 |
|
|
2132 |
103
|
List<ValidationResultInfo> val = validateCluLoRelation("SYSTEM", cluLoRelationInfo); |
2133 |
103
|
if(null != val && val.size() > 0) { |
2134 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2135 |
|
} |
2136 |
|
|
2137 |
103
|
Clu clu = luDao.fetch(Clu.class, cluId); |
2138 |
102
|
if (clu == null) { |
2139 |
0
|
throw new DoesNotExistException("Clu does not exist for id: " |
2140 |
|
+ cluId); |
2141 |
|
} |
2142 |
|
|
2143 |
102
|
CluLoRelationType cluLoRelationTypeEntity = luDao.fetch(CluLoRelationType.class, cluLoRelationType); |
2144 |
102
|
if (cluLoRelationTypeEntity == null) { |
2145 |
0
|
throw new DoesNotExistException("CluLoRelationType does not exist for id: " |
2146 |
|
+ cluLoRelationType); |
2147 |
|
} |
2148 |
|
|
2149 |
|
|
2150 |
102
|
List<CluLoRelation> reltns = luDao.getCluLoRelationsByCludIdAndLoId( |
2151 |
|
cluId, loId); |
2152 |
102
|
if (reltns.size() > 0) { |
2153 |
1
|
throw new AlreadyExistsException( |
2154 |
|
"Relation already exists for cluId:" + cluId + " and Lo:" |
2155 |
|
+ loId); |
2156 |
|
} |
2157 |
|
|
2158 |
101
|
CluLoRelation cluLoRelation = new CluLoRelation(); |
2159 |
101
|
BeanUtils.copyProperties(cluLoRelationInfo, cluLoRelation, |
2160 |
|
new String[] { "cluId", "attributes", "metaInfo", "type" }); |
2161 |
|
|
2162 |
101
|
cluLoRelation.setClu(clu); |
2163 |
101
|
cluLoRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
2164 |
|
CluLoRelationAttribute.class, |
2165 |
|
cluLoRelationInfo.getAttributes(), cluLoRelation, luDao)); |
2166 |
101
|
cluLoRelation.setType(cluLoRelationTypeEntity); |
2167 |
|
|
2168 |
101
|
luDao.create(cluLoRelation); |
2169 |
|
|
2170 |
101
|
return LuServiceAssembler.toCluLoRelationInfo(cluLoRelation); |
2171 |
|
} |
2172 |
|
|
|
|
| 71.4% |
Uncovered Elements: 8 (28) |
Complexity: 6 |
Complexity Density: 0.3 |
|
2173 |
1
|
@Override... |
2174 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2175 |
|
public CluLoRelationInfo updateCluLoRelation(String cluLoRelationId, |
2176 |
|
CluLoRelationInfo cluLoRelationInfo) |
2177 |
|
throws DataValidationErrorException, DoesNotExistException, |
2178 |
|
InvalidParameterException, MissingParameterException, |
2179 |
|
OperationFailedException, PermissionDeniedException, |
2180 |
|
VersionMismatchException { |
2181 |
1
|
checkForMissingParameter(cluLoRelationId, "cluLoRelationId"); |
2182 |
1
|
checkForMissingParameter(cluLoRelationInfo, "cluLoRelationInfo"); |
2183 |
|
|
2184 |
|
|
2185 |
1
|
List<ValidationResultInfo> val = validateCluLoRelation("SYSTEM", cluLoRelationInfo); |
2186 |
1
|
if(null != val && val.size() > 0) { |
2187 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2188 |
|
} |
2189 |
|
|
2190 |
1
|
CluLoRelation reltn = luDao.fetch(CluLoRelation.class, cluLoRelationId); |
2191 |
|
|
2192 |
1
|
if (!String.valueOf(reltn.getVersionNumber()).equals( |
2193 |
|
cluLoRelationInfo.getMetaInfo().getVersionInd())) { |
2194 |
0
|
throw new VersionMismatchException( |
2195 |
|
"CluLoRelation to be updated is not the current version"); |
2196 |
|
} |
2197 |
|
|
2198 |
1
|
Clu clu = luDao.fetch(Clu.class, cluLoRelationInfo.getCluId()); |
2199 |
1
|
if (clu == null) { |
2200 |
0
|
throw new DoesNotExistException("Clu does not exist for id: " |
2201 |
|
+ cluLoRelationInfo.getCluId()); |
2202 |
|
} |
2203 |
|
|
2204 |
1
|
CluLoRelationType cluLoRelationTypeEntity = luDao.fetch(CluLoRelationType.class, cluLoRelationInfo.getType()); |
2205 |
1
|
if (cluLoRelationTypeEntity == null) { |
2206 |
0
|
throw new DoesNotExistException("CluLoRelationType does not exist for id: " |
2207 |
|
+ cluLoRelationInfo.getType()); |
2208 |
|
} |
2209 |
|
|
2210 |
1
|
BeanUtils.copyProperties(cluLoRelationInfo, reltn, new String[] { |
2211 |
|
"cluId", "attributes", "metaInfo", "type"}); |
2212 |
|
|
2213 |
1
|
reltn.setClu(clu); |
2214 |
1
|
reltn.setAttributes(LuServiceAssembler.toGenericAttributes( |
2215 |
|
CluLoRelationAttribute.class, |
2216 |
|
cluLoRelationInfo.getAttributes(), reltn, luDao)); |
2217 |
1
|
reltn.setType(cluLoRelationTypeEntity); |
2218 |
1
|
CluLoRelation updated = luDao.update(reltn); |
2219 |
|
|
2220 |
1
|
return LuServiceAssembler.toCluLoRelationInfo(updated); |
2221 |
|
} |
2222 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
2223 |
7
|
@Override... |
2224 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2225 |
|
public StatusInfo deleteCluLoRelation(String cluLoRelationId) |
2226 |
|
throws DoesNotExistException, InvalidParameterException, |
2227 |
|
MissingParameterException, OperationFailedException, |
2228 |
|
PermissionDeniedException { |
2229 |
7
|
checkForMissingParameter(cluLoRelationId, "cluLoRelationId"); |
2230 |
|
|
2231 |
7
|
CluLoRelation reltn = luDao.fetch(CluLoRelation.class, cluLoRelationId); |
2232 |
7
|
if (reltn == null) { |
2233 |
0
|
throw new DoesNotExistException( |
2234 |
|
"CluLoRelation does not exist for id: " + cluLoRelationId); |
2235 |
|
} |
2236 |
|
|
2237 |
7
|
luDao.delete(CluLoRelation.class, cluLoRelationId); |
2238 |
|
|
2239 |
7
|
StatusInfo statusInfo = new StatusInfo(); |
2240 |
7
|
statusInfo.setSuccess(true); |
2241 |
|
|
2242 |
7
|
return statusInfo; |
2243 |
|
} |
2244 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2245 |
0
|
@Override... |
2246 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2247 |
|
public StatusInfo addCluResourceRequirement(String resourceTypeKey, |
2248 |
|
String cluId) throws AlreadyExistsException, DoesNotExistException, |
2249 |
|
InvalidParameterException, MissingParameterException, |
2250 |
|
OperationFailedException, PermissionDeniedException { |
2251 |
0
|
throw new UnsupportedOperationException("Method not yet implemented!"); |
2252 |
|
} |
2253 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2254 |
0
|
@Override... |
2255 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2256 |
|
public StatusInfo removeCluResourceRequirement(String resourceTypeKey, |
2257 |
|
String cluId) throws DoesNotExistException, |
2258 |
|
InvalidParameterException, MissingParameterException, |
2259 |
|
OperationFailedException, PermissionDeniedException { |
2260 |
|
|
2261 |
0
|
return null; |
2262 |
|
} |
2263 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
2264 |
46
|
@Override... |
2265 |
|
public List<ValidationResultInfo> validateCluSet(String validationType, |
2266 |
|
CluSetInfo cluSetInfo) throws DoesNotExistException, |
2267 |
|
InvalidParameterException, MissingParameterException, |
2268 |
|
OperationFailedException { |
2269 |
46
|
checkForMissingParameter(validationType, "validationType"); |
2270 |
46
|
checkForMissingParameter(cluSetInfo, "cluSetInfo"); |
2271 |
|
|
2272 |
46
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CluSetInfo.class.getName()); |
2273 |
46
|
Validator defaultValidator = validatorFactory.getValidator(); |
2274 |
46
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluSetInfo, objStructure); |
2275 |
46
|
return validationResults; |
2276 |
|
} |
2277 |
|
|
|
|
| 83.3% |
Uncovered Elements: 4 (24) |
Complexity: 6 |
Complexity Density: 0.3 |
|
2278 |
39
|
@Override... |
2279 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2280 |
|
public CluSetInfo createCluSet(String cluSetType, CluSetInfo cluSetInfo) |
2281 |
|
throws AlreadyExistsException, DataValidationErrorException, |
2282 |
|
InvalidParameterException, MissingParameterException, |
2283 |
|
OperationFailedException, PermissionDeniedException, |
2284 |
|
UnsupportedActionException { |
2285 |
|
|
2286 |
39
|
checkForMissingParameter(cluSetType, "cluSetType"); |
2287 |
39
|
checkForMissingParameter(cluSetInfo, "cluSetInfo"); |
2288 |
|
|
2289 |
39
|
cluSetInfo.setType(cluSetType); |
2290 |
|
|
2291 |
39
|
validateCluSet(cluSetInfo); |
2292 |
|
|
2293 |
|
|
2294 |
36
|
List<ValidationResultInfo> val; |
2295 |
36
|
try { |
2296 |
36
|
val = validateCluSet("SYSTEM", cluSetInfo); |
2297 |
|
} catch (DoesNotExistException e) { |
2298 |
0
|
throw new DataValidationErrorException("Validation error! " + e.getMessage()); |
2299 |
|
} |
2300 |
36
|
if(null != val && val.size() > 0) { |
2301 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2302 |
|
} |
2303 |
|
|
2304 |
36
|
List<String> cluIdList = getMembershipQuerySearchResult(cluSetInfo.getMembershipQuery()); |
2305 |
|
|
2306 |
36
|
CluSet cluSet = null; |
2307 |
36
|
try { |
2308 |
36
|
cluSet = LuServiceAssembler.toCluSetEntity(cluSetInfo, this.luDao); |
2309 |
|
} catch (DoesNotExistException e) { |
2310 |
0
|
throw new DataValidationErrorException("Creating CluSet entity failed. Clu or CluSet does not exist: " + e.getMessage()); |
2311 |
|
} |
2312 |
|
|
2313 |
36
|
cluSet = luDao.create(cluSet); |
2314 |
|
|
2315 |
36
|
CluSetInfo newCluSetInfo = LuServiceAssembler.toCluSetInfo(cluSet); |
2316 |
|
|
2317 |
36
|
if(cluIdList != null) { |
2318 |
6
|
newCluSetInfo.getCluIds().addAll(cluIdList); |
2319 |
|
} |
2320 |
|
|
2321 |
36
|
return newCluSetInfo; |
2322 |
|
} |
2323 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
2324 |
122
|
private void setMembershipQuerySearchResult(CluSetInfo cluSetInfo) throws MissingParameterException {... |
2325 |
122
|
if(cluSetInfo.getMembershipQuery() == null) { |
2326 |
117
|
return; |
2327 |
|
} |
2328 |
5
|
List<String> cluIds = getMembershipQuerySearchResult(cluSetInfo.getMembershipQuery()); |
2329 |
5
|
cluSetInfo.getCluIds().addAll(cluIds); |
2330 |
|
} |
2331 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 5 |
Complexity Density: 0.36 |
|
2332 |
51
|
private List<String> getMembershipQuerySearchResult(MembershipQueryInfo query) throws MissingParameterException {... |
2333 |
51
|
if(query == null) { |
2334 |
39
|
return null; |
2335 |
|
} |
2336 |
12
|
SearchRequest sr = new SearchRequest(); |
2337 |
12
|
sr.setSearchKey(query.getSearchTypeKey()); |
2338 |
12
|
sr.setParams(query.getQueryParamValueList()); |
2339 |
|
|
2340 |
12
|
SearchResult result = search(sr); |
2341 |
|
|
2342 |
12
|
Set<String> cluIds = new HashSet<String>(); |
2343 |
12
|
List<SearchResultRow> rows = result.getRows(); |
2344 |
12
|
for(SearchResultRow row : rows) { |
2345 |
827
|
List<SearchResultCell> cells = row.getCells(); |
2346 |
827
|
for(SearchResultCell cell : cells) { |
2347 |
2481
|
if((cell.getKey().equals("lu.resultColumn.luOptionalVersionIndId") || cell.getKey().equals("lo.resultColumn.loLuOptionalVersionIndId")) |
2348 |
|
&& (cell.getValue() != null)) { |
2349 |
799
|
cluIds.add(cell.getValue()); |
2350 |
|
} |
2351 |
|
} |
2352 |
|
} |
2353 |
12
|
return new ArrayList<String>(cluIds); |
2354 |
|
} |
2355 |
|
|
|
|
| 84.6% |
Uncovered Elements: 2 (13) |
Complexity: 9 |
Complexity Density: 1.29 |
|
2356 |
49
|
private void validateCluSet(CluSetInfo cluSetInfo) throws UnsupportedActionException {... |
2357 |
49
|
MembershipQueryInfo mqInfo = cluSetInfo.getMembershipQuery(); |
2358 |
|
|
2359 |
49
|
if (cluSetInfo.getType() == null) { |
2360 |
0
|
throw new UnsupportedActionException("CluSet type cannot be null. CluSet id="+cluSetInfo.getId()); |
2361 |
|
} |
2362 |
49
|
else if(mqInfo != null && mqInfo.getSearchTypeKey() != null && !mqInfo.getSearchTypeKey().isEmpty() && |
2363 |
|
(cluSetInfo.getCluIds().size() > 0 || cluSetInfo.getCluSetIds().size() > 0)) { |
2364 |
2
|
throw new UnsupportedActionException("Dynamic CluSet cannot contain Clus and/or CluSets. CluSet id="+cluSetInfo.getId()); |
2365 |
|
} |
2366 |
47
|
else if (cluSetInfo.getCluIds().size() > 0 && cluSetInfo.getCluSetIds().size() > 0) { |
2367 |
1
|
throw new UnsupportedActionException("CluSet cannot contain both Clus and CluSets. CluSet id="+cluSetInfo.getId()); |
2368 |
|
} |
2369 |
|
} |
2370 |
|
|
|
|
| 80% |
Uncovered Elements: 17 (85) |
Complexity: 17 |
Complexity Density: 0.3 |
|
2371 |
10
|
@Override... |
2372 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2373 |
|
public CluSetInfo updateCluSet(String cluSetId, CluSetInfo cluSetInfo) |
2374 |
|
throws DataValidationErrorException, DoesNotExistException, |
2375 |
|
InvalidParameterException, MissingParameterException, |
2376 |
|
OperationFailedException, PermissionDeniedException, |
2377 |
|
VersionMismatchException, CircularRelationshipException, |
2378 |
|
UnsupportedActionException { |
2379 |
|
|
2380 |
|
|
2381 |
10
|
checkForMissingParameter(cluSetId, "cluSetId"); |
2382 |
10
|
checkForMissingParameter(cluSetInfo, "cluSetInfo"); |
2383 |
|
|
2384 |
|
|
2385 |
10
|
List<ValidationResultInfo> val = validateCluSet("SYSTEM", cluSetInfo); |
2386 |
10
|
if(null != val && val.size() > 0) { |
2387 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2388 |
|
} |
2389 |
|
|
2390 |
10
|
cluSetInfo.setId(cluSetId); |
2391 |
|
|
2392 |
10
|
validateCluSet(cluSetInfo); |
2393 |
|
|
2394 |
10
|
List<String> cluIdList = getMembershipQuerySearchResult(cluSetInfo.getMembershipQuery()); |
2395 |
|
|
2396 |
10
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
2397 |
|
|
2398 |
10
|
if (!cluSetInfo.getType().equals(cluSet.getType())) { |
2399 |
0
|
throw new UnsupportedActionException("CluSet type is set at creation time and cannot be updated. CluSet id="+cluSetId); |
2400 |
|
} |
2401 |
|
|
2402 |
10
|
if (!String.valueOf(cluSet.getVersionNumber()).equals( |
2403 |
|
cluSetInfo.getMetaInfo().getVersionInd())) { |
2404 |
1
|
throw new VersionMismatchException( |
2405 |
|
"CluSet (id=" + cluSetId + |
2406 |
|
") to be updated is not the current version " + |
2407 |
|
"(version=" + cluSetInfo.getMetaInfo().getVersionInd() + |
2408 |
|
"), current version="+cluSet.getVersionNumber()); |
2409 |
|
} |
2410 |
|
|
2411 |
|
|
2412 |
9
|
Map<String, CluSetJoinVersionIndClu> oldClus = new HashMap<String, CluSetJoinVersionIndClu>(); |
2413 |
9
|
for(CluSetJoinVersionIndClu join:cluSet.getCluVerIndIds()){ |
2414 |
8
|
oldClus.put(join.getCluVersionIndId(), join); |
2415 |
|
} |
2416 |
|
|
2417 |
9
|
cluSet.getCluVerIndIds().clear(); |
2418 |
|
|
2419 |
9
|
for (String newCluId : cluSetInfo.getCluIds()) { |
2420 |
6
|
CluSetJoinVersionIndClu join = oldClus.remove(newCluId); |
2421 |
6
|
if (join == null) { |
2422 |
2
|
join = new CluSetJoinVersionIndClu(); |
2423 |
2
|
join.setCluSet(cluSet); |
2424 |
2
|
join.setCluVersionIndId(newCluId); |
2425 |
|
} |
2426 |
6
|
cluSet.getCluVerIndIds().add(join); |
2427 |
|
} |
2428 |
|
|
2429 |
|
|
2430 |
9
|
for (Entry<String, CluSetJoinVersionIndClu> entry : oldClus.entrySet()) { |
2431 |
4
|
luDao.delete(entry.getValue()); |
2432 |
|
} |
2433 |
|
|
2434 |
|
|
2435 |
9
|
if (cluSetInfo.getId() != null) { |
2436 |
9
|
CluSetInfo originalCluSet = getCluSetInfo(cluSetInfo.getId()); |
2437 |
9
|
List<CluSetInfo> origSubCSs = null; |
2438 |
9
|
List<String> origSubCSIds = originalCluSet.getCluSetIds(); |
2439 |
9
|
if (origSubCSIds != null && !origSubCSIds.isEmpty()) { |
2440 |
2
|
origSubCSs = getCluSetInfoByIdList(origSubCSIds); |
2441 |
|
} |
2442 |
9
|
if (origSubCSs != null) { |
2443 |
2
|
for (CluSetInfo origSubCS : origSubCSs) { |
2444 |
6
|
if (!origSubCS.getIsReusable()) { |
2445 |
0
|
deleteCluSet(origSubCS.getId()); |
2446 |
|
} |
2447 |
|
} |
2448 |
|
} |
2449 |
|
} |
2450 |
|
|
2451 |
|
|
2452 |
9
|
if(cluSet.getCluSets()==null){ |
2453 |
0
|
cluSet.setCluSets(new ArrayList<CluSet>()); |
2454 |
|
} |
2455 |
9
|
cluSet.setCluSets(null); |
2456 |
9
|
if(!cluSetInfo.getCluSetIds().isEmpty()) { |
2457 |
3
|
Set<String> newCluSetIds = new HashSet<String>(cluSetInfo.getCluSetIds()); |
2458 |
3
|
if(cluSet.getCluSets()!=null){ |
2459 |
0
|
for (Iterator<CluSet> i = cluSet.getCluSets().iterator(); i.hasNext();) { |
2460 |
0
|
if (!newCluSetIds.remove(i.next().getId())) { |
2461 |
0
|
i.remove(); |
2462 |
|
} |
2463 |
|
} |
2464 |
|
} |
2465 |
3
|
List<CluSet> cluSetList = luDao.getCluSetInfoByIdList(new ArrayList<String>(newCluSetIds)); |
2466 |
3
|
cluSet.setCluSets(cluSetList); |
2467 |
|
} |
2468 |
|
|
2469 |
9
|
BeanUtils.copyProperties(cluSetInfo, cluSet, new String[] { "descr", |
2470 |
|
"attributes", "metaInfo", "membershipQuery" }); |
2471 |
9
|
cluSet.setAttributes(LuServiceAssembler.toGenericAttributes( |
2472 |
|
CluSetAttribute.class, cluSetInfo.getAttributes(), cluSet, luDao)); |
2473 |
9
|
cluSet.setDescr(LuServiceAssembler.toRichText(LuRichText.class, cluSetInfo.getDescr())); |
2474 |
|
|
2475 |
9
|
MembershipQuery mq = LuServiceAssembler.toMembershipQueryEntity(cluSetInfo.getMembershipQuery()); |
2476 |
9
|
cluSet.setMembershipQuery(mq); |
2477 |
|
|
2478 |
9
|
CluSet updated = luDao.update(cluSet); |
2479 |
|
|
2480 |
9
|
CluSetInfo updatedCluSetInfo = LuServiceAssembler.toCluSetInfo(updated); |
2481 |
|
|
2482 |
9
|
if(cluIdList != null) { |
2483 |
1
|
updatedCluSetInfo.getCluIds().addAll(cluIdList); |
2484 |
|
} |
2485 |
|
|
2486 |
9
|
return updatedCluSetInfo; |
2487 |
|
} |
2488 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
2489 |
1
|
@Override... |
2490 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2491 |
|
public StatusInfo deleteCluSet(String cluSetId) |
2492 |
|
throws DoesNotExistException, InvalidParameterException, |
2493 |
|
MissingParameterException, OperationFailedException, |
2494 |
|
PermissionDeniedException { |
2495 |
|
|
2496 |
1
|
checkForMissingParameter(cluSetId, "cluSetId"); |
2497 |
|
|
2498 |
1
|
luDao.delete(CluSet.class, cluSetId); |
2499 |
|
|
2500 |
1
|
StatusInfo statusInfo = new StatusInfo(); |
2501 |
1
|
statusInfo.setSuccess(true); |
2502 |
|
|
2503 |
1
|
return statusInfo; |
2504 |
|
} |
2505 |
|
|
|
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
|
2506 |
27
|
@Override... |
2507 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2508 |
|
public StatusInfo addCluSetToCluSet(String cluSetId, String addedCluSetId) |
2509 |
|
throws DoesNotExistException, InvalidParameterException, |
2510 |
|
MissingParameterException, OperationFailedException, |
2511 |
|
PermissionDeniedException, UnsupportedActionException, |
2512 |
|
CircularRelationshipException { |
2513 |
27
|
checkForMissingParameter(cluSetId, "cluSetId"); |
2514 |
27
|
checkForMissingParameter(addedCluSetId, "addedCluSetId"); |
2515 |
|
|
2516 |
27
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
2517 |
|
|
2518 |
27
|
checkCluSetAlreadyAdded(cluSet, addedCluSetId); |
2519 |
|
|
2520 |
25
|
CluSet addedCluSet = luDao.fetch(CluSet.class, addedCluSetId); |
2521 |
|
|
2522 |
23
|
checkCluSetCircularReference(addedCluSet, cluSetId); |
2523 |
|
|
2524 |
19
|
if(cluSet.getCluSets()==null){ |
2525 |
0
|
cluSet.setCluSets(new ArrayList<CluSet>()); |
2526 |
|
} |
2527 |
19
|
cluSet.getCluSets().add(addedCluSet); |
2528 |
|
|
2529 |
19
|
luDao.update(cluSet); |
2530 |
|
|
2531 |
19
|
StatusInfo statusInfo = new StatusInfo(); |
2532 |
19
|
statusInfo.setSuccess(true); |
2533 |
|
|
2534 |
19
|
return statusInfo; |
2535 |
|
} |
2536 |
|
|
|
|
| 72.7% |
Uncovered Elements: 6 (22) |
Complexity: 4 |
Complexity Density: 0.25 |
|
2537 |
1
|
@Override... |
2538 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2539 |
|
public StatusInfo removeCluSetFromCluSet(String cluSetId, |
2540 |
|
String removedCluSetId) throws DoesNotExistException, |
2541 |
|
InvalidParameterException, MissingParameterException, |
2542 |
|
OperationFailedException, PermissionDeniedException, |
2543 |
|
UnsupportedActionException { |
2544 |
|
|
2545 |
1
|
checkForMissingParameter(cluSetId, "cluSetId"); |
2546 |
1
|
checkForMissingParameter(removedCluSetId, "removedCluSetId"); |
2547 |
|
|
2548 |
1
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
2549 |
1
|
if(cluSet.getCluSets()!=null){ |
2550 |
2
|
for (Iterator<CluSet> i = cluSet.getCluSets().iterator(); i.hasNext();) { |
2551 |
2
|
CluSet childCluSet = i.next(); |
2552 |
2
|
if (childCluSet.getId().equals(removedCluSetId)) { |
2553 |
1
|
i.remove(); |
2554 |
1
|
luDao.update(cluSet); |
2555 |
1
|
StatusInfo statusInfo = new StatusInfo(); |
2556 |
1
|
statusInfo.setSuccess(true); |
2557 |
|
|
2558 |
1
|
return statusInfo; |
2559 |
|
} |
2560 |
|
} |
2561 |
|
} |
2562 |
|
|
2563 |
0
|
StatusInfo statusInfo = new StatusInfo(); |
2564 |
0
|
statusInfo.setSuccess(false); |
2565 |
0
|
statusInfo.setMessage("CluSet does not contain CluSet:" |
2566 |
|
+ removedCluSetId); |
2567 |
|
|
2568 |
0
|
return statusInfo; |
2569 |
|
} |
2570 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 2 |
Complexity Density: 0.13 |
|
2571 |
14
|
@Override... |
2572 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2573 |
|
public StatusInfo addCluToCluSet(String cluId, String cluSetId) |
2574 |
|
throws DoesNotExistException, InvalidParameterException, |
2575 |
|
MissingParameterException, OperationFailedException, |
2576 |
|
PermissionDeniedException, UnsupportedActionException { |
2577 |
|
|
2578 |
14
|
checkForMissingParameter(cluId, "cluId"); |
2579 |
14
|
checkForMissingParameter(cluSetId, "cluSetId"); |
2580 |
|
|
2581 |
14
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
2582 |
|
|
2583 |
13
|
checkCluAlreadyAdded(cluSet, cluId); |
2584 |
|
|
2585 |
11
|
try{ |
2586 |
11
|
luDao.getCurrentCluVersionInfo(cluId, LuServiceConstants.CLU_NAMESPACE_URI); |
2587 |
|
}catch(NoResultException e){ |
2588 |
1
|
throw new DoesNotExistException(); |
2589 |
|
} |
2590 |
|
|
2591 |
10
|
CluSetJoinVersionIndClu join = new CluSetJoinVersionIndClu(); |
2592 |
10
|
join.setCluSet(cluSet); |
2593 |
10
|
join.setCluVersionIndId(cluId); |
2594 |
|
|
2595 |
10
|
cluSet.getCluVerIndIds().add(join); |
2596 |
|
|
2597 |
10
|
luDao.update(cluSet); |
2598 |
|
|
2599 |
10
|
StatusInfo statusInfo = new StatusInfo(); |
2600 |
10
|
statusInfo.setSuccess(true); |
2601 |
|
|
2602 |
10
|
return statusInfo; |
2603 |
|
} |
2604 |
|
|
|
|
| 75% |
Uncovered Elements: 5 (20) |
Complexity: 3 |
Complexity Density: 0.19 |
|
2605 |
1
|
@Override... |
2606 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2607 |
|
public StatusInfo removeCluFromCluSet(String cluId, String cluSetId) |
2608 |
|
throws DoesNotExistException, InvalidParameterException, |
2609 |
|
MissingParameterException, OperationFailedException, |
2610 |
|
PermissionDeniedException, UnsupportedActionException { |
2611 |
|
|
2612 |
1
|
checkForMissingParameter(cluId, "cluId"); |
2613 |
1
|
checkForMissingParameter(cluSetId, "cluSetId"); |
2614 |
|
|
2615 |
1
|
CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
2616 |
|
|
2617 |
2
|
for (Iterator<CluSetJoinVersionIndClu> i = cluSet.getCluVerIndIds().iterator(); i.hasNext();) { |
2618 |
2
|
CluSetJoinVersionIndClu join = i.next(); |
2619 |
2
|
if (join.getCluVersionIndId().equals(cluId)) { |
2620 |
1
|
i.remove(); |
2621 |
1
|
luDao.delete(join); |
2622 |
1
|
luDao.update(cluSet); |
2623 |
1
|
StatusInfo statusInfo = new StatusInfo(); |
2624 |
1
|
statusInfo.setSuccess(true); |
2625 |
|
|
2626 |
1
|
return statusInfo; |
2627 |
|
} |
2628 |
|
} |
2629 |
|
|
2630 |
0
|
StatusInfo statusInfo = new StatusInfo(); |
2631 |
0
|
statusInfo.setSuccess(false); |
2632 |
0
|
statusInfo.setMessage("Clu set does not contain Clu:" + cluId); |
2633 |
|
|
2634 |
0
|
return statusInfo; |
2635 |
|
} |
2636 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
2637 |
4
|
@Override... |
2638 |
|
public List<ValidationResultInfo> validateLui(String validationType, |
2639 |
|
LuiInfo luiInfo) throws DoesNotExistException, |
2640 |
|
InvalidParameterException, MissingParameterException, |
2641 |
|
OperationFailedException { |
2642 |
4
|
checkForMissingParameter(validationType, "validationType"); |
2643 |
4
|
checkForMissingParameter(luiInfo, "luiInfo"); |
2644 |
|
|
2645 |
4
|
ObjectStructureDefinition objStructure = this.getObjectStructure(LuiInfo.class.getName()); |
2646 |
4
|
Validator defaultValidator = validatorFactory.getValidator(); |
2647 |
4
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(luiInfo, objStructure); |
2648 |
4
|
return validationResults; |
2649 |
|
} |
2650 |
|
|
|
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 4 |
Complexity Density: 0.31 |
|
2651 |
2
|
@Override... |
2652 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2653 |
|
public LuiInfo createLui(String cluId, String atpKey, LuiInfo luiInfo) |
2654 |
|
throws AlreadyExistsException, DataValidationErrorException, |
2655 |
|
DoesNotExistException, InvalidParameterException, |
2656 |
|
MissingParameterException, OperationFailedException, |
2657 |
|
PermissionDeniedException { |
2658 |
2
|
checkForMissingParameter(cluId, "cludId"); |
2659 |
2
|
checkForMissingParameter(atpKey, "atpKey"); |
2660 |
2
|
checkForMissingParameter(luiInfo, "luiInfo"); |
2661 |
|
|
2662 |
|
|
2663 |
2
|
List<ValidationResultInfo> val = validateLui("SYSTEM", luiInfo); |
2664 |
2
|
if(null != val && val.size() > 0) { |
2665 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2666 |
|
} |
2667 |
|
|
2668 |
2
|
Lui lui = new Lui(); |
2669 |
2
|
luiInfo.setCluId(cluId); |
2670 |
2
|
luiInfo.setAtpId(atpKey); |
2671 |
|
|
2672 |
2
|
try { |
2673 |
2
|
lui = LuServiceAssembler.toLui(false, luiInfo, luDao); |
2674 |
|
} catch (VersionMismatchException vme) { |
2675 |
|
} |
2676 |
|
|
2677 |
2
|
luDao.create(lui); |
2678 |
|
|
2679 |
2
|
return LuServiceAssembler.toLuiInfo(lui); |
2680 |
|
} |
2681 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
2682 |
2
|
@Override... |
2683 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2684 |
|
public LuiInfo updateLui(String luiId, LuiInfo luiInfo) |
2685 |
|
throws DataValidationErrorException, DoesNotExistException, |
2686 |
|
InvalidParameterException, MissingParameterException, |
2687 |
|
OperationFailedException, PermissionDeniedException, |
2688 |
|
VersionMismatchException { |
2689 |
|
|
2690 |
2
|
checkForMissingParameter(luiId, "luiId"); |
2691 |
2
|
checkForMissingParameter(luiInfo, "luiInfo"); |
2692 |
|
|
2693 |
|
|
2694 |
2
|
List<ValidationResultInfo> val = validateLui("SYSTEM", luiInfo); |
2695 |
2
|
if(null != val && val.size() > 0) { |
2696 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2697 |
|
} |
2698 |
|
|
2699 |
2
|
Lui lui = luDao.fetch(Lui.class, luiId); |
2700 |
|
|
2701 |
2
|
if (!String.valueOf(lui.getVersionNumber()).equals( |
2702 |
|
luiInfo.getMetaInfo().getVersionInd())) { |
2703 |
1
|
throw new VersionMismatchException( |
2704 |
|
"Lui to be updated is not the current version"); |
2705 |
|
} |
2706 |
|
|
2707 |
1
|
Clu clu = luDao.fetch(Clu.class, luiInfo.getCluId()); |
2708 |
1
|
lui.setClu(clu); |
2709 |
|
|
2710 |
1
|
lui.setAttributes(LuServiceAssembler.toGenericAttributes( |
2711 |
|
LuiAttribute.class, luiInfo.getAttributes(), lui, luDao)); |
2712 |
|
|
2713 |
|
|
2714 |
1
|
BeanUtils.copyProperties(luiInfo, lui, new String[] { "cluId", |
2715 |
|
"attributes" }); |
2716 |
|
|
2717 |
1
|
Lui updated = luDao.update(lui); |
2718 |
|
|
2719 |
1
|
return LuServiceAssembler.toLuiInfo(updated); |
2720 |
|
} |
2721 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
2722 |
3
|
@Override... |
2723 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2724 |
|
public StatusInfo deleteLui(String luiId) |
2725 |
|
throws DependentObjectsExistException, DoesNotExistException, |
2726 |
|
InvalidParameterException, MissingParameterException, |
2727 |
|
OperationFailedException, PermissionDeniedException { |
2728 |
|
|
2729 |
3
|
checkForMissingParameter(luiId, "luiId"); |
2730 |
|
|
2731 |
3
|
luDao.delete(Lui.class, luiId); |
2732 |
|
|
2733 |
2
|
StatusInfo statusInfo = new StatusInfo(); |
2734 |
2
|
statusInfo.setSuccess(true); |
2735 |
|
|
2736 |
2
|
return statusInfo; |
2737 |
|
} |
2738 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
2739 |
3
|
@Override... |
2740 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2741 |
|
public LuiInfo updateLuiState(String luiId, String luiState) |
2742 |
|
throws DataValidationErrorException, DoesNotExistException, |
2743 |
|
InvalidParameterException, MissingParameterException, |
2744 |
|
OperationFailedException, PermissionDeniedException { |
2745 |
|
|
2746 |
|
|
2747 |
3
|
checkForMissingParameter(luiId, "luiId"); |
2748 |
2
|
checkForMissingParameter(luiState, "luiState"); |
2749 |
1
|
Lui lui = luDao.fetch(Lui.class, luiId); |
2750 |
1
|
lui.setState(luiState); |
2751 |
1
|
Lui updated = luDao.update(lui); |
2752 |
1
|
return LuServiceAssembler.toLuiInfo(updated); |
2753 |
|
} |
2754 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
2755 |
3
|
@Override... |
2756 |
|
public List<ValidationResultInfo> validateLuiLuiRelation( |
2757 |
|
String validationType, LuiLuiRelationInfo luiLuiRelationInfo) |
2758 |
|
throws DoesNotExistException, InvalidParameterException, |
2759 |
|
MissingParameterException, OperationFailedException { |
2760 |
3
|
checkForMissingParameter(validationType, "validationType"); |
2761 |
3
|
checkForMissingParameter(luiLuiRelationInfo, "luiLuiRelationInfo"); |
2762 |
|
|
2763 |
3
|
ObjectStructureDefinition objStructure = this.getObjectStructure(LuiLuiRelation.class.getName()); |
2764 |
3
|
Validator defaultValidator = validatorFactory.getValidator(); |
2765 |
3
|
List<ValidationResultInfo> validationResults = defaultValidator.validateObject(luiLuiRelationInfo, objStructure); |
2766 |
3
|
return validationResults; |
2767 |
|
} |
2768 |
|
|
|
|
| 83.3% |
Uncovered Elements: 4 (24) |
Complexity: 4 |
Complexity Density: 0.2 |
|
2769 |
1
|
@Override... |
2770 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2771 |
|
public LuiLuiRelationInfo createLuiLuiRelation(String luiId, |
2772 |
|
String relatedLuiId, String luLuRelationTypeKey, |
2773 |
|
LuiLuiRelationInfo luiLuiRelationInfo) |
2774 |
|
throws AlreadyExistsException, CircularRelationshipException, |
2775 |
|
DataValidationErrorException, DoesNotExistException, |
2776 |
|
InvalidParameterException, MissingParameterException, |
2777 |
|
OperationFailedException, PermissionDeniedException { |
2778 |
1
|
checkForMissingParameter(luiId, "luiId"); |
2779 |
1
|
checkForMissingParameter(relatedLuiId, "relatedLuiId"); |
2780 |
1
|
checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
2781 |
1
|
checkForMissingParameter(luiLuiRelationInfo, "luiLuiRelationInfo"); |
2782 |
|
|
2783 |
|
|
2784 |
1
|
List<ValidationResultInfo> val = validateLuiLuiRelation("SYSTEM", luiLuiRelationInfo); |
2785 |
1
|
if(null != val && val.size() > 0) { |
2786 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2787 |
|
} |
2788 |
|
|
2789 |
1
|
if (luiId.equals(relatedLuiId)) { |
2790 |
0
|
throw new CircularRelationshipException( |
2791 |
|
"Can not relate a Lui to itself"); |
2792 |
|
} |
2793 |
|
|
2794 |
1
|
Lui lui = luDao.fetch(Lui.class, luiId); |
2795 |
1
|
Lui relatedLui = luDao.fetch(Lui.class, relatedLuiId); |
2796 |
|
|
2797 |
1
|
LuiLuiRelation luiLuiRelation = new LuiLuiRelation(); |
2798 |
1
|
BeanUtils.copyProperties(luiLuiRelationInfo, luiLuiRelation, |
2799 |
|
new String[] { "luiId", "relatedLuiId", "attributes", |
2800 |
|
"metaInfo" }); |
2801 |
|
|
2802 |
1
|
luiLuiRelation.setLui(lui); |
2803 |
1
|
luiLuiRelation.setRelatedLui(relatedLui); |
2804 |
1
|
luiLuiRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
2805 |
|
LuiLuiRelationAttribute.class, luiLuiRelationInfo |
2806 |
|
.getAttributes(), luiLuiRelation, luDao)); |
2807 |
|
|
2808 |
1
|
LuLuRelationType luLuRelationType = luDao.fetch(LuLuRelationType.class, |
2809 |
|
luLuRelationTypeKey); |
2810 |
|
|
2811 |
1
|
luiLuiRelation.setLuLuRelationType(luLuRelationType); |
2812 |
|
|
2813 |
1
|
luDao.create(luiLuiRelation); |
2814 |
|
|
2815 |
1
|
return LuServiceAssembler.toLuiLuiRelationInfo(luiLuiRelation); |
2816 |
|
} |
2817 |
|
|
|
|
| 82.1% |
Uncovered Elements: 5 (28) |
Complexity: 7 |
Complexity Density: 0.39 |
|
2818 |
2
|
@Override... |
2819 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2820 |
|
public LuiLuiRelationInfo updateLuiLuiRelation(String luiLuiRelationId, |
2821 |
|
LuiLuiRelationInfo luiLuiRelationInfo) |
2822 |
|
throws DataValidationErrorException, DoesNotExistException, |
2823 |
|
InvalidParameterException, MissingParameterException, |
2824 |
|
OperationFailedException, PermissionDeniedException, |
2825 |
|
VersionMismatchException { |
2826 |
|
|
2827 |
2
|
checkForMissingParameter(luiLuiRelationId, "luiLuiRelationId"); |
2828 |
2
|
checkForMissingParameter(luiLuiRelationInfo, "luiLuiRelationInfo"); |
2829 |
|
|
2830 |
|
|
2831 |
2
|
List<ValidationResultInfo> val = validateLuiLuiRelation("SYSTEM", luiLuiRelationInfo); |
2832 |
2
|
if(null != val && val.size() > 0) { |
2833 |
0
|
throw new DataValidationErrorException("Validation error!", val); |
2834 |
|
} |
2835 |
|
|
2836 |
2
|
LuiLuiRelation luiLuiRelation = luDao.fetch(LuiLuiRelation.class, |
2837 |
|
luiLuiRelationId); |
2838 |
|
|
2839 |
2
|
if (!String.valueOf(luiLuiRelation.getVersionNumber()).equals( |
2840 |
|
luiLuiRelationInfo.getMetaInfo().getVersionInd())) { |
2841 |
1
|
throw new VersionMismatchException( |
2842 |
|
"LuiLuiRelation to be updated is not the current version"); |
2843 |
|
} |
2844 |
|
|
2845 |
1
|
BeanUtils.copyProperties(luiLuiRelationInfo, luiLuiRelation, |
2846 |
|
new String[] { "luiId", "relatedLuiId", "attributes", |
2847 |
|
"metaInfo" }); |
2848 |
|
|
2849 |
1
|
if (!luiLuiRelationInfo.getLuiId().equals( |
2850 |
|
luiLuiRelation.getLui().getId())) { |
2851 |
1
|
luiLuiRelation.setLui(luDao.fetch(Lui.class, luiLuiRelationInfo |
2852 |
|
.getLuiId())); |
2853 |
|
} |
2854 |
|
|
2855 |
1
|
if (!luiLuiRelationInfo.getRelatedLuiId().equals( |
2856 |
|
luiLuiRelation.getRelatedLui().getId())) { |
2857 |
1
|
luiLuiRelation.setRelatedLui(luDao.fetch(Lui.class, |
2858 |
|
luiLuiRelationInfo.getRelatedLuiId())); |
2859 |
|
} |
2860 |
|
|
2861 |
1
|
luiLuiRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
2862 |
|
LuiLuiRelationAttribute.class, luiLuiRelationInfo |
2863 |
|
.getAttributes(), luiLuiRelation, luDao)); |
2864 |
|
|
2865 |
1
|
if (!luiLuiRelationInfo.getType().equals( |
2866 |
|
luiLuiRelation.getLuLuRelationType().getId())) { |
2867 |
1
|
luiLuiRelation.setLuLuRelationType(luDao.fetch( |
2868 |
|
LuLuRelationType.class, luiLuiRelationInfo.getType())); |
2869 |
|
} |
2870 |
|
|
2871 |
1
|
LuiLuiRelation updated = luDao.update(luiLuiRelation); |
2872 |
|
|
2873 |
1
|
return LuServiceAssembler.toLuiLuiRelationInfo(updated); |
2874 |
|
} |
2875 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
2876 |
1
|
@Override... |
2877 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
2878 |
|
public StatusInfo deleteLuiLuiRelation(String luiLuiRelationId) |
2879 |
|
throws DoesNotExistException, InvalidParameterException, |
2880 |
|
MissingParameterException, OperationFailedException, |
2881 |
|
PermissionDeniedException { |
2882 |
|
|
2883 |
1
|
checkForMissingParameter(luiLuiRelationId, "luiLuiRelationId"); |
2884 |
|
|
2885 |
1
|
luDao.delete(LuiLuiRelation.class, luiLuiRelationId); |
2886 |
|
|
2887 |
1
|
StatusInfo statusInfo = new StatusInfo(); |
2888 |
1
|
statusInfo.setSuccess(true); |
2889 |
|
|
2890 |
1
|
return statusInfo; |
2891 |
|
} |
2892 |
|
|
2893 |
|
|
2894 |
|
|
2895 |
|
|
2896 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2897 |
0
|
@Override... |
2898 |
|
public SearchCriteriaTypeInfo getSearchCriteriaType( |
2899 |
|
String searchCriteriaTypeKey) throws DoesNotExistException, |
2900 |
|
InvalidParameterException, MissingParameterException, |
2901 |
|
OperationFailedException { |
2902 |
|
|
2903 |
0
|
return searchManager.getSearchCriteriaType(searchCriteriaTypeKey); |
2904 |
|
} |
2905 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2906 |
0
|
@Override... |
2907 |
|
public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() |
2908 |
|
throws OperationFailedException { |
2909 |
0
|
return searchManager.getSearchCriteriaTypes(); |
2910 |
|
} |
2911 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2912 |
0
|
@Override... |
2913 |
|
public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) |
2914 |
|
throws DoesNotExistException, InvalidParameterException, |
2915 |
|
MissingParameterException, OperationFailedException { |
2916 |
0
|
checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
2917 |
0
|
return searchManager.getSearchResultType(searchResultTypeKey); |
2918 |
|
} |
2919 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2920 |
0
|
@Override... |
2921 |
|
public List<SearchResultTypeInfo> getSearchResultTypes() |
2922 |
|
throws OperationFailedException { |
2923 |
0
|
return searchManager.getSearchResultTypes(); |
2924 |
|
} |
2925 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2926 |
0
|
@Override... |
2927 |
|
public SearchTypeInfo getSearchType(String searchTypeKey) |
2928 |
|
throws DoesNotExistException, InvalidParameterException, |
2929 |
|
MissingParameterException, OperationFailedException { |
2930 |
0
|
checkForMissingParameter(searchTypeKey, "searchTypeKey"); |
2931 |
0
|
return searchManager.getSearchType(searchTypeKey); |
2932 |
|
} |
2933 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2934 |
0
|
@Override... |
2935 |
|
public List<SearchTypeInfo> getSearchTypes() |
2936 |
|
throws OperationFailedException { |
2937 |
0
|
return searchManager.getSearchTypes(); |
2938 |
|
} |
2939 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2940 |
0
|
@Override... |
2941 |
|
public List<SearchTypeInfo> getSearchTypesByCriteria( |
2942 |
|
String searchCriteriaTypeKey) throws DoesNotExistException, |
2943 |
|
InvalidParameterException, MissingParameterException, |
2944 |
|
OperationFailedException { |
2945 |
0
|
checkForMissingParameter(searchCriteriaTypeKey, "searchCriteriaTypeKey"); |
2946 |
0
|
return searchManager.getSearchTypesByCriteria(searchCriteriaTypeKey); |
2947 |
|
} |
2948 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2949 |
0
|
@Override... |
2950 |
|
public List<SearchTypeInfo> getSearchTypesByResult( |
2951 |
|
String searchResultTypeKey) throws DoesNotExistException, |
2952 |
|
InvalidParameterException, MissingParameterException, |
2953 |
|
OperationFailedException { |
2954 |
0
|
checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
2955 |
0
|
return searchManager.getSearchTypesByResult(searchResultTypeKey); |
2956 |
|
} |
2957 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
2958 |
13
|
private void checkCluAlreadyAdded(CluSet cluSet, String cluId)... |
2959 |
|
throws OperationFailedException { |
2960 |
13
|
for (CluSetJoinVersionIndClu join : cluSet.getCluVerIndIds()) { |
2961 |
13
|
if (join.getCluVersionIndId().equals(cluId)) { |
2962 |
2
|
throw new OperationFailedException("CluSet already contains Clu (id='" + cluId + "')"); |
2963 |
|
} |
2964 |
|
} |
2965 |
|
} |
2966 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
2967 |
27
|
private void checkCluSetAlreadyAdded(CluSet cluSet, String cluSetIdToAdd)... |
2968 |
|
throws OperationFailedException { |
2969 |
27
|
if(cluSet.getCluSets()!=null){ |
2970 |
27
|
for (CluSet childCluSet : cluSet.getCluSets()) { |
2971 |
20
|
if (childCluSet.getId().equals(cluSetIdToAdd)) { |
2972 |
2
|
throw new OperationFailedException("CluSet (id=" + cluSet.getId() + |
2973 |
|
") already contains CluSet (id='" + cluSetIdToAdd + "')"); |
2974 |
|
} |
2975 |
|
} |
2976 |
|
} |
2977 |
|
} |
2978 |
|
|
|
|
| 92.3% |
Uncovered Elements: 1 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
2979 |
77
|
private void checkCluSetCircularReference(CluSet addedCluSet, String hostCluSetId)... |
2980 |
|
throws CircularRelationshipException { |
2981 |
77
|
if (addedCluSet.getId().equals(hostCluSetId)) { |
2982 |
2
|
throw new CircularRelationshipException( |
2983 |
|
"Cannot add a CluSet (id=" + hostCluSetId + ") to ifself"); |
2984 |
|
} |
2985 |
75
|
if(addedCluSet.getCluSets()!=null){ |
2986 |
75
|
for (CluSet childSet : addedCluSet.getCluSets()) { |
2987 |
56
|
if (childSet.getId().equals(hostCluSetId)) { |
2988 |
2
|
throw new CircularRelationshipException( |
2989 |
|
"CluSet (id=" + hostCluSetId + |
2990 |
|
") already contains this CluSet (id=" + |
2991 |
|
childSet.getId() + ")"); |
2992 |
|
} |
2993 |
54
|
checkCluSetCircularReference(childSet, hostCluSetId); |
2994 |
|
} |
2995 |
|
} |
2996 |
|
} |
2997 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2998 |
2
|
private void findClusInCluSet(List<String> clus, CluSet parentCluSet)... |
2999 |
|
throws DoesNotExistException { |
3000 |
2
|
List<String> processedCluSetIds = new ArrayList<String>(); |
3001 |
2
|
doFindClusInCluSet(processedCluSetIds, clus, parentCluSet); |
3002 |
|
} |
3003 |
|
|
|
|
| 85.7% |
Uncovered Elements: 2 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
3004 |
4
|
private void doFindClusInCluSet(List<String> processedCluSetIds, ... |
3005 |
|
List<String> clus, CluSet parentCluSet) { |
3006 |
4
|
for (CluSetJoinVersionIndClu join : parentCluSet.getCluVerIndIds()) { |
3007 |
7
|
if (!clus.contains(join.getCluVersionIndId())) { |
3008 |
5
|
clus.add(join.getCluVersionIndId()); |
3009 |
|
} |
3010 |
|
} |
3011 |
4
|
if(parentCluSet.getCluSets()!=null){ |
3012 |
4
|
for (CluSet cluSet : parentCluSet.getCluSets()) { |
3013 |
|
|
3014 |
2
|
if (!processedCluSetIds.contains(cluSet.getId())) { |
3015 |
2
|
processedCluSetIds.add(cluSet.getId()); |
3016 |
2
|
doFindClusInCluSet(processedCluSetIds, clus, cluSet); |
3017 |
|
} |
3018 |
|
} |
3019 |
|
} |
3020 |
|
} |
3021 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 10 |
Complexity Density: 0.29 |
|
3022 |
0
|
private SearchResult doSearchProposalsByCourseCode(String courseCode) throws MissingParameterException{... |
3023 |
0
|
if(courseCode==null||courseCode.isEmpty()){ |
3024 |
0
|
return new SearchResult(); |
3025 |
|
} |
3026 |
|
|
3027 |
0
|
SearchRequest sr = new SearchRequest("lu.search.mostCurrent.union"); |
3028 |
0
|
sr.addParam("lu.queryParam.luOptionalCode", courseCode); |
3029 |
0
|
sr.addParam("lu.queryParam.luOptionalType","kuali.lu.type.CreditCourse"); |
3030 |
0
|
SearchResult results = search(sr); |
3031 |
0
|
Map<String,String> cluIdToCodeMap = new HashMap<String,String>(); |
3032 |
0
|
for(SearchResultRow row:results.getRows()){ |
3033 |
0
|
String cluId = null; |
3034 |
0
|
String code = null; |
3035 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3036 |
0
|
if("lu.resultColumn.cluId".equals(cell.getKey())){ |
3037 |
0
|
cluId = cell.getValue(); |
3038 |
0
|
}else if("lu.resultColumn.luOptionalCode".equals(cell.getKey())){ |
3039 |
0
|
code = cell.getValue(); |
3040 |
|
} |
3041 |
|
} |
3042 |
|
|
3043 |
0
|
if(code!=null&&cluId!=null){ |
3044 |
0
|
cluIdToCodeMap.put(cluId, code); |
3045 |
|
} |
3046 |
|
} |
3047 |
|
|
3048 |
|
|
3049 |
0
|
sr = new SearchRequest("proposal.search.proposalsForReferenceIds"); |
3050 |
0
|
sr.addParam("proposal.queryParam.proposalOptionalReferenceIds", new ArrayList<String>(cluIdToCodeMap.keySet())); |
3051 |
0
|
results = searchDispatcher.dispatchSearch(sr); |
3052 |
0
|
for(SearchResultRow row:results.getRows()){ |
3053 |
0
|
String cluId = null; |
3054 |
0
|
SearchResultCell proposalNameCell = null; |
3055 |
|
|
3056 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3057 |
0
|
if("proposal.resultColumn.proposalOptionalName".equals(cell.getKey())){ |
3058 |
0
|
proposalNameCell = cell; |
3059 |
0
|
cell.setKey("lu.resultColumn.proposalOptionalName"); |
3060 |
0
|
}else if("proposal.resultColumn.proposalOptionalReferenceId".equals(cell.getKey())){ |
3061 |
0
|
cluId = cell.getValue(); |
3062 |
0
|
cell.setKey("lu.resultColumn.proposalOptionalReferenceId"); |
3063 |
0
|
}else if("proposal.resultColumn.proposalId".equals(cell.getKey())){ |
3064 |
0
|
cell.setKey("lu.resultColumn.proposalId"); |
3065 |
|
} |
3066 |
|
} |
3067 |
|
|
3068 |
0
|
proposalNameCell.setValue(cluIdToCodeMap.get(cluId)+" ("+proposalNameCell.getValue()+")"); |
3069 |
|
} |
3070 |
|
|
3071 |
0
|
return results; |
3072 |
|
} |
3073 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3074 |
781
|
@Override... |
3075 |
|
public ObjectStructureDefinition getObjectStructure(String objectTypeKey) { |
3076 |
781
|
return dictionaryServiceDelegate.getObjectStructure(objectTypeKey); |
3077 |
|
} |
3078 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3079 |
0
|
@Override... |
3080 |
|
public List<String> getObjectTypes() { |
3081 |
0
|
return dictionaryServiceDelegate.getObjectTypes(); |
3082 |
|
} |
3083 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3084 |
0
|
public LuDao getLuDao() {... |
3085 |
0
|
return luDao; |
3086 |
|
} |
3087 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3088 |
5
|
public void setLuDao(LuDao luDao) {... |
3089 |
5
|
this.luDao = luDao; |
3090 |
|
} |
3091 |
|
|
|
|
| 36.8% |
Uncovered Elements: 24 (38) |
Complexity: 9 |
Complexity Density: 0.38 |
|
3092 |
18
|
@Override... |
3093 |
|
@Transactional(readOnly=true) |
3094 |
|
public SearchResult search(SearchRequest searchRequest) throws MissingParameterException { |
3095 |
18
|
checkForMissingParameter(searchRequest, "searchRequest"); |
3096 |
|
|
3097 |
18
|
if(SEARCH_KEY_DEPENDENCY_ANALYSIS.equals(searchRequest.getSearchKey())){ |
3098 |
0
|
String cluId = null; |
3099 |
0
|
for(SearchParam param:searchRequest.getParams()){ |
3100 |
0
|
if("lu.queryParam.luOptionalCluId".equals(param.getKey())){ |
3101 |
0
|
cluId = (String)param.getValue(); |
3102 |
0
|
break; |
3103 |
|
} |
3104 |
|
} |
3105 |
0
|
try { |
3106 |
0
|
return doDependencyAnalysisSearch(cluId); |
3107 |
|
} catch (DoesNotExistException e) { |
3108 |
0
|
throw new RuntimeException("Error performing search"); |
3109 |
|
} |
3110 |
18
|
}else if(SEARCH_KEY_BROWSE_PROGRAM.equals(searchRequest.getSearchKey())){ |
3111 |
0
|
return doBrowseProgramSearch(); |
3112 |
18
|
}else if(SEARCH_KEY_PROPOSALS_BY_COURSE_CODE.equals(searchRequest.getSearchKey())){ |
3113 |
0
|
String courseCode = null; |
3114 |
0
|
for(SearchParam param:searchRequest.getParams()){ |
3115 |
0
|
if("lu.queryParam.luOptionalCode".equals(param.getKey())){ |
3116 |
0
|
courseCode = (String)param.getValue(); |
3117 |
0
|
break; |
3118 |
|
} |
3119 |
|
} |
3120 |
0
|
return doSearchProposalsByCourseCode(courseCode); |
3121 |
18
|
}else if(SEARCH_KEY_BROWSE_VERSIONS.equals(searchRequest.getSearchKey())){ |
3122 |
1
|
return doBrowseVersionsSearch(searchRequest); |
3123 |
17
|
}else if(SEARCH_KEY_LU_RESULT_COMPONENTS.equals(searchRequest.getSearchKey())){ |
3124 |
0
|
return doResultComponentTypesForCluSearch(searchRequest); |
3125 |
|
} |
3126 |
17
|
return searchManager.search(searchRequest, luDao); |
3127 |
|
} |
3128 |
|
|
3129 |
|
|
3130 |
|
|
3131 |
|
|
3132 |
|
@param |
3133 |
|
@return |
3134 |
|
@throws |
3135 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 8 |
Complexity Density: 0.32 |
|
3136 |
0
|
private SearchResult doResultComponentTypesForCluSearch(SearchRequest cluSearchRequest) throws MissingParameterException {... |
3137 |
|
|
3138 |
0
|
SearchResult searchResult = searchManager.search(cluSearchRequest, luDao); |
3139 |
|
|
3140 |
|
|
3141 |
0
|
Map<String,List<SearchResultRow>> rcIdToRowMapping = new HashMap<String,List<SearchResultRow>>(); |
3142 |
|
|
3143 |
|
|
3144 |
0
|
for(SearchResultRow row:searchResult.getRows()){ |
3145 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3146 |
0
|
if(cell.getValue()!=null && |
3147 |
|
"lu.resultColumn.resultComponentId".equals(cell.getKey())) { |
3148 |
0
|
List<SearchResultRow> rows = rcIdToRowMapping.get(cell.getValue()); |
3149 |
0
|
if(rows==null){ |
3150 |
0
|
rows = new ArrayList<SearchResultRow>(); |
3151 |
0
|
rcIdToRowMapping.put(cell.getValue(), rows); |
3152 |
|
} |
3153 |
0
|
rows.add(row); |
3154 |
|
} |
3155 |
|
} |
3156 |
|
} |
3157 |
|
|
3158 |
|
|
3159 |
0
|
SearchRequest lrcSearchRequest = new SearchRequest(SEARCH_KEY_LRC_RESULT_COMPONENT); |
3160 |
0
|
lrcSearchRequest.addParam("lrc.queryParam.resultComponent.idRestrictionList", new ArrayList<String>(rcIdToRowMapping.keySet())); |
3161 |
0
|
SearchResult lrcSearchResults = searchDispatcher.dispatchSearch(lrcSearchRequest); |
3162 |
|
|
3163 |
|
|
3164 |
0
|
for(SearchResultRow row:lrcSearchResults.getRows()){ |
3165 |
0
|
String lrcId = null; |
3166 |
0
|
String lrcName = null; |
3167 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3168 |
0
|
if("lrc.resultColumn.resultComponent.id".equals(cell.getKey())){ |
3169 |
0
|
lrcId = cell.getValue(); |
3170 |
0
|
}else if("lrc.resultColumn.resultComponent.name".equals(cell.getKey())){ |
3171 |
0
|
lrcName = cell.getValue(); |
3172 |
|
} |
3173 |
|
} |
3174 |
0
|
if(lrcId!=null && rcIdToRowMapping.get(lrcId)!=null){ |
3175 |
0
|
for(SearchResultRow resultRow : rcIdToRowMapping.get(lrcId)){ |
3176 |
0
|
resultRow.addCell("lu.resultColumn.resultComponentName",lrcName); |
3177 |
|
} |
3178 |
|
} |
3179 |
|
} |
3180 |
|
|
3181 |
0
|
return searchResult; |
3182 |
|
} |
3183 |
|
|
3184 |
|
|
3185 |
|
|
3186 |
|
@param |
3187 |
|
@return |
3188 |
|
@throws |
3189 |
|
|
|
|
| 45.7% |
Uncovered Elements: 19 (35) |
Complexity: 9 |
Complexity Density: 0.36 |
|
3190 |
1
|
private SearchResult doBrowseVersionsSearch(SearchRequest searchRequest) throws MissingParameterException {... |
3191 |
1
|
SearchResult searchResult = searchManager.search(searchRequest, luDao); |
3192 |
|
|
3193 |
1
|
Map<String,List<SearchResultCell>> atpIdToCellMapping = new HashMap<String,List<SearchResultCell>>(); |
3194 |
|
|
3195 |
1
|
for(SearchResultRow row:searchResult.getRows()){ |
3196 |
3
|
for(SearchResultCell cell:row.getCells()){ |
3197 |
48
|
if(cell.getValue()!=null && |
3198 |
|
("lu.resultColumn.luOptionalExpFirstAtpDisplay".equals(cell.getKey()) || |
3199 |
|
"lu.resultColumn.luOptionalLastAtpDisplay".equals(cell.getKey()))) { |
3200 |
0
|
List<SearchResultCell> cells = atpIdToCellMapping.get(cell.getValue()); |
3201 |
0
|
if(cells==null){ |
3202 |
0
|
cells = new ArrayList<SearchResultCell>(); |
3203 |
0
|
atpIdToCellMapping.put(cell.getValue(), cells); |
3204 |
|
} |
3205 |
0
|
cells.add(cell); |
3206 |
|
} |
3207 |
|
} |
3208 |
|
} |
3209 |
|
|
3210 |
|
|
3211 |
1
|
SearchRequest atpSearchRequest = new SearchRequest("atp.search.advancedAtpSearch"); |
3212 |
1
|
atpSearchRequest.addParam("atp.advancedAtpSearchParam.optionalAtpIds", new ArrayList<String>(atpIdToCellMapping.keySet())); |
3213 |
1
|
SearchResult atpSearchResults = searchDispatcher.dispatchSearch(atpSearchRequest); |
3214 |
1
|
for(SearchResultRow row:atpSearchResults.getRows()){ |
3215 |
1
|
String atpId = null; |
3216 |
1
|
String atpName = null; |
3217 |
1
|
for(SearchResultCell cell:row.getCells()){ |
3218 |
0
|
if("atp.resultColumn.atpId".equals(cell.getKey())){ |
3219 |
0
|
atpId = cell.getValue(); |
3220 |
0
|
}else if("atp.resultColumn.atpShortName".equals(cell.getKey())){ |
3221 |
0
|
atpName = cell.getValue(); |
3222 |
|
} |
3223 |
|
} |
3224 |
1
|
if(atpId!=null && atpIdToCellMapping.get(atpId)!=null){ |
3225 |
0
|
for(SearchResultCell cell : atpIdToCellMapping.get(atpId)){ |
3226 |
0
|
cell.setValue(atpName); |
3227 |
|
} |
3228 |
|
} |
3229 |
|
} |
3230 |
|
|
3231 |
1
|
return searchResult; |
3232 |
|
} |
3233 |
|
|
|
|
| 0% |
Uncovered Elements: 214 (214) |
Complexity: 33 |
Complexity Density: 0.22 |
|
3234 |
0
|
private SearchResult doBrowseProgramSearch() throws MissingParameterException {... |
3235 |
|
|
3236 |
0
|
SearchRequest request = new SearchRequest(SEARCH_KEY_BROWSE_PROGRAM); |
3237 |
0
|
request.setSortDirection(SortDirection.ASC); |
3238 |
0
|
request.setSortColumn("lu.resultColumn.luOptionalLongName"); |
3239 |
0
|
SearchResult programSearchResults = searchManager.search(request, luDao); |
3240 |
|
|
3241 |
|
|
3242 |
0
|
SearchResult variationSearchResults = searchManager.search(new SearchRequest(SEARCH_KEY_BROWSE_VARIATIONS), luDao); |
3243 |
|
|
3244 |
|
|
3245 |
0
|
Map<String,List<String>> variationMapping = new HashMap<String,List<String>>(); |
3246 |
0
|
for(SearchResultRow row:variationSearchResults.getRows()){ |
3247 |
0
|
String programId = null; |
3248 |
0
|
String variationLongName = null; |
3249 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3250 |
0
|
if("lu.resultColumn.cluId".equals(cell.getKey())){ |
3251 |
0
|
programId = cell.getValue(); |
3252 |
0
|
}else if("lu.resultColumn.luOptionalLongName".equals(cell.getKey())){ |
3253 |
0
|
variationLongName = cell.getValue(); |
3254 |
|
} |
3255 |
|
} |
3256 |
0
|
List<String> variationLongNames = variationMapping.get(programId); |
3257 |
0
|
if(variationLongNames == null){ |
3258 |
0
|
variationLongNames = new ArrayList<String>(); |
3259 |
0
|
variationMapping.put(programId, variationLongNames); |
3260 |
|
} |
3261 |
0
|
variationLongNames.add(variationLongName); |
3262 |
|
} |
3263 |
|
|
3264 |
|
|
3265 |
|
|
3266 |
0
|
SearchRequest resultComponentSearchRequest = new SearchRequest(SEARCH_KEY_LRC_RESULT_COMPONENT); |
3267 |
0
|
resultComponentSearchRequest.addParam("lrc.queryParam.resultComponent.type", "kuali.resultComponentType.degree"); |
3268 |
0
|
SearchResult resultComponentSearchResults = searchDispatcher.dispatchSearch(resultComponentSearchRequest); |
3269 |
|
|
3270 |
|
|
3271 |
0
|
Map<String,String> resultComponentMapping = new HashMap<String,String>(); |
3272 |
0
|
for(SearchResultRow row:resultComponentSearchResults.getRows()){ |
3273 |
0
|
String resultComponentTypeId = null; |
3274 |
0
|
String resultComponentTypeName = null; |
3275 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3276 |
0
|
if("lrc.resultColumn.resultComponent.id".equals(cell.getKey())){ |
3277 |
0
|
resultComponentTypeId = cell.getValue(); |
3278 |
0
|
}else if("lrc.resultColumn.resultComponent.name".equals(cell.getKey())){ |
3279 |
0
|
resultComponentTypeName = cell.getValue(); |
3280 |
|
} |
3281 |
|
} |
3282 |
0
|
resultComponentMapping.put(resultComponentTypeId, resultComponentTypeName); |
3283 |
|
} |
3284 |
|
|
3285 |
0
|
Map<String, Set<SearchResultCell>> orgIdToCellMapping = new HashMap<String, Set<SearchResultCell>>(); |
3286 |
0
|
Map<String, Set<SearchResultCell>> resultComponentToCellMapping = new HashMap<String, Set<SearchResultCell>>(); |
3287 |
0
|
Map<String, Set<SearchResultCell>> campusToCellMapping = new HashMap<String, Set<SearchResultCell>>(); |
3288 |
0
|
Map<String, SearchResultCell> progIdToOrgCellMapping = new HashMap<String, SearchResultCell>(); |
3289 |
0
|
Map<String, SearchResultCell> progIdToResultComponentCellMapping = new HashMap<String, SearchResultCell>(); |
3290 |
0
|
Map<String, SearchResultCell> progIdToCampusCellMapping = new HashMap<String, SearchResultCell>(); |
3291 |
|
|
3292 |
|
|
3293 |
|
|
3294 |
0
|
for(Iterator<SearchResultRow> rowIter = programSearchResults.getRows().iterator();rowIter.hasNext();){ |
3295 |
0
|
SearchResultRow row = rowIter.next(); |
3296 |
0
|
String programId = null; |
3297 |
0
|
String orgId = null; |
3298 |
0
|
String resultComponentName = null; |
3299 |
0
|
String campusCode = null; |
3300 |
0
|
SearchResultCell orgCell = null; |
3301 |
0
|
SearchResultCell resultComponentCell = null; |
3302 |
0
|
SearchResultCell variationCell = null; |
3303 |
0
|
SearchResultCell campusLocationCell = null; |
3304 |
|
|
3305 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3306 |
0
|
if("lu.resultColumn.cluId".equals(cell.getKey())){ |
3307 |
0
|
programId = cell.getValue(); |
3308 |
0
|
}else if("lu.resultColumn.luOptionalAdminOrg".equals(cell.getKey())){ |
3309 |
0
|
orgId = cell.getValue(); |
3310 |
0
|
orgCell = cell; |
3311 |
0
|
}else if("lu.resultColumn.resultComponentId".equals(cell.getKey())){ |
3312 |
0
|
resultComponentName = resultComponentMapping.get(cell.getValue()); |
3313 |
0
|
resultComponentCell = cell; |
3314 |
0
|
}else if("lu.resultColumn.variationId".equals(cell.getKey())){ |
3315 |
0
|
variationCell = cell; |
3316 |
0
|
}else if("lu.resultColumn.luOptionalCampusLocation".equals(cell.getKey())){ |
3317 |
0
|
campusLocationCell = cell; |
3318 |
0
|
campusCode = cell.getValue(); |
3319 |
|
} |
3320 |
|
} |
3321 |
0
|
if(!progIdToOrgCellMapping.containsKey(programId)){ |
3322 |
|
|
3323 |
0
|
List<String> variations = variationMapping.get(programId); |
3324 |
0
|
variationCell.setValue(""); |
3325 |
0
|
if(variations!=null){ |
3326 |
0
|
for(Iterator<String> variationIter = variations.iterator();variationIter.hasNext();){ |
3327 |
0
|
String variation = variationIter.next(); |
3328 |
0
|
if(variationIter.hasNext()){ |
3329 |
0
|
variation += "<br/>"; |
3330 |
|
} |
3331 |
0
|
variationCell.setValue(variationCell.getValue()+variation); |
3332 |
|
} |
3333 |
|
} |
3334 |
|
|
3335 |
|
|
3336 |
0
|
Set<SearchResultCell> orgCells = orgIdToCellMapping.get(orgId); |
3337 |
0
|
if(orgCells == null){ |
3338 |
0
|
orgCells = new HashSet<SearchResultCell>(); |
3339 |
0
|
orgIdToCellMapping.put(orgId, orgCells); |
3340 |
|
} |
3341 |
0
|
orgCells.add(orgCell); |
3342 |
0
|
orgCell.setValue(null); |
3343 |
|
|
3344 |
|
|
3345 |
|
|
3346 |
0
|
Set<SearchResultCell> campusCells = campusToCellMapping.get(campusCode); |
3347 |
0
|
if(campusCells == null){ |
3348 |
0
|
campusCells = new HashSet<SearchResultCell>(); |
3349 |
0
|
campusToCellMapping.put(campusCode, campusCells); |
3350 |
|
} |
3351 |
0
|
campusCells.add(campusLocationCell); |
3352 |
0
|
campusLocationCell.setValue(null); |
3353 |
|
|
3354 |
|
|
3355 |
0
|
Set<SearchResultCell> resultCells = resultComponentToCellMapping.get(resultComponentName); |
3356 |
0
|
if(resultCells == null){ |
3357 |
0
|
resultCells = new HashSet<SearchResultCell>(); |
3358 |
0
|
resultComponentToCellMapping.put(resultComponentName, resultCells); |
3359 |
|
} |
3360 |
0
|
resultCells.add(resultComponentCell); |
3361 |
0
|
resultComponentCell.setValue(null); |
3362 |
|
|
3363 |
0
|
progIdToOrgCellMapping.put(programId, orgCell); |
3364 |
0
|
progIdToResultComponentCellMapping.put(programId, resultComponentCell); |
3365 |
0
|
progIdToCampusCellMapping.put(programId, campusLocationCell); |
3366 |
|
}else{ |
3367 |
|
|
3368 |
|
|
3369 |
0
|
Set<SearchResultCell> resultCells = resultComponentToCellMapping.get(resultComponentName); |
3370 |
0
|
if(resultCells == null){ |
3371 |
0
|
resultCells = new HashSet<SearchResultCell>(); |
3372 |
0
|
resultComponentToCellMapping.put(resultComponentName, resultCells); |
3373 |
|
} |
3374 |
0
|
resultCells.add(progIdToResultComponentCellMapping.get(programId)); |
3375 |
|
|
3376 |
|
|
3377 |
0
|
Set<SearchResultCell> orgCells = orgIdToCellMapping.get(orgId); |
3378 |
0
|
if(orgCells == null){ |
3379 |
0
|
orgCells = new HashSet<SearchResultCell>(); |
3380 |
0
|
orgIdToCellMapping.put(orgId, orgCells); |
3381 |
|
} |
3382 |
0
|
orgCells.add(progIdToOrgCellMapping.get(programId)); |
3383 |
|
|
3384 |
|
|
3385 |
0
|
Set<SearchResultCell> campusCells = campusToCellMapping.get(campusCode); |
3386 |
0
|
if(campusCells == null){ |
3387 |
0
|
campusCells = new HashSet<SearchResultCell>(); |
3388 |
0
|
campusToCellMapping.put(campusCode, campusCells); |
3389 |
|
} |
3390 |
0
|
campusCells.add(progIdToCampusCellMapping.get(programId)); |
3391 |
|
|
3392 |
|
|
3393 |
0
|
rowIter.remove(); |
3394 |
|
} |
3395 |
|
} |
3396 |
|
|
3397 |
0
|
if(!resultComponentToCellMapping.isEmpty()){ |
3398 |
0
|
List<String> resultComponentNames = new ArrayList<String>(resultComponentToCellMapping.keySet()); |
3399 |
0
|
Collections.sort(resultComponentNames); |
3400 |
0
|
for(String resultComponentName:resultComponentNames){ |
3401 |
|
|
3402 |
0
|
Set<SearchResultCell> cells = resultComponentToCellMapping.get(resultComponentName); |
3403 |
0
|
if(cells!=null){ |
3404 |
0
|
for(SearchResultCell cell:cells){ |
3405 |
0
|
if(cell.getValue()==null){ |
3406 |
0
|
cell.setValue(resultComponentName); |
3407 |
|
}else{ |
3408 |
0
|
cell.setValue(cell.getValue()+"<br/>"+resultComponentName); |
3409 |
|
} |
3410 |
|
} |
3411 |
|
} |
3412 |
|
} |
3413 |
|
} |
3414 |
|
|
3415 |
0
|
if(!campusToCellMapping.isEmpty()){ |
3416 |
0
|
List<String> campusCodes = new ArrayList<String>(campusToCellMapping.keySet()); |
3417 |
0
|
Collections.sort(campusCodes); |
3418 |
0
|
for(String campusCode:campusCodes){ |
3419 |
|
|
3420 |
0
|
Set<SearchResultCell> cells = campusToCellMapping.get(campusCode); |
3421 |
0
|
if(cells!=null){ |
3422 |
0
|
for(SearchResultCell cell:cells){ |
3423 |
0
|
if(cell.getValue()==null){ |
3424 |
0
|
cell.setValue(campusCode); |
3425 |
|
}else{ |
3426 |
0
|
cell.setValue(cell.getValue()+"<br/>"+campusCode); |
3427 |
|
} |
3428 |
|
} |
3429 |
|
} |
3430 |
|
} |
3431 |
|
} |
3432 |
|
|
3433 |
|
|
3434 |
0
|
if(!orgIdToCellMapping.isEmpty()){ |
3435 |
|
|
3436 |
0
|
SearchRequest orgIdTranslationSearchRequest = new SearchRequest("org.search.generic"); |
3437 |
0
|
orgIdTranslationSearchRequest.addParam("org.queryParam.orgOptionalIds", new ArrayList<String>(orgIdToCellMapping.keySet())); |
3438 |
0
|
orgIdTranslationSearchRequest.setSortColumn("org.resultColumn.orgShortName"); |
3439 |
0
|
SearchResult orgIdTranslationSearchResult = searchDispatcher.dispatchSearch(orgIdTranslationSearchRequest); |
3440 |
|
|
3441 |
|
|
3442 |
0
|
for(SearchResultRow row:orgIdTranslationSearchResult.getRows()){ |
3443 |
|
|
3444 |
|
|
3445 |
0
|
String orgId=""; |
3446 |
0
|
String orgName=""; |
3447 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3448 |
0
|
if("org.resultColumn.orgId".equals(cell.getKey())){ |
3449 |
0
|
orgId = cell.getValue(); |
3450 |
0
|
continue; |
3451 |
0
|
}else if("org.resultColumn.orgShortName".equals(cell.getKey())){ |
3452 |
0
|
orgName = cell.getValue(); |
3453 |
|
} |
3454 |
|
} |
3455 |
|
|
3456 |
|
|
3457 |
0
|
Set<SearchResultCell> cells = orgIdToCellMapping.get(orgId); |
3458 |
0
|
if(cells!=null){ |
3459 |
0
|
for(SearchResultCell cell:cells){ |
3460 |
0
|
if(cell.getValue()==null){ |
3461 |
0
|
cell.setValue(orgName); |
3462 |
|
}else{ |
3463 |
0
|
cell.setValue(cell.getValue()+"<br/>"+orgName); |
3464 |
|
} |
3465 |
|
} |
3466 |
|
} |
3467 |
|
} |
3468 |
|
} |
3469 |
|
|
3470 |
0
|
Collections.sort(programSearchResults.getRows(),new Comparator<SearchResultRow>(){ |
3471 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
3472 |
0
|
@Override... |
3473 |
|
public int compare(SearchResultRow row1, SearchResultRow row2) { |
3474 |
0
|
int i = 0,index =0; |
3475 |
0
|
SearchResultCell cell1 = null,cell2 = null,cell3 = null,cell4 = null; |
3476 |
|
|
3477 |
0
|
for(SearchResultCell cell : row1.getCells()){ |
3478 |
0
|
if("lu.resultColumn.luOptionalLongName".equals(cell.getKey())) |
3479 |
|
{ |
3480 |
0
|
cell1 = cell; cell2 = row2.getCells().get(index); |
3481 |
|
} |
3482 |
0
|
else if("lu.resultColumn.resultComponentId".equals(cell.getKey())) |
3483 |
|
{ |
3484 |
0
|
cell3 = cell; cell4 = row2.getCells().get(index); |
3485 |
|
} |
3486 |
0
|
index++; |
3487 |
|
} |
3488 |
0
|
if(cell1.getValue().equalsIgnoreCase(cell2.getValue())) |
3489 |
0
|
i = cell3.getValue().compareToIgnoreCase(cell4.getValue()); |
3490 |
0
|
return i; |
3491 |
|
} |
3492 |
|
|
3493 |
|
}); |
3494 |
|
|
3495 |
0
|
return programSearchResults; |
3496 |
|
} |
3497 |
|
|
3498 |
|
|
|
|
| 0% |
Uncovered Elements: 198 (198) |
Complexity: 31 |
Complexity Density: 0.21 |
|
3499 |
0
|
private SearchResult doDependencyAnalysisSearch(String cluId) throws MissingParameterException, DoesNotExistException {... |
3500 |
|
|
3501 |
0
|
checkForMissingParameter(cluId, "cluId"); |
3502 |
|
|
3503 |
0
|
Clu triggerClu = luDao.fetch(Clu.class, cluId); |
3504 |
|
|
3505 |
0
|
List<String> cluVersionIndIds = new ArrayList<String>(); |
3506 |
0
|
cluVersionIndIds.add(triggerClu.getVersion().getVersionIndId()); |
3507 |
|
|
3508 |
|
|
3509 |
0
|
List<CluSet> cluSets = luDao.getCluSetsByCluVersionIndId(cluVersionIndIds); |
3510 |
|
|
3511 |
|
|
3512 |
0
|
Map<String, CluSet> cluSetMap = new HashMap<String, CluSet>(); |
3513 |
0
|
if(cluSets!=null){ |
3514 |
0
|
for(CluSet cluSet:cluSets){ |
3515 |
0
|
cluSetMap.put(cluSet.getId(), cluSet); |
3516 |
|
} |
3517 |
|
} |
3518 |
|
|
3519 |
|
|
3520 |
0
|
List<CluSet> dynamicCluSets = luDao.getAllDynamicCluSets(); |
3521 |
0
|
if(dynamicCluSets!=null){ |
3522 |
0
|
for(CluSet cluSet:dynamicCluSets){ |
3523 |
0
|
MembershipQueryInfo queryInfo = LuServiceAssembler.toMembershipQueryInfo(cluSet.getMembershipQuery()); |
3524 |
0
|
List<String> memberCluVersionIndIds = getMembershipQuerySearchResult(queryInfo); |
3525 |
0
|
if(memberCluVersionIndIds!=null){ |
3526 |
0
|
for(String cluVersionIndId:cluVersionIndIds){ |
3527 |
0
|
if(memberCluVersionIndIds.contains(cluVersionIndId)){ |
3528 |
0
|
cluSetMap.put(cluSet.getId(),cluSet); |
3529 |
0
|
break; |
3530 |
|
} |
3531 |
|
} |
3532 |
|
} |
3533 |
|
} |
3534 |
|
} |
3535 |
|
|
3536 |
|
|
3537 |
|
|
3538 |
|
|
3539 |
|
|
3540 |
|
|
3541 |
0
|
SearchRequest statementSearchRequest = new SearchRequest("stmt.search.dependencyAnalysis"); |
3542 |
|
|
3543 |
0
|
statementSearchRequest.addParam("stmt.queryParam.cluSetIds", new ArrayList<String>(cluSetMap.keySet())); |
3544 |
0
|
statementSearchRequest.addParam("stmt.queryParam.cluVersionIndIds", cluVersionIndIds); |
3545 |
|
|
3546 |
0
|
SearchResult statementSearchResult = searchDispatcher.dispatchSearch(statementSearchRequest); |
3547 |
|
|
3548 |
|
|
3549 |
0
|
SearchResult searchResult = new SearchResult(); |
3550 |
|
|
3551 |
0
|
Map<String,List<SearchResultCell>> orgIdToCellMapping = new HashMap<String,List<SearchResultCell>>(); |
3552 |
|
|
3553 |
|
|
3554 |
|
|
3555 |
|
|
3556 |
0
|
Set<String> processed = new HashSet<String>(); |
3557 |
0
|
for(SearchResultRow stmtRow:statementSearchResult.getRows()){ |
3558 |
|
|
3559 |
|
|
3560 |
0
|
String refObjId = null; |
3561 |
0
|
String statementType = null; |
3562 |
0
|
String statementTypeName = null; |
3563 |
0
|
String rootId = null; |
3564 |
0
|
String requirementComponentIds = null; |
3565 |
|
|
3566 |
0
|
for(SearchResultCell stmtCell:stmtRow.getCells()){ |
3567 |
0
|
if("stmt.resultColumn.refObjId".equals(stmtCell.getKey())){ |
3568 |
0
|
refObjId = stmtCell.getValue(); |
3569 |
0
|
continue; |
3570 |
0
|
}else if("stmt.resultColumn.statementTypeId".equals(stmtCell.getKey())){ |
3571 |
0
|
statementType = stmtCell.getValue(); |
3572 |
0
|
continue; |
3573 |
0
|
}else if("stmt.resultColumn.statementTypeName".equals(stmtCell.getKey())){ |
3574 |
0
|
statementTypeName = stmtCell.getValue(); |
3575 |
0
|
continue; |
3576 |
0
|
}else if("stmt.resultColumn.rootId".equals(stmtCell.getKey())){ |
3577 |
0
|
rootId = stmtCell.getValue(); |
3578 |
0
|
continue; |
3579 |
0
|
}else if("stmt.resultColumn.requirementComponentIds".equals(stmtCell.getKey())){ |
3580 |
0
|
requirementComponentIds = stmtCell.getValue(); |
3581 |
|
} |
3582 |
|
} |
3583 |
|
|
3584 |
|
|
3585 |
0
|
Clu clu = luDao.fetch(Clu.class, refObjId); |
3586 |
|
|
3587 |
|
|
3588 |
0
|
if("kuali.lu.type.Requirement".equals(clu.getLuType().getId())){ |
3589 |
|
|
3590 |
0
|
List<Clu> clus = luDao.getClusByRelatedCluId(clu.getId(), "kuali.lu.lu.relation.type.hasProgramRequirement"); |
3591 |
|
|
3592 |
0
|
rootId = clu.getId(); |
3593 |
|
|
3594 |
0
|
if(clus==null||clus.size()==0){ |
3595 |
0
|
throw new RuntimeException("Statement Dependency clu found, but no parent Program exists"); |
3596 |
0
|
}else if(clus.size()>1){ |
3597 |
0
|
throw new RuntimeException("Statement Dependency clu can only have one parent Program relation"); |
3598 |
|
} |
3599 |
0
|
clu = clus.get(0); |
3600 |
|
} |
3601 |
|
|
3602 |
|
|
3603 |
0
|
String rowId = clu.getId()+"|"+statementType+"|"+rootId; |
3604 |
|
|
3605 |
0
|
if("Active".equals(clu.getState()) && !processed.contains(rowId)){ |
3606 |
|
|
3607 |
0
|
processed.add(rowId); |
3608 |
|
|
3609 |
0
|
SearchResultRow resultRow = new SearchResultRow(); |
3610 |
|
|
3611 |
|
|
3612 |
0
|
resultRow.addCell("lu.resultColumn.cluId",clu.getId()); |
3613 |
0
|
resultRow.addCell("lu.resultColumn.cluType",clu.getLuType().getId()); |
3614 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalCode",clu.getOfficialIdentifier().getCode()); |
3615 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalShortName",clu.getOfficialIdentifier().getShortName()); |
3616 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalLongName",clu.getOfficialIdentifier().getLongName()); |
3617 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyType",statementType); |
3618 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName",statementTypeName); |
3619 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyRootId",rootId); |
3620 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyRequirementComponentIds",requirementComponentIds); |
3621 |
|
|
3622 |
0
|
try{ |
3623 |
|
|
3624 |
|
|
3625 |
0
|
List<String> relatedClus = this.getCluIdsByRelation(clu.getId(), "kuali.lu.lu.relation.type.hasVariationProgram"); |
3626 |
0
|
for(String parentCluId: relatedClus){ |
3627 |
0
|
resultRow.addCell("lu.resultColumn.parentCluId", parentCluId); |
3628 |
|
} |
3629 |
|
} catch(InvalidParameterException ex){ |
3630 |
0
|
throw new RuntimeException("Error performing getCluIdsByRelation search", ex); |
3631 |
|
} catch (OperationFailedException e) { |
3632 |
0
|
throw new RuntimeException("Error performing getCluIdsByRelation search", e); |
3633 |
|
} |
3634 |
|
|
3635 |
|
|
3636 |
|
|
3637 |
0
|
SearchResultCell orgIdsCell = new SearchResultCell("lu.resultColumn.luOptionalOversightCommitteeIds",null); |
3638 |
0
|
resultRow.getCells().add(orgIdsCell); |
3639 |
|
|
3640 |
|
|
3641 |
0
|
SearchResultCell orgNamesCell = new SearchResultCell("lu.resultColumn.luOptionalOversightCommitteeNames",null); |
3642 |
0
|
resultRow.getCells().add(orgNamesCell); |
3643 |
|
|
3644 |
|
|
3645 |
|
|
3646 |
|
|
3647 |
0
|
boolean differentAdminOrg = true; |
3648 |
0
|
for(CluAdminOrg adminOrg:clu.getAdminOrgs()){ |
3649 |
0
|
if("kuali.adminOrg.type.CurriculumOversight".equals(adminOrg.getType()) || |
3650 |
|
"kuali.adminOrg.type.CurriculumOversightUnit".equals(adminOrg.getType())){ |
3651 |
|
|
3652 |
|
|
3653 |
0
|
List<SearchResultCell> cells = orgIdToCellMapping.get(adminOrg.getOrgId()); |
3654 |
0
|
if(cells == null){ |
3655 |
0
|
cells = new ArrayList<SearchResultCell>(); |
3656 |
0
|
orgIdToCellMapping.put(adminOrg.getOrgId(), cells); |
3657 |
|
} |
3658 |
0
|
cells.add(orgNamesCell); |
3659 |
|
|
3660 |
|
|
3661 |
0
|
if(orgIdsCell.getValue()==null){ |
3662 |
0
|
orgIdsCell.setValue(adminOrg.getId()); |
3663 |
|
}else{ |
3664 |
0
|
orgIdsCell.setValue(orgIdsCell.getValue()+","+adminOrg.getId()); |
3665 |
|
} |
3666 |
|
|
3667 |
0
|
for(CluAdminOrg triggerAdminOrg:triggerClu.getAdminOrgs()){ |
3668 |
0
|
if(triggerAdminOrg.getOrgId().equals(adminOrg.getOrgId())){ |
3669 |
0
|
differentAdminOrg = false; |
3670 |
|
} |
3671 |
|
} |
3672 |
|
} |
3673 |
|
} |
3674 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyRequirementDifferentAdminOrg", String.valueOf(differentAdminOrg)); |
3675 |
|
|
3676 |
|
|
3677 |
0
|
searchResult.getRows().add(resultRow); |
3678 |
|
} |
3679 |
|
} |
3680 |
|
|
3681 |
|
|
3682 |
0
|
if(!orgIdToCellMapping.isEmpty()){ |
3683 |
|
|
3684 |
0
|
SearchRequest orgIdTranslationSearchRequest = new SearchRequest("org.search.generic"); |
3685 |
0
|
orgIdTranslationSearchRequest.addParam("org.queryParam.orgOptionalIds", new ArrayList<String>(orgIdToCellMapping.keySet())); |
3686 |
0
|
SearchResult orgIdTranslationSearchResult = searchDispatcher.dispatchSearch(orgIdTranslationSearchRequest); |
3687 |
|
|
3688 |
|
|
3689 |
0
|
for(SearchResultRow row:orgIdTranslationSearchResult.getRows()){ |
3690 |
|
|
3691 |
|
|
3692 |
0
|
String orgId=""; |
3693 |
0
|
String orgName=""; |
3694 |
0
|
for(SearchResultCell cell:row.getCells()){ |
3695 |
0
|
if("org.resultColumn.orgId".equals(cell.getKey())){ |
3696 |
0
|
orgId = cell.getValue(); |
3697 |
0
|
continue; |
3698 |
0
|
}else if("org.resultColumn.orgShortName".equals(cell.getKey())){ |
3699 |
0
|
orgName = cell.getValue(); |
3700 |
|
} |
3701 |
|
} |
3702 |
|
|
3703 |
|
|
3704 |
0
|
List<SearchResultCell> cells = orgIdToCellMapping.get(orgId); |
3705 |
0
|
if(cells!=null){ |
3706 |
0
|
for(SearchResultCell cell:cells){ |
3707 |
0
|
if(cell.getValue()==null){ |
3708 |
0
|
cell.setValue(orgName); |
3709 |
|
}else{ |
3710 |
0
|
cell.setValue(cell.getValue()+", "+orgName); |
3711 |
|
} |
3712 |
|
} |
3713 |
|
} |
3714 |
|
} |
3715 |
|
} |
3716 |
|
|
3717 |
|
|
3718 |
0
|
for(CluSet cluSet:cluSetMap.values()){ |
3719 |
0
|
if(!"AdHock".equals(cluSet.getName())){ |
3720 |
|
|
3721 |
0
|
SearchResultRow resultRow = new SearchResultRow(); |
3722 |
|
|
3723 |
0
|
resultRow.addCell("lu.resultColumn.cluId",cluSet.getId()); |
3724 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalShortName",cluSet.getName()); |
3725 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalLongName",cluSet.getName()); |
3726 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyType","cluSet"); |
3727 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName", "Course Set"); |
3728 |
|
|
3729 |
0
|
searchResult.getRows().add(resultRow); |
3730 |
|
} |
3731 |
|
} |
3732 |
|
|
3733 |
|
|
3734 |
0
|
List<String> luStateList = new ArrayList(); |
3735 |
0
|
luStateList.add(DtoConstants.STATE_ACTIVE); |
3736 |
0
|
luStateList.add(DtoConstants.STATE_APPROVED); |
3737 |
0
|
List<Clu> joints = luDao.getClusByRelationSt(cluId, "kuali.lu.relation.type.co-located", luStateList); |
3738 |
0
|
if(joints!=null){ |
3739 |
0
|
for(Clu clu:joints){ |
3740 |
|
|
3741 |
0
|
SearchResultRow resultRow = new SearchResultRow(); |
3742 |
|
|
3743 |
0
|
resultRow.addCell("lu.resultColumn.cluId", clu.getId()); |
3744 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalCode", clu.getOfficialIdentifier().getCode()); |
3745 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalShortName", clu.getOfficialIdentifier().getShortName()); |
3746 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalLongName", clu.getOfficialIdentifier().getLongName()); |
3747 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyType", "joint"); |
3748 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName", "jointly offered"); |
3749 |
|
|
3750 |
0
|
searchResult.getRows().add(resultRow); |
3751 |
|
} |
3752 |
|
} |
3753 |
|
|
3754 |
|
|
3755 |
0
|
for(CluIdentifier altId:triggerClu.getAlternateIdentifiers()){ |
3756 |
0
|
if("kuali.lu.type.CreditCourse.identifier.crosslisting".equals(altId.getType())){ |
3757 |
0
|
SearchResultRow resultRow = new SearchResultRow(); |
3758 |
|
|
3759 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalCode", altId.getCode()); |
3760 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalShortName", altId.getShortName()); |
3761 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalLongName", altId.getLongName()); |
3762 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyType", "crossListed"); |
3763 |
0
|
resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName", "cross-listed"); |
3764 |
|
|
3765 |
0
|
searchResult.getRows().add(resultRow); |
3766 |
|
} |
3767 |
|
} |
3768 |
|
|
3769 |
|
|
3770 |
0
|
Collections.sort(searchResult.getRows(), new SearchResultRowComparator("lu.resultColumn.luOptionalCode")); |
3771 |
|
|
3772 |
0
|
return searchResult; |
3773 |
|
} |
3774 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 7 |
Complexity Density: 0.37 |
|
3775 |
|
public class SearchResultRowComparator implements Comparator<SearchResultRow>{ |
3776 |
|
private String sortColumn; |
3777 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3778 |
0
|
SearchResultRowComparator(String sortColumn){... |
3779 |
0
|
super(); |
3780 |
0
|
this.sortColumn = sortColumn; |
3781 |
|
} |
3782 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 6 |
Complexity Density: 0.35 |
|
3783 |
0
|
@Override... |
3784 |
|
public int compare(SearchResultRow o1, SearchResultRow o2) { |
3785 |
0
|
String o1SortValue = null; |
3786 |
0
|
String o2SortValue = null; |
3787 |
0
|
for(SearchResultCell cell:o1.getCells()){ |
3788 |
0
|
if(sortColumn.equals(cell.getKey())){ |
3789 |
0
|
o1SortValue = cell.getValue(); |
3790 |
0
|
break; |
3791 |
|
} |
3792 |
|
} |
3793 |
0
|
for(SearchResultCell cell:o2.getCells()){ |
3794 |
0
|
if(sortColumn.equals(cell.getKey())){ |
3795 |
0
|
o2SortValue = cell.getValue(); |
3796 |
0
|
break; |
3797 |
|
} |
3798 |
|
} |
3799 |
0
|
if(o1SortValue!=null){ |
3800 |
0
|
if(o2SortValue==null){ |
3801 |
0
|
return 1; |
3802 |
|
} |
3803 |
0
|
return o1SortValue.compareTo(o2SortValue); |
3804 |
0
|
}if(o2SortValue==null){ |
3805 |
0
|
return 0; |
3806 |
|
} |
3807 |
0
|
return -1; |
3808 |
|
} |
3809 |
|
|
3810 |
|
} |
3811 |
|
|
3812 |
|
|
3813 |
|
|
3814 |
|
|
3815 |
|
@param |
3816 |
|
@param |
3817 |
|
|
3818 |
|
@throws |
3819 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
3820 |
5198
|
private void checkForMissingParameter(Object param, String paramName)... |
3821 |
|
throws MissingParameterException { |
3822 |
5198
|
if (param == null) { |
3823 |
27
|
throw new MissingParameterException(paramName + " can not be null"); |
3824 |
|
} |
3825 |
|
} |
3826 |
|
|
3827 |
|
|
3828 |
|
@param |
3829 |
|
@param |
3830 |
|
@throws |
3831 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 4 |
Complexity Density: 2 |
|
3832 |
214
|
private void checkForEmptyList(Object param, String paramName)... |
3833 |
|
throws MissingParameterException { |
3834 |
214
|
if (param != null && param instanceof List<?> |
3835 |
|
&& ((List<?>) param).size() == 0) { |
3836 |
0
|
throw new MissingParameterException(paramName |
3837 |
|
+ " can not be an empty list"); |
3838 |
|
} |
3839 |
|
} |
3840 |
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
3841 |
7
|
@Override... |
3842 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
3843 |
|
public StatusInfo addCluSetsToCluSet(String cluSetId, List<String> cluSetIdList) |
3844 |
|
throws CircularRelationshipException, |
3845 |
|
DoesNotExistException, InvalidParameterException, |
3846 |
|
MissingParameterException, OperationFailedException, |
3847 |
|
PermissionDeniedException, UnsupportedActionException { |
3848 |
|
|
3849 |
7
|
checkForMissingParameter(cluSetId, "cluSetId"); |
3850 |
7
|
checkForMissingParameter(cluSetIdList, "cluSetIdList"); |
3851 |
|
|
3852 |
|
|
3853 |
7
|
luDao.fetch(CluSet.class, cluSetId); |
3854 |
|
|
3855 |
7
|
for(String cluSetIdToAdd : cluSetIdList) { |
3856 |
19
|
StatusInfo status = addCluSetToCluSet(cluSetId, cluSetIdToAdd); |
3857 |
15
|
if (!status.getSuccess()) { |
3858 |
0
|
return status; |
3859 |
|
} |
3860 |
|
} |
3861 |
|
|
3862 |
3
|
StatusInfo statusInfo = new StatusInfo(); |
3863 |
3
|
statusInfo.setSuccess(true); |
3864 |
|
|
3865 |
3
|
return statusInfo; |
3866 |
|
} |
3867 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
3868 |
4
|
@Override... |
3869 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
3870 |
|
public StatusInfo addClusToCluSet(List<String> cluIdList, String cluSetId) |
3871 |
|
throws DoesNotExistException, InvalidParameterException, |
3872 |
|
MissingParameterException, OperationFailedException, |
3873 |
|
PermissionDeniedException, UnsupportedActionException { |
3874 |
|
|
3875 |
4
|
checkForMissingParameter(cluIdList, "cluIdList"); |
3876 |
4
|
checkForMissingParameter(cluSetId, "cluSetId"); |
3877 |
|
|
3878 |
4
|
for(String cluId : cluIdList) { |
3879 |
11
|
StatusInfo status = addCluToCluSet(cluId, cluSetId); |
3880 |
8
|
if (!status.getSuccess()) { |
3881 |
0
|
return status; |
3882 |
|
} |
3883 |
|
} |
3884 |
|
|
3885 |
1
|
StatusInfo statusInfo = new StatusInfo(); |
3886 |
1
|
statusInfo.setSuccess(true); |
3887 |
|
|
3888 |
1
|
return statusInfo; |
3889 |
|
} |
3890 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3891 |
0
|
public ValidatorFactory getValidatorFactory() {... |
3892 |
0
|
return validatorFactory; |
3893 |
|
} |
3894 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3895 |
3
|
public void setValidatorFactory(ValidatorFactory validatorFactory) {... |
3896 |
3
|
this.validatorFactory = validatorFactory; |
3897 |
|
} |
3898 |
|
|
3899 |
|
|
3900 |
|
|
|
|
| 88% |
Uncovered Elements: 3 (25) |
Complexity: 4 |
Complexity Density: 0.16 |
|
3901 |
18
|
@Override... |
3902 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
3903 |
|
public CluInfo createNewCluVersion(String versionIndCluId, String versionComment) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { |
3904 |
18
|
Clu latestClu; |
3905 |
18
|
Clu currentClu; |
3906 |
18
|
try{ |
3907 |
18
|
latestClu = luDao.getLatestCluVersion(versionIndCluId); |
3908 |
|
}catch(NoResultException e){ |
3909 |
0
|
throw new DoesNotExistException("There are no matching versions of this clu", e); |
3910 |
|
} |
3911 |
18
|
try{ |
3912 |
18
|
currentClu = luDao.getCurrentCluVersion(versionIndCluId); |
3913 |
|
}catch(NoResultException e){ |
3914 |
0
|
throw new DoesNotExistException("There is no current version of this clu. Only current clus can be versioned. Use setCurrentCluVersion to make a clu current.", e); |
3915 |
|
} |
3916 |
|
|
3917 |
18
|
CluInfo cluInfo = LuServiceAssembler.toCluInfo(currentClu); |
3918 |
|
|
3919 |
|
|
3920 |
18
|
clearCluIds(cluInfo); |
3921 |
|
|
3922 |
|
|
3923 |
18
|
CluInfo newClu = null; |
3924 |
|
|
3925 |
18
|
try { |
3926 |
18
|
Clu clu = toCluForCreate(cluInfo.getType(), cluInfo); |
3927 |
|
|
3928 |
18
|
Version version = new Version(); |
3929 |
18
|
version.setSequenceNumber(latestClu.getVersion().getSequenceNumber() + 1); |
3930 |
18
|
version.setVersionIndId(versionIndCluId); |
3931 |
18
|
version.setCurrentVersionStart(null); |
3932 |
18
|
version.setCurrentVersionEnd(null); |
3933 |
18
|
version.setVersionComment(versionComment); |
3934 |
18
|
version.setVersionedFromId(currentClu.getId()); |
3935 |
18
|
clu.setVersion(version); |
3936 |
18
|
luDao.create(clu); |
3937 |
18
|
newClu = LuServiceAssembler.toCluInfo(clu); |
3938 |
|
} catch (AlreadyExistsException e) { |
3939 |
0
|
throw new OperationFailedException("Error creating a new clu version", e); |
3940 |
|
} |
3941 |
|
|
3942 |
18
|
return newClu; |
3943 |
|
} |
3944 |
|
|
|
|
| 96.7% |
Uncovered Elements: 1 (30) |
Complexity: 4 |
Complexity Density: 0.17 |
|
3945 |
18
|
private void clearCluIds(CluInfo clu) {... |
3946 |
|
|
3947 |
18
|
clu.setState(DtoConstants.STATE_DRAFT); |
3948 |
18
|
clu.setId(null); |
3949 |
|
|
3950 |
18
|
if(clu.getAccountingInfo()!=null){ |
3951 |
10
|
clu.getAccountingInfo().setId(null); |
3952 |
|
|
3953 |
10
|
for(AffiliatedOrgInfo affiliatedOrg:clu.getAccountingInfo().getAffiliatedOrgs()){ |
3954 |
16
|
affiliatedOrg.setId(null); |
3955 |
|
} |
3956 |
|
} |
3957 |
18
|
for(AccreditationInfo accredation:clu.getAccreditations()){ |
3958 |
8
|
accredation.setId(null); |
3959 |
|
} |
3960 |
18
|
for(AdminOrgInfo adminOrg:clu.getAdminOrgs()){ |
3961 |
174
|
adminOrg.setId(null); |
3962 |
|
} |
3963 |
18
|
for(CluIdentifierInfo alternateIdentifier:clu.getAlternateIdentifiers()){ |
3964 |
34
|
alternateIdentifier.setId(null); |
3965 |
|
} |
3966 |
18
|
if(clu.getFeeInfo()!=null){ |
3967 |
10
|
clu.getFeeInfo().setId(null); |
3968 |
10
|
for(CluFeeRecordInfo cluFeeRecord:clu.getFeeInfo().getCluFeeRecords()){ |
3969 |
36
|
cluFeeRecord.setId(null); |
3970 |
36
|
for(AffiliatedOrgInfo affiliatedOrg:cluFeeRecord.getAffiliatedOrgs()){ |
3971 |
40
|
affiliatedOrg.setId(null); |
3972 |
|
} |
3973 |
36
|
for(CurrencyAmountInfo feeAmount:cluFeeRecord.getFeeAmounts()){ |
3974 |
38
|
feeAmount.setId(null); |
3975 |
|
} |
3976 |
|
} |
3977 |
|
} |
3978 |
18
|
for(LuCodeInfo luCode:clu.getLuCodes()){ |
3979 |
36
|
luCode.setId(null); |
3980 |
|
} |
3981 |
18
|
if(clu.getOfficialIdentifier()!=null){ |
3982 |
18
|
clu.getOfficialIdentifier().setId(null); |
3983 |
|
} |
3984 |
|
} |
3985 |
|
|
3986 |
|
|
3987 |
|
|
3988 |
|
|
3989 |
|
@param |
3990 |
|
|
3991 |
|
|
|
|
| 71.4% |
Uncovered Elements: 12 (42) |
Complexity: 10 |
Complexity Density: 0.33 |
|
3992 |
8
|
@Override... |
3993 |
|
@Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
3994 |
|
public StatusInfo setCurrentCluVersion(String cluVersionId, Date currentVersionStart) throws DoesNotExistException, InvalidParameterException, MissingParameterException, IllegalVersionSequencingException, OperationFailedException, PermissionDeniedException { |
3995 |
|
|
3996 |
8
|
Date currentDbDate = new Date(); |
3997 |
8
|
if(currentVersionStart!=null&¤tVersionStart.compareTo(currentDbDate)<0){ |
3998 |
1
|
throw new InvalidParameterException("currentVersionStart must be in the future."); |
3999 |
|
} |
4000 |
|
|
4001 |
7
|
if(currentVersionStart==null){ |
4002 |
5
|
currentVersionStart = currentDbDate; |
4003 |
|
} |
4004 |
|
|
4005 |
|
|
4006 |
7
|
Clu clu = luDao.fetch(Clu.class, cluVersionId); |
4007 |
7
|
String versionIndId = clu.getVersion().getVersionIndId(); |
4008 |
|
|
4009 |
7
|
Clu oldClu = null; |
4010 |
7
|
try{ |
4011 |
7
|
oldClu = luDao.getCurrentCluVersion(versionIndId); |
4012 |
|
}catch(NoResultException e){} |
4013 |
|
|
4014 |
|
|
4015 |
7
|
if(oldClu!=null){ |
4016 |
7
|
if(clu.getVersion().getSequenceNumber()<=oldClu.getVersion().getSequenceNumber()){ |
4017 |
0
|
throw new OperationFailedException("Clu to make current must have been versioned from the current Clu"); |
4018 |
|
} |
4019 |
|
}else{ |
4020 |
|
|
4021 |
0
|
currentVersionStart = currentDbDate; |
4022 |
|
} |
4023 |
|
|
4024 |
|
|
4025 |
|
|
4026 |
7
|
List<VersionDisplayInfo> versionsInFuture = luDao.getVersionsInDateRange(versionIndId, null, currentDbDate, null); |
4027 |
7
|
for(VersionDisplayInfo versionInFuture:versionsInFuture){ |
4028 |
0
|
if(oldClu==null || !versionInFuture.getId().equals(oldClu.getId())){ |
4029 |
0
|
VersionEntity futureClu = luDao.fetch(Clu.class, versionInFuture.getId()); |
4030 |
0
|
futureClu.getVersion().setCurrentVersionStart(null); |
4031 |
0
|
futureClu.getVersion().setCurrentVersionEnd(null); |
4032 |
0
|
futureClu = luDao.update(futureClu); |
4033 |
|
} |
4034 |
|
} |
4035 |
|
|
4036 |
|
|
4037 |
7
|
if(oldClu!=null){ |
4038 |
7
|
oldClu.getVersion().setCurrentVersionEnd(currentVersionStart); |
4039 |
7
|
oldClu = luDao.update(oldClu); |
4040 |
|
} |
4041 |
|
|
4042 |
|
|
4043 |
7
|
clu.getVersion().setCurrentVersionStart(currentVersionStart); |
4044 |
7
|
clu.getVersion().setCurrentVersionEnd(null); |
4045 |
7
|
clu = luDao.update(clu); |
4046 |
|
|
4047 |
7
|
StatusInfo statusInfo = new StatusInfo(); |
4048 |
7
|
statusInfo.setSuccess(true); |
4049 |
7
|
return statusInfo; |
4050 |
|
} |
4051 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4052 |
0
|
@Override... |
4053 |
|
@Transactional(readOnly=true) |
4054 |
|
public VersionDisplayInfo getLatestVersion(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4055 |
0
|
VersionDisplayInfo versionInfo = null; |
4056 |
0
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4057 |
0
|
try{ |
4058 |
0
|
versionInfo = luDao.getLatestVersion(refObjectId, refObjectTypeURI); |
4059 |
|
}catch(NoResultException e){ |
4060 |
0
|
throw new DoesNotExistException(); |
4061 |
|
} |
4062 |
|
}else{ |
4063 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4064 |
|
} |
4065 |
0
|
return versionInfo; |
4066 |
|
} |
4067 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4068 |
25
|
@Override... |
4069 |
|
@Transactional(readOnly=true) |
4070 |
|
public VersionDisplayInfo getCurrentVersion(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4071 |
25
|
VersionDisplayInfo versionInfo = null; |
4072 |
25
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4073 |
25
|
try{ |
4074 |
25
|
versionInfo = luDao.getCurrentCluVersionInfo(refObjectId, refObjectTypeURI); |
4075 |
|
}catch(NoResultException e){ |
4076 |
0
|
throw new DoesNotExistException(); |
4077 |
|
} |
4078 |
|
}else{ |
4079 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4080 |
|
} |
4081 |
25
|
return versionInfo; |
4082 |
|
} |
4083 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4084 |
3
|
@Override... |
4085 |
|
@Transactional(readOnly=true) |
4086 |
|
public VersionDisplayInfo getCurrentVersionOnDate(String refObjectTypeURI, String refObjectId, Date date) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4087 |
3
|
VersionDisplayInfo versionInfo = null; |
4088 |
3
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4089 |
3
|
try{ |
4090 |
3
|
versionInfo = luDao.getCurrentVersionOnDate(refObjectId, refObjectTypeURI, date); |
4091 |
|
}catch(NoResultException e){ |
4092 |
0
|
throw new DoesNotExistException(); |
4093 |
|
} |
4094 |
|
}else{ |
4095 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4096 |
|
} |
4097 |
3
|
return versionInfo; |
4098 |
|
} |
4099 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4100 |
1
|
@Override... |
4101 |
|
@Transactional(readOnly=true) |
4102 |
|
public VersionDisplayInfo getFirstVersion(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4103 |
1
|
VersionDisplayInfo versionInfo = null; |
4104 |
1
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4105 |
1
|
try{ |
4106 |
1
|
versionInfo = luDao.getFirstVersion(refObjectId, refObjectTypeURI); |
4107 |
|
}catch(NoResultException e){ |
4108 |
0
|
throw new DoesNotExistException(); |
4109 |
|
} |
4110 |
|
}else{ |
4111 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4112 |
|
} |
4113 |
1
|
return versionInfo; |
4114 |
|
} |
4115 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4116 |
1
|
@Override... |
4117 |
|
@Transactional(readOnly=true) |
4118 |
|
public VersionDisplayInfo getVersionBySequenceNumber(String refObjectTypeURI, String refObjectId, Long sequence) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4119 |
1
|
VersionDisplayInfo versionInfo = null; |
4120 |
1
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4121 |
1
|
try{ |
4122 |
1
|
versionInfo = luDao.getVersionBySequenceNumber(refObjectId, refObjectTypeURI, sequence); |
4123 |
|
}catch(NoResultException e){ |
4124 |
0
|
throw new DoesNotExistException(); |
4125 |
|
} |
4126 |
|
}else{ |
4127 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4128 |
|
} |
4129 |
1
|
return versionInfo; |
4130 |
|
} |
4131 |
|
|
|
|
| 63.6% |
Uncovered Elements: 4 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4132 |
2
|
@Override... |
4133 |
|
@Transactional(readOnly=true) |
4134 |
|
public List<VersionDisplayInfo> getVersions(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4135 |
2
|
List<VersionDisplayInfo> versionInfos = null; |
4136 |
2
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4137 |
2
|
versionInfos = luDao.getVersions(refObjectId, refObjectTypeURI); |
4138 |
2
|
if(versionInfos==null){ |
4139 |
0
|
versionInfos = Collections.<VersionDisplayInfo>emptyList(); |
4140 |
|
} |
4141 |
|
}else{ |
4142 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4143 |
|
} |
4144 |
2
|
return versionInfos; |
4145 |
|
} |
4146 |
|
|
|
|
| 63.6% |
Uncovered Elements: 4 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4147 |
1
|
@Override... |
4148 |
|
@Transactional(readOnly=true) |
4149 |
|
public List<VersionDisplayInfo> getVersionsInDateRange(String refObjectTypeURI, String refObjectId, Date from, Date to) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
4150 |
1
|
List<VersionDisplayInfo> versionInfos = null; |
4151 |
1
|
if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
4152 |
1
|
versionInfos = luDao.getVersionsInDateRange(refObjectId, refObjectTypeURI, from, to); |
4153 |
1
|
if(versionInfos==null){ |
4154 |
0
|
versionInfos = Collections.<VersionDisplayInfo>emptyList(); |
4155 |
|
} |
4156 |
|
}else{ |
4157 |
0
|
throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
4158 |
|
} |
4159 |
1
|
return versionInfos; |
4160 |
|
} |
4161 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4162 |
1
|
public void setSearchDispatcher(SearchDispatcher searchDispatcher) {... |
4163 |
1
|
this.searchDispatcher = searchDispatcher; |
4164 |
|
} |
4165 |
|
} |