Revision bce3ec44
Added by Andreas Müller about 15 years ago
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/hibernate/CacheStrategyGenerator.java | ||
---|---|---|
39 | 39 |
if(ICdmBase.class.isAssignableFrom(entityClazz)) { |
40 | 40 |
ICdmBase cdmBase = (ICdmBase)entity; |
41 | 41 |
if(cdmBase.getId() == 0) { |
42 |
cdmBase.setCreated(new DateTime()); |
|
43 |
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
|
42 |
if (cdmBase.getCreated() == null){ |
|
43 |
cdmBase.setCreated(new DateTime()); |
|
44 |
} |
|
45 |
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
|
44 | 46 |
if(authentication != null && authentication.getPrincipal() != null && authentication.getPrincipal() instanceof User) { |
45 | 47 |
User user = (User)authentication.getPrincipal(); |
46 | 48 |
cdmBase.setCreatedBy(user); |
Also available in: Unified diff
createdBy not set if it is not null