コード例 #1
1
 FolderServerGroup findGroupByName(String groupName) {
   String cypher = CypherQueryBuilder.getGroupByName();
   Map<String, Object> params = CypherParamBuilder.getGroupByName(groupName);
   CypherQuery q = new CypherQueryWithParameters(cypher, params);
   JsonNode jsonNode = executeCypherQueryAndCommit(q);
   JsonNode groupNode = jsonNode.at("/results/0/data/0/row/0");
   return buildGroup(groupNode);
 }
コード例 #2
0
 FolderServerGroup updateGroupById(
     String groupId, Map<String, String> updateFields, String updatedBy) {
   String cypher = CypherQueryBuilder.updateGroupById(updateFields);
   Map<String, Object> params =
       CypherParamBuilder.updateGroupById(groupId, updateFields, updatedBy);
   CypherQuery q = new CypherQueryWithParameters(cypher, params);
   JsonNode jsonNode = executeCypherQueryAndCommit(q);
   JsonNode updatedNode = jsonNode.at("/results/0/data/0/row/0");
   return buildGroup(updatedNode);
 }
コード例 #3
0
 boolean deleteGroupById(String groupURL) {
   String cypher = CypherQueryBuilder.deleteGroupById();
   Map<String, Object> params = CypherParamBuilder.deleteGroupById(groupURL);
   CypherQuery q = new CypherQueryWithParameters(cypher, params);
   JsonNode jsonNode = executeCypherQueryAndCommit(q);
   JsonNode errorsNode = jsonNode.at("/errors");
   if (errorsNode.size() != 0) {
     JsonNode error = errorsNode.path(0);
     log.warn("Error while deleting group:", error);
   }
   return errorsNode.size() == 0;
 }
コード例 #4
0
 boolean removeRelation(FolderServerUser user, FolderServerGroup group, RelationLabel relation) {
   String cypher = CypherQueryBuilder.removeRelation(NodeLabel.USER, NodeLabel.GROUP, relation);
   Map<String, Object> params =
       CypherParamBuilder.matchFromNodeToNode(user.getId(), group.getId());
   CypherQuery q = new CypherQueryWithParameters(cypher, params);
   JsonNode jsonNode = executeCypherQueryAndCommit(q);
   JsonNode errorsNode = jsonNode.at("/errors");
   if (errorsNode.size() != 0) {
     JsonNode error = errorsNode.path(0);
     log.warn("Error while removing relation:", error);
   }
   return errorsNode.size() == 0;
 }
コード例 #5
0
 FolderServerGroup createGroup(
     String groupURL,
     String name,
     String displayName,
     String description,
     String ownerURL,
     Map<String, Object> extraProperties) {
   String cypher = CypherQueryBuilder.createGroup(extraProperties);
   Map<String, Object> params =
       CypherParamBuilder.createGroup(
           groupURL, name, displayName, description, ownerURL, extraProperties);
   CypherQuery q = new CypherQueryWithParameters(cypher, params);
   JsonNode jsonNode = executeCypherQueryAndCommit(q);
   JsonNode groupNode = jsonNode.at("/results/0/data/0/row/0");
   return buildGroup(groupNode);
 }
コード例 #6
-1
 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;
 }