private List<ValidationStamp> readValidationStamps(JsonNode validationStampIds) { List<ValidationStamp> validationStampList; if (validationStampIds.isArray()) { List<Integer> ids = new ArrayList<>(); validationStampIds.forEach(id -> ids.add(id.asInt())); // Reading the validation stamps and then the names validationStampList = ids.stream() .map(id -> structureService.getValidationStamp(ID.of(id))) .collect(Collectors.toList()); } else { throw new AutoPromotionPropertyCannotParseException( "Cannot get the list of validation stamps"); } return validationStampList; }
List<FolderServerGroup> findGroups() { List<FolderServerGroup> groupList = new ArrayList<>(); String cypher = CypherQueryBuilder.findGroups(); CypherQuery q = new CypherQueryLiteral(cypher); JsonNode jsonNode = executeCypherQueryAndCommit(q); JsonNode userListJsonNode = jsonNode.at("/results/0/data"); if (userListJsonNode != null && !userListJsonNode.isMissingNode()) { userListJsonNode.forEach( f -> { JsonNode groupNode = f.at("/row/0"); if (groupNode != null && !groupNode.isMissingNode()) { FolderServerGroup cg = buildGroup(groupNode); groupList.add(cg); } }); } return groupList; }
List<FolderServerUser> findGroupMembers(String groupURL) { List<FolderServerUser> memberList = new ArrayList<>(); String cypher = CypherQueryBuilder.getGroupUsersWithRelation(RelationLabel.MEMBEROF); Map<String, Object> params = CypherParamBuilder.matchGroupId(groupURL); CypherQuery q = new CypherQueryWithParameters(cypher, params); JsonNode jsonNode = executeCypherQueryAndCommit(q); JsonNode userListJsonNode = jsonNode.at("/results/0/data"); if (userListJsonNode != null && !userListJsonNode.isMissingNode()) { userListJsonNode.forEach( f -> { JsonNode userNode = f.at("/row/0"); if (userNode != null && !userNode.isMissingNode()) { FolderServerUser u = buildUser(userNode); memberList.add(u); } }); } return memberList; }