/** * {@inheritDoc} */ @Override public void modify( ModifyOperationContext modifyContext ) throws LdapException { // Bypass trigger handling if the service is disabled. if ( !enabled ) { next( modifyContext ); return; } Dn normName = modifyContext.getDn(); // Gather supplementary data. Entry originalEntry = modifyContext.getEntry(); StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( modifyContext ); // Gather Trigger Specifications which apply to the entry being modified. List<TriggerSpecification> triggerSpecs = new ArrayList<>(); addPrescriptiveTriggerSpecs( modifyContext, triggerSpecs, normName, originalEntry ); addEntryTriggerSpecs( triggerSpecs, originalEntry ); Map<ActionTime, List<TriggerSpecification>> triggerMap = getActionTimeMappedTriggerSpecsForOperation( triggerSpecs, LdapOperation.MODIFY ); next( modifyContext ); triggerSpecCache.subentryModified( modifyContext, originalEntry ); // Fire AFTER Triggers. List<TriggerSpecification> afterTriggerSpecs = triggerMap.get( ActionTime.AFTER ); executeTriggers( modifyContext, afterTriggerSpecs, injector ); }
throws LdapException Entry entry = modifyContext.getEntry(); Attribute oc = entry.get( objectClassAT );
public void entryModified( ModifyOperationContext modifyContext ) { try { Binding newBinding = new Binding( modifyContext.getDn().getName(), ServerEntryUtils.toBasicAttributes( modifyContext.getEntry() ), false ); Binding oldBinding = new Binding( modifyContext.getDn().getName(), ServerEntryUtils.toBasicAttributes( ( ( ClonedServerEntry ) modifyContext.getEntry() ) .getOriginalEntry() ), false ); NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_CHANGED, newBinding, oldBinding, modifyContext ); if ( listener instanceof ObjectChangeListener ) { ( ( ObjectChangeListener ) listener ).objectChanged( evt ); } } catch ( Exception e ) { deliverNamingExceptionEvent( e ); } }
/** * Check that we can modify an entry */ private void checkModify( ModifyOperationContext modifyContext ) throws LdapException { List<Modification> mods = modifyContext.getModItems(); Entry originalEntry = modifyContext.getEntry(); Entry targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry ); // If the modified entry contains the CollectiveAttributeSubentry, then the modification // is accepted, no matter what if ( targetEntry.contains( directoryService.getAtProvider().getObjectClass(), SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) ) { return; } // Check that we don't add any collectve attribute, this is not allowed on normal entries if ( hasCollectiveAttributes( mods ) ) { /* * TODO: Replace the Exception and the ResultCodeEnum with the correct ones. */ LOG.info( "Cannot modify the entry {} : it contains some CollectiveAttributes and is not a collective subentry", targetEntry ); throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_242 ) ); } }
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String schemaName = getSchemaName( name ); MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName ); String oldOid = getOid( entry ); if ( isSchemaEnabled( schemaName ) ) { schemaManager.unregisterMatchingRule( oldOid ); schemaManager.add( mr ); return SCHEMA_MODIFIED; } else { return SCHEMA_UNCHANGED; } }
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String schemaName = getSchemaName( name ); String oid = getOid( entry ); LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager .getRegistries(), schemaName ); if ( isSchemaEnabled( schemaName ) ) { comparator.setSchemaName( schemaName ); schemaManager.unregisterComparator( oid ); schemaManager.add( comparator ); return SCHEMA_MODIFIED; } return SCHEMA_UNCHANGED; }
throws LdapException Entry entry = modifyContext.getEntry(); List<Modification> mods = modifyContext.getModItems(); boolean hasModification = SCHEMA_UNCHANGED;
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String schemaName = getSchemaName( name ); String oid = getOid( entry ); SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager .getRegistries(), schemaName ); if ( isSchemaEnabled( schemaName ) ) { syntaxChecker.setSchemaName( schemaName ); schemaManager.unregisterSyntaxChecker( oid ); schemaManager.add( syntaxChecker ); return SCHEMA_MODIFIED; } return SCHEMA_UNCHANGED; }
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String schemaName = getSchemaName( name ); String oldOid = getOid( entry ); Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName ); if ( isSchemaEnabled( schemaName ) ) { normalizer.setSchemaName( schemaName ); schemaManager.unregisterNormalizer( oldOid ); schemaManager.add( normalizer ); return SCHEMA_MODIFIED; } return SCHEMA_UNCHANGED; }
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String oid = getOid( entry ); ObjectClass oc = factory.getObjectClass( schemaManager, targetEntry, schemaManager.getRegistries(), getSchemaName( name ) ); String schemaName = getSchemaName( entry.getDn() ); if ( isSchemaEnabled( schemaName ) ) { schemaManager.unregisterObjectClass( oid ); schemaManager.add( oc ); return SCHEMA_MODIFIED; } return SCHEMA_UNCHANGED; }
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String oid = getOid( entry ); LdapSyntax syntax = factory.getSyntax( schemaManager, targetEntry, schemaManager.getRegistries(), getSchemaName( name ) ); String schemaName = getSchemaName( entry.getDn() ); if ( isSchemaEnabled( schemaName ) ) { schemaManager.unregisterLdapSyntax( oid ); schemaManager.add( syntax ); return SCHEMA_MODIFIED; } return SCHEMA_UNCHANGED; }
/** * {@inheritDoc} */ @Override public boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascade ) throws LdapException { Dn name = modifyContext.getDn(); Entry entry = modifyContext.getEntry(); String schemaName = getSchemaName( name ); String oid = getOid( entry ); AttributeType at = factory.getAttributeType( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName ); if ( isSchemaEnabled( schemaName ) ) { if ( schemaManager.getAttributeTypeRegistry().contains( oid ) ) { schemaManager.unregisterAttributeType( oid ); } schemaManager.add( at ); return SCHEMA_MODIFIED; } return SCHEMA_UNCHANGED; }
/** * {@inheritDoc} */ public void modify( ModifyOperationContext modifyContext ) throws LdapException { Entry entry = modifyContext.getEntry(); if ( entry == null ) { LookupOperationContext lookupCtx = new LookupOperationContext( modifyContext.getSession(), modifyContext.getDn() ); lookupCtx.setPartition( this ); lookupCtx.setTransaction( modifyContext.getTransaction() ); entry = wrapped.lookup( lookupCtx ); modifyContext.setEntry( entry ); } Entry targetEntry = SchemaUtils.getTargetEntry( modifyContext.getModItems(), entry ); boolean cascade = modifyContext.hasRequestControl( Cascade.OID ); boolean hasModification = synchronizer.modify( modifyContext, targetEntry, cascade ); if ( hasModification ) { wrapped.modify( modifyContext ); } if ( !modifyContext.getDn().equals( schemaModificationDN ) ) { updateSchemaModificationAttributes( modifyContext ); } }
List<Modification> modifications = modifyContext.getModItems(); Entry entry = modifyContext.getEntry();