/** * Deletes the old {@link DomainConsistencyPredicate}s that no longer exist * in this metaClass. * * @param metaClass * the {@link DomainMetaClass} of the domain class that used to * declare the predicates to process. * * @param oldPredicatesToProcess * the <code>Set</code> of {@link DomainConsistencyPredicate}s, * that are no longer being declared inside the domain class of * the given metaClass. */ private void deleteOldPredicates(Set<DomainConsistencyPredicate> oldPredicatesToRemove, DomainMetaClass metaClass) { for (DomainConsistencyPredicate domainConsistencyPredicate : oldPredicatesToRemove) { // Commits the current, and starts a new write transaction. // This is necessary to split the load of the mass deletion of DomainDependenceRecords among several transactions. // Each transaction fully processes one DomainConsistencyPredicate. domainConsistencyPredicate.delete(); checkpointTransaction(); } }
/** * Deletes all the {@link DomainMetaClass}es and {@link DomainMetaObject}s, * and any associated {@link DomainConsistencyPredicate}s and {@link DomainDependenceRecord}s. This method should be * invoked when the {@link FenixFramework} is configured not to create meta objects. * * @see JvstmOJBConfig#canCreateMetaObjects */ private void deleteAllMetaObjectsAndClasses() { if (!getDomainMetaClassSet().isEmpty()) { logger.info("Deleting all DomainMetaObjects, DomainMetaClasses, DomainConsistencyPredicates and DomainDependenceRecords"); for (DomainMetaClass metaClass : getDomainMetaClassSet()) { // Commits the current, and starts a new write transaction. // This is necessary to split the load of the mass deletion of objects among several transactions. // Each transaction fully processes one DomainMetaClass. metaClass.delete(); checkpointTransaction(); } } }
/** * Finishes the initialization of any {@link DomainConsistencyPredicate} that was not yet finalized.<br> * * @param existingPredicatesToProcess * the <code>Collection</code> of {@link DomainConsistencyPredicate}s to be finalized * @param metaClass * the {@link DomainMetaClass} that declares the {@link DomainConsistencyPredicate}s to be finalized */ private void finishInitializingConsistencyPredicates(Collection<DomainConsistencyPredicate> existingPredicatesToProcess, DomainMetaClass metaClass) { for (DomainConsistencyPredicate consistencyPredicate : existingPredicatesToProcess) { if (consistencyPredicate.isInitialized()) { continue; } logger.info("Resuming the initialization of the consistency predicate: " + consistencyPredicate.getPredicate().getName()); consistencyPredicate.executeConsistencyPredicateForMetaClassAndSubclasses(metaClass); // Because the executeConsistencyPredicateForMetaClassAndSubclasses method is split among several transactions, // the creation of the DomainConsistencyPredicate and its full initialization may not run atomically. // In case of a system failure during the execution of the executeConsistencyPredicateForMetaClassAndSubclasses method, // the DomainConsistencyPredicate was already created, but not yet fully initialized. // The init is only considered completed when finalized is set to true. consistencyPredicate.setInitialized(true); checkpointTransaction(); } }
/** * Finishes the initialization of any {@link DomainMetaClass} that was not * yet finalized.<br> * * @param existingMetaClassesToFinalize * the <code>Collection</code> of {@link DomainMetaClass}es to be * finalized */ private void finishInitializingMetaClasses(Collection<DomainMetaClass> existingMetaClassesToFinalize) { for (DomainMetaClass metaClass : existingMetaClassesToFinalize) { if (metaClass.isInitialized()) { continue; } logger.info("Resuming the initialization of the DomainMetaClass: " + metaClass.getDomainClass().getSimpleName()); metaClass.initExistingDomainObjects(); metaClass.executeInheritedPredicates(); // Because the initExistingDomainObjects method is split among several transactions, // the creation of the DomainMetaClass and its full initialization may not run atomically. // In case of a system failure during the execution of the initExistingDomainObjects() method, // the DomainMetaClass was already created, but not yet fully initialized. // The init is only considered completed when finalized is set to true. metaClass.setInitialized(true); checkpointTransaction(); } }
DomainFenixFrameworkRoot.checkpointTransaction();
DomainFenixFrameworkRoot.checkpointTransaction(); DomainFenixFrameworkRoot.checkpointTransaction();
DomainFenixFrameworkRoot.checkpointTransaction();
/** * Creates a {@link DomainMetaClass} for each new class. For each new {@link DomainMetaClass}, initializes its * meta-superclass and creates a {@link DomainMetaObject} for each existing object of the new {@link DomainMetaClass}. * * @param newClassesToAddTopDown * the <code>Collection</code> of Classes for which to create {@link DomainMetaClass}es, in top-down * order */ private void createNewMetaClasses(Collection<Class<? extends DomainObject>> newClassesToAddTopDown) { for (Class<? extends DomainObject> domainClass : newClassesToAddTopDown) { DomainMetaClass newDomainMetaClass = new DomainMetaClass(domainClass); if (hasSuperclassInDML(newDomainMetaClass)) { newDomainMetaClass.initDomainMetaSuperclass(getDomainMetaSuperclassFromDML(newDomainMetaClass)); } newDomainMetaClass.initExistingDomainObjects(); newDomainMetaClass.executeInheritedPredicates(); // Because the initExistingDomainObjects method is split among several transactions, // the creation of the DomainMetaClass and its full initialization may not run atomically. // In case of a system failure during the execution of the initExistingDomainObjects() method, // the DomainMetaClass was already created, but not yet fully initialized. // The init is only considered completed when finalized is set to true. newDomainMetaClass.setInitialized(true); checkpointTransaction(); } }