/** * @see Object#toString() */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "ModifyContext for Dn '" ).append( getDn().getName() ).append( "', modifications :\n" ); if ( modItems != null ) { for ( Modification mod : modItems ) { sb.append( mod ).append( '\n' ); } } return sb.toString(); } }
public ModifyStoredProcedureParameterInjector( ModifyOperationContext opContext ) throws LdapException { super( opContext ); modifiedEntryName = opContext.getDn(); modifications = opContext.getModItems(); this.oldEntry = getEntry( opContext ); Map<Class<?>, MicroInjector> injectors = super.getInjectors(); injectors.put( StoredProcedureParameter.Modify_OBJECT.class, objectInjector ); injectors.put( StoredProcedureParameter.Modify_MODIFICATION.class, modificationInjector ); injectors.put( StoredProcedureParameter.Modify_OLD_ENTRY.class, oldEntryInjector ); injectors.put( StoredProcedureParameter.Modify_NEW_ENTRY.class, newEntryInjector ); }
String id = getEntryId( partitionTxn, modifyContext.getDn() ); super.modify( modifyContext.getTransaction(), modifyContext.getDn(), modifyContext.getModItems().toArray( new Modification[] {} ) ); Entry modifiedEntry = fetch( modifyContext.getTransaction(), id, modifyContext.getDn() ); modifyContext.setAlteredEntry( modifiedEntry ); Dn dn = modifyContext.getDn();
/** * {@inheritDoc} */ @Override public void modify( ModifyOperationContext modifyContext ) throws LdapException { // Special case : if we don't have any modification to apply, just return if ( modifyContext.getModItems().isEmpty() ) { return; } Partition partition = getPartition( modifyContext.getDn() ); partition.modify( modifyContext ); if ( modifyContext.isPushToEvtInterceptor() ) { directoryService.getInterceptor( InterceptorEnum.EVENT_INTERCEPTOR.getName() ).modify( modifyContext ); } }
/** * {@inheritDoc} */ @Override public void modify( ModifyOperationContext modifyContext ) throws LdapException { PartitionTxn partitionTxn = modifyContext.getTransaction(); synchronized ( lock ) { try { Entry modifiedEntry = super.modify( partitionTxn, modifyContext.getDn(), modifyContext.getModItems().toArray( new Modification[] {} ) ); // Remove the EntryDN modifiedEntry.removeAttributes( entryDnAT ); modifyContext.setAlteredEntry( modifiedEntry ); } catch ( Exception e ) { throw new LdapOperationException( e.getMessage(), e ); } dirty = true; rewritePartitionData( partitionTxn ); } }
/** * {@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 ); }
modifyContext.getDn(), entry, modifyContext.getModItems() ) ); throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM );
public void subentryModified( ModifyOperationContext opContext, Entry entry ) throws LdapException { if ( !hasPrescriptiveTrigger( entry ) ) { return; } Dn normName = opContext.getDn(); List<Modification> mods = opContext.getModItems(); boolean isTriggerSpecModified = false; for ( Modification mod : mods ) { isTriggerSpecModified |= mod.getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR ); } if ( isTriggerSpecModified ) { subentryDeleted( normName, entry ); subentryAdded( normName, entry ); } }
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 ); } }
/** * Proceed with the Modification operation when the PasswordPolicy is not activated. */ private void processStandardModify( ModifyOperationContext modifyContext ) throws LdapException { next( modifyContext ); List<Modification> modifications = modifyContext.getModItems(); for ( Modification modification : modifications ) { if ( directoryService.getAtProvider().getUserPassword() .equals( modification.getAttribute().getAttributeType() ) ) { invalidateAuthenticatorCaches( modifyContext.getDn() ); break; } } return; }
resultEntry.setObjectName( modifyContext.getDn() ); resultEntry.setEntry( alteredEntry );
/** * {@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 ); } }
/** * {@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; }
public void entryModified( ModifyOperationContext modifyContext ) { if ( !psearchControl.isNotificationEnabled( ChangeType.MODIFY ) ) { return; } SearchResultEntry respEntry = new SearchResultEntryImpl( req.getMessageId() ); respEntry.setObjectName( modifyContext.getDn() ); Entry entry = new ClonedServerEntry( modifyContext.getAlteredEntry() ); filterEntry( entry ); respEntry.setEntry( entry ); setECResponseControl( respEntry, modifyContext, ChangeType.MODIFY ); session.getIoSession().write( respEntry ); }
/** * {@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; }