@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(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();
    }
  }
  @Override
  protected void deleteSelectedItems() {
    if (!isSelectAll) {
      Collection<SimpleRole> currentDataList = view.getPagedBeanTable().getCurrentDataList();
      List<Role> keyList = new ArrayList<>();
      for (SimpleRole item : currentDataList) {
        if (item.isSelected()) {
          if (Boolean.TRUE.equals(item.getIssystemrole())) {
            NotificationUtil.showErrorNotification(
                String.format(
                    "Can not delete role %s because it is the system role.", item.getRolename()));
          } else {
            keyList.add(item);
          }
        }
      }

      if (keyList.size() > 0) {
        roleService.massRemoveWithSession(
            keyList, AppContext.getUsername(), AppContext.getAccountId());
        doSearch(searchCriteria);
      }
    } else {
      roleService.removeByCriteria(searchCriteria, AppContext.getAccountId());
      doSearch(searchCriteria);
    }
  }
  @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();
    }
  }
 @Override
 protected void onGo(ComponentContainer container, ScreenData<?> data) {
   if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.MILESTONES)) {
     super.onGo(container, data);
     view.displayStatus(OptionI18nEnum.MilestoneStatus.InProgress);
     AppContext.addFragment(
         "project/milestone/list/"
             + GenericLinkUtils.encodeParam(CurrentProjectVariables.getProjectId()),
         AppContext.getMessage(MilestoneI18nEnum.VIEW_LIST_TITLE));
   } else {
     NotificationUtil.showMessagePermissionAlert();
   }
 }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (AppContext.canRead(RolePermissionCollections.ACCOUNT_ROLE)) {
      RoleContainer roleContainer = (RoleContainer) container;
      roleContainer.removeAllComponents();
      roleContainer.addComponent(view.getWidget());
      searchCriteria = (RoleSearchCriteria) data.getParams();
      doSearch(searchCriteria);

      AccountSettingBreadcrumb breadcrumb =
          ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
      breadcrumb.gotoRoleList();
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {

    if (data instanceof ProjectScreenData.Edit) {
      // TODO: Handle edit project
    } else {
      if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.PROJECT)) {
        super.onGo(container, data);
        view.displayDashboard();
        AppContext.addFragment(
            ProjectLinkGenerator.generateProjectLink(CurrentProjectVariables.getProject().getId()),
            AppContext.getMessage(ProjectCommonI18nEnum.VIEW_DASHBOARD));
      } 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();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)) {
      VersionContainer versionContainer = (VersionContainer) container;
      versionContainer.addComponent(view.getWidget());

      Version version = (Version) data.getParams();
      view.editItem(version);

      ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
      if (version.getId() == null) {
        breadcrumb.gotoVersionAdd();
      } else {
        breadcrumb.gotoVersionEdit(version);
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.BUGS)) {
      InsideProjectNavigationMenu projectModuleMenu =
          (InsideProjectNavigationMenu)
              ((MobileNavigationManager) UI.getCurrent().getContent()).getNavigationMenu();
      projectModuleMenu.selectButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_BUG));

      BugFilterParameter param = (BugFilterParameter) data.getParams();
      super.onGo(container, data);
      this.doSearch(param.getSearchCriteria());
      AppContext.addFragment(
          "project/bug/list/"
              + GenericLinkUtils.encodeParam(CurrentProjectVariables.getProjectId()),
          AppContext.getMessage(BugI18nEnum.VIEW_LIST_TITLE));

    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
      MilestoneContainer milestoneContainer = (MilestoneContainer) container;
      milestoneContainer.navigateToContainer(ProjectTypeConstants.MILESTONE);
      milestoneContainer.removeAllComponents();
      milestoneContainer.addComponent(view.getWidget());

      Milestone milestone = (Milestone) data.getParams();
      view.editItem(milestone);

      ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
      if (milestone.getId() == null) {
        breadcrumb.gotoMilestoneAdd();
      } else {
        breadcrumb.gotoMilestoneEdit(milestone);
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }