Refine search
/** * Returns a attribute given it's id * * @param attributeId * The attribute Id * @return The attribute if it exists */ public EntryAttribute get( String attributeId ) { if ( "dn".equalsIgnoreCase( attributeId ) ) { return new DefaultClientAttribute( "dn", entry.getDn().getName() ); } return entry.get( attributeId ); }
public Entry toClientEntry() throws LdapException { // Copy the DN Entry clientEntry = new DefaultClientEntry( dn ); // Convert each attribute for ( EntryAttribute serverAttribute:this ) { EntryAttribute clientAttribute = serverAttribute.toClientAttribute(); clientEntry.add( clientAttribute ); } return clientEntry; } }
/** * Create a new attributeValue * * @param type The attribute's name (called 'type' in the grammar) */ public void addAttributeType( String type ) throws LdapException { // do not create a new attribute if we have seen this attributeType before if ( entry.get( type ) != null ) { currentAttribute = entry.get( type ); return; } // fix this to use AttributeImpl(type.getString().toLowerCase()) currentAttribute = new DefaultClientAttribute( type ); entry.put( currentAttribute ); }
/** * Remove a list of Attributes from the LdifEntry * * @param ids The Attributes to remove * @return The list of removed EntryAttributes */ public List<EntryAttribute> removeAttribute( String... ids ) { if ( entry.containsAttribute( ids ) ) { return entry.removeAttributes( ids ); } else { return null; } }
String modificationId = modAttr.getId(); EntryAttribute modifiedAttr = entry.get( modificationId ); entry.put( modAttr ); modifiedAttr.add( value ); if ( modAttr.get() == null ) entry.removeAttributes( modificationId ); modifiedAttr = entry.get( modificationId ); entry.removeAttributes( modifiedAttr.getId() ); entry.removeAttributes( modificationId ); entry.put( modAttr );
throws LdapException Entry targetEntry = entry.clone(); String id = mod.getAttribute().getId(); targetEntry.put( mod.getAttribute() ); break; EntryAttribute combined = mod.getAttribute().clone(); EntryAttribute toBeAdded = mod.getAttribute(); EntryAttribute existing = entry.get( id ); combined.add( value ); targetEntry.put( combined ); break; if ( toBeRemoved.size() == 0 ) targetEntry.removeAttributes( id ); existing = targetEntry.get( id );
addRequestLength = 1 + TLV.getNbBytes( DN.getNbBytes( entry.getDn() ) ) + DN.getNbBytes( entry.getDn() ); if ( ( entry != null ) && ( entry.size() != 0 ) ) int idLength = attribute.getId().getBytes().length; localAttributeLength = 1 + TLV.getNbBytes( idLength ) + idLength; if ( attribute.size() != 0 )
String msg = I18n.err( I18n.ERR_10020, entry.getDn().getName(), schemaName ); LOG.warn( msg ); throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); String msg = I18n.err( I18n.ERR_10021, entry.getDn().getName(), schemaName ); LOG.info( msg ); schema = schemaManager.getLoadedSchema( schemaName ); EntryAttribute mHumanReadable = entry.get( MetaSchemaConstants.X_HUMAN_READABLE_AT ); String val = mHumanReadable.getString(); syntax.setHumanReadable( val.toUpperCase().equals( "TRUE" ) );
/** * Verifies that an entry exists in the directory with the * specified attributes. * * @param entry the entry to verify * @throws NamingException if there are problems accessing the entry */ protected void verify( LdifEntry entry ) throws Exception { Entry readEntry = rootDSE.lookup( entry.getDn() ); for ( EntryAttribute readAttribute:readEntry ) { String id = readAttribute.getId(); EntryAttribute origAttribute = entry.getEntry().get( id ); for ( Value<?> value:origAttribute ) { if ( ! readAttribute.contains( value ) ) { LOG.error( "Failed to verify entry addition of {}. {} attribute in original " + "entry missing from read entry.", entry.getDn(), id ); throw new AssertionFailedError( "Failed to verify entry addition of " + entry.getDn() ); } } } }
/** * Get the entry DN * * @return Returns the objectName. */ public DN getObjectName() { return entry.getDn(); }
Entry clonedEntry = ( Entry ) modifiedEntry.clone(); EntryAttribute mod = modification.getAttribute(); EntryAttribute previous = clonedEntry.get( mod.getId() ); mod = modification.getAttribute(); previous = clonedEntry.get( mod.getId() ); if ( mod.get() == null ) mod = modification.getAttribute(); previous = clonedEntry.get( mod.getId() );
if ( entry.getDn() != null ) dn = (DN)entry.getDn().clone(); LOG.warn( "The DN '" + entry.getDn() + "' cannot be normalized" ); attributes = new HashMap<AttributeType, EntryAttribute>( entry.size() ); AttributeType attributeType = attribute.getAttributeType(); attributeType = schemaManager.lookupAttributeTypeRegistry( attribute.getId() ); LOG.warn( "The attribute '" + attribute.getId() + "' cannot be stored" );
/** * Process the FQCN attribute * @throws LdapInvalidAttributeValueException */ private String getFqcn( Entry entry, String objectType ) throws LdapInvalidAttributeValueException { // The FQCN EntryAttribute mFqcn = entry.get( MetaSchemaConstants.M_FQCN_AT ); if ( mFqcn == null ) { String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_FQCN_AT ); LOG.warn( msg ); throw new NullPointerException( msg ); } return mFqcn.getString(); }
String msg = I18n.err( I18n.ERR_10026, entry.getDn().getName(), schemaName ); LOG.warn( msg ); throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); String msg = I18n.err( I18n.ERR_10027, entry.getDn().getName(), schemaName ); LOG.info( msg ); schema = schemaManager.getLoadedSchema( schemaName ); EntryAttribute mSyntax = entry.get( MetaSchemaConstants.M_SYNTAX_AT ); EntryAttribute mSyntaxLength = entry.get( MetaSchemaConstants.M_LENGTH_AT ); EntryAttribute mEquality = entry.get( MetaSchemaConstants.M_EQUALITY_AT ); EntryAttribute mOrdering = entry.get( MetaSchemaConstants.M_ORDERING_AT ); EntryAttribute mSubstr = entry.get( MetaSchemaConstants.M_SUBSTR_AT ); EntryAttribute mSupAttributeType = entry.get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT ); EntryAttribute mCollective = entry.get( MetaSchemaConstants.M_COLLECTIVE_AT ); EntryAttribute mSingleValued = entry.get( MetaSchemaConstants.M_SINGLE_VALUE_AT ); EntryAttribute mNoUserModification = entry.get( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT ); EntryAttribute mUsage = entry.get( MetaSchemaConstants.M_USAGE_AT );
/** * @return the Names as Ldif lines */ private String nameToLdif() throws NamingException { if ( names.size() == 0 ) { return ""; } else { Entry entry = new DefaultClientEntry(); EntryAttribute attribute = new DefaultClientAttribute( "m-name" ); for ( String name:names ) { attribute.add( name ); } entry.put( attribute ); return LdifUtils.convertAttributesToLdif( entry ); } }
/** * * modifies all the attributes present in the entry by applying the same operation. * * @param entry the entry whise attributes to be modified * @param modOp the operation to be applied on all the attributes of the above entry * @return the modify operation's response * @throws LdapException in case of modify operation failure or timeout happens */ public ModifyResponse modify( Entry entry, ModificationOperation modOp ) throws LdapException { if ( entry == null ) { LOG.debug( "received a null entry for modification" ); throw new NullPointerException( "Entry to be modified cannot be null" ); } ModifyRequest modReq = new ModifyRequest( entry.getDn() ); Iterator<EntryAttribute> itr = entry.iterator(); while ( itr.hasNext() ) { modReq.addModification( itr.next(), modOp ); } return modify( modReq ); }
/** * Process the ByteCode attribute */ private EntryAttribute getByteCode( Entry entry, String objectType ) { EntryAttribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT ); if ( byteCode == null ) { String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_BYTECODE_AT ); LOG.warn( msg ); throw new NullPointerException( msg ); } return byteCode; }