Friday, January 8, 2021

How to fetch user status of JOSN Object?

 public static String extractUserState(String jsonObject)

throws ParseException, JsonParseException, JsonMappingException, IOException {

String methodName = "extractUserState";

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

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


String userStatus = null;

String id = null;

State state = new State();

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()) {

state = user.getState();

id = state.getId();

userStatus = id.substring(7);

System.out.println(id.substring(7));

}

}

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

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

return userStatus;

}

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...