Example usage for com.liferay.portal.kernel.workflow WorkflowConstants getStatusLabel

List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants getStatusLabel

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowConstants getStatusLabel.

Prototype

public static String getStatusLabel(int status) 

Source Link

Usage

From source file:blade.document.action.configurationicon.BladeActionConfigurationIcon.java

License:Apache License

public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

    HttpServletRequest servletRequest = _portal.getHttpServletRequest(portletRequest);

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

    FileEntry fileEntry = _retrieveFile(servletRequest);

    PortletURL portletURL = PortletURLFactoryUtil.create(servletRequest,
            "blade_document_action_portlet_BladeDocumentActionPortlet", themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    String fileName = fileEntry.getFileName();
    String mimeType = fileEntry.getMimeType();
    String version = fileEntry.getVersion();
    String createdDate = fileEntry.getCreateDate().toString();
    String createdUserName = fileEntry.getUserName();
    String statusLabel = null;//from  w  w w . j  a v a 2s .  c om

    try {
        statusLabel = WorkflowConstants.getStatusLabel(fileEntry.getLatestFileVersion().getStatus());
    } catch (PortalException pe) {
        _log.error(pe);
    }

    portletURL.setParameter("fileName", fileName);
    portletURL.setParameter("mimeType", mimeType);
    portletURL.setParameter("version", version);
    portletURL.setParameter("statusLabel", statusLabel);
    portletURL.setParameter("createdDate", createdDate);
    portletURL.setParameter("createdUserName", createdUserName);

    try {
        portletURL.setWindowState(LiferayWindowState.POP_UP);
    } catch (WindowStateException wse) {
        _log.error(wse);
    }

    StringBuilder stringBuilder = new StringBuilder();

    stringBuilder.append("javascript:Liferay.Util.openWindow(");
    stringBuilder.append("{dialog: {cache: false,width:800,modal: true},");
    stringBuilder.append("title: 'basic information',id: ");
    stringBuilder.append("'testPopupIdUnique',uri: '");
    stringBuilder.append(portletURL.toString() + "'});");

    return stringBuilder.toString();
}

From source file:blade.document.action.displaycontext.BladeActionDisplayContext.java

License:Apache License

private String _getOnclick() {

    PortletURL portletURL = PortletURLFactoryUtil.create(request,
            "blade_document_action_portlet_BladeDocumentActionPortlet", _themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    String fileName = fileVersion.getFileName();
    String mimeType = fileVersion.getMimeType();
    String version = fileVersion.getVersion();
    String createdDate = fileVersion.getCreateDate().toString();
    String createdUserName = fileVersion.getUserName();
    String statusLabel = WorkflowConstants.getStatusLabel(fileVersion.getStatus());

    portletURL.setParameter("fileName", fileName);
    portletURL.setParameter("mimeType", mimeType);
    portletURL.setParameter("version", version);
    portletURL.setParameter("statusLabel", statusLabel);
    portletURL.setParameter("createdDate", createdDate);
    portletURL.setParameter("createdUserName", createdUserName);

    try {//  ww  w  .j  a  va  2s .c o m
        portletURL.setWindowState(LiferayWindowState.POP_UP);
    } catch (WindowStateException wse) {
        _log.error(wse);
    }

    StringBuilder stringBuilder = new StringBuilder();

    stringBuilder.append("Liferay.Util.openWindow({");
    stringBuilder.append("dialog: {cache: false,width:800,modal: true},");
    stringBuilder.append("title: 'basic information',id: ");
    stringBuilder.append("'testPopupIdUnique',uri: '");
    stringBuilder.append(portletURL.toString() + "'});");

    return stringBuilder.toString();
}

From source file:com.liferay.dynamic.data.lists.exporter.impl.BaseDDLExporter.java

License:Open Source License

protected String getStatusMessage(int status) {
    String statusLabel = WorkflowConstants.getStatusLabel(status);

    return LanguageUtil.get(_locale, statusLabel);
}

From source file:com.liferay.item.selector.taglib.internal.util.ItemSelectorRepositoryEntryBrowserUtil.java

License:Open Source License

public static JSONObject getItemMetadataJSONObject(FileEntry fileEntry, Locale locale) throws PortalException {

    JSONObject itemMetadataJSONObject = JSONFactoryUtil.createJSONObject();

    JSONArray groupsJSONArray = JSONFactoryUtil.createJSONArray();

    JSONObject firstTabJSONObject = JSONFactoryUtil.createJSONObject();

    JSONArray firstTabDataJSONArray = JSONFactoryUtil.createJSONArray();

    FileVersion latestFileVersion = fileEntry.getLatestFileVersion();

    firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "format"),
            HtmlUtil.escape(latestFileVersion.getExtension())));

    firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "size"),
            TextFormatter.formatStorageSize(fileEntry.getSize(), locale)));
    firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "name"),
            HtmlUtil.escape(DLUtil.getTitleWithExtension(fileEntry))));

    Date modifiedDate = fileEntry.getModifiedDate();

    firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "modified"),
            LanguageUtil.format(locale, "x-ago-by-x",
                    new Object[] {
                            LanguageUtil.getTimeDescription(locale,
                                    System.currentTimeMillis() - modifiedDate.getTime(), true),
                            HtmlUtil.escape(fileEntry.getUserName()) })));

    firstTabJSONObject.put("data", firstTabDataJSONArray);

    firstTabJSONObject.put("title", LanguageUtil.get(locale, "file-info"));

    groupsJSONArray.put(firstTabJSONObject);

    JSONObject secondTabJSONObject = JSONFactoryUtil.createJSONObject();

    JSONArray secondTabDataJSONArray = JSONFactoryUtil.createJSONArray();

    secondTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "version"),
            HtmlUtil.escape(latestFileVersion.getVersion())));
    secondTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "status"),
            WorkflowConstants.getStatusLabel(latestFileVersion.getStatus())));

    secondTabJSONObject.put("data", secondTabDataJSONArray);

    secondTabJSONObject.put("title", LanguageUtil.get(locale, "version"));

    groupsJSONArray.put(secondTabJSONObject);

    itemMetadataJSONObject.put("groups", groupsJSONArray);

    return itemMetadataJSONObject;
}

From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java

License:Open Source License

public String getManagementBarStatusFilterValue() {
    return WorkflowConstants.getStatusLabel(getStatus());
}

From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java

License:Open Source License

protected ManagementBarFilterItem getManagementBarFilterItem(int status)
        throws PortalException, PortletException {

    boolean active = false;

    if (status == getStatus()) {
        active = true;//from  w  ww. j  a v  a2 s.  c o m
    }

    PortletURL portletURL = PortletURLUtil.clone(getPortletURL(), _liferayPortletResponse);

    portletURL.setParameter("status", String.valueOf(status));

    return new ManagementBarFilterItem(active, WorkflowConstants.getStatusLabel(status), portletURL.toString());
}