@Test public void testCreateEntry3() throws Exception { assumeTrue(isExternalServer()); try (Session session = userDir.getSession()) { assertNotNull(session); Map<String, Object> map = new HashMap<>(); map.put("username", "user123"); map.put("password", "pwd123"); map.put("firstName", "John"); map.put("lastName", "Doh"); map.put("dn", "cn=this,ou=is,ou=a,ou=fake,o=dn"); map.put("employeeType", new ArrayList<Serializable>()); DocumentModel user = session.getEntry(session.createEntry(map).getId()); assertNotNull(user); assertEquals(Collections.<String> emptyList(), user.getProperty(USER_SCHEMANAME, "employeeType")); map = new HashMap<>(); map.put("username", "anotherUser"); map.put("password", "secret"); map.put("firstName", "Mister"); map.put("lastName", "Untel"); map.put("dn", "cn=this,ou=is,ou=a,ou=fake,o=dn"); map.put("employeeType", Collections.<String> emptyList()); if (!(this instanceof TestLDAPPOSIXSession)) { X509Certificate myCert = createCertificate("cn=Mister Untel"); Blob cert = Blobs.createBlob(myCert.getEncoded()); map.put("certificate", cert); user = session.getEntry(session.createEntry(map).getId()); assertNotNull(user); assertEquals(Collections.<String> emptyList(), user.getProperty(USER_SCHEMANAME, "employeeType")); Blob cert2 = (Blob) user.getProperty(USER_SCHEMANAME, "certificate"); assertEquals(new String(cert.getByteArray()), new String(cert2.getByteArray())); } } }
@Override public DocumentModel createEntry(DocumentModel entry) { Map<String, Object> fieldMap = entry.getProperties(directory.getSchema()); Map<String, Object> simpleNameFieldMap = new HashMap<>(); for (Map.Entry<String, Object> fieldEntry : fieldMap.entrySet()) { String fieldKey = fieldEntry.getKey(); if (fieldKey.contains(":")) { fieldKey = fieldKey.split(":")[1]; } simpleNameFieldMap.put(fieldKey, fieldEntry.getValue()); } return createEntry(simpleNameFieldMap); }
LDAPSession extends BaseSession { @Override public DocumentModel createEntry(DocumentModel entry) { Map<String, Object> fieldMap = entry.getProperties(directory.getSchema()); Map<String, Object> simpleNameFieldMap = new HashMap<>(); for (Map.Entry<String, Object> fieldEntry : fieldMap.entrySet()) { String fieldKey = fieldEntry.getKey(); if (fieldKey.contains(":")) { fieldKey = fieldKey.split(":")[1]; } simpleNameFieldMap.put(fieldKey, fieldEntry.getValue()); } return createEntry(simpleNameFieldMap); } }
LDAPSession extends BaseSession { @Override public DocumentModel createEntry(DocumentModel entry) { Map<String, Object> fieldMap = entry.getProperties(directory.getSchema()); Map<String, Object> simpleNameFieldMap = new HashMap<>(); for (Map.Entry<String, Object> fieldEntry : fieldMap.entrySet()) { String fieldKey = fieldEntry.getKey(); if (fieldKey.contains(":")) { fieldKey = fieldKey.split(":")[1]; } simpleNameFieldMap.put(fieldKey, fieldEntry.getValue()); } return createEntry(simpleNameFieldMap); } LDAPSession(LDAPDirectory directory); }
LDAPSession extends BaseSession { @Override public DocumentModel createEntry(DocumentModel entry) { Map<String, Object> fieldMap = entry.getProperties(directory.getSchema()); Map<String, Object> simpleNameFieldMap = new HashMap<>(); for (Map.Entry<String, Object> fieldEntry : fieldMap.entrySet()) { String fieldKey = fieldEntry.getKey(); if (fieldKey.contains(":")) { fieldKey = fieldKey.split(":")[1]; } simpleNameFieldMap.put(fieldKey, fieldEntry.getValue()); } return createEntry(simpleNameFieldMap); } LDAPSession(LDAPDirectory directory); @Override LDAPDirectory getDirectory(); DirContext getContext(); @Override void deleteEntryWithoutReferences(String id); @Override boolean hasEntry(String id); @Override void deleteEntry(String id, Map<String, String> map); @Override DocumentModel getEntryFromSource(String id, boolean fetchReferences); @Override DocumentModelList query(Map<String, Serializable> filter, Set<String> fulltext, Map<String, String> orderBy,
            boolean fetchReferences, int limit, int offset); @Override DocumentModelList query(QueryBuilder queryBuilder, boolean fetchReferences); @Override List<String> queryIds(QueryBuilder queryBuilder); @Override void close(); @Override boolean authenticate(String username, String password); @Override boolean isAuthenticating(); boolean rdnMatchesIdField(); @Override // useful for the log function String toString(); @Override DocumentModel createEntry(DocumentModel entry); }
LDAPSession extends BaseSession { @Override public DocumentModel createEntry(DocumentModel entry) { Map<String, Object> fieldMap = entry.getProperties(directory.getSchema()); Map<String, Object> simpleNameFieldMap = new HashMap<>(); for (Map.Entry<String, Object> fieldEntry : fieldMap.entrySet()) { String fieldKey = fieldEntry.getKey(); if (fieldKey.contains(":")) { fieldKey = fieldKey.split(":")[1]; } simpleNameFieldMap.put(fieldKey, fieldEntry.getValue()); } return createEntry(simpleNameFieldMap); } LDAPSession(LDAPDirectory directory); @Override LDAPDirectory getDirectory(); DirContext getContext(); @Override void deleteEntryWithoutReferences(String id); @Override boolean hasEntry(String id); @Override void deleteEntry(String id, Map<String, String> map); @Override DocumentModel getEntryFromSource(String id, boolean fetchReferences); @Override DocumentModelList query(Map<String, Serializable> filter, Set<String> fulltext, Map<String, String> orderBy,
            boolean fetchReferences, int limit, int offset); @Override DocumentModelList query(QueryBuilder queryBuilder, boolean fetchReferences); @Override List<String> queryIds(QueryBuilder queryBuilder); @Override void close(); @Override boolean authenticate(String username, String password); @Override boolean isAuthenticating(); boolean rdnMatchesIdField(); @Override // useful for the log function String toString(); @Override DocumentModel createEntry(DocumentModel entry);  }