Friday, January 8, 2021

How to fetch User Id / External Id of JSON Object?

 // fetch external user Id

public static String extractUserId(String jsonObject)

throws ParseException, JsonParseException, JsonMappingException, IOException {

String methodName = "extractUserId";

LOGGER.debug(CLASS_NAME + "/" + methodName);

System.out.println(CLASS_NAME + "/" + methodName);

String externalUserIDValue = null;

ObjectMapper objectMapper = new ObjectMapper();

Entities entities = objectMapper.readValue(jsonObject, Entities.class);

System.out.println("Entities lenght  : " + entities.getEntities().length);

if (entities.getEntities().length != 0) {

for (User user : entities.getEntities()) {

externalUserIDValue = user.getExternalId();

}

}

System.out.println("Exiting from the method : " + methodName);

LOGGER.debug("Exiting from the method : " + methodName);

return externalUserIDValue;

}


No comments:

Post a Comment

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...