Revision ae5cf321
Added by Andreas Müller almost 4 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/MediaServiceImpl.java | ||
---|---|---|
60 | 60 |
@Transactional(readOnly=true) |
61 | 61 |
public class MediaServiceImpl extends IdentifiableServiceBase<Media,IMediaDao> implements IMediaService { |
62 | 62 |
|
63 |
|
|
64 | 63 |
public static final Integer IMAGE_READ_TIMEOUT = 3000; |
65 | 64 |
|
66 |
|
|
67 | 65 |
@Override |
68 | 66 |
@Autowired |
69 | 67 |
protected void setDao(IMediaDao dao) { |
... | ... | |
225 | 223 |
String message = null; |
226 | 224 |
if (ref instanceof MediaRepresentation){ |
227 | 225 |
continue; |
228 |
} |
|
229 |
if (ref instanceof TextData){ |
|
226 |
}else if (ref instanceof TextData){ |
|
230 | 227 |
TextData textData = HibernateProxyHelper.deproxy(ref, TextData.class); |
231 |
DescriptionBase description = HibernateProxyHelper.deproxy(textData.getInDescription(), DescriptionBase.class); |
|
228 |
DescriptionBase<?> description = HibernateProxyHelper.deproxy(textData.getInDescription(), DescriptionBase.class);
|
|
232 | 229 |
|
233 | 230 |
if (description instanceof TaxonDescription){ |
234 | 231 |
TaxonDescription desc = HibernateProxyHelper.deproxy(description, TaxonDescription.class); |
... | ... | |
256 | 253 |
result.setAbort(); |
257 | 254 |
} |
258 | 255 |
} |
259 |
|
|
260 |
}if (ref instanceof MediaSpecimen){ |
|
256 |
}else if (ref instanceof MediaSpecimen){ |
|
261 | 257 |
message = "The media can't be deleted from the database because it is referenced by a mediaspecimen. ("+((MediaSpecimen)ref).getTitleCache()+")"; |
262 | 258 |
result.setAbort(); |
263 | 259 |
}else { |
... | ... | |
267 | 263 |
if (message != null){ |
268 | 264 |
result.addException(new ReferencedObjectUndeletableException(message)); |
269 | 265 |
result.addRelatedObject(ref); |
270 |
|
|
271 | 266 |
} |
272 |
|
|
273 | 267 |
} |
274 | 268 |
|
275 | 269 |
return result; |
... | ... | |
325 | 319 |
} |
326 | 320 |
|
327 | 321 |
if(metadata == null) { |
328 |
metadata = new HashMap<>(0);
|
|
322 |
metadata = new HashMap<>(); |
|
329 | 323 |
} |
330 | 324 |
return metadata; |
331 | 325 |
} |
... | ... | |
337 | 331 |
protected List<String> mediaMetadataKeyExludes(){ |
338 | 332 |
CdmPreference pref = prefsService.findExact(CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.MediaMetadataKeynameExcludes)); |
339 | 333 |
if(pref == null) { |
340 |
return new ArrayList<>(0);
|
|
334 |
return new ArrayList<>(); |
|
341 | 335 |
} |
342 | 336 |
return pref.splitStringListValue(); |
343 | 337 |
} |
... | ... | |
349 | 343 |
} |
350 | 344 |
return pref.splitStringListValue(); |
351 | 345 |
} |
352 |
|
|
353 |
|
|
354 | 346 |
} |
Also available in: Unified diff
cleanup