use of org.apache.syncope.common.lib.to.ConnIdObjectClassTO in project syncope by apache.
the class ConnectorITCase method buildObjectClassInfo.
@Test
public void buildObjectClassInfo() {
ConnInstanceTO ws = connectorService.read("5ffbb4ac-a8c3-4b44-b699-11b398a1ba08", Locale.ENGLISH.getLanguage());
assertNotNull(ws);
List<ConnIdObjectClassTO> objectClassInfo = connectorService.buildObjectClassInfo(ws, true);
assertNotNull(objectClassInfo);
assertEquals(1, objectClassInfo.size());
assertEquals(ObjectClass.ACCOUNT_NAME, objectClassInfo.get(0).getType());
assertTrue(objectClassInfo.get(0).getAttributes().contains("promoThirdPartyDisclaimer"));
ConnInstanceTO ldap = connectorService.read("74141a3b-0762-4720-a4aa-fc3e374ef3ef", Locale.ENGLISH.getLanguage());
assertNotNull(ldap);
objectClassInfo = connectorService.buildObjectClassInfo(ldap, true);
assertNotNull(objectClassInfo);
Collection<String> objectClasses = objectClassInfo.stream().map(info -> info.getType()).collect(Collectors.toSet());
assertTrue(objectClasses.contains(ObjectClass.ACCOUNT_NAME));
assertTrue(objectClasses.contains(ObjectClass.GROUP_NAME));
}
use of org.apache.syncope.common.lib.to.ConnIdObjectClassTO in project syncope by apache.
the class ConnectorLogic method buildObjectClassInfo.
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')")
public List<ConnIdObjectClassTO> buildObjectClassInfo(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
ConnInstanceTO actual = connInstanceTO;
ConnInstance existing = connInstanceDAO.find(connInstanceTO.getKey());
if (existing != null) {
actual = binder.getConnInstanceTO(existing);
}
Set<ObjectClassInfo> objectClassInfo = connFactory.createConnector(connFactory.buildConnInstanceOverride(actual, connInstanceTO.getConf(), null)).getObjectClassInfo();
return objectClassInfo.stream().map(info -> {
ConnIdObjectClassTO connIdObjectClassTO = new ConnIdObjectClassTO();
connIdObjectClassTO.setType(info.getType());
connIdObjectClassTO.setAuxiliary(info.isAuxiliary());
connIdObjectClassTO.setContainer(info.isContainer());
connIdObjectClassTO.getAttributes().addAll(info.getAttributeInfo().stream().filter(attrInfo -> includeSpecial || !AttributeUtil.isSpecialName(attrInfo.getName())).map(AttributeInfo::getName).collect(Collectors.toList()));
return connIdObjectClassTO;
}).collect(Collectors.toList());
}
use of org.apache.syncope.common.lib.to.ConnIdObjectClassTO in project syncope by apache.
the class VirSchemaDetails method getExtAttrNames.
private List<String> getExtAttrNames() {
ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setKey(selectedResource.getConnector());
connInstanceTO.getConf().addAll(selectedResource.getConfOverride());
Optional<ConnIdObjectClassTO> connIdObjectClass = connRestClient.buildObjectClassInfo(connInstanceTO, false).stream().filter(object -> object.getType().equals(anyTypes.get(anyType.getModelObject()))).findAny();
return connIdObjectClass.isPresent() ? connIdObjectClass.get().getAttributes() : Collections.<String>emptyList();
}
use of org.apache.syncope.common.lib.to.ConnIdObjectClassTO in project syncope by apache.
the class ConnectorRestClient method getExtAttrNames.
public List<String> getExtAttrNames(final String adminRealm, final String objectClass, final String connectorKey, final Collection<ConnConfProperty> conf) {
ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setAdminRealm(adminRealm);
connInstanceTO.setKey(connectorKey);
connInstanceTO.getConf().addAll(conf);
// SYNCOPE-156: use provided info to give schema names (and type!) by ObjectClass
Optional<ConnIdObjectClassTO> connIdObjectClass = buildObjectClassInfo(connInstanceTO, false).stream().filter(object -> object.getType().equalsIgnoreCase(objectClass)).findAny();
return connIdObjectClass.isPresent() ? connIdObjectClass.get().getAttributes() : new ArrayList<>();
}
Aggregations