Changeset 5463
- Timestamp:
- 07/09/14 07:46:46 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/service/impl/VirtualCollectionCMDICreatorImpl.java
r5427 r5463 145 145 virtualCollection.setCreationDate(getCreationDate(vc)); 146 146 virtualCollection.setStatus(getStatus(vc)); 147 virtualCollection.setReproducability(getReproducability(vc));148 147 virtualCollection.setPurpose(getPurpose(vc)); 149 148 virtualCollection.getCreator().add(getCreator(vc)); 150 149 virtualCollection.setGeneratedBy(new CMD.Components.VirtualCollection.GeneratedBy()); 150 virtualCollection.setReproducability(getReproducability(vc)); 151 151 152 152 if (vc.getReproducibilityNotice() != null) { … … 167 167 168 168 private ComplextypeStatus1 getStatus(VirtualCollection vc) { 169 // status is a mandatory field 169 170 final ComplextypeStatus1 status = new ComplextypeStatus1(); 170 171 switch (vc.getState()) { … … 185 186 186 187 private ComplextypeReproducability1 getReproducability(VirtualCollection vc) { 187 final ComplextypeReproducability1 reproducability = new ComplextypeReproducability1(); 188 if (vc.getReproducibility() != null) { 188 if (vc.getReproducibility() == null) { 189 return null; 190 } else { 191 final ComplextypeReproducability1 reproducability = new ComplextypeReproducability1(); 189 192 switch (vc.getReproducibility()) { 190 193 //TODO: better mapping … … 199 202 break; 200 203 } 201 }202 return reproducability;204 return reproducability; 205 } 203 206 } 204 207 205 208 private ComplextypePurpose1 getPurpose(VirtualCollection vc) { 206 final ComplextypePurpose1 purpose = new ComplextypePurpose1(); 207 if (vc.getPurpose() != null) { 209 if (vc.getPurpose() == null) { 210 return null; 211 } else { 212 final ComplextypePurpose1 purpose = new ComplextypePurpose1(); 208 213 switch (vc.getPurpose()) { 209 214 case FUTURE_USE: … … 220 225 break; 221 226 } 222 }223 return purpose;227 return purpose; 228 } 224 229 } 225 230 226 231 private CMD.Components.VirtualCollection.Creator getCreator(VirtualCollection vc) { 227 final CMD.Components.VirtualCollection.Creator creator = new CMD.Components.VirtualCollection.Creator(); 228 if (vc.getCreators().size() > 0) { 232 if (vc.getCreators().isEmpty()) { 233 return null; 234 } else { 235 final CMD.Components.VirtualCollection.Creator creator = new CMD.Components.VirtualCollection.Creator(); 229 236 final Creator vcCreator = vc.getCreators().get(0); 230 237 238 // name/creator is a mandatory field 231 239 final CMD.Components.VirtualCollection.Creator.Name name = new CMD.Components.VirtualCollection.Creator.Name(); 232 240 name.setValue(vcCreator.getPerson()); 233 241 creator.setName(name); 234 242 235 final Email email = new Email(); 236 email.setValue(vcCreator.getEMail()); 237 creator.setEmail(email); 238 239 final Organisation organisation = new Organisation(); 240 organisation.setValue(vcCreator.getOrganisation()); 241 creator.setOrganisation(organisation); 242 } 243 return creator; 243 if (vcCreator.getEMail() != null) { 244 final Email email = new Email(); 245 email.setValue(vcCreator.getEMail()); 246 creator.setEmail(email); 247 } 248 249 if (vcCreator.getOrganisation() != null) { 250 final Organisation organisation = new Organisation(); 251 organisation.setValue(vcCreator.getOrganisation()); 252 creator.setOrganisation(organisation); 253 } 254 return creator; 255 } 244 256 } 245 257 }
Note: See TracChangeset
for help on using the changeset viewer.