Esempio 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();
    }
  }
  @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();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    CrmToolbar.navigateItem(CrmTypeConstants.LEAD);
    if (AppContext.canRead(RolePermissionCollections.CRM_LEAD)) {
      if (data.getParams() instanceof SimpleLead) {
        SimpleLead lead = (SimpleLead) data.getParams();
        super.onGo(container, data);
        view.previewItem(lead);

        AppContext.addFragment(
            CrmLinkGenerator.generateLeadPreviewLink(lead.getId()),
            AppContext.getMessage(
                GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE, "Lead", lead.getLeadName()));
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }