Refine search
/** * Creates new entry addition dialog. * * @param parent the parent frame * @param modal whether or not to go modal on the dialog */ public AddEntryDialog(Frame parent, boolean modal, SchemaManager schemaManager ) { super( parent, modal ); childEntry = new DefaultServerEntry( schemaManager ); childEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC ); initGUI(); }
/** * Add an attribute (represented by its ID and string values) into an entry. * * @param upId The attribute ID * @param values The list of string values to inject. It can be empty * @throws LdapException If the attribute does not exist */ public void add( String upId, String... values ) throws LdapException { add( upId, getAttributeType( upId ), values ); }
/** * Tells if an entry has a specific ObjectClass value * * @param objectClass The ObjectClass ID we want to check * @return <code>true</code> if the ObjectClass value is present * in the ObjectClass attribute */ public boolean hasObjectClass( String objectClass ) { return contains( OBJECT_CLASS_AT, objectClass ); }
userEntry = new DefaultServerEntry( m_SchemaManager, dn ); userEntry.put(SchemaConstants.OBJECT_CLASS, SchemaConstants.INET_ORG_PERSON_OC); userEntry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_PERSON_OC, SchemaConstants.PERSON_OC, SchemaConstants.INET_ORG_PERSON_OC); userEntry.put(SchemaConstants.CN_AT, u.getDisplayName()); userEntry.put(SchemaConstants.UID_AT,user); userEntry.put("mail", u.getEmailAddress());
public ServerEntry get() throws Exception { return new DefaultServerEntry( schemaManager ); }
DefaultServerEntry entry = new DefaultServerEntry( schemaManager, suffixDn ); entry.add( "objectClass", "organization" ); entry.add( "o", "Good Times Co." ); entry.add( "postalCode", "1" ); entry.add( "postOfficeBox", "1" ); injectEntryInStore( store, entry ); entry = new DefaultServerEntry( schemaManager, dn ); entry.add( "objectClass", "top", "organizationalUnit" ); entry.add( "ou", "Sales" ); entry.add( "postalCode", "1" ); entry.add( "postOfficeBox", "1" ); injectEntryInStore( store, entry ); entry = new DefaultServerEntry( schemaManager, dn ); entry.add( "objectClass", "top", "organizationalUnit" ); entry.add( "ou", "Board of Directors" ); entry.add( "postalCode", "1" ); entry.add( "postOfficeBox", "1" ); injectEntryInStore( store, entry ); entry = new DefaultServerEntry( schemaManager, dn ); entry.add( "objectClass", "top", "organizationalUnit" ); entry.add( "ou", "Engineering" ); entry.add( "postalCode", "2" ); entry.add( "postOfficeBox", "2" ); injectEntryInStore( store, entry ); entry = new DefaultServerEntry( schemaManager, dn );
public void importLdif(InputStream in) throws Exception { /** the context root for the rootDSE */ CoreSession rootDSE = service.getAdminSession(); for (LdifEntry ldifEntry : new LdifReader(in)) { DefaultServerEntry entry = new DefaultServerEntry(rootDSE.getDirectoryService().getSchemaManager(), ldifEntry.getEntry()); if (!rootDSE.exists(entry.getDn())) { rootDSE.add(entry); } } }
upId = getUpId( upId, attributeType ); createAttribute( upId, attributeType, values );
initObjectClassAT( schemaManager ); add( serverAttribute );
if ( containsAttribute( OBJECT_CLASS_AT ) ) EntryAttribute objectClass = get( OBJECT_CLASS_AT );
createAttribute( null, attributeType, values );
public ServerEntry createGroupEntry(DN dn) { ServerEntry groupEntry = m_EntryCache.get(dn.getName()); if (groupEntry == null) { try { //1. Obtain from crowd RDN rdn = dn.getRdn(2); String group = rdn.getNormValue(); Group g = m_CrowdClient.getGroup(group); List<String> users = m_CrowdClient.getNamesOfUsersOfGroup(group, 0, Integer.MAX_VALUE); groupEntry = new DefaultServerEntry( m_SchemaManager, dn ); groupEntry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.GROUP_OF_NAMES_OC); groupEntry.put(SchemaConstants.CN_AT, g.getName()); groupEntry.put("description", g.getDescription()); for (String u : users) { DN mdn = new DN(String.format("dn=%s,%s", u, CROWD_USERS_DN)); groupEntry.add(SchemaConstants.MEMBER_AT, mdn.getName()); } m_EntryCache.put(dn.getName(), groupEntry); } catch (Exception ex) { log.debug("createGroupEntry()", ex); } } return groupEntry; }//createUserEntry
ServerEntry attrs = new DefaultServerEntry( schemaManager, entry.getEntry() );
upId = getUpId( upId, attributeType ); createAttribute( upId, attributeType, values );
createAttribute( null, attributeType, values );
public ServerEntry getAttributes( String oid, LdapComparator<? super Object> comparator, Schema schema, SchemaManager schemaManager ) { ServerEntry entry = new DefaultServerEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_COMPARATOR_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, comparator.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }
private static void injectEntry(LdifEntry entry) throws Exception { if (entry.isChangeAdd()) { service.getAdminSession().add( new DefaultServerEntry(service.getSchemaManager(), entry.getEntry())); } else if (entry.isChangeModify()) { service.getAdminSession().modify(entry.getDn(), entry.getModificationItems()); } else { String message = I18n.err(I18n.ERR_117, entry.getChangeType()); throw new NamingException(message); } }
/** * Add an attribute (represented by its ID and Value values) into an entry. * * @param upId The attribute ID * @param values The list of Value values to inject. It can be empty * @throws LdapException If the attribute does not exist */ public void add( String upId, Value<?>... values ) throws LdapException { add( upId, getAttributeType( upId ), values ); }
upId = getUpId( upId, attributeType ); createAttribute( upId, attributeType, values );
createAttribute( null, attributeType, values );