コード例 #1
0
  @Override
  public void commit(CommitRequest request) {
    logger.debug(request);

    try {

      User user = new User();
      user.setId(request.getUserId());
      Device device = new Device(request.getDeviceId());
      Workspace workspace = new Workspace(request.getWorkspaceId());

      CommitNotification result =
          getHandler().doCommit(user, workspace, device, request.getItems());
      result.setRequestId(request.getRequestId());

      UUID id = workspace.getId();

      RemoteWorkspace commitNotifier = broker.lookupMulti(id.toString(), RemoteWorkspace.class);
      commitNotifier.notifyCommit(result);

      logger.debug("Consumer: Response sent to workspace \"" + workspace + "\"");

    } catch (Exception e) {
      logger.error(e);
    }
  }
コード例 #2
0
  @Override
  public void updateWorkspace(UpdateWorkspaceRequest request)
      throws UserNotFoundException, WorkspaceNotUpdatedException {
    logger.debug(request);

    User user = new User();
    user.setId(request.getUserId());
    Item item = new Item(request.getParentItemId());

    Workspace workspace = new Workspace(request.getWorkspaceId());
    workspace.setName(request.getWorkspaceName());
    workspace.setParentItem(item);

    getHandler().doUpdateWorkspace(user, workspace);

    // Create notification
    UpdateWorkspaceNotification notification =
        new UpdateWorkspaceNotification(
            workspace.getId(), workspace.getName(), workspace.getParentItem().getId());
    notification.setRequestId(request.getRequestId());

    // Send notification to owner
    RemoteClient client;
    try {
      client = broker.lookupMulti(user.getId().toString(), RemoteClient.class);
      client.notifyUpdateWorkspace(notification);
    } catch (RemoteException e1) {
      logger.error(String.format("Could not notify user: '******'", user.getId()), e1);
    }
  }
コード例 #3
0
  @Override
  public void createShareProposal(ShareProposalRequest request)
      throws ShareProposalNotCreatedException, UserNotFoundException {

    logger.debug(request);

    User user = new User();
    user.setId(request.getUserId());

    Item item = new Item(request.getItemId());

    // Create share proposal
    Workspace workspace =
        getHandler().doShareFolder(user, request.getEmails(), item, request.isEncrypted());

    // Create notification
    ShareProposalNotification notification =
        new ShareProposalNotification(
            workspace.getId(),
            workspace.getName(),
            item.getId(),
            workspace.getOwner().getId(),
            workspace.getOwner().getName(),
            workspace.getSwiftContainer(),
            workspace.getSwiftUrl(),
            workspace.isEncrypted());

    notification.setRequestId(request.getRequestId());

    // Send notification to owner
    RemoteClient client;
    try {
      client = broker.lookupMulti(user.getId().toString(), RemoteClient.class);
      client.notifyShareProposal(notification);
    } catch (RemoteException e1) {
      logger.error(String.format("Could not notify user: '******'", user.getId()), e1);
    }

    // Send notifications to users
    for (User addressee : workspace.getUsers()) {
      try {
        client = broker.lookupMulti(addressee.getId().toString(), RemoteClient.class);
        client.notifyShareProposal(notification);
      } catch (RemoteException e) {
        logger.error(String.format("Could not notify user: '******'", addressee.getId()), e);
      }
    }
  }
コード例 #4
0
  public CloneWorkspace(Workspace r) {
    this.id = r.getId().toString();
    this.name = r.getName();

    this.parentId = null;
    if (r.getParentItem() != null && r.getParentItem().getId() != null) {
      this.parentId = r.getParentItem().getId();
    }

    this.defaultWorkspace = !r.isShared();
    this.localLastUpdate = r.getLatestRevision();
    this.remoteLastUpdate = r.getLatestRevision();
    this.swiftContainer = r.getSwiftContainer();
    this.swiftStorageURL = r.getSwiftUrl();
    this.owner = r.getOwner().getId().toString();
    this.pathWorkspace = generatePath();
    this.encrypted = true;

    if (!defaultWorkspace) this.encrypted = r.isEncrypted();
  }