From aa84e432a8554d2b4e4e741c7899e327fca3ec8c Mon Sep 17 00:00:00 2001 From: Ethan Kromhout Date: Fri, 27 Sep 2019 14:44:03 -0400 Subject: [PATCH] Added sample configuration for importing entities as services --- .../samples/entities.xml | 485 ++++++++++++++++++ .../FederationManagerConnector.java | 6 +- 2 files changed, 489 insertions(+), 2 deletions(-) create mode 100644 connector-federation-manager/samples/entities.xml diff --git a/connector-federation-manager/samples/entities.xml b/connector-federation-manager/samples/entities.xml new file mode 100644 index 0000000..cf062c6 --- /dev/null +++ b/connector-federation-manager/samples/entities.xml @@ -0,0 +1,485 @@ + + Federation Manager Entities + + 2019-09-27T15:55:25.886Z + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-09-27T15:25:13.265Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000142624 + + Federation Manager Entities + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-09-27T15:25:14.897Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000142671 + + Federation Manager Entities + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-09-27T15:25:17.305Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000142718 + + Federation Manager Entities + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-09-27T15:25:23.371Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000142800 + + Federation Manager Entities + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-09-27T15:55:25.935Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000149190 + + Federation Manager Entities + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + 0 + + + up + + + + + c:connectorType + edu.unc.polygon.connector.federationManager.FederationManagerConnector + + + + + + + X-API-KEY + https://fmdev.inc.testbed.tier.internet2.edu + 72038b582ca7535edd1e6f1a45402668 + + + + + 2019-09-27T15:55:27.619Z + e1c4c34669b56849-ca866b33a7c98586 + + + + + + + + + + + icfs:uid + icfs:name + icfs:name
 + icfs:name + CustomEntityObjectClassObjectClass + + + + + + + 120 + status + + + + + + + 130 + organization_name + + + + + + + ConnId Name + 110 + __NAME__ + + + + + + + 140 + id + + + + + + + 150 + type + + + + + + + 160 + entity_name + + + + + + + 170 + organization_id + + + + + + + ConnId UID + 100 + read + + + + + + + + + + icfs:uid + icfs:name + icfs:name + icfs:name + __ACCOUNT__ + account + true + + + + + + + 120 + phonenumber + + + + + + + 130 + firstname + + + + + + + 140 + mobilenumber + + + + + + + 150 + email + + + + + + + 160 + organization_id + + + + + + + 170 + middlename + + + + + + + 180 + faxnumber + + + + + + + 190 + lastname + + + + + + + 200 + informalname + + + + + + + ConnId Name + 110 + __NAME__ + + + + + + + 210 + id + + + + + + + 220 + website + + + + + + + ConnId UID + 100 + read + + + + + + + + + + + account + default + true + CustomEntityObjectClassObjectClass + + icfs:name + + + $focus/name + + + + + ri:entity_name + + + $focus/url + + + + + ri:id + + + $focus/identifier + + + + + ri:type + + + $focus/subtype + + + + + ri:organization_name + + + $focus/displayName + + + + + + + + 2019-09-27T15:55:27.615Z + 3f84b0e2bcf1b1d9-1efa42b1a668cbb2 + + + + + + + connector + + + + + + + false + + + + + true + + + true + + connector + + + + true + + true + true + true + + + false + false + + + false + false + + + false + false + true + + + + true + false + + + + + + Entity sync policy + CustomEntityObjectClassObjectClass + account + default + c:ServiceType + true + + + polyStringNorm + c:name + + Matches using Name + declare namespace ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"; $account/attributes/icfs:name + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + + diff --git a/connector-federation-manager/src/main/java/edu/unc/polygon/connector/federationManager/FederationManagerConnector.java b/connector-federation-manager/src/main/java/edu/unc/polygon/connector/federationManager/FederationManagerConnector.java index 55f89c5..94bf754 100644 --- a/connector-federation-manager/src/main/java/edu/unc/polygon/connector/federationManager/FederationManagerConnector.java +++ b/connector-federation-manager/src/main/java/edu/unc/polygon/connector/federationManager/FederationManagerConnector.java @@ -239,6 +239,7 @@ public Schema schema() { Set entityAttributes = new HashSet(); AttributeInfoBuilder entity_id = new AttributeInfoBuilder(); entity_id.setName(ENTITY_ATTR_ID); + entity_id.setType(int.class); entity_id.setCreateable(true); entity_id.setUpdateable(true); entity_id.setReadable(true); @@ -262,6 +263,7 @@ public Schema schema() { entity_type.setMultiValued(false); entityAttributes.add(entity_type.build()); AttributeInfoBuilder entity_organization_id = new AttributeInfoBuilder(); + entity_organization_id.setType(int.class); entity_organization_id.setName(ENTITY_ATTR_ORGANIZATION_ID); entity_organization_id.setCreateable(true); entity_organization_id.setUpdateable(true); @@ -512,7 +514,7 @@ private void handleEntity ( ResultsHandler handler, JSONObject uidSearchResponse attributes = (JSONObject) uidSearchResponseJson.get("attributes"); } //builder.setUid(new Uid(String.valueOf(id))); - String [] potentialAttributes = { ENTITY_ATTR_ENTITY_NAME,ENTITY_ATTR_TYPE,ENTITY_ATTR_ORGANIZATION_ID,ENTITY_ATTR_ORGANIZATION_NAME,ENTITY_ATTR_STATUS}; + String [] potentialAttributes = { ENTITY_ATTR_ID,ENTITY_ATTR_ENTITY_NAME,ENTITY_ATTR_TYPE,ENTITY_ATTR_ORGANIZATION_ID,ENTITY_ATTR_ORGANIZATION_NAME,ENTITY_ATTR_STATUS}; for ( String potentialAttribute: potentialAttributes ) { LOG.info(">>> checking for attribute " + potentialAttribute ); if ( attributes.has(potentialAttribute) && attributes.get(potentialAttribute) != null && !JSONObject.NULL.equals(attributes.get(potentialAttribute)) ) { @@ -521,7 +523,7 @@ private void handleEntity ( ResultsHandler handler, JSONObject uidSearchResponse builder.setName(attributes.getString(potentialAttribute)); //builder.setName(String.valueOf(uidSearchResponseJson.getInt(ATTR_ID))); //Temp work around to use "id" as __NAME__ until we get username } - else if ( potentialAttribute.equals(ENTITY_ATTR_ORGANIZATION_ID) ) { + if ( potentialAttribute.equals(ENTITY_ATTR_ORGANIZATION_ID) || potentialAttribute.equals(ENTITY_ATTR_ID) ) { addAttr(builder, potentialAttribute, attributes.getInt(potentialAttribute)); } else {