mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
19.36.2016 93dc3520b26d74dadbdad265182d9beaa9145dc4
opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java
@@ -118,10 +118,7 @@
         */
        private String rdName;
        /**
         * The condition which is used to determine if a referenced
         * managed object is enabled.
         */
        /** The condition which is used to determine if a referenced managed object is enabled. */
        private Condition targetIsEnabledCondition = Conditions.TRUE;
        /**
@@ -189,7 +186,6 @@
            this.targetNeedsEnablingCondition = condition;
        }
        /** {@inheritDoc} */
        @Override
        protected AggregationPropertyDefinition<C, S> buildInstance(AbstractManagedObjectDefinition<?, ?> d,
            String propertyName, EnumSet<PropertyOption> options, AdministratorAction adminAction,
@@ -210,9 +206,7 @@
    }
    /**
     * A change listener which prevents the named component from being disabled.
     */
    /** A change listener which prevents the named component from being disabled. */
    private final class ReferentialIntegrityChangeListener implements ServerManagedObjectChangeListener<S> {
        /**
@@ -230,7 +224,7 @@
            this.message = message;
        }
        /** {@inheritDoc} */
        @Override
        public ConfigChangeResult applyConfigurationChange(ServerManagedObject<? extends S> mo) {
            try {
                if (targetIsEnabledCondition.evaluate(mo)) {
@@ -247,7 +241,7 @@
                + relationDefinition.getChildDefinition().getUserFriendlyName());
        }
        /** {@inheritDoc} */
        @Override
        public boolean isConfigurationChangeAcceptable(ServerManagedObject<? extends S> mo,
            List<LocalizableMessage> unacceptableReasons) {
            // Always prevent the referenced component from being
@@ -280,9 +274,7 @@
    }
    /**
     * A delete listener which prevents the named component from being deleted.
     */
    /** A delete listener which prevents the named component from being deleted. */
    private final class ReferentialIntegrityDeleteListener implements ConfigurationDeleteListener<S> {
        /** The DN of the referenced configuration entry. */
@@ -300,7 +292,7 @@
            this.message = message;
        }
        /** {@inheritDoc} */
        @Override
        public ConfigChangeResult applyConfigurationDelete(S configuration) {
            // This should not happen - the
            // isConfigurationDeleteAcceptable() call-back should have
@@ -316,7 +308,7 @@
            }
        }
        /** {@inheritDoc} */
        @Override
        public boolean isConfigurationDeleteAcceptable(S configuration, List<LocalizableMessage> unacceptableReasons) {
            if (configuration.dn().equals(dn)) {
                // Always prevent deletion of the referenced component.
@@ -328,12 +320,9 @@
    }
    /**
     * The server-side constraint handler implementation.
     */
    /** The server-side constraint handler implementation. */
    private class ServerHandler extends ServerConstraintHandler {
        /** {@inheritDoc} */
        @Override
        public boolean isUsable(ServerManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ConfigException {
@@ -370,7 +359,6 @@
            return isUsable;
        }
        /** {@inheritDoc} */
        @Override
        public void performPostAdd(ServerManagedObject<?> managedObject) throws ConfigException {
            // First make sure existing listeners associated with this
@@ -426,7 +414,6 @@
            }
        }
        /** {@inheritDoc} */
        @Override
        public void performPostDelete(ServerManagedObject<?> managedObject) throws ConfigException {
            // Remove any registered delete and change listeners.
@@ -456,7 +443,6 @@
            }
        }
        /** {@inheritDoc} */
        @Override
        public void performPostModify(ServerManagedObject<?> managedObject) throws ConfigException {
            // Remove all the constraints associated with this managed
@@ -473,7 +459,6 @@
     */
    private class SourceClientHandler extends ClientConstraintHandler {
        /** {@inheritDoc} */
        @Override
        public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
@@ -516,7 +501,6 @@
            return isAcceptable;
        }
        /** {@inheritDoc} */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
@@ -533,7 +517,6 @@
     */
    private class TargetClientHandler extends ClientConstraintHandler {
        /** {@inheritDoc} */
        @Override
        public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
@@ -554,7 +537,6 @@
            return isAcceptable;
        }
        /** {@inheritDoc} */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
@@ -584,10 +566,7 @@
            return isAcceptable;
        }
        /**
         * Find all managed objects which reference the named managed
         * object using this property.
         */
        /** Find all managed objects which reference the named managed object using this property. */
        private <C1 extends ConfigurationClient> List<ManagedObject<? extends C1>> findReferences(
            ManagementContext context, AbstractManagedObjectDefinition<C1, ?> mod, String name)
                throws LdapException {
@@ -684,22 +663,13 @@
    private static final Logger debugLogger = LoggerFactory.getLogger(AggregationPropertyDefinition.class);
    /**
     * The active server-side referential integrity change listeners
     * associated with this property.
     */
    /** The active server-side referential integrity change listeners associated with this property. */
    private final Map<DN, List<ReferentialIntegrityChangeListener>> changeListeners = new HashMap<>();
    /**
     * The active server-side referential integrity delete listeners
     * associated with this property.
     */
    /** The active server-side referential integrity delete listeners associated with this property. */
    private final Map<DN, List<ReferentialIntegrityDeleteListener>> deleteListeners = new HashMap<>();
    /**
     * The name of the managed object which is the parent of the
     * aggregated managed objects.
     */
    /** The name of the managed object which is the parent of the aggregated managed objects. */
    private ManagedObjectPath<?, ?> parentPath;
    /**
@@ -714,19 +684,13 @@
     */
    private final String rdName;
    /**
     * The relation in the parent managed object which contains the
     * aggregated managed objects.
     */
    /** The relation in the parent managed object which contains the aggregated managed objects. */
    private InstantiableRelationDefinition<C, S> relationDefinition;
    /** The source constraint. */
    private final Constraint sourceConstraint;
    /**
     * The condition which is used to determine if a referenced managed
     * object is enabled.
     */
    /** The condition which is used to determine if a referenced managed object is enabled. */
    private final Condition targetIsEnabledCondition;
    /**
@@ -748,13 +712,13 @@
        this.targetIsEnabledCondition = targetIsEnabledCondition;
        this.sourceConstraint = new Constraint() {
            /** {@inheritDoc} */
            @Override
            public Collection<ClientConstraintHandler> getClientConstraintHandlers() {
                ClientConstraintHandler handler = new SourceClientHandler();
                return Collections.singleton(handler);
            }
            /** {@inheritDoc} */
            @Override
            public Collection<ServerConstraintHandler> getServerConstraintHandlers() {
                ServerConstraintHandler handler = new ServerHandler();
                return Collections.singleton(handler);
@@ -762,19 +726,16 @@
        };
    }
    /** {@inheritDoc} */
    @Override
    public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
        return v.visitAggregation(this, p);
    }
    /** {@inheritDoc} */
    @Override
    public <R, P> R accept(PropertyValueVisitor<R, P> v, String value, P p) {
        return v.visitAggregation(this, value, p);
    }
    /** {@inheritDoc} */
    @Override
    public String decodeValue(String value) {
        Reject.ifNull(value);
@@ -907,7 +868,6 @@
        return targetNeedsEnablingCondition;
    }
    /** {@inheritDoc} */
    @Override
    public String normalizeValue(String value) {
        try {
@@ -918,7 +878,6 @@
        }
    }
    /** {@inheritDoc} */
    @Override
    public void toString(StringBuilder builder) {
        super.toString(builder);
@@ -936,7 +895,6 @@
        builder.append(targetIsEnabledCondition);
    }
    /** {@inheritDoc} */
    @Override
    public void validateValue(String value) {
        try {
@@ -967,13 +925,13 @@
        // for actions performed against referenced managed objects.
        Constraint constraint = new Constraint() {
            /** {@inheritDoc} */
            @Override
            public Collection<ClientConstraintHandler> getClientConstraintHandlers() {
                ClientConstraintHandler handler = new TargetClientHandler();
                return Collections.singleton(handler);
            }
            /** {@inheritDoc} */
            @Override
            public Collection<ServerConstraintHandler> getServerConstraintHandlers() {
                return Collections.emptyList();
            }