Package javax.naming.directory

Examples of javax.naming.directory.ModificationItem


      // didn't exist, it will automatically be created
      // TODO - since null is a valid attribute
      // value, we don't do any special handling of it right
      // now.  But maybe null should mean to delete an
      // attribute?
            updateMods[i] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(nameLeftElement, valueRightExpr));
    }
    // just try to update an LDAP entry using the DN and
    // attributes specified in the UPDATE operation.  If it isn't
    // legal, we'll get a NamingException back, whose explanation
    // we'll return in a ConnectorException
View Full Code Here


      AnyMap map = item.toMap();
      int modop = map.getLeft().toInt();
      Any right = map.getRight();
      if (right instanceof AnyAttribute) {
        Attribute attr = (Attribute)right.toObject();
        return new ModificationItem(modop, attr);
      }
    } else {
      if (item instanceof AnyAttribute) {
        Attribute attr = (Attribute)item.toObject();
        return new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr);
      }
    }
    return null;
  }
View Full Code Here

    if (i<n) {
      int size = n - i;
      modifications = new ModificationItem[n - i];
      int c = 0;
      for(i=0; i<n; i++) {
        ModificationItem item = buildItem(parameters[i]);
        if (item != null) {
          modifications[c++] = item;
        }
      }
      if (c < size) {
View Full Code Here

        userPasswordAttribute = new BasicAttribute ( ldapUserPasswordAttribute, pwdArray );
      } else {
        userPasswordAttribute = new BasicAttribute ( ldapUserPasswordAttribute, pwd );
      }

      modificationItems [ 0 ] = new ModificationItem ( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute );
      ctx.modifyAttributes ( dn, modificationItems );
      ctx.close();
    } catch (NamingException e) {
      log.error("NamingException when trying to change password with username::" + uid, e);
      errors.insert("Cannot change the password");
View Full Code Here

        PropertyIterator iter = getArguments().iterator();
        int count = 0;
        while (iter.hasNext()) {
            Argument item = (Argument) iter.next().getObjectValue();
            attr = getBasicAttribute(item.getName(), item.getValue());
            mods[count] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr);
            count = +1;
        }
        return mods;
    }
View Full Code Here

        // replace (update) attribute
        Attribute mod0 = new BasicAttribute("userpassword", "secret"); //$NON-NLS-1$ //$NON-NLS-2$
        // add mobile phone number attribute
        Attribute mod1 = new BasicAttribute("mobile", "123-456-1234"); //$NON-NLS-1$ //$NON-NLS-2$

        mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
        mods[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, mod1);

        return mods;
    }
View Full Code Here

                                    List<ModificationItem> mis = new ArrayList<ModificationItem>();
                                    NamingEnumeration<? extends Attribute> all = newAttributes.getAll();
                                    while ( all.hasMore() )
                                    {
                                        Attribute attribute = all.next();
                                        ModificationItem mi = new ModificationItem( DirContext.REPLACE_ATTRIBUTE,
                                            attribute );
                                        mis.add( mi );
                                    }

                                    // modify entry
View Full Code Here

    {
        // Creating the modification items
        List<ModificationItem> modificationItems = new ArrayList<ModificationItem>();
        for ( Modification modification : request.getModifications() )
        {
            modificationItems.add( new ModificationItem( convertModificationOperation( modification.getOperation() ),
                AttributeUtils.toAttribute( modification.getAttribute() ) ) );
        }

        // Executing the modify request
        browserConnection.getConnection().getJNDIConnectionWrapper().modifyEntry( request.getObject().getUpName(),
View Full Code Here

                    attribute.add( attrVals[x].getValueAsObject() );
                }

                if ( modSpecType.isAdd() )
                {
                    mis[ii] = new ModificationItem( DirContext.ADD_ATTRIBUTE, attribute );
                }
                else if ( modSpecType.isDelete() )
                {
                    mis[ii] = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attribute );
                }
                else if ( modSpecType.isReplace() )
                {
                    mis[ii] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attribute );
                }
            }

            browserConnection.getConnection().getJNDIConnectionWrapper().modifyEntry( dn, mis,
                getControls( modifyRecord ), monitor, null );
View Full Code Here

        // if krb5kdc is disabled then enable it
        if ( isKrb5KdcDisabled )
        {
            Attribute disabled = new BasicAttribute( "m-disabled" );
            ModificationItem[] mods = new ModificationItem[]
                { new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
            schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
        }
    }
View Full Code Here

TOP

Related Classes of javax.naming.directory.ModificationItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.