org.visallo.core.model.workspace.WorkspaceRepository.getCreatorUserId()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.visallo.core.model.workspace.WorkspaceRepository.getCreatorUserId()方法的一些代码示例,展示了WorkspaceRepository.getCreatorUserId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkspaceRepository.getCreatorUserId()方法的具体详情如下:
包路径:org.visallo.core.model.workspace.WorkspaceRepository
类名称:WorkspaceRepository
方法名:getCreatorUserId

WorkspaceRepository.getCreatorUserId介绍

暂无

代码示例

代码示例来源:origin: org.visallo/visallo-core

public JSONObject toJson(Workspace workspace, User user) {
  checkNotNull(workspace, "workspace cannot be null");
  checkNotNull(user, "user cannot be null");
  try {
    JSONObject workspaceJson = new JSONObject();
    workspaceJson.put("workspaceId", workspace.getWorkspaceId());
    workspaceJson.put("title", workspace.getDisplayTitle());
    String creatorUserId = getCreatorUserId(workspace.getWorkspaceId(), user);
    if (creatorUserId != null) {
      workspaceJson.put("createdBy", creatorUserId);
      workspaceJson.put("sharedToUser", !creatorUserId.equals(user.getUserId()));
    }
    workspaceJson.put("editable", hasWritePermissions(workspace.getWorkspaceId(), user));
    JSONArray usersJson = new JSONArray();
    for (WorkspaceUser workspaceUser : findUsersWithAccess(workspace.getWorkspaceId(), user)) {
      String userId = workspaceUser.getUserId();
      JSONObject userJson = new JSONObject();
      userJson.put("userId", userId);
      userJson.put("access", workspaceUser.getWorkspaceAccess().toString().toLowerCase());
      usersJson.put(userJson);
    }
    workspaceJson.put("users", usersJson);
    return workspaceJson;
  } catch (JSONException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.visallo/visallo-web

.sorted(Comparator.comparing(w -> w.getDisplayTitle().toLowerCase()))
.collect(Collectors.partitioningBy(userWorkspace ->
    workspaceRepository.getCreatorUserId(userWorkspace.getWorkspaceId(), user).equals(user.getUserId())));

代码示例来源:origin: org.visallo/visallo-core

workspaceClientApi.setTitle(workspace.getDisplayTitle());
String creatorUserId = getCreatorUserId(workspace.getWorkspaceId(), user);
if (creatorUserId == null) {
  workspaceClientApi.setSharedToUser(true);

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
public ClientApiSearch getSavedSearchOnWorkspace(String id, User user, String workspaceId) {
  Authorizations authorizations = authorizationRepository.getGraphAuthorizations(
      user,
      VISIBILITY_STRING,
      UserRepository.VISIBILITY_STRING
  );
  Vertex searchVertex = graph.getVertex(id, authorizations);
  if (searchVertex == null) {
    return null;
  }
  boolean isGlobalSearch = isSearchGlobal(id, authorizations);
  boolean hasWorkspaceAccess = workspaceId != null && workspaceRepository.hasReadPermissions(workspaceId, user);
  if (isGlobalSearch || isSearchPrivateToUser(id, user, authorizations)) {
    return toClientApiSearch(searchVertex);
  } else if (!isGlobalSearch && !hasWorkspaceAccess) {
    return null;
  } else {
    String workspaceCreatorId = workspaceRepository.getCreatorUserId(workspaceId, user);
    if (isSearchPrivateToUser(id, userRepository.findById(workspaceCreatorId), authorizations)) {
      return toClientApiSearch(searchVertex);
    }
    return null;
  }
}

相关文章