Ejemplo 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();
    }
  }
Ejemplo n.º 2
0
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (AppContext.canWrite(RolePermissionCollections.CRM_MEETING)) {
      MeetingWithBLOBs meeting = null;
      if (data.getParams() instanceof MeetingWithBLOBs) {
        meeting = (MeetingWithBLOBs) data.getParams();
      } else if (data.getParams() instanceof Integer) {
        MeetingService meetingService = ApplicationContextUtil.getSpringBean(MeetingService.class);
        meeting =
            meetingService.findByPrimaryKey((Integer) data.getParams(), AppContext.getAccountId());
      }
      if (meeting == null) {
        NotificationUtil.showRecordNotExistNotification();
        return;
      }
      super.onGo(container, data);

      view.editItem(meeting);

      if (meeting.getId() == null) {
        AppContext.addFragment(
            "crm/activity/meeting/add/",
            AppContext.getMessage(GenericI18Enum.BROWSER_ADD_ITEM_TITLE, "Meeting"));
      } else {
        AppContext.addFragment(
            "crm/activity/meeting/edit/" + UrlEncodeDecoder.encode(meeting.getId()),
            AppContext.getMessage(
                GenericI18Enum.BROWSER_EDIT_ITEM_TITLE, "Meeting", meeting.getSubject()));
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
Ejemplo n.º 3
0
  @Override
  protected void onGo(final ComponentContainer container, final ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) {

      InsideProjectNavigationMenu projectModuleMenu =
          (InsideProjectNavigationMenu)
              ((MobileNavigationManager) UI.getCurrent().getContent()).getNavigationMenu();
      projectModuleMenu.selectButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK));

      if (data.getParams() instanceof Integer) {
        ProjectTaskService taskService =
            ApplicationContextUtil.getSpringBean(ProjectTaskService.class);
        SimpleTask task =
            taskService.findById((Integer) data.getParams(), AppContext.getAccountId());

        if (task != null) {
          this.view.previewItem(task);
          super.onGo(container, data);

          AppContext.addFragment(
              ProjectLinkGenerator.generateTaskPreviewLink(
                  task.getTaskkey(), task.getProjectShortname()),
              task.getTaskname());
        } else {
          NotificationUtil.showRecordNotExistNotification();
          return;
        }
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
Ejemplo n.º 4
0
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (AppContext.canRead(RolePermissionCollections.ACCOUNT_ROLE)) {
      RoleService roleService = ApplicationContextUtil.getSpringBean(RoleService.class);
      SimpleRole role = roleService.findById((Integer) data.getParams(), AppContext.getAccountId());
      if (role != null) {
        RoleContainer roleContainer = (RoleContainer) container;
        roleContainer.removeAllComponents();
        roleContainer.addComponent(view.getWidget());
        view.previewItem(role);

        AccountSettingBreadcrumb breadcrumb =
            ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
        breadcrumb.gotoRoleRead(role);
      } else {
        NotificationUtil.showRecordNotExistNotification();
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }