コード例 #1
0
ファイル: DLImpl.java プロジェクト: einsty/liferay-portal
  @Override
  public boolean hasWorkflowDefinitionLink(
      long companyId, long groupId, long folderId, long fileEntryTypeId) throws Exception {

    while (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
      DLFolder dlFolder = DLFolderLocalServiceUtil.fetchDLFolder(folderId);

      if (dlFolder == null) {
        return false;
      }

      if (dlFolder.isOverrideFileEntryTypes()) {
        break;
      }

      folderId = dlFolder.getParentFolderId();
    }

    if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(
            companyId, groupId, DLFolderConstants.getClassName(), folderId, fileEntryTypeId)
        || WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(
            companyId,
            groupId,
            DLFolderConstants.getClassName(),
            folderId,
            DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_ALL)) {

      return true;
    }

    return false;
  }
コード例 #2
0
  public List<ManagementBarFilterItem> getManagementBarStatusFilterItems()
      throws PortalException, PortletException {

    List<ManagementBarFilterItem> managementBarFilterItems = new ArrayList<>();

    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_ANY));
    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_DRAFT));

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    int workflowDefinitionLinksCount =
        WorkflowDefinitionLinkLocalServiceUtil.getWorkflowDefinitionLinksCount(
            themeDisplay.getCompanyId(),
            themeDisplay.getScopeGroupId(),
            JournalFolder.class.getName());

    if (workflowDefinitionLinksCount > 0) {
      managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_PENDING));
      managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_DENIED));
    }

    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_SCHEDULED));
    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_APPROVED));
    managementBarFilterItems.add(getManagementBarFilterItem(WorkflowConstants.STATUS_EXPIRED));

    return managementBarFilterItems;
  }
コード例 #3
0
  /** @throws PortalException */
  @Override
  public WorkflowDefinitionLink getWorkflowDefinitionLink(
      long companyId, long groupId, long classPK) throws PortalException {

    return WorkflowDefinitionLinkLocalServiceUtil.fetchWorkflowDefinitionLink(
        companyId, groupId, getClassName(), 0, 0);
  }
コード例 #4
0
  protected DDLRecordSet updateRecordSet(ActionRequest actionRequest) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    long recordSetId = ParamUtil.getLong(actionRequest, "recordSetId");

    long groupId = ParamUtil.getLong(actionRequest, "groupId");
    long ddmStructureId = ParamUtil.getLong(actionRequest, "ddmStructureId");
    Map<Locale, String> nameMap = LocalizationUtil.getLocalizationMap(actionRequest, "name");
    Map<Locale, String> descriptionMap =
        LocalizationUtil.getLocalizationMap(actionRequest, "description");
    int scope = ParamUtil.getInteger(actionRequest, "scope");

    ServiceContext serviceContext =
        ServiceContextFactory.getInstance(DDLRecordSet.class.getName(), actionRequest);

    DDLRecordSet recordSet = null;

    if (cmd.equals(Constants.ADD)) {
      recordSet =
          DDLRecordSetServiceUtil.addRecordSet(
              groupId,
              ddmStructureId,
              null,
              nameMap,
              descriptionMap,
              DDLRecordSetConstants.MIN_DISPLAY_ROWS_DEFAULT,
              scope,
              serviceContext);
    } else {
      recordSet =
          DDLRecordSetServiceUtil.updateRecordSet(
              recordSetId,
              ddmStructureId,
              nameMap,
              descriptionMap,
              DDLRecordSetConstants.MIN_DISPLAY_ROWS_DEFAULT,
              serviceContext);
    }

    String workflowDefinition = ParamUtil.getString(actionRequest, "workflowDefinition");

    WorkflowDefinitionLinkLocalServiceUtil.updateWorkflowDefinitionLink(
        serviceContext.getUserId(),
        serviceContext.getCompanyId(),
        groupId,
        DDLRecordSet.class.getName(),
        recordSet.getRecordSetId(),
        0,
        workflowDefinition);

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    if (Validator.isNotNull(portletResource)) {
      PortletPreferences preferences =
          PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);

      preferences.reset("detailDDMTemplateId");
      preferences.reset("editable");
      preferences.reset("listDDMTemplateId");
      preferences.reset("spreadsheet");

      preferences.setValue("recordSetId", String.valueOf(recordSet.getRecordSetId()));

      preferences.store();
    }

    return recordSet;
  }