public void refreshGroupTasks(Date date, TaskView taskView) {
    Date fromDate = determineFirstDateForTaskViewBasedOnSpecifiedDate(date, taskView);
    int daysTotal = taskView.getNrOfDaysToShow();

    List<String> statuses = new ArrayList<String>(4);
    statuses.add("Ready");

    if (taskView.equals(TaskView.GRID)) {
      taskServices
          .call(
              new RemoteCallback<List<TaskSummary>>() {
                @Override
                public void callback(List<TaskSummary> tasks) {
                  allTaskSummaries = tasks;
                  filterTasks(view.getSearchBox().getText());
                  view.getSelectionModel().clear();
                }
              })
          .getTasksAssignedAsPotentialOwnerByExpirationDateOptional(
              identity.getName(), statuses, null, "en-UK");
    } else {
      taskServices
          .call(
              new RemoteCallback<Map<Day, List<TaskSummary>>>() {
                @Override
                public void callback(Map<Day, List<TaskSummary>> tasks) {
                  currentDayTasks = tasks;
                  filterTasks(view.getSearchBox().getText());
                }
              })
          .getTasksAssignedAsPotentialOwnerFromDateToDateByDays(
              identity.getName(), statuses, fromDate, daysTotal, "en-UK");
    }
  }
Example #2
0
 private CommentedOption makeCommentedOption(final String commitMessage) {
   final String name = identity.getName();
   final Date when = new Date();
   final CommentedOption co =
       new CommentedOption(sessionInfo.getId(), name, null, commitMessage, when);
   return co;
 }
  public Path save(
      final Path resource,
      final InputStream content,
      final String sessionId,
      final String comment) {
    log.info("USER:"******" UPDATING asset [" + resource.getFileName() + "]");

    try {
      final org.uberfire.java.nio.file.Path nioPath = Paths.convert(resource);
      final OutputStream outputStream =
          ioService.newOutputStream(nioPath, makeCommentedOption(sessionId, comment));
      IOUtils.copy(content, outputStream);
      outputStream.flush();
      outputStream.close();

      return resource;

    } catch (Exception e) {
      throw ExceptionUtilities.handleException(e);

    } finally {
      try {
        content.close();
      } catch (IOException e) {
        throw new org.uberfire.java.nio.IOException(e.getMessage());
      }
    }
  }
  public Path save(final Path resource, final InputStream content, final String comment) {
    log.info("USER:"******" UPDATING asset [" + resource.getFileName() + "]");

    try {
      final org.kie.commons.java.nio.file.Path nioPath = paths.convert(resource);
      final OutputStream outputStream =
          ioService.newOutputStream(nioPath, makeCommentedOption(comment));
      IOUtils.copy(content, outputStream);
      outputStream.flush();
      outputStream.close();

      // Read Path to ensure attributes have been set
      final Path newPath = paths.convert(nioPath);

      // Signal update to interested parties
      resourceUpdatedEvent.fire(new ResourceUpdatedEvent(newPath, sessionInfo));

      return newPath;

    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw ExceptionUtilities.handleException(e);

    } finally {
      try {
        content.close();
      } catch (IOException e) {
        throw ExceptionUtilities.handleException(e);
      }
    }
  }
 private List<String> getGroups(Identity identity) {
   List<Role> roles = identity.getRoles();
   List<String> groups = new ArrayList<String>(roles.size());
   for (Role r : roles) {
     groups.add(r.getName().trim());
   }
   return groups;
 }
 @Override
 public Path copy(final Path path, final String newName, final String comment) {
   System.out.println(
       "USER:"******" COPYING asset ["
           + path.getFileName()
           + "] to ["
           + newName
           + "]");
   String targetName =
       path.getFileName().substring(0, path.getFileName().lastIndexOf("/") + 1) + newName;
   String targetURI = path.toURI().substring(0, path.toURI().lastIndexOf("/") + 1) + newName;
   Path targetPath = PathFactory.newPath(path.getFileSystem(), targetName, targetURI);
   ioService.copy(
       paths.convert(path),
       paths.convert(targetPath),
       new CommentedOption(identity.getName(), comment));
   return targetPath;
 }
 public void refreshRelatedToMeProcessList() {
   List<Integer> states = new ArrayList<Integer>();
   states.add(ProcessInstance.STATE_ACTIVE);
   dataServices
       .call(
           new RemoteCallback<List<ProcessInstanceSummary>>() {
             @Override
             public void callback(List<ProcessInstanceSummary> processInstances) {
               currentProcessInstances = processInstances;
               filterProcessList(view.getCurrentFilter());
             }
           })
       .getProcessInstances(states, "", identity.getName());
 }
Example #8
0
  @Override
  public void delete(final Path pathToPomXML, final String comment) {
    try {
      final org.uberfire.java.nio.file.Path projectDirectory =
          Paths.convert(pathToPomXML).getParent();
      final Project project2Delete = resolveProject(Paths.convert(projectDirectory));

      ioService.delete(
          projectDirectory,
          StandardDeleteOption.NON_EMPTY_DIRECTORIES,
          new CommentedOption(sessionInfo.getId(), identity.getName(), null, comment));
      deleteProjectEvent.fire(new DeleteProjectEvent(project2Delete));
    } catch (final Exception e) {
      throw ExceptionUtilities.handleException(e);
    }
  }
  public void addTask(
      final List<String> users,
      List<String> groups,
      final String taskName,
      int priority,
      boolean isAssignToMe,
      long dueDate,
      long dueDateTime) {
    Date due = UTCDateBox.utc2date(dueDate + dueDateTime);

    if (isAssignToMe
        && users != null
        && users.isEmpty()
        && groups != null
        && containsGroup(groups, identity.getRoles())) {
      // System.out.println(" FIRST OPTION -> Groups were I'm Included  and I want to be
      // autoassigned add/start/claim!!");
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(
                      taskId, taskName, "Task Created and Started (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), true, true);
    } else if (!isAssignToMe
        && users != null
        && users.isEmpty()
        && groups != null
        && containsGroup(groups, identity.getRoles())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(
                      taskId, taskName, "Task Created and Started (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), false, false);
    }
    if (users != null && !users.isEmpty() && users.contains(identity.getName())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(taskId, taskName, "Task Created (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), true, false);
    } else if (users != null && !users.isEmpty() && !users.contains(identity.getName())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(taskId, taskName, "Task Created (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), false, false);
    } else if (groups != null && !groups.isEmpty() && !containsGroup(groups, identity.getRoles())) {
      taskOperationsService
          .call(
              new RemoteCallback<Long>() {
                @Override
                public void callback(Long taskId) {
                  refreshNewTask(taskId, taskName, "Task Created (id = " + taskId + ")");
                }
              },
              new ErrorCallback<Message>() {
                @Override
                public boolean error(Message message, Throwable throwable) {
                  ErrorPopup.showMessage(
                      "Unexpected error encountered : " + throwable.getMessage());
                  return true;
                }
              })
          .addQuickTask(taskName, priority, due, users, groups, identity.getName(), false, false);
    }
  }
 @Override
 public void delete(final Path path, final String comment) {
   System.out.println(
       "USER:"******" DELETING asset [" + path.getFileName() + "]");
   ioService.delete(paths.convert(path));
 }