protected boolean isCollectionClonable(Collection col) { return IntactCore.isInitialized(col); } }
protected boolean isCollectionClonable(Collection col) { return IntactCore.isInitialized(col); } }
/** * Returns true if the collection has been initialized by hibernate and has pending changes. * Modifying a property of an object of the collection will NOT mark as dirty the collection itself. * * @param collection the collection to check * @return true if modified and initialized by hibernate */ public static boolean isInitializedAndDirty(Collection collection) { if (collection instanceof PersistentCollection) { return isInitialized(collection) && ((PersistentCollection) collection).isDirty(); } return isInitialized(collection); }
/** * Returns true if the collection has been initialized by hibernate and has pending changes. * Modifying a property of an object of the collection will NOT mark as dirty the collection itself. * * @param collection the collection to check * @return true if modified and initialized by hibernate */ public static boolean isInitializedAndDirty(Collection collection) { if (collection instanceof PersistentCollection) { return isInitialized(collection) && ((PersistentCollection) collection).isDirty(); } return isInitialized(collection); }
private <X extends Xref> void copyXrefCollection( Collection<X> sourceCol, Collection<X> targetCol ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection elementsToAdd = subtractXrefs( sourceCol, targetCol ); Collection elementsToRemove = subtractXrefs( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
private <X extends Xref> void copyXrefCollection( Collection<X> sourceCol, Collection<X> targetCol ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection elementsToAdd = subtractXrefs( sourceCol, targetCol ); Collection elementsToRemove = subtractXrefs( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
private void copyAnnotationCollection( Collection<Annotation> sourceCol, Collection<Annotation> targetCol ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection elementsToAdd = subtractAnnotations( sourceCol, targetCol ); Collection elementsToRemove = subtractAnnotations( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
private <A extends Alias> void copyAliasCollection( Collection<A> sourceCol, Collection<A> targetCol, AnnotatedObject source, AnnotatedObject target ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection<A> elementsToAdd = subtractAliases( sourceCol, targetCol ); Collection<A> elementsToRemove = subtractAliases( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
private void copyAnnotationCollection( Collection<Annotation> sourceCol, Collection<Annotation> targetCol ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection elementsToAdd = subtractAnnotations( sourceCol, targetCol ); Collection elementsToRemove = subtractAnnotations( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
private <A extends Alias> void copyAliasCollection( Collection<A> sourceCol, Collection<A> targetCol, AnnotatedObject source, AnnotatedObject target ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection<A> elementsToAdd = subtractAliases( sourceCol, targetCol ); Collection<A> elementsToRemove = subtractAliases( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
protected void copyCollection( Collection sourceCol, Collection targetCol ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection elementsToAdd = CollectionUtils.subtract( sourceCol, targetCol ); Collection elementsToRemove = CollectionUtils.subtract( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
protected void copyCollection( Collection sourceCol, Collection targetCol ) { if (!IntactCore.isInitialized(sourceCol) || !IntactCore.isInitialized(targetCol)) { return; } if (!CollectionUtils.isEqualCollection(sourceCol, targetCol)) { copiedProperty = true; } Collection elementsToAdd = CollectionUtils.subtract( sourceCol, targetCol ); Collection elementsToRemove = CollectionUtils.subtract( targetCol, sourceCol ); targetCol.removeAll( elementsToRemove ); targetCol.addAll( elementsToAdd ); }
private <T extends AnnotatedObject> void initializeCommonsIfNecessary(T ao, T managedObject) { if (IntactCore.isInitialized(ao.getXrefs())) IntactCore.initialize(managedObject.getXrefs()); if (IntactCore.isInitialized(ao.getAnnotations())) IntactCore.initialize(managedObject.getAnnotations()); if (IntactCore.isInitialized(ao.getAliases())) { IntactCore.initialize(managedObject.getAliases()); } }
private <T extends AnnotatedObject> void initializeCommonsIfNecessary(T ao, T managedObject) { if (IntactCore.isInitialized(ao.getXrefs())) IntactCore.initialize(managedObject.getXrefs()); if (IntactCore.isInitialized(ao.getAnnotations())) IntactCore.initialize(managedObject.getAnnotations()); if (IntactCore.isInitialized(ao.getAliases())) { IntactCore.initialize(managedObject.getAliases()); } }
private static Collection<Annotation> fetchAnnotations(Interaction interaction) { Collection<Annotation> annotations; if (IntactCore.isInitialized(interaction.getAnnotations())) { annotations = interaction.getAnnotations(); } else { annotations = IntactContext.getCurrentInstance().getDaoFactory().getAnnotationDao().getByParentAc(InteractionImpl.class, interaction.getAc()); } return annotations; }
private static Collection<Annotation> fetchAnnotations(Interaction interaction) { Collection<Annotation> annotations; if (IntactCore.isInitialized(interaction.getAnnotations())) { annotations = interaction.getAnnotations(); } else { annotations = IntactContext.getCurrentInstance().getDaoFactory().getAnnotationDao().getByParentAc(InteractionImpl.class, interaction.getAc()); } return annotations; }
/** * Ensures that the roles are initialized. * @param user The user * @return the initialized objects * @since 2.5.0 */ public static Collection<Role> ensureInitializedRoles(User user) { Collection<Role> roles; if (IntactCore.isInitialized(user.getPreferences())) { roles = user.getRoles(); } else { roles = IntactContext.getCurrentInstance().getDaoFactory().getRoleDao().getByUserAc(user.getAc()); } return roles; }
/** * Ensures that the preferences are initialized. * @param user The user * @return the initialized objects * @since 2.5.0 */ public static Collection<Preference> ensureInitializedPreferences(User user) { Collection<Preference> preferences; if (IntactCore.isInitialized(user.getPreferences())) { preferences = user.getPreferences(); } else { preferences = IntactContext.getCurrentInstance().getDaoFactory().getPreferenceDao().getByUserAc(user.getAc()); } return preferences; }
/** * Ensures that the lifecycle events are initialized. * @param publication The publication * @return the initialized events * @since 2.5.0 */ public static List<LifecycleEvent> ensureInitializedLifecycleEvents(Publication publication) { List<LifecycleEvent> events; if (IntactCore.isInitialized(publication.getLifecycleEvents())) { events = publication.getLifecycleEvents(); } else { events = IntactContext.getCurrentInstance().getDaoFactory().getLifecycleEventDao().getByPublicationAc(publication.getAc()); } return events; }
/** * Ensures that the lifecycle events are initialized. * @param publication The publication * @return the initialized events * @since 2.5.0 */ public static List<LifecycleEvent> ensureInitializedLifecycleEvents(Publication publication) { List<LifecycleEvent> events; if (IntactCore.isInitialized(publication.getLifecycleEvents())) { events = publication.getLifecycleEvents(); } else { events = IntactContext.getCurrentInstance().getDaoFactory().getLifecycleEventDao().getByPublicationAc(publication.getAc()); } return events; }