| 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.HashMap; |
| 20 |
|
import java.util.List; |
| 21 |
|
import java.util.Map; |
| 22 |
|
import java.util.Map.Entry; |
| 23 |
|
|
| 24 |
|
import org.kuali.student.core.dto.AmountInfo; |
| 25 |
|
import org.kuali.student.core.dto.CurrencyAmountInfo; |
| 26 |
|
import org.kuali.student.core.dto.TimeAmountInfo; |
| 27 |
|
import org.kuali.student.core.entity.Amount; |
| 28 |
|
import org.kuali.student.core.entity.CurrencyAmount; |
| 29 |
|
import org.kuali.student.core.entity.TimeAmount; |
| 30 |
|
import org.kuali.student.core.exceptions.DoesNotExistException; |
| 31 |
|
import org.kuali.student.core.exceptions.InvalidParameterException; |
| 32 |
|
import org.kuali.student.core.exceptions.VersionMismatchException; |
| 33 |
|
import org.kuali.student.core.search.dto.SearchParam; |
| 34 |
|
import org.kuali.student.core.service.impl.BaseAssembler; |
| 35 |
|
import org.kuali.student.lum.lrc.dto.ResultComponentTypeInfo; |
| 36 |
|
import org.kuali.student.lum.lu.dao.LuDao; |
| 37 |
|
import org.kuali.student.lum.lu.dto.AccreditationInfo; |
| 38 |
|
import org.kuali.student.lum.lu.dto.AdminOrgInfo; |
| 39 |
|
import org.kuali.student.lum.lu.dto.AffiliatedOrgInfo; |
| 40 |
|
import org.kuali.student.lum.lu.dto.CluAccountingInfo; |
| 41 |
|
import org.kuali.student.lum.lu.dto.CluCluRelationInfo; |
| 42 |
|
import org.kuali.student.lum.lu.dto.CluCreditInfo; |
| 43 |
|
import org.kuali.student.lum.lu.dto.CluFeeInfo; |
| 44 |
|
import org.kuali.student.lum.lu.dto.CluFeeRecordInfo; |
| 45 |
|
import org.kuali.student.lum.lu.dto.CluIdentifierInfo; |
| 46 |
|
import org.kuali.student.lum.lu.dto.CluInfo; |
| 47 |
|
import org.kuali.student.lum.lu.dto.CluInstructorInfo; |
| 48 |
|
import org.kuali.student.lum.lu.dto.CluLoRelationInfo; |
| 49 |
|
import org.kuali.student.lum.lu.dto.CluLoRelationTypeInfo; |
| 50 |
|
import org.kuali.student.lum.lu.dto.CluPublicationInfo; |
| 51 |
|
import org.kuali.student.lum.lu.dto.CluResultInfo; |
| 52 |
|
import org.kuali.student.lum.lu.dto.CluResultTypeInfo; |
| 53 |
|
import org.kuali.student.lum.lu.dto.CluSetInfo; |
| 54 |
|
import org.kuali.student.lum.lu.dto.CluSetTypeInfo; |
| 55 |
|
import org.kuali.student.lum.lu.dto.DeliveryMethodTypeInfo; |
| 56 |
|
import org.kuali.student.lum.lu.dto.FieldInfo; |
| 57 |
|
import org.kuali.student.lum.lu.dto.InstructionalFormatTypeInfo; |
| 58 |
|
import org.kuali.student.lum.lu.dto.LuCodeInfo; |
| 59 |
|
import org.kuali.student.lum.lu.dto.LuCodeTypeInfo; |
| 60 |
|
import org.kuali.student.lum.lu.dto.LuLuRelationTypeInfo; |
| 61 |
|
import org.kuali.student.lum.lu.dto.LuPublicationTypeInfo; |
| 62 |
|
import org.kuali.student.lum.lu.dto.LuTypeInfo; |
| 63 |
|
import org.kuali.student.lum.lu.dto.LuiInfo; |
| 64 |
|
import org.kuali.student.lum.lu.dto.LuiLuiRelationInfo; |
| 65 |
|
import org.kuali.student.lum.lu.dto.MembershipQueryInfo; |
| 66 |
|
import org.kuali.student.lum.lu.dto.ResultOptionInfo; |
| 67 |
|
import org.kuali.student.lum.lu.dto.ResultUsageTypeInfo; |
| 68 |
|
import org.kuali.student.lum.lu.entity.AffiliatedOrg; |
| 69 |
|
import org.kuali.student.lum.lu.entity.Clu; |
| 70 |
|
import org.kuali.student.lum.lu.entity.CluAccounting; |
| 71 |
|
import org.kuali.student.lum.lu.entity.CluAccreditation; |
| 72 |
|
import org.kuali.student.lum.lu.entity.CluAdminOrg; |
| 73 |
|
import org.kuali.student.lum.lu.entity.CluAtpTypeKey; |
| 74 |
|
import org.kuali.student.lum.lu.entity.CluCampusLocation; |
| 75 |
|
import org.kuali.student.lum.lu.entity.CluCluRelation; |
| 76 |
|
import org.kuali.student.lum.lu.entity.CluCredit; |
| 77 |
|
import org.kuali.student.lum.lu.entity.CluFee; |
| 78 |
|
import org.kuali.student.lum.lu.entity.CluFeeAmount; |
| 79 |
|
import org.kuali.student.lum.lu.entity.CluFeeAttribute; |
| 80 |
|
import org.kuali.student.lum.lu.entity.CluFeeRecord; |
| 81 |
|
import org.kuali.student.lum.lu.entity.CluFeeRecordAttribute; |
| 82 |
|
import org.kuali.student.lum.lu.entity.CluIdentifier; |
| 83 |
|
import org.kuali.student.lum.lu.entity.CluIdentifierAttribute; |
| 84 |
|
import org.kuali.student.lum.lu.entity.CluInstructor; |
| 85 |
|
import org.kuali.student.lum.lu.entity.CluLoRelation; |
| 86 |
|
import org.kuali.student.lum.lu.entity.CluLoRelationType; |
| 87 |
|
import org.kuali.student.lum.lu.entity.CluPublication; |
| 88 |
|
import org.kuali.student.lum.lu.entity.CluPublicationVariant; |
| 89 |
|
import org.kuali.student.lum.lu.entity.CluResult; |
| 90 |
|
import org.kuali.student.lum.lu.entity.CluResultType; |
| 91 |
|
import org.kuali.student.lum.lu.entity.CluSet; |
| 92 |
|
import org.kuali.student.lum.lu.entity.CluSetAttribute; |
| 93 |
|
import org.kuali.student.lum.lu.entity.CluSetJoinVersionIndClu; |
| 94 |
|
import org.kuali.student.lum.lu.entity.CluSetType; |
| 95 |
|
import org.kuali.student.lum.lu.entity.DeliveryMethodType; |
| 96 |
|
import org.kuali.student.lum.lu.entity.InstructionalFormatType; |
| 97 |
|
import org.kuali.student.lum.lu.entity.LuCode; |
| 98 |
|
import org.kuali.student.lum.lu.entity.LuCodeType; |
| 99 |
|
import org.kuali.student.lum.lu.entity.LuLuRelationType; |
| 100 |
|
import org.kuali.student.lum.lu.entity.LuPublicationType; |
| 101 |
|
import org.kuali.student.lum.lu.entity.LuRichText; |
| 102 |
|
import org.kuali.student.lum.lu.entity.LuType; |
| 103 |
|
import org.kuali.student.lum.lu.entity.Lui; |
| 104 |
|
import org.kuali.student.lum.lu.entity.LuiAttribute; |
| 105 |
|
import org.kuali.student.lum.lu.entity.LuiLuiRelation; |
| 106 |
|
import org.kuali.student.lum.lu.entity.MembershipQuery; |
| 107 |
|
import org.kuali.student.lum.lu.entity.ResultOption; |
| 108 |
|
import org.kuali.student.lum.lu.entity.ResultUsageType; |
| 109 |
|
import org.kuali.student.lum.lu.entity.SearchParameter; |
| 110 |
|
import org.kuali.student.lum.lu.entity.SearchParameterValue; |
| 111 |
|
import org.springframework.beans.BeanUtils; |
| 112 |
|
|
|
|
|
| 76.1% |
Uncovered Elements: 207 (867) |
Complexity: 174 |
Complexity Density: 0.29 |
|
| 113 |
|
public class LuServiceAssembler extends BaseAssembler { |
| 114 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 115 |
0
|
public static List<CluLoRelationTypeInfo> toCluLoRelationTypeInfos(... |
| 116 |
|
List<CluLoRelationType> entities) { |
| 117 |
0
|
return toGenericTypeInfoList(CluLoRelationTypeInfo.class, entities); |
| 118 |
|
} |
| 119 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 120 |
0
|
public static CluLoRelationTypeInfo toCluLoRelationTypeInfo(... |
| 121 |
|
CluLoRelationType entity) { |
| 122 |
0
|
return toGenericTypeInfo(CluLoRelationTypeInfo.class, entity); |
| 123 |
|
} |
| 124 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 125 |
80
|
public static List<CluCluRelationInfo> toCluCluRelationInfos(... |
| 126 |
|
List<CluCluRelation> entities) { |
| 127 |
80
|
List<CluCluRelationInfo> dtos = new ArrayList<CluCluRelationInfo>( |
| 128 |
|
entities.size()); |
| 129 |
80
|
if (entities != null) { |
| 130 |
80
|
for (CluCluRelation entity : entities) { |
| 131 |
206
|
dtos.add(toCluCluRelationInfo(entity)); |
| 132 |
|
} |
| 133 |
|
} |
| 134 |
80
|
return dtos; |
| 135 |
|
|
| 136 |
|
} |
| 137 |
|
|
|
|
|
| 84.6% |
Uncovered Elements: 2 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
| 138 |
391
|
public static CluCluRelationInfo toCluCluRelationInfo(CluCluRelation entity) {... |
| 139 |
391
|
if (entity == null) { |
| 140 |
0
|
return null; |
| 141 |
|
} |
| 142 |
391
|
CluCluRelationInfo dto = new CluCluRelationInfo(); |
| 143 |
391
|
BeanUtils.copyProperties(entity, dto, |
| 144 |
|
new String[] { "cluId", "relatedCluId", "cluRelationRequired", |
| 145 |
|
"attributes", "metaInfo" }); |
| 146 |
|
|
| 147 |
391
|
dto.setIsCluRelationRequired(entity.isCluRelationRequired()); |
| 148 |
391
|
dto.setCluId(entity.getClu().getId()); |
| 149 |
391
|
dto.setRelatedCluId(entity.getRelatedClu().getId()); |
| 150 |
391
|
dto.setType(entity.getLuLuRelationType().getId()); |
| 151 |
391
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 152 |
391
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 153 |
|
|
| 154 |
391
|
return dto; |
| 155 |
|
|
| 156 |
|
} |
| 157 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 158 |
185
|
public static List<CluLoRelationInfo> toCluLoRelationInfos(... |
| 159 |
|
List<CluLoRelation> entities) { |
| 160 |
|
|
| 161 |
185
|
List<CluLoRelationInfo> dtos = new ArrayList<CluLoRelationInfo>( |
| 162 |
|
entities.size()); |
| 163 |
185
|
if (entities != null) { |
| 164 |
185
|
for (CluLoRelation entity : entities) { |
| 165 |
107
|
dtos.add(toCluLoRelationInfo(entity)); |
| 166 |
|
} |
| 167 |
|
} |
| 168 |
185
|
return dtos; |
| 169 |
|
} |
| 170 |
|
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 171 |
210
|
public static CluLoRelationInfo toCluLoRelationInfo(CluLoRelation entity) {... |
| 172 |
210
|
if (entity == null) { |
| 173 |
0
|
return null; |
| 174 |
|
} |
| 175 |
210
|
CluLoRelationInfo dto = new CluLoRelationInfo(); |
| 176 |
210
|
BeanUtils.copyProperties(entity, dto, new String[] { "cluId", |
| 177 |
|
"attributes", "metaInfo", "type" }); |
| 178 |
|
|
| 179 |
210
|
dto.setCluId(entity.getClu().getId()); |
| 180 |
210
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 181 |
210
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 182 |
210
|
dto.setType(entity.getType().getId()); |
| 183 |
|
|
| 184 |
210
|
return dto; |
| 185 |
|
} |
| 186 |
|
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 187 |
72
|
public static List<CluInfo> toCluInfos(List<Clu> entities) {... |
| 188 |
|
|
| 189 |
|
|
| 190 |
72
|
if (entities == null) { |
| 191 |
0
|
return new ArrayList<CluInfo>(0); |
| 192 |
|
} |
| 193 |
|
|
| 194 |
72
|
List<CluInfo> dtos = new ArrayList<CluInfo>(entities.size()); |
| 195 |
72
|
for (Clu entity : entities) { |
| 196 |
116
|
dtos.add(toCluInfo(entity)); |
| 197 |
|
} |
| 198 |
72
|
return dtos; |
| 199 |
|
|
| 200 |
|
} |
| 201 |
|
|
|
|
|
| 89.2% |
Uncovered Elements: 4 (37) |
Complexity: 4 |
Complexity Density: 0.13 |
|
| 202 |
553
|
public static CluInfo toCluInfo(Clu entity) {... |
| 203 |
553
|
if (entity == null) { |
| 204 |
0
|
return null; |
| 205 |
|
} |
| 206 |
553
|
CluInfo dto = new CluInfo(); |
| 207 |
|
|
| 208 |
|
|
| 209 |
553
|
BeanUtils.copyProperties(entity, dto, new String[] { |
| 210 |
|
"officialIdentifier", "alternateIdentifiers", "descr", |
| 211 |
|
"participatingOrgs", "primaryInstructor", "instructors", |
| 212 |
|
"stdDuration", "luCodes", "credit", "offeredAtpTypes", "fee", |
| 213 |
|
"accounting", "intensity", |
| 214 |
|
"campusLocationList", "accreditationList", |
| 215 |
|
"adminOrgs", "attributes", "metaInfo", "versionInfo" }); |
| 216 |
553
|
dto.setOfficialIdentifier(toCluIdentifierInfo(entity |
| 217 |
|
.getOfficialIdentifier())); |
| 218 |
553
|
dto.setAlternateIdentifiers(toCluIdentifierInfos(entity |
| 219 |
|
.getAlternateIdentifiers())); |
| 220 |
553
|
dto.setDescr(toRichTextInfo(entity.getDescr())); |
| 221 |
|
|
| 222 |
|
|
| 223 |
|
|
| 224 |
553
|
dto.setAccreditations(toAccreditationInfos(entity.getAccreditations())); |
| 225 |
|
|
| 226 |
553
|
dto.setAdminOrgs(toCluAdminOrgInfos(entity |
| 227 |
|
.getAdminOrgs())); |
| 228 |
|
|
| 229 |
553
|
dto.setPrimaryInstructor(toCluInstructorInfo(entity |
| 230 |
|
.getPrimaryInstructor())); |
| 231 |
553
|
dto.setInstructors(toCluInstructorInfos(entity.getInstructors())); |
| 232 |
553
|
dto.setStdDuration(toTimeAmountInfo(entity.getStdDuration())); |
| 233 |
553
|
dto.setLuCodes(toLuCodeInfos(entity.getLuCodes())); |
| 234 |
|
|
| 235 |
553
|
if (entity.getOfferedAtpTypes() != null) { |
| 236 |
553
|
List<String> offeredAtpTypes = new ArrayList<String>(entity |
| 237 |
|
.getOfferedAtpTypes().size()); |
| 238 |
553
|
for (CluAtpTypeKey key : entity.getOfferedAtpTypes()) { |
| 239 |
315
|
offeredAtpTypes.add(key.getAtpTypeKey()); |
| 240 |
|
} |
| 241 |
553
|
dto.setOfferedAtpTypes(offeredAtpTypes); |
| 242 |
|
} |
| 243 |
|
|
| 244 |
553
|
dto.setFeeInfo(toCluFeeInfo(entity.getFee())); |
| 245 |
553
|
dto.setAccountingInfo(toCluAccountingInfo(entity.getAccounting())); |
| 246 |
|
|
| 247 |
553
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 248 |
553
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 249 |
|
|
| 250 |
553
|
dto.setType(entity.getLuType().getId()); |
| 251 |
|
|
| 252 |
553
|
if (entity.getCampusLocations() != null) { |
| 253 |
553
|
List<String> campusLocations = new ArrayList<String>(entity |
| 254 |
|
.getCampusLocations().size()); |
| 255 |
553
|
for (CluCampusLocation cluCamp : entity.getCampusLocations()) { |
| 256 |
448
|
campusLocations.add(cluCamp.getCampusLocation()); |
| 257 |
|
} |
| 258 |
553
|
dto.setCampusLocations(campusLocations); |
| 259 |
|
} |
| 260 |
|
|
| 261 |
553
|
dto.setIntensity(toAmountInfo(entity.getIntensity())); |
| 262 |
|
|
| 263 |
553
|
dto.setVersionInfo(toVersionInfo(entity.getVersion())); |
| 264 |
|
|
| 265 |
553
|
return dto; |
| 266 |
|
|
| 267 |
|
} |
| 268 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 269 |
4
|
public static List<CluSetInfo> toCluSetInfos(List<CluSet> entities) {... |
| 270 |
4
|
List<CluSetInfo> dtos = new ArrayList<CluSetInfo>(entities.size()); |
| 271 |
4
|
if (entities != null) { |
| 272 |
4
|
for (CluSet entity : entities) { |
| 273 |
7
|
dtos.add(toCluSetInfo(entity)); |
| 274 |
|
} |
| 275 |
|
} |
| 276 |
4
|
return dtos; |
| 277 |
|
} |
| 278 |
|
|
|
|
|
| 89.5% |
Uncovered Elements: 2 (19) |
Complexity: 2 |
Complexity Density: 0.12 |
|
| 279 |
36
|
public static CluSet toCluSetEntity(CluSetInfo cluSetInfo, LuDao luDao) throws InvalidParameterException, DoesNotExistException {... |
| 280 |
36
|
CluSet cluSet = new CluSet(); |
| 281 |
|
|
| 282 |
36
|
BeanUtils.copyProperties(cluSetInfo, cluSet, new String[] { "id", |
| 283 |
|
"descr", "attributes", "metaInfo", "membershipQuery" }); |
| 284 |
36
|
cluSet.setAttributes(toGenericAttributes( |
| 285 |
|
CluSetAttribute.class, cluSetInfo.getAttributes(), cluSet, luDao)); |
| 286 |
36
|
cluSet.setType(cluSetInfo.getType()); |
| 287 |
36
|
cluSet.setDescr(toRichText(LuRichText.class, cluSetInfo.getDescr())); |
| 288 |
|
|
| 289 |
36
|
for (String cluId : cluSetInfo.getCluIds()) { |
| 290 |
11
|
CluSetJoinVersionIndClu join = new CluSetJoinVersionIndClu(); |
| 291 |
11
|
join.setCluSet(cluSet); |
| 292 |
11
|
join.setCluVersionIndId(cluId); |
| 293 |
11
|
cluSet.getCluVerIndIds().add(join); |
| 294 |
|
} |
| 295 |
36
|
for (String cluSetId : cluSetInfo.getCluSetIds()) { |
| 296 |
9
|
CluSet c = luDao.fetch(CluSet.class, cluSetId); |
| 297 |
9
|
if(cluSet.getCluSets()==null){ |
| 298 |
0
|
cluSet.setCluSets(new ArrayList<CluSet>()); |
| 299 |
|
} |
| 300 |
9
|
cluSet.getCluSets().add(c); |
| 301 |
|
} |
| 302 |
36
|
cluSet.setMembershipQuery(toMembershipQueryEntity(cluSetInfo.getMembershipQuery())); |
| 303 |
|
|
| 304 |
36
|
return cluSet; |
| 305 |
|
} |
| 306 |
|
|
|
|
|
| 92% |
Uncovered Elements: 2 (25) |
Complexity: 3 |
Complexity Density: 0.14 |
|
| 307 |
174
|
public static CluSetInfo toCluSetInfo(CluSet entity) {... |
| 308 |
174
|
if (entity == null) { |
| 309 |
0
|
return null; |
| 310 |
|
} |
| 311 |
174
|
CluSetInfo dto = new CluSetInfo(); |
| 312 |
|
|
| 313 |
174
|
BeanUtils.copyProperties(entity, dto, new String[] { "descr", |
| 314 |
|
"cluCriteria", "cluSets", "clus", "attributes", "metaInfo", "membershipQuery" }); |
| 315 |
|
|
| 316 |
174
|
dto.setDescr(toRichTextInfo(entity.getDescr())); |
| 317 |
|
|
| 318 |
174
|
if(entity.getCluSets()!=null){ |
| 319 |
168
|
List<String> cluSetIds = new ArrayList<String>(entity.getCluSets() |
| 320 |
|
.size()); |
| 321 |
168
|
for (CluSet id : entity.getCluSets()) { |
| 322 |
49
|
cluSetIds.add(id.getId()); |
| 323 |
|
} |
| 324 |
168
|
dto.setCluSetIds(cluSetIds); |
| 325 |
|
} |
| 326 |
|
|
| 327 |
174
|
List<String> cluIds = new ArrayList<String>(entity.getCluVerIndIds().size()); |
| 328 |
174
|
for (CluSetJoinVersionIndClu join : entity.getCluVerIndIds()) { |
| 329 |
206
|
cluIds.add(join.getCluVersionIndId()); |
| 330 |
|
} |
| 331 |
174
|
dto.setCluIds(cluIds); |
| 332 |
|
|
| 333 |
174
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 334 |
174
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 335 |
|
|
| 336 |
174
|
MembershipQueryInfo mqInfo = toMembershipQueryInfo(entity.getMembershipQuery()); |
| 337 |
174
|
dto.setMembershipQuery(mqInfo); |
| 338 |
174
|
dto.setIsReusable(entity.getIsReusable()); |
| 339 |
174
|
dto.setIsReferenceable(entity.getIsReferenceable()); |
| 340 |
|
|
| 341 |
174
|
return dto; |
| 342 |
|
} |
| 343 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
| 344 |
174
|
public static MembershipQueryInfo toMembershipQueryInfo(MembershipQuery entity) {... |
| 345 |
174
|
if(entity == null) { |
| 346 |
162
|
return null; |
| 347 |
|
} |
| 348 |
12
|
MembershipQueryInfo dto = new MembershipQueryInfo(); |
| 349 |
12
|
dto.setId(entity.getId()); |
| 350 |
12
|
dto.setSearchTypeKey(entity.getSearchTypeKey()); |
| 351 |
12
|
List<SearchParam> list = new ArrayList<SearchParam>(); |
| 352 |
12
|
for(SearchParameter param : entity.getSearchParameters()) { |
| 353 |
10
|
SearchParam sp = toSearchParam(param); |
| 354 |
10
|
list.add(sp); |
| 355 |
|
} |
| 356 |
12
|
dto.setQueryParamValueList(list); |
| 357 |
|
|
| 358 |
12
|
return dto; |
| 359 |
|
} |
| 360 |
|
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 361 |
10
|
public static SearchParam toSearchParam(SearchParameter entity) {... |
| 362 |
10
|
SearchParam dto = new SearchParam(); |
| 363 |
10
|
dto.setKey(entity.getKey()); |
| 364 |
10
|
List<String> values = new ArrayList<String>(); |
| 365 |
10
|
for(SearchParameterValue value : entity.getValues()) { |
| 366 |
10
|
values.add(value.getValue()); |
| 367 |
|
} |
| 368 |
10
|
dto.setValue(values); |
| 369 |
10
|
if(entity.getValues().size() == 1) { |
| 370 |
10
|
dto.setValue(entity.getValues().get(0).getValue()); |
| 371 |
|
} |
| 372 |
10
|
return dto; |
| 373 |
|
} |
| 374 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 375 |
45
|
public static MembershipQuery toMembershipQueryEntity(MembershipQueryInfo dto) {... |
| 376 |
45
|
if(dto == null) { |
| 377 |
38
|
return null; |
| 378 |
|
} |
| 379 |
7
|
MembershipQuery entity = new MembershipQuery(); |
| 380 |
7
|
entity.setSearchTypeKey(dto.getSearchTypeKey()); |
| 381 |
7
|
List<SearchParameter> list = new ArrayList<SearchParameter>(); |
| 382 |
7
|
for(SearchParam param : dto.getQueryParamValueList()) { |
| 383 |
6
|
SearchParameter sp = toSearchParameterEntity(param); |
| 384 |
6
|
list.add(sp); |
| 385 |
|
} |
| 386 |
7
|
entity.setSearchParameters(list); |
| 387 |
|
|
| 388 |
7
|
return entity; |
| 389 |
|
} |
| 390 |
|
|
|
|
|
| 52.2% |
Uncovered Elements: 11 (23) |
Complexity: 4 |
Complexity Density: 0.24 |
|
| 391 |
6
|
public static SearchParameter toSearchParameterEntity(SearchParam dto) {... |
| 392 |
6
|
if(dto == null) { |
| 393 |
0
|
return null; |
| 394 |
|
} |
| 395 |
6
|
SearchParameter entity = new SearchParameter(); |
| 396 |
6
|
entity.setKey(dto.getKey()); |
| 397 |
6
|
List<SearchParameterValue> values = new ArrayList<SearchParameterValue>(); |
| 398 |
6
|
if(dto.getValue() instanceof String) { |
| 399 |
6
|
SearchParameterValue value = new SearchParameterValue(); |
| 400 |
6
|
value.setValue((String) dto.getValue()); |
| 401 |
6
|
values.add(value); |
| 402 |
0
|
} else if(dto.getValue() instanceof List<?>) { |
| 403 |
0
|
List<String> stringList = (List<String>)dto.getValue(); |
| 404 |
0
|
for(String s : stringList) { |
| 405 |
0
|
SearchParameterValue value = new SearchParameterValue(); |
| 406 |
0
|
value.setValue(s); |
| 407 |
0
|
values.add(value); |
| 408 |
|
} |
| 409 |
|
} |
| 410 |
6
|
entity.setValues(values); |
| 411 |
6
|
return entity; |
| 412 |
|
} |
| 413 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 414 |
1
|
public static List<ResultUsageTypeInfo> toResultUsageTypeInfos(... |
| 415 |
|
List<ResultUsageType> entities) { |
| 416 |
1
|
return toGenericTypeInfoList(ResultUsageTypeInfo.class, entities); |
| 417 |
|
} |
| 418 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 419 |
1
|
public static ResultUsageTypeInfo toResultUsageTypeInfo(... |
| 420 |
|
ResultUsageType entity) { |
| 421 |
1
|
return toGenericTypeInfo(ResultUsageTypeInfo.class, entity); |
| 422 |
|
} |
| 423 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 424 |
0
|
public static List<DeliveryMethodTypeInfo> toDeliveryMethodTypeInfos(... |
| 425 |
|
List<DeliveryMethodType> entities) { |
| 426 |
0
|
return toGenericTypeInfoList(DeliveryMethodTypeInfo.class, entities); |
| 427 |
|
} |
| 428 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 429 |
0
|
public static DeliveryMethodTypeInfo toDeliveryMethodTypeInfo(... |
| 430 |
|
DeliveryMethodType entity) { |
| 431 |
0
|
return toGenericTypeInfo(DeliveryMethodTypeInfo.class, entity); |
| 432 |
|
} |
| 433 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 434 |
0
|
public static List<InstructionalFormatTypeInfo> toInstructionalFormatTypeInfos(... |
| 435 |
|
List<InstructionalFormatType> entities) { |
| 436 |
0
|
return toGenericTypeInfoList(InstructionalFormatTypeInfo.class, |
| 437 |
|
entities); |
| 438 |
|
} |
| 439 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 440 |
0
|
public static InstructionalFormatTypeInfo toInstructionalFormatTypeInfo(... |
| 441 |
|
InstructionalFormatType entity) { |
| 442 |
0
|
return toGenericTypeInfo(InstructionalFormatTypeInfo.class, entity); |
| 443 |
|
} |
| 444 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 445 |
0
|
public static List<LuCodeTypeInfo> toLuCodeTypeInfos(... |
| 446 |
|
List<LuCodeType> entities) { |
| 447 |
0
|
return toGenericTypeInfoList(LuCodeTypeInfo.class, entities); |
| 448 |
|
} |
| 449 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 450 |
0
|
public static LuCodeTypeInfo toLuCodeTypeInfo(LuCodeType entity) {... |
| 451 |
0
|
return toGenericTypeInfo(LuCodeTypeInfo.class, entity); |
| 452 |
|
} |
| 453 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 454 |
0
|
public static List<CluResultTypeInfo> toCluResultTypeInfos(... |
| 455 |
|
List<CluResultType> entities) { |
| 456 |
0
|
return toGenericTypeInfoList(CluResultTypeInfo.class, entities); |
| 457 |
|
} |
| 458 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 459 |
241
|
public static CluResultTypeInfo toCluResultTypeInfo(CluResultType entity) {... |
| 460 |
241
|
return toGenericTypeInfo(CluResultTypeInfo.class, entity); |
| 461 |
|
} |
| 462 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 463 |
0
|
public static CluSetTypeInfo toCluSetTypeInfo(CluSetType entity) {... |
| 464 |
0
|
return toGenericTypeInfo(CluSetTypeInfo.class, entity); |
| 465 |
|
} |
| 466 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 467 |
0
|
public static List<CluSetTypeInfo> toCluSetTypeInfos(... |
| 468 |
|
List<CluSetType> entities) { |
| 469 |
0
|
return toGenericTypeInfoList(CluSetTypeInfo.class, entities); |
| 470 |
|
} |
| 471 |
|
|
|
|
|
| 82.4% |
Uncovered Elements: 3 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
| 472 |
241
|
public static CluResultInfo toCluResultInfo(CluResult entity) {... |
| 473 |
241
|
if (entity == null) { |
| 474 |
0
|
return null; |
| 475 |
|
} |
| 476 |
|
|
| 477 |
241
|
CluResultInfo dto = new CluResultInfo(); |
| 478 |
|
|
| 479 |
241
|
BeanUtils.copyProperties(entity, dto, new String[] { "resultOptions", "desc" }); |
| 480 |
|
|
| 481 |
241
|
List<ResultOptionInfo> resultOptions = toResultOptionInfos(entity.getResultOptions()); |
| 482 |
241
|
dto.setResultOptions(resultOptions); |
| 483 |
241
|
dto.setDesc(toRichTextInfo(entity.getDesc())); |
| 484 |
241
|
dto.setCluId(entity.getClu().getId()); |
| 485 |
241
|
CluResultTypeInfo type = toCluResultTypeInfo(entity.getCluResultType()); |
| 486 |
241
|
if(type!=null){ |
| 487 |
241
|
dto.setType(type.getId()); |
| 488 |
|
} |
| 489 |
241
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 490 |
|
|
| 491 |
241
|
return dto; |
| 492 |
|
} |
| 493 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 494 |
124
|
public static List<CluResultInfo> toCluResultInfos(List<CluResult> entities) {... |
| 495 |
124
|
List<CluResultInfo> dtos = new ArrayList<CluResultInfo>(); |
| 496 |
124
|
if (entities != null) { |
| 497 |
124
|
for (CluResult entity : entities) { |
| 498 |
127
|
dtos.add(toCluResultInfo(entity)); |
| 499 |
|
} |
| 500 |
|
} |
| 501 |
124
|
return dtos; |
| 502 |
|
} |
| 503 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 504 |
241
|
public static List<ResultOptionInfo> toResultOptionInfos(... |
| 505 |
|
List<ResultOption> entities) { |
| 506 |
241
|
List<ResultOptionInfo> dtos = new ArrayList<ResultOptionInfo>(); |
| 507 |
241
|
if (entities != null) { |
| 508 |
241
|
for (ResultOption entity : entities) { |
| 509 |
324
|
dtos.add(toResultOptionInfo(entity)); |
| 510 |
|
} |
| 511 |
|
} |
| 512 |
241
|
return dtos; |
| 513 |
|
} |
| 514 |
|
|
|
|
|
| 84.6% |
Uncovered Elements: 2 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 515 |
324
|
public static ResultOptionInfo toResultOptionInfo(ResultOption entity) {... |
| 516 |
324
|
if (entity == null) { |
| 517 |
0
|
return null; |
| 518 |
|
} |
| 519 |
|
|
| 520 |
324
|
ResultOptionInfo dto = new ResultOptionInfo(); |
| 521 |
|
|
| 522 |
324
|
BeanUtils.copyProperties(entity, dto, new String[] { "resultUsageType", "desc" }); |
| 523 |
324
|
if(entity.getResultUsageType() != null) { |
| 524 |
2
|
dto.setResultUsageTypeKey(entity.getResultUsageType().getId()); |
| 525 |
|
} |
| 526 |
324
|
dto.setDesc(toRichTextInfo(entity.getDesc())); |
| 527 |
324
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 528 |
|
|
| 529 |
324
|
return dto; |
| 530 |
|
} |
| 531 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 532 |
1
|
public static List<LuLuRelationTypeInfo> toLuLuRelationTypeInfos(... |
| 533 |
|
List<LuLuRelationType> entities) { |
| 534 |
1
|
List<LuLuRelationTypeInfo> dtos = new ArrayList<LuLuRelationTypeInfo>( |
| 535 |
|
entities.size()); |
| 536 |
1
|
if(entities!=null){ |
| 537 |
1
|
for (LuLuRelationType entity : entities) { |
| 538 |
13
|
dtos.add(toLuLuRelationTypeInfo(entity)); |
| 539 |
|
} |
| 540 |
|
} |
| 541 |
1
|
return dtos; |
| 542 |
|
|
| 543 |
|
} |
| 544 |
|
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 545 |
15
|
public static LuLuRelationTypeInfo toLuLuRelationTypeInfo(... |
| 546 |
|
LuLuRelationType entity) { |
| 547 |
15
|
if (entity == null) { |
| 548 |
0
|
return null; |
| 549 |
|
} |
| 550 |
15
|
LuLuRelationTypeInfo dto = new LuLuRelationTypeInfo(); |
| 551 |
|
|
| 552 |
15
|
BeanUtils.copyProperties(entity, dto, new String[] { "attributes" }); |
| 553 |
15
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 554 |
|
|
| 555 |
15
|
return dto; |
| 556 |
|
} |
| 557 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 558 |
0
|
public static List<LuTypeInfo> toLuTypeInfos(List<LuType> entities) {... |
| 559 |
0
|
return toGenericTypeInfoList(LuTypeInfo.class, entities); |
| 560 |
|
} |
| 561 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 562 |
0
|
public static LuTypeInfo toLuTypeInfo(LuType entity) {... |
| 563 |
0
|
LuTypeInfo typeInfo = toGenericTypeInfo(LuTypeInfo.class, entity); |
| 564 |
0
|
typeInfo.setDeliveryMethod(entity.getDeliveryMethod()); |
| 565 |
0
|
typeInfo.setInstructionalFormat(entity.getInstructionalFormat()); |
| 566 |
|
|
| 567 |
0
|
return typeInfo; |
| 568 |
|
} |
| 569 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 570 |
5
|
public static List<LuiInfo> toLuiInfos(List<Lui> entities) {... |
| 571 |
5
|
List<LuiInfo> dtos = new ArrayList<LuiInfo>(entities.size()); |
| 572 |
5
|
if (entities != null) { |
| 573 |
5
|
for (Lui entity : entities) { |
| 574 |
5
|
dtos.add(toLuiInfo(entity)); |
| 575 |
|
} |
| 576 |
|
} |
| 577 |
5
|
return dtos; |
| 578 |
|
|
| 579 |
|
} |
| 580 |
|
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 581 |
11
|
public static LuiInfo toLuiInfo(Lui entity) {... |
| 582 |
11
|
if (entity == null) { |
| 583 |
0
|
return null; |
| 584 |
|
} |
| 585 |
11
|
LuiInfo luiInfo = new LuiInfo(); |
| 586 |
|
|
| 587 |
11
|
BeanUtils.copyProperties(entity, luiInfo, new String[] { "clu", |
| 588 |
|
"metaInfo", "attributes" }); |
| 589 |
|
|
| 590 |
11
|
luiInfo.setCluId(entity.getClu().getId()); |
| 591 |
|
|
| 592 |
11
|
luiInfo |
| 593 |
|
.setMetaInfo(toMetaInfo(entity.getMeta(), entity |
| 594 |
|
.getVersionNumber())); |
| 595 |
|
|
| 596 |
11
|
luiInfo.setAttributes(toAttributeMap(entity.getAttributes())); |
| 597 |
|
|
| 598 |
11
|
return luiInfo; |
| 599 |
|
} |
| 600 |
|
|
|
|
|
| 48.1% |
Uncovered Elements: 14 (27) |
Complexity: 6 |
Complexity Density: 0.35 |
|
| 601 |
2
|
public static Lui toLui(boolean isUpdate, LuiInfo luiInfo, LuDao dao)... |
| 602 |
|
throws DoesNotExistException, VersionMismatchException, |
| 603 |
|
InvalidParameterException { |
| 604 |
2
|
if (luiInfo == null) { |
| 605 |
0
|
return null; |
| 606 |
|
} |
| 607 |
2
|
Lui lui; |
| 608 |
|
|
| 609 |
2
|
if (isUpdate) { |
| 610 |
0
|
lui = dao.fetch(Lui.class, luiInfo.getId()); |
| 611 |
0
|
if (null == lui) { |
| 612 |
0
|
throw new DoesNotExistException((new StringBuilder()).append( |
| 613 |
|
"Lui does not exist for id: ").append(luiInfo.getId()) |
| 614 |
|
.toString()); |
| 615 |
|
} |
| 616 |
0
|
if (!String.valueOf(lui.getVersionNumber()).equals( |
| 617 |
|
luiInfo.getMetaInfo().getVersionInd())) { |
| 618 |
0
|
throw new VersionMismatchException( |
| 619 |
|
"Lui to be updated is not the current version"); |
| 620 |
|
} |
| 621 |
|
} else { |
| 622 |
2
|
lui = new Lui(); |
| 623 |
|
} |
| 624 |
|
|
| 625 |
2
|
BeanUtils.copyProperties(luiInfo, lui, new String[] { "cluId", |
| 626 |
|
"attributes", "metaInfo" }); |
| 627 |
|
|
| 628 |
2
|
lui.setAttributes(toGenericAttributes(LuiAttribute.class, luiInfo |
| 629 |
|
.getAttributes(), lui, dao)); |
| 630 |
|
|
| 631 |
2
|
Clu clu = dao.fetch(Clu.class, luiInfo.getCluId()); |
| 632 |
2
|
if (null == clu) { |
| 633 |
0
|
throw new InvalidParameterException((new StringBuilder()).append( |
| 634 |
|
"Clu does not exist for id: ").append(luiInfo.getCluId()) |
| 635 |
|
.toString()); |
| 636 |
|
} |
| 637 |
2
|
lui.setClu(clu); |
| 638 |
2
|
return lui; |
| 639 |
|
} |
| 640 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 641 |
3
|
public static List<LuiLuiRelationInfo> toLuiLuiRelationInfos(... |
| 642 |
|
List<LuiLuiRelation> entities) { |
| 643 |
3
|
List<LuiLuiRelationInfo> dtos = new ArrayList<LuiLuiRelationInfo>( |
| 644 |
|
entities.size()); |
| 645 |
3
|
if (entities != null) { |
| 646 |
3
|
for (LuiLuiRelation entity : entities) { |
| 647 |
3
|
dtos.add(toLuiLuiRelationInfo(entity)); |
| 648 |
|
} |
| 649 |
|
} |
| 650 |
3
|
return dtos; |
| 651 |
|
} |
| 652 |
|
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 653 |
6
|
public static LuiLuiRelationInfo toLuiLuiRelationInfo(LuiLuiRelation entity) {... |
| 654 |
6
|
if (entity == null) { |
| 655 |
0
|
return null; |
| 656 |
|
} |
| 657 |
6
|
LuiLuiRelationInfo dto = new LuiLuiRelationInfo(); |
| 658 |
|
|
| 659 |
6
|
BeanUtils.copyProperties(entity, dto, new String[] { "lui", |
| 660 |
|
"relatedLui", "attributes" }); |
| 661 |
|
|
| 662 |
6
|
dto.setLuiId(entity.getLui().getId()); |
| 663 |
6
|
dto.setRelatedLuiId(entity.getRelatedLui().getId()); |
| 664 |
6
|
dto.setType(entity.getLuLuRelationType().getId()); |
| 665 |
6
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 666 |
6
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 667 |
6
|
return dto; |
| 668 |
|
} |
| 669 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 670 |
553
|
public static List<CluIdentifierInfo> toCluIdentifierInfos(... |
| 671 |
|
List<CluIdentifier> entities) { |
| 672 |
553
|
List<CluIdentifierInfo> dtos = new ArrayList<CluIdentifierInfo>( |
| 673 |
|
entities.size()); |
| 674 |
553
|
if(entities!=null){ |
| 675 |
553
|
for (CluIdentifier entity : entities) { |
| 676 |
482
|
dtos.add(toCluIdentifierInfo(entity)); |
| 677 |
|
} |
| 678 |
|
} |
| 679 |
553
|
return dtos; |
| 680 |
|
} |
| 681 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 682 |
1229
|
public static CluIdentifierInfo toCluIdentifierInfo(CluIdentifier entity) {... |
| 683 |
1229
|
if (entity == null) { |
| 684 |
230
|
return null; |
| 685 |
|
} |
| 686 |
|
|
| 687 |
999
|
CluIdentifierInfo dto = new CluIdentifierInfo(); |
| 688 |
|
|
| 689 |
999
|
BeanUtils.copyProperties(entity, dto, |
| 690 |
|
new String[] { "attributes" }); |
| 691 |
999
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 692 |
999
|
return dto; |
| 693 |
|
} |
| 694 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 695 |
553
|
public static List<CluInstructorInfo> toCluInstructorInfos(... |
| 696 |
|
List<CluInstructor> entities) { |
| 697 |
553
|
List<CluInstructorInfo> dtos = new ArrayList<CluInstructorInfo>( |
| 698 |
|
entities.size()); |
| 699 |
553
|
if(entities!=null){ |
| 700 |
553
|
for (CluInstructor entity : entities) { |
| 701 |
217
|
dtos.add(toCluInstructorInfo(entity)); |
| 702 |
|
} |
| 703 |
|
} |
| 704 |
553
|
return dtos; |
| 705 |
|
} |
| 706 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 707 |
770
|
public static CluInstructorInfo toCluInstructorInfo(CluInstructor entity) {... |
| 708 |
770
|
if (entity == null) { |
| 709 |
309
|
return null; |
| 710 |
|
} |
| 711 |
461
|
CluInstructorInfo dto = new CluInstructorInfo(); |
| 712 |
|
|
| 713 |
461
|
BeanUtils.copyProperties(entity, dto, |
| 714 |
|
new String[] { "id", "attributes" }); |
| 715 |
461
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 716 |
|
|
| 717 |
461
|
return dto; |
| 718 |
|
} |
| 719 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 720 |
553
|
public static AmountInfo toAmountInfo(Amount entity) {... |
| 721 |
553
|
if (entity == null) { |
| 722 |
197
|
return null; |
| 723 |
|
} |
| 724 |
356
|
AmountInfo dto = new AmountInfo(); |
| 725 |
|
|
| 726 |
356
|
BeanUtils.copyProperties(entity, dto); |
| 727 |
|
|
| 728 |
356
|
return dto; |
| 729 |
|
} |
| 730 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 731 |
553
|
public static TimeAmountInfo toTimeAmountInfo(TimeAmount entity) {... |
| 732 |
553
|
if (entity == null) { |
| 733 |
89
|
return null; |
| 734 |
|
} |
| 735 |
464
|
TimeAmountInfo dto = new TimeAmountInfo(); |
| 736 |
|
|
| 737 |
464
|
BeanUtils.copyProperties(entity, dto); |
| 738 |
|
|
| 739 |
464
|
return dto; |
| 740 |
|
} |
| 741 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 742 |
553
|
public static List<LuCodeInfo> toLuCodeInfos(List<LuCode> entities) {... |
| 743 |
553
|
List<LuCodeInfo> dtos = new ArrayList<LuCodeInfo>(entities.size()); |
| 744 |
553
|
if(entities!=null){ |
| 745 |
553
|
for (LuCode entity : entities) { |
| 746 |
730
|
dtos.add(toLuCodeInfo(entity)); |
| 747 |
|
} |
| 748 |
|
} |
| 749 |
553
|
return dtos; |
| 750 |
|
} |
| 751 |
|
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 752 |
730
|
public static LuCodeInfo toLuCodeInfo(LuCode entity) {... |
| 753 |
730
|
if (entity == null) { |
| 754 |
0
|
return null; |
| 755 |
|
} |
| 756 |
730
|
LuCodeInfo dto = new LuCodeInfo(); |
| 757 |
|
|
| 758 |
730
|
BeanUtils.copyProperties(entity, dto, new String[] { "attributes", |
| 759 |
|
"metInfo" }); |
| 760 |
|
|
| 761 |
730
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 762 |
730
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 763 |
|
|
| 764 |
730
|
return dto; |
| 765 |
|
} |
| 766 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 767 |
0
|
public static CluCreditInfo toCluCreditInfos(CluCredit entity) {... |
| 768 |
0
|
if (entity == null) { |
| 769 |
0
|
return null; |
| 770 |
|
} |
| 771 |
0
|
CluCreditInfo dto = new CluCreditInfo(); |
| 772 |
|
|
| 773 |
0
|
BeanUtils.copyProperties(entity, dto, new String[] { "id", |
| 774 |
|
"repeatTime", "minTimeToComplete", "maxTimeToComplete", |
| 775 |
|
"maxAllowableInactivity", "maxTimeResultsRecognized" }); |
| 776 |
0
|
dto.setRepeatTime(toTimeAmountInfo(entity.getRepeatTime())); |
| 777 |
0
|
dto |
| 778 |
|
.setMinTimeToComplete(toTimeAmountInfo(entity |
| 779 |
|
.getMinTimeToComplete())); |
| 780 |
0
|
dto |
| 781 |
|
.setMaxTimeToComplete(toTimeAmountInfo(entity |
| 782 |
|
.getMaxTimeToComplete())); |
| 783 |
0
|
dto.setMaxAllowableInactivity(toTimeAmountInfo(entity |
| 784 |
|
.getMaxAllowableInactivity())); |
| 785 |
0
|
dto.setMaxTimeResultsRecognized(toTimeAmountInfo(entity |
| 786 |
|
.getMaxTimeResultsRecognized())); |
| 787 |
|
|
| 788 |
0
|
return dto; |
| 789 |
|
} |
| 790 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 791 |
0
|
public static List<ResultComponentTypeInfo> toResultComponentTypeInfo(... |
| 792 |
|
List<String> componentIds) { |
| 793 |
0
|
List<ResultComponentTypeInfo> dtos = new ArrayList<ResultComponentTypeInfo>(); |
| 794 |
0
|
if(componentIds!=null){ |
| 795 |
0
|
for (String id : componentIds) { |
| 796 |
0
|
ResultComponentTypeInfo comp = new ResultComponentTypeInfo(); |
| 797 |
0
|
comp.setId(id); |
| 798 |
0
|
dtos.add(comp); |
| 799 |
|
} |
| 800 |
|
} |
| 801 |
0
|
return dtos; |
| 802 |
|
} |
| 803 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 804 |
553
|
public static CluFeeInfo toCluFeeInfo(CluFee entity) {... |
| 805 |
553
|
if (entity == null) { |
| 806 |
438
|
return null; |
| 807 |
|
} |
| 808 |
115
|
CluFeeInfo dto = new CluFeeInfo(); |
| 809 |
|
|
| 810 |
115
|
dto.setCluFeeRecords(toCluFeeRecordInfos(entity.getCluFeeRecords())); |
| 811 |
115
|
dto.setId(entity.getId()); |
| 812 |
115
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 813 |
115
|
dto.setDescr(toRichTextInfo(entity.getDescr())); |
| 814 |
115
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 815 |
|
|
| 816 |
115
|
return dto; |
| 817 |
|
} |
| 818 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 819 |
115
|
private static List<CluFeeRecordInfo> toCluFeeRecordInfos(... |
| 820 |
|
List<CluFeeRecord> entities) { |
| 821 |
115
|
List<CluFeeRecordInfo> dtos = new ArrayList<CluFeeRecordInfo>(); |
| 822 |
115
|
if (entities != null) { |
| 823 |
115
|
for (CluFeeRecord record : entities) { |
| 824 |
344
|
dtos.add(toCluFeeRecordInfo(record)); |
| 825 |
|
} |
| 826 |
|
} |
| 827 |
115
|
return dtos; |
| 828 |
|
} |
| 829 |
|
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 830 |
344
|
private static CluFeeRecordInfo toCluFeeRecordInfo(CluFeeRecord entity) {... |
| 831 |
344
|
if (entity == null) { |
| 832 |
0
|
return null; |
| 833 |
|
} |
| 834 |
|
|
| 835 |
344
|
CluFeeRecordInfo dto = new CluFeeRecordInfo(); |
| 836 |
|
|
| 837 |
344
|
BeanUtils.copyProperties(entity, dto, |
| 838 |
|
new String[] { "affiliatedOrgs", "currencyAmount","attributes","descr" }); |
| 839 |
|
|
| 840 |
344
|
dto.setAffiliatedOrgs(toAffiliatedOrgInfos(entity.getAffiliatedOrgs())); |
| 841 |
344
|
dto.setFeeAmounts(toFeeAmounts(entity.getFeeAmounts())); |
| 842 |
344
|
dto.setDescr(toRichTextInfo(entity.getDescr())); |
| 843 |
344
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 844 |
344
|
dto.setMetaInfo(toMetaInfo(entity.getMeta(), entity.getVersionNumber())); |
| 845 |
|
|
| 846 |
344
|
return dto; |
| 847 |
|
} |
| 848 |
|
|
|
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 849 |
344
|
private static List<CurrencyAmountInfo> toFeeAmounts(List<CluFeeAmount> cluFees) {... |
| 850 |
344
|
List<CurrencyAmountInfo> feeAmounts = new ArrayList<CurrencyAmountInfo>(); |
| 851 |
|
|
| 852 |
344
|
if (cluFees != null){ |
| 853 |
344
|
for (CluFeeAmount cluFeeAmount:cluFees){ |
| 854 |
313
|
CurrencyAmountInfo dto = new CurrencyAmountInfo(); |
| 855 |
313
|
CurrencyAmount ca = cluFeeAmount.getCurrencyAmount(); |
| 856 |
313
|
if(ca!=null){ |
| 857 |
308
|
dto.setCurrencyQuantity(ca.getCurrencyQuantity()); |
| 858 |
308
|
dto.setCurrencyTypeKey(ca.getCurrencyTypeKey()); |
| 859 |
|
} |
| 860 |
313
|
feeAmounts.add(dto); |
| 861 |
|
} |
| 862 |
|
} |
| 863 |
|
|
| 864 |
344
|
return feeAmounts; |
| 865 |
|
} |
| 866 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 867 |
459
|
private static List<AffiliatedOrgInfo> toAffiliatedOrgInfos(... |
| 868 |
|
List<AffiliatedOrg> entities) { |
| 869 |
459
|
List<AffiliatedOrgInfo> dtos = new ArrayList<AffiliatedOrgInfo>(); |
| 870 |
459
|
if (entities != null) { |
| 871 |
457
|
for (AffiliatedOrg record : entities) { |
| 872 |
473
|
dtos.add(toAffiliatedOrgInfo(record)); |
| 873 |
|
} |
| 874 |
|
} |
| 875 |
459
|
return dtos; |
| 876 |
|
} |
| 877 |
|
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 878 |
473
|
private static AffiliatedOrgInfo toAffiliatedOrgInfo(AffiliatedOrg entity) {... |
| 879 |
473
|
if (entity == null) { |
| 880 |
0
|
return null; |
| 881 |
|
} |
| 882 |
|
|
| 883 |
473
|
AffiliatedOrgInfo dto = new AffiliatedOrgInfo(); |
| 884 |
|
|
| 885 |
473
|
BeanUtils.copyProperties(entity, dto); |
| 886 |
473
|
return dto; |
| 887 |
|
} |
| 888 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 889 |
553
|
public static CluAccountingInfo toCluAccountingInfo(CluAccounting entity) {... |
| 890 |
553
|
if (entity == null) { |
| 891 |
438
|
return null; |
| 892 |
|
} |
| 893 |
115
|
CluAccountingInfo dto = new CluAccountingInfo(); |
| 894 |
115
|
dto.setId(entity.getId()); |
| 895 |
115
|
dto.setAffiliatedOrgs(toAffiliatedOrgInfos(entity.getAffiliatedOrgs())); |
| 896 |
115
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 897 |
115
|
return dto; |
| 898 |
|
} |
| 899 |
|
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 900 |
126
|
public static Amount toAmount(AmountInfo amountInfo) {... |
| 901 |
126
|
if (amountInfo == null) { |
| 902 |
0
|
return null; |
| 903 |
|
} |
| 904 |
126
|
Amount amount = new Amount(); |
| 905 |
126
|
BeanUtils.copyProperties(amountInfo, amount); |
| 906 |
126
|
return amount; |
| 907 |
|
} |
| 908 |
|
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 909 |
169
|
public static TimeAmount toTimeAmount(TimeAmountInfo timeAmountInfo) {... |
| 910 |
169
|
if (timeAmountInfo == null) { |
| 911 |
0
|
return null; |
| 912 |
|
} |
| 913 |
169
|
TimeAmount timeAmount = new TimeAmount(); |
| 914 |
169
|
BeanUtils.copyProperties(timeAmountInfo, timeAmount); |
| 915 |
169
|
return timeAmount; |
| 916 |
|
} |
| 917 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 918 |
0
|
public static CluCredit toCluCredit(CluCreditInfo cluCreditInfo) {... |
| 919 |
0
|
if (cluCreditInfo == null) { |
| 920 |
0
|
return null; |
| 921 |
|
} |
| 922 |
0
|
CluCredit cluCredit = new CluCredit(); |
| 923 |
|
|
| 924 |
0
|
cluCredit.setMaxAllowableInactivity(LuServiceAssembler |
| 925 |
|
.toTimeAmount(cluCreditInfo.getMaxAllowableInactivity())); |
| 926 |
0
|
cluCredit.setMaxTimeResultsRecognized(LuServiceAssembler |
| 927 |
|
.toTimeAmount(cluCreditInfo.getMaxTimeResultsRecognized())); |
| 928 |
0
|
cluCredit.setMaxTimeToComplete(LuServiceAssembler |
| 929 |
|
.toTimeAmount(cluCreditInfo.getMaxTimeToComplete())); |
| 930 |
0
|
cluCredit.setMinTimeToComplete(LuServiceAssembler |
| 931 |
|
.toTimeAmount(cluCreditInfo.getMinTimeToComplete())); |
| 932 |
0
|
cluCredit.setRepeatTime(LuServiceAssembler.toTimeAmount(cluCreditInfo |
| 933 |
|
.getRepeatTime())); |
| 934 |
|
|
| 935 |
0
|
BeanUtils.copyProperties(cluCreditInfo, cluCredit, new String[] { |
| 936 |
|
"repeatTime", "minTimeToComplete", "maxTimeToComplete", |
| 937 |
|
"maxAllowableInactivity", "maxTimeResultsRecognized" }); |
| 938 |
|
|
| 939 |
0
|
return cluCredit; |
| 940 |
|
} |
| 941 |
|
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 7 |
Complexity Density: 0.39 |
|
| 942 |
0
|
public static void copyCluCredit(CluCreditInfo cluCreditInfo,... |
| 943 |
|
CluCredit entity) { |
| 944 |
0
|
if (entity == null) { |
| 945 |
0
|
return; |
| 946 |
|
} |
| 947 |
0
|
if (entity.getMaxAllowableInactivity() == null) { |
| 948 |
0
|
entity.setMaxAllowableInactivity(new TimeAmount()); |
| 949 |
|
} |
| 950 |
0
|
BeanUtils.copyProperties(cluCreditInfo.getMaxAllowableInactivity(), |
| 951 |
|
entity.getMaxAllowableInactivity()); |
| 952 |
|
|
| 953 |
0
|
if (entity.getMaxTimeResultsRecognized() == null) { |
| 954 |
0
|
entity.setMaxTimeResultsRecognized(new TimeAmount()); |
| 955 |
|
} |
| 956 |
0
|
BeanUtils.copyProperties(cluCreditInfo.getMaxTimeResultsRecognized(), |
| 957 |
|
entity.getMaxTimeResultsRecognized()); |
| 958 |
|
|
| 959 |
0
|
if (entity.getMaxTimeToComplete() == null) { |
| 960 |
0
|
entity.setMaxTimeToComplete(new TimeAmount()); |
| 961 |
|
} |
| 962 |
0
|
BeanUtils.copyProperties(cluCreditInfo.getMaxTimeToComplete(), entity |
| 963 |
|
.getMaxTimeToComplete()); |
| 964 |
|
|
| 965 |
0
|
if (entity.getMinTimeToComplete() == null) { |
| 966 |
0
|
entity.setMinTimeToComplete(new TimeAmount()); |
| 967 |
|
} |
| 968 |
0
|
BeanUtils.copyProperties(cluCreditInfo.getMinTimeToComplete(), entity |
| 969 |
|
.getMinTimeToComplete()); |
| 970 |
|
|
| 971 |
0
|
if (entity.getRepeatTime() == null) { |
| 972 |
0
|
entity.setRepeatTime(new TimeAmount()); |
| 973 |
|
} |
| 974 |
0
|
BeanUtils.copyProperties(cluCreditInfo.getRepeatTime(), entity |
| 975 |
|
.getRepeatTime()); |
| 976 |
|
|
| 977 |
0
|
BeanUtils.copyProperties(cluCreditInfo, entity, new String[] { |
| 978 |
|
"repeatTime", "minTimeToComplete", "maxTimeToComplete", |
| 979 |
|
"maxAllowableInactivity", "maxTimeResultsRecognized" }); |
| 980 |
|
|
| 981 |
|
} |
| 982 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 983 |
553
|
public static List<AccreditationInfo> toAccreditationInfos(... |
| 984 |
|
List<CluAccreditation> entities) { |
| 985 |
553
|
List<AccreditationInfo> dtos = new ArrayList<AccreditationInfo>(entities.size()); |
| 986 |
|
|
| 987 |
553
|
if (entities != null) { |
| 988 |
553
|
for (CluAccreditation entity : entities) { |
| 989 |
73
|
dtos.add(toAccreditationInfo(entity)); |
| 990 |
|
} |
| 991 |
|
} |
| 992 |
553
|
return dtos; |
| 993 |
|
} |
| 994 |
|
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 995 |
73
|
public static AccreditationInfo toAccreditationInfo(CluAccreditation entity) {... |
| 996 |
73
|
if (entity == null) { |
| 997 |
0
|
return null; |
| 998 |
|
} |
| 999 |
73
|
AccreditationInfo dto = new AccreditationInfo(); |
| 1000 |
|
|
| 1001 |
73
|
BeanUtils.copyProperties(entity, dto, new String[] { "attributes" }); |
| 1002 |
|
|
| 1003 |
73
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 1004 |
|
|
| 1005 |
73
|
return dto; |
| 1006 |
|
|
| 1007 |
|
} |
| 1008 |
|
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 1009 |
553
|
public static List<AdminOrgInfo> toCluAdminOrgInfos(... |
| 1010 |
|
List<CluAdminOrg> entities) { |
| 1011 |
553
|
List<AdminOrgInfo> dtos = new ArrayList<AdminOrgInfo>(entities.size()); |
| 1012 |
553
|
if (entities != null) { |
| 1013 |
553
|
for (CluAdminOrg entity : entities) { |
| 1014 |
2412
|
dtos.add(toAdminOrgInfo(entity)); |
| 1015 |
|
} |
| 1016 |
|
} |
| 1017 |
553
|
return dtos; |
| 1018 |
|
} |
| 1019 |
|
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 1020 |
2412
|
public static AdminOrgInfo toAdminOrgInfo(CluAdminOrg entity) {... |
| 1021 |
2412
|
if (entity == null) { |
| 1022 |
0
|
return null; |
| 1023 |
|
} |
| 1024 |
2412
|
AdminOrgInfo dto = new AdminOrgInfo(); |
| 1025 |
2412
|
BeanUtils.copyProperties(entity, dto, new String[] { "attributes" }); |
| 1026 |
2412
|
dto.setAttributes(toAttributeMap(entity.getAttributes())); |
| 1027 |
|
|
| 1028 |
2412
|
return dto; |
| 1029 |
|
} |
| 1030 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1031 |
0
|
public static List<LuPublicationTypeInfo> toLuPublicationTypeInfos(... |
| 1032 |
|
List<LuPublicationType> entities) { |
| 1033 |
0
|
return toGenericTypeInfoList(LuPublicationTypeInfo.class, entities); |
| 1034 |
|
} |
| 1035 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1036 |
0
|
public static LuPublicationTypeInfo toLuPublicationTypeInfo(... |
| 1037 |
|
LuPublicationType entity) { |
| 1038 |
0
|
return toGenericTypeInfo(LuPublicationTypeInfo.class, entity); |
| 1039 |
|
} |
| 1040 |
|
|
|
|
|
| 69.7% |
Uncovered Elements: 10 (33) |
Complexity: 11 |
Complexity Density: 0.58 |
|
| 1041 |
36
|
public static CluFee toCluFee(Clu clu, boolean isUpdate, CluFeeInfo feeInfo,... |
| 1042 |
|
LuDao dao) throws DoesNotExistException, VersionMismatchException, |
| 1043 |
|
InvalidParameterException { |
| 1044 |
36
|
if (feeInfo == null) { |
| 1045 |
0
|
return null; |
| 1046 |
|
} |
| 1047 |
|
|
| 1048 |
36
|
CluFee fee = null; |
| 1049 |
|
|
| 1050 |
36
|
if (isUpdate) { |
| 1051 |
10
|
fee = clu.getFee(); |
| 1052 |
10
|
if (!String.valueOf(fee.getVersionNumber()).equals( |
| 1053 |
|
feeInfo.getMetaInfo().getVersionInd())) { |
| 1054 |
0
|
throw new VersionMismatchException( |
| 1055 |
|
"CluFee to be updated is not the current version"); |
| 1056 |
|
} |
| 1057 |
|
} |
| 1058 |
36
|
if(fee == null){ |
| 1059 |
26
|
fee = new CluFee(); |
| 1060 |
|
} |
| 1061 |
|
|
| 1062 |
36
|
if (feeInfo.getDescr() != null && (feeInfo.getDescr().getPlain() != null || feeInfo.getDescr().getFormatted() != null)) { |
| 1063 |
36
|
if (fee.getDescr() == null) { |
| 1064 |
26
|
fee.setDescr(new LuRichText()); |
| 1065 |
|
} |
| 1066 |
36
|
BeanUtils.copyProperties(feeInfo.getDescr(), fee.getDescr()); |
| 1067 |
0
|
} else if (isUpdate && fee.getDescr() != null) { |
| 1068 |
0
|
dao.delete(fee.getDescr()); |
| 1069 |
0
|
fee.setDescr(null); |
| 1070 |
|
} |
| 1071 |
|
|
| 1072 |
36
|
fee.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1073 |
|
CluFeeAttribute.class, feeInfo.getAttributes(), fee, dao)); |
| 1074 |
36
|
toCluFeeRecords(isUpdate, fee, feeInfo.getCluFeeRecords(), dao); |
| 1075 |
|
|
| 1076 |
36
|
return fee; |
| 1077 |
|
} |
| 1078 |
|
|
|
|
|
| 89.1% |
Uncovered Elements: 5 (46) |
Complexity: 7 |
Complexity Density: 0.21 |
|
| 1079 |
36
|
public static void toCluFeeRecords(boolean isUpdate,... |
| 1080 |
|
CluFee cluFee, List<CluFeeRecordInfo> cluFeeRecords, LuDao dao) throws InvalidParameterException { |
| 1081 |
|
|
| 1082 |
36
|
if (cluFeeRecords == null) { |
| 1083 |
0
|
return; |
| 1084 |
|
} |
| 1085 |
|
|
| 1086 |
36
|
if (!isUpdate) { |
| 1087 |
|
|
| 1088 |
26
|
for (CluFeeRecordInfo feeRecordInfo : cluFeeRecords) { |
| 1089 |
96
|
CluFeeRecord feeRec = new CluFeeRecord(); |
| 1090 |
96
|
feeRec.setAffiliatedOrgs(toAffiliatedOrgs(isUpdate, feeRec.getAffiliatedOrgs(), feeRecordInfo.getAffiliatedOrgs(), dao)); |
| 1091 |
96
|
feeRec.setFeeType(feeRecordInfo.getFeeType()); |
| 1092 |
96
|
feeRec.setRateType(feeRecordInfo.getRateType()); |
| 1093 |
96
|
feeRec.setDescr(toRichText(LuRichText.class, feeRecordInfo.getDescr())); |
| 1094 |
96
|
feeRec.setFeeAmounts(toFeeAmounts(isUpdate, feeRec.getFeeAmounts(), feeRecordInfo.getFeeAmounts(), dao)); |
| 1095 |
96
|
feeRec.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1096 |
|
CluFeeRecordAttribute.class, feeRecordInfo |
| 1097 |
|
.getAttributes(), feeRec, dao)); |
| 1098 |
96
|
if(cluFee.getCluFeeRecords()==null){ |
| 1099 |
26
|
cluFee.setCluFeeRecords(new ArrayList<CluFeeRecord>()); |
| 1100 |
|
} |
| 1101 |
96
|
cluFee.getCluFeeRecords().add(feeRec); |
| 1102 |
|
} |
| 1103 |
|
} else { |
| 1104 |
10
|
Map<String, CluFeeRecord> oldFeeRecMap = new HashMap<String, CluFeeRecord>(); |
| 1105 |
10
|
if(cluFee.getCluFeeRecords()!=null){ |
| 1106 |
10
|
for (CluFeeRecord feeRec : cluFee.getCluFeeRecords()) { |
| 1107 |
38
|
oldFeeRecMap.put(feeRec.getId(), feeRec); |
| 1108 |
|
} |
| 1109 |
10
|
cluFee.getCluFeeRecords().clear(); |
| 1110 |
|
} |
| 1111 |
|
|
| 1112 |
|
|
| 1113 |
|
|
| 1114 |
|
|
| 1115 |
10
|
for (CluFeeRecordInfo feeRecordInfo : cluFeeRecords) { |
| 1116 |
37
|
CluFeeRecord feeRec = oldFeeRecMap.remove(feeRecordInfo.getId()); |
| 1117 |
37
|
if (feeRec == null) { |
| 1118 |
1
|
feeRec = new CluFeeRecord(); |
| 1119 |
|
} |
| 1120 |
|
|
| 1121 |
37
|
feeRec.setAffiliatedOrgs(toAffiliatedOrgs(isUpdate, feeRec.getAffiliatedOrgs(), feeRecordInfo.getAffiliatedOrgs(),dao)); |
| 1122 |
37
|
feeRec.setFeeType(feeRecordInfo.getFeeType()); |
| 1123 |
37
|
feeRec.setRateType(feeRecordInfo.getRateType()); |
| 1124 |
37
|
feeRec.setDescr(toRichText(LuRichText.class, feeRecordInfo.getDescr())); |
| 1125 |
37
|
feeRec.setFeeAmounts(toFeeAmounts(isUpdate, feeRec.getFeeAmounts(), feeRecordInfo.getFeeAmounts(),dao)); |
| 1126 |
37
|
feeRec.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1127 |
|
CluFeeRecordAttribute.class, feeRecordInfo |
| 1128 |
|
.getAttributes(), feeRec, dao)); |
| 1129 |
37
|
if(cluFee.getCluFeeRecords()==null){ |
| 1130 |
0
|
cluFee.setCluFeeRecords(new ArrayList<CluFeeRecord>()); |
| 1131 |
|
} |
| 1132 |
37
|
cluFee.getCluFeeRecords().add(feeRec); |
| 1133 |
|
} |
| 1134 |
|
|
| 1135 |
|
|
| 1136 |
10
|
for (Entry<String, CluFeeRecord> entry : oldFeeRecMap.entrySet()) { |
| 1137 |
2
|
dao.delete(entry.getValue()); |
| 1138 |
|
} |
| 1139 |
|
} |
| 1140 |
|
} |
| 1141 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (30) |
Complexity: 5 |
Complexity Density: 0.23 |
|
| 1142 |
169
|
public static List<AffiliatedOrg> toAffiliatedOrgs(boolean isUpdate, List<AffiliatedOrg> orgList, List<AffiliatedOrgInfo> affiliatedOrgInfoList, LuDao dao) {... |
| 1143 |
169
|
if(null == affiliatedOrgInfoList) { |
| 1144 |
3
|
return orgList; |
| 1145 |
|
} |
| 1146 |
166
|
if(orgList==null){ |
| 1147 |
121
|
orgList = new ArrayList<AffiliatedOrg>(); |
| 1148 |
|
} |
| 1149 |
|
|
| 1150 |
166
|
if (!isUpdate) { |
| 1151 |
|
|
| 1152 |
120
|
for (AffiliatedOrgInfo orgInfo : affiliatedOrgInfoList) { |
| 1153 |
148
|
AffiliatedOrg org = new AffiliatedOrg(); |
| 1154 |
148
|
BeanUtils.copyProperties(orgInfo, org); |
| 1155 |
148
|
orgList.add(org); |
| 1156 |
|
} |
| 1157 |
|
} else { |
| 1158 |
46
|
Map<String, AffiliatedOrg> oldOrgMap = new HashMap<String, AffiliatedOrg>(); |
| 1159 |
46
|
for (AffiliatedOrg org : orgList) { |
| 1160 |
58
|
oldOrgMap.put(org.getId(), org); |
| 1161 |
|
} |
| 1162 |
46
|
orgList.clear(); |
| 1163 |
|
|
| 1164 |
46
|
for (AffiliatedOrgInfo orgInfo : affiliatedOrgInfoList) { |
| 1165 |
56
|
AffiliatedOrg org = oldOrgMap.remove(orgInfo.getId()); |
| 1166 |
56
|
if (org == null) { |
| 1167 |
1
|
org = new AffiliatedOrg(); |
| 1168 |
|
} |
| 1169 |
|
|
| 1170 |
56
|
BeanUtils.copyProperties(orgInfo, org); |
| 1171 |
|
|
| 1172 |
56
|
orgList.add(org); |
| 1173 |
|
} |
| 1174 |
|
|
| 1175 |
|
|
| 1176 |
46
|
for (Entry<String, AffiliatedOrg> entry : oldOrgMap.entrySet()) { |
| 1177 |
3
|
dao.delete(entry.getValue()); |
| 1178 |
|
} |
| 1179 |
|
} |
| 1180 |
|
|
| 1181 |
166
|
return orgList; |
| 1182 |
|
} |
| 1183 |
|
|
|
|
|
| 93.1% |
Uncovered Elements: 2 (29) |
Complexity: 4 |
Complexity Density: 0.17 |
|
| 1184 |
133
|
public static List<CluFeeAmount> toFeeAmounts(boolean isUpdate, List<CluFeeAmount> caList, List<CurrencyAmountInfo> caInfoList, LuDao dao){... |
| 1185 |
133
|
if(null == caInfoList) { |
| 1186 |
0
|
return caList; |
| 1187 |
|
} |
| 1188 |
133
|
if(caList==null){ |
| 1189 |
97
|
caList = new ArrayList<CluFeeAmount>(caInfoList.size()); |
| 1190 |
|
} |
| 1191 |
|
|
| 1192 |
133
|
if (!isUpdate) { |
| 1193 |
96
|
for (CurrencyAmountInfo caInfo:caInfoList){ |
| 1194 |
100
|
CurrencyAmount ca = new CurrencyAmount(); |
| 1195 |
100
|
ca.setCurrencyQuantity(caInfo.getCurrencyQuantity()); |
| 1196 |
100
|
ca.setCurrencyTypeKey(caInfo.getCurrencyTypeKey()); |
| 1197 |
100
|
CluFeeAmount cluFeeAmount = new CluFeeAmount(); |
| 1198 |
100
|
cluFeeAmount.setCurrencyAmount(ca); |
| 1199 |
100
|
caList.add(cluFeeAmount); |
| 1200 |
|
} |
| 1201 |
|
} else { |
| 1202 |
|
|
| 1203 |
37
|
for (CluFeeAmount cluFeeAmount:caList) { |
| 1204 |
35
|
dao.delete(cluFeeAmount); |
| 1205 |
|
} |
| 1206 |
37
|
caList.clear(); |
| 1207 |
|
|
| 1208 |
37
|
for (CurrencyAmountInfo caInfo : caInfoList) { |
| 1209 |
36
|
CurrencyAmount ca = new CurrencyAmount(); |
| 1210 |
|
|
| 1211 |
36
|
ca.setCurrencyQuantity(caInfo.getCurrencyQuantity()); |
| 1212 |
36
|
ca.setCurrencyTypeKey(caInfo.getCurrencyTypeKey()); |
| 1213 |
36
|
CluFeeAmount cluFeeAmount = new CluFeeAmount(); |
| 1214 |
36
|
cluFeeAmount.setCurrencyAmount(ca); |
| 1215 |
36
|
caList.add(cluFeeAmount); |
| 1216 |
|
} |
| 1217 |
|
} |
| 1218 |
|
|
| 1219 |
133
|
return caList; |
| 1220 |
|
} |
| 1221 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 1222 |
57
|
public static CluIdentifier createOfficialIdentifier(CluInfo cluInfo, LuDao dao) throws InvalidParameterException {... |
| 1223 |
57
|
CluIdentifier officialIdentifier = new CluIdentifier(); |
| 1224 |
57
|
BeanUtils.copyProperties(cluInfo.getOfficialIdentifier(), |
| 1225 |
|
officialIdentifier, new String[] { "attributes"}); |
| 1226 |
57
|
officialIdentifier.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1227 |
|
CluIdentifierAttribute.class, cluInfo.getOfficialIdentifier() |
| 1228 |
|
.getAttributes(), officialIdentifier, dao)); |
| 1229 |
|
|
| 1230 |
57
|
return officialIdentifier; |
| 1231 |
|
} |
| 1232 |
|
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 1233 |
46
|
public static void updateOfficialIdentifier(Clu clu, CluInfo cluInfo, LuDao dao) throws InvalidParameterException {... |
| 1234 |
46
|
if (clu.getOfficialIdentifier() == null) { |
| 1235 |
0
|
clu.setOfficialIdentifier(new CluIdentifier()); |
| 1236 |
|
} |
| 1237 |
46
|
BeanUtils.copyProperties(cluInfo.getOfficialIdentifier(), clu |
| 1238 |
|
.getOfficialIdentifier(), new String[] { "id" , "attributes"}); |
| 1239 |
|
|
| 1240 |
46
|
clu.getOfficialIdentifier().setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1241 |
|
CluIdentifierAttribute.class, cluInfo.getOfficialIdentifier() |
| 1242 |
|
.getAttributes(), clu.getOfficialIdentifier(), dao)); |
| 1243 |
|
|
| 1244 |
|
} |
| 1245 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 1246 |
189
|
public static List<CluIdentifier> createAlternateIdentifiers(CluInfo cluInfo, LuDao dao) throws InvalidParameterException {... |
| 1247 |
189
|
List<CluIdentifier> alternateIdentifiers = new ArrayList<CluIdentifier>(0); |
| 1248 |
189
|
for (CluIdentifierInfo cluIdInfo : cluInfo.getAlternateIdentifiers()) { |
| 1249 |
95
|
CluIdentifier identifier = new CluIdentifier(); |
| 1250 |
95
|
BeanUtils.copyProperties(cluIdInfo, identifier, new String[] { "attributes"} ); |
| 1251 |
|
|
| 1252 |
95
|
identifier.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1253 |
|
CluIdentifierAttribute.class, cluIdInfo.getAttributes(), identifier, dao)); |
| 1254 |
|
|
| 1255 |
95
|
alternateIdentifiers.add(identifier); |
| 1256 |
|
} |
| 1257 |
189
|
return alternateIdentifiers; |
| 1258 |
|
} |
| 1259 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 1260 |
48
|
public static void updateAlternateIdentifier(Map<String, CluIdentifier> oldAltIdMap, Clu clu, CluInfo cluInfo, LuDao dao) throws InvalidParameterException {... |
| 1261 |
48
|
for (CluIdentifier altIdentifier : clu.getAlternateIdentifiers()) { |
| 1262 |
79
|
oldAltIdMap.put(altIdentifier.getId(), altIdentifier); |
| 1263 |
|
} |
| 1264 |
48
|
clu.getAlternateIdentifiers().clear(); |
| 1265 |
|
|
| 1266 |
|
|
| 1267 |
|
|
| 1268 |
|
|
| 1269 |
48
|
for (CluIdentifierInfo cluIdInfo : cluInfo.getAlternateIdentifiers()) { |
| 1270 |
79
|
CluIdentifier identifier = oldAltIdMap.remove(cluIdInfo.getId()); |
| 1271 |
79
|
if (identifier == null) { |
| 1272 |
1
|
identifier = new CluIdentifier(); |
| 1273 |
|
} |
| 1274 |
|
|
| 1275 |
79
|
BeanUtils.copyProperties(cluIdInfo, identifier, new String[] { "attributes"}); |
| 1276 |
|
|
| 1277 |
79
|
identifier.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1278 |
|
CluIdentifierAttribute.class, cluIdInfo.getAttributes(), identifier, dao)); |
| 1279 |
|
|
| 1280 |
79
|
clu.getAlternateIdentifiers().add(identifier); |
| 1281 |
|
} |
| 1282 |
|
} |
| 1283 |
|
|
|
|
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
|
| 1284 |
58
|
public static List<CluPublicationVariant> toCluPublicationVariants(... |
| 1285 |
|
List<FieldInfo> variantInfos, CluPublication cluPub, LuDao luDao) { |
| 1286 |
58
|
List<CluPublicationVariant> variants = new ArrayList<CluPublicationVariant>(); |
| 1287 |
|
|
| 1288 |
58
|
if(cluPub.getVariants()==null){ |
| 1289 |
58
|
cluPub.setVariants(new ArrayList<CluPublicationVariant>()); |
| 1290 |
|
} |
| 1291 |
|
|
| 1292 |
|
|
| 1293 |
58
|
for (CluPublicationVariant variant : cluPub.getVariants()) { |
| 1294 |
0
|
luDao.delete(variant); |
| 1295 |
|
} |
| 1296 |
58
|
cluPub.getVariants().clear(); |
| 1297 |
|
|
| 1298 |
58
|
for (FieldInfo variantInfo: variantInfos) { |
| 1299 |
30
|
CluPublicationVariant variant = new CluPublicationVariant(); |
| 1300 |
30
|
variant.setKey(variantInfo.getId()); |
| 1301 |
30
|
variant.setValue(variantInfo.getValue()); |
| 1302 |
30
|
variant.setOwner(cluPub); |
| 1303 |
30
|
variants.add(variant); |
| 1304 |
|
} |
| 1305 |
|
|
| 1306 |
58
|
return variants; |
| 1307 |
|
} |
| 1308 |
|
|
|
|
|
| 88.2% |
Uncovered Elements: 2 (17) |
Complexity: 2 |
Complexity Density: 0.13 |
|
| 1309 |
247
|
public static CluPublicationInfo toCluPublicationInfo(CluPublication cluPub) {... |
| 1310 |
247
|
if(cluPub==null){ |
| 1311 |
0
|
return null; |
| 1312 |
|
} |
| 1313 |
247
|
CluPublicationInfo cluPubInfo = new CluPublicationInfo(); |
| 1314 |
247
|
cluPubInfo.setCluId(cluPub.getClu().getId()); |
| 1315 |
247
|
cluPubInfo.setId(cluPub.getId()); |
| 1316 |
247
|
cluPubInfo.setEndCycle(cluPub.getEndCycle()); |
| 1317 |
247
|
cluPubInfo.setStartCycle(cluPub.getStartCycle()); |
| 1318 |
247
|
cluPubInfo.setEffectiveDate(cluPub.getEffectiveDate()); |
| 1319 |
247
|
cluPubInfo.setExpirationDate(cluPub.getExpirationDate()); |
| 1320 |
247
|
cluPubInfo.setState(cluPub.getState()); |
| 1321 |
247
|
cluPubInfo.setType(cluPub.getType().getId()); |
| 1322 |
247
|
cluPubInfo.setMetaInfo(toMetaInfo(cluPub.getMeta(), cluPub.getVersionNumber())); |
| 1323 |
247
|
cluPubInfo.setAttributes(LuServiceAssembler.toAttributeMap(cluPub.getAttributes())); |
| 1324 |
247
|
cluPubInfo.setVariants(LuServiceAssembler.toCluPublicationVariantInfos(cluPub.getVariants())); |
| 1325 |
|
|
| 1326 |
247
|
return cluPubInfo; |
| 1327 |
|
} |
| 1328 |
|
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 1329 |
247
|
private static List<FieldInfo> toCluPublicationVariantInfos(... |
| 1330 |
|
List<CluPublicationVariant> variants) { |
| 1331 |
247
|
if(variants == null){ |
| 1332 |
0
|
return new ArrayList<FieldInfo>(0); |
| 1333 |
|
} |
| 1334 |
247
|
List<FieldInfo> fields = new ArrayList<FieldInfo>(); |
| 1335 |
247
|
for(CluPublicationVariant variant:variants){ |
| 1336 |
172
|
FieldInfo field = new FieldInfo(); |
| 1337 |
172
|
field.setId(variant.getKey()); |
| 1338 |
172
|
field.setValue(variant.getValue()); |
| 1339 |
172
|
fields.add(field); |
| 1340 |
|
} |
| 1341 |
247
|
return fields; |
| 1342 |
|
} |
| 1343 |
|
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 1344 |
186
|
public static List<CluPublicationInfo> toCluPublicationInfos(... |
| 1345 |
|
List<CluPublication> cluPublications) { |
| 1346 |
186
|
if(cluPublications == null){ |
| 1347 |
0
|
return new ArrayList<CluPublicationInfo>(0); |
| 1348 |
|
} |
| 1349 |
186
|
List<CluPublicationInfo> cluPublicationInfos = new ArrayList<CluPublicationInfo>(cluPublications.size()); |
| 1350 |
186
|
for(CluPublication cluPublication:cluPublications){ |
| 1351 |
168
|
cluPublicationInfos.add(toCluPublicationInfo(cluPublication)); |
| 1352 |
|
} |
| 1353 |
186
|
return cluPublicationInfos; |
| 1354 |
|
} |
| 1355 |
|
} |