Revision 2368acec
Added by Andreas Müller almost 3 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/CdmBase.java | ||
---|---|---|
13 | 13 |
import java.beans.PropertyChangeSupport; |
14 | 14 |
import java.io.Serializable; |
15 | 15 |
import java.lang.reflect.Method; |
16 |
import java.util.EnumSet; |
|
16 | 17 |
import java.util.HashSet; |
17 | 18 |
import java.util.List; |
18 | 19 |
import java.util.Set; |
... | ... | |
490 | 491 |
return field; |
491 | 492 |
} |
492 | 493 |
|
494 |
|
|
495 |
/** |
|
496 |
* EnumSets being part of the model should be immutable to make hibernate know if they have been changed. |
|
497 |
* Therefore any change to the enum set should result in a new enum set. |
|
498 |
*/ |
|
499 |
protected <T extends Enum<T>> EnumSet<T> newEnumSet(@NotNull EnumSet<T> enumSet, T additionalClass, T classToRemove) { |
|
500 |
EnumSet<T> result = EnumSet.copyOf(enumSet); |
|
501 |
if (additionalClass != null){ |
|
502 |
result.add(additionalClass); |
|
503 |
} |
|
504 |
if (classToRemove != null){ |
|
505 |
result.remove(classToRemove); |
|
506 |
} |
|
507 |
return result; |
|
508 |
} |
|
509 |
|
|
493 | 510 |
// ********************* HELPER ****************************************/ |
494 | 511 |
|
495 | 512 |
protected <T extends CdmBase> boolean replaceInList(List<T> list, |
Also available in: Unified diff
ref #9619 add conceptId, conceptDefinitions, conceptStatus, taxonTypes and currentConceptPeriod to Taxon