Exemplo n.º 1
0
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (AppContext.canWrite(RolePermissionCollections.CRM_TASK)) {
      Task task;
      if (data.getParams() instanceof Task) {
        task = (Task) data.getParams();
      } else if (data.getParams() instanceof Integer) {
        TaskService taskService = ApplicationContextUtil.getSpringBean(TaskService.class);
        task = taskService.findByPrimaryKey((Integer) data.getParams(), AppContext.getAccountId());
        if (task == null) {
          NotificationUtil.showRecordNotExistNotification();
          return;
        }
      } else {
        throw new MyCollabException("Do not support param data: " + data);
      }

      super.onGo(container, data);
      view.editItem(task);

      if (task.getId() == null) {
        AppContext.addFragment("crm/activity/task/add/", "Add Activity Task");
      } else {
        AppContext.addFragment(
            "crm/activity/task/edit/" + UrlEncodeDecoder.encode(task.getId()),
            "Edit Activity Task: " + task.getSubject());
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
Exemplo n.º 2
0
  public void save(Task item) {
    TaskService taskService = ApplicationContextUtil.getSpringBean(TaskService.class);

    item.setSaccountid(AppContext.getAccountId());
    if (item.getId() == null) {
      taskService.saveWithSession(item, AppContext.getUsername());
    } else {
      taskService.updateWithSession(item, AppContext.getUsername());
    }
  }