Example usage for com.liferay.portal.kernel.util StringPool QUESTION

List of usage examples for com.liferay.portal.kernel.util StringPool QUESTION

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool QUESTION.

Prototype

String QUESTION

To view the source code for com.liferay.portal.kernel.util StringPool QUESTION.

Click Source Link

Usage

From source file:com.liferay.alloy.util.TypeUtil.java

License:Open Source License

private boolean _isJavaType(String type) {
    try {//from  w w  w .  j av  a2  s  . c  om
        String genericsType = _getGenericsType(type);

        if (Validator.isNotNull(genericsType)) {
            String[] genericsTypes = StringUtil.split(genericsType);

            for (int i = 0; i < genericsTypes.length; i++) {
                String curType = genericsTypes[i].trim();

                if (!curType.equals(StringPool.QUESTION)) {
                    Class.forName(_removeArrayNotation(curType));
                }
            }

            type = _removeGenericsType(type);
        }

        Class.forName(_removeArrayNotation(type));

        return true;
    } catch (ClassNotFoundException e) {
        return false;
    }
}

From source file:com.liferay.bbb.util.BBBAPIUtil.java

License:Open Source License

protected static String getURL(BBBServer bbbServer, String methodName, String queryString)
        throws PortalException {

    StringBundler sb = new StringBundler(6);

    sb.append(bbbServer.getUrl());/*from   w  w  w .j  av a2s  .  co m*/
    sb.append(methodName);
    sb.append(StringPool.QUESTION);
    sb.append(queryString);
    sb.append("&checksum=");

    String checksum = DigesterUtil.digestHex(Digester.SHA_1, methodName + queryString + bbbServer.getSecret());

    sb.append(checksum);

    return sb.toString();
}

From source file:com.liferay.blogs.service.impl.BlogsEntryServiceImpl.java

License:Open Source License

protected String exportToRSS(String name, String description, String type, double version, String displayStyle,
        String feedURL, String entryURL, List<BlogsEntry> blogsEntries, ThemeDisplay themeDisplay) {

    SyndFeed syndFeed = new SyndFeedImpl();

    syndFeed.setDescription(description);

    List<SyndEntry> syndEntries = new ArrayList<>();

    syndFeed.setEntries(syndEntries);/*from w ww  .  j  a v a 2 s.  c o  m*/

    for (BlogsEntry entry : blogsEntries) {
        SyndEntry syndEntry = new SyndEntryImpl();

        String author = PortalUtil.getUserName(entry);

        syndEntry.setAuthor(author);

        SyndContent syndContent = new SyndContentImpl();

        syndContent.setType(RSSUtil.ENTRY_TYPE_DEFAULT);

        String value = null;

        if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) {
            String summary = entry.getDescription();

            if (Validator.isNull(summary)) {
                summary = entry.getContent();
            }

            value = StringUtil.shorten(HtmlUtil.extractText(summary), PropsValues.BLOGS_RSS_ABSTRACT_LENGTH,
                    StringPool.BLANK);
        } else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) {
            value = StringPool.BLANK;
        } else {
            value = StringUtil.replace(entry.getContent(), new String[] { "href=\"/", "src=\"/" },
                    new String[] { "href=\"" + themeDisplay.getURLPortal() + "/",
                            "src=\"" + themeDisplay.getURLPortal() + "/" });
        }

        syndContent.setValue(value);

        syndEntry.setDescription(syndContent);

        StringBundler sb = new StringBundler(4);

        sb.append(entryURL);

        if (!entryURL.endsWith(StringPool.QUESTION)) {
            sb.append(StringPool.AMPERSAND);
        }

        sb.append("entryId=");
        sb.append(entry.getEntryId());

        String link = sb.toString();

        syndEntry.setLink(link);

        syndEntry.setPublishedDate(entry.getDisplayDate());
        syndEntry.setTitle(entry.getTitle());
        syndEntry.setUpdatedDate(entry.getModifiedDate());
        syndEntry.setUri(link);

        syndEntries.add(syndEntry);
    }

    syndFeed.setFeedType(RSSUtil.getFeedType(type, version));

    List<SyndLink> syndLinks = new ArrayList<>();

    syndFeed.setLinks(syndLinks);

    SyndLink selfSyndLink = new SyndLinkImpl();

    syndLinks.add(selfSyndLink);

    selfSyndLink.setHref(feedURL);
    selfSyndLink.setRel("self");

    syndFeed.setPublishedDate(new Date());
    syndFeed.setTitle(name);
    syndFeed.setUri(feedURL);

    try {
        return RSSUtil.export(syndFeed);
    } catch (FeedException fe) {
        throw new SystemException(fe);
    }
}

From source file:com.liferay.chat.service.persistence.impl.StatusFinderImpl.java

License:Open Source License

protected String getFindBySocialRelationTypes_SQL(int[] types) {
    String sql = CustomSQLUtil.get(FIND_BY_SOCIAL_RELATION_TYPES);

    if (types.length == 0) {
        return StringUtil.replace(sql, "[$SOCIAL_RELATION_TYPES$]", StringPool.BLANK);
    }/*from   ww  w  . ja  v  a 2 s.  c  o m*/

    StringBundler sb = new StringBundler(types.length * 2 - 1);

    for (int i = 0; i < types.length; i++) {
        sb.append(StringPool.QUESTION);

        if ((i + 1) < types.length) {
            sb.append(StringPool.COMMA);
        }
    }

    return StringUtil.replace(sql, "[$SOCIAL_RELATION_TYPES$]",
            "SocialRelation.type_ IN (" + sb.toString() + ") AND");
}

From source file:com.liferay.chat.service.persistence.impl.StatusFinderImpl.java

License:Open Source License

protected String getFindByUsersGroups_SQL(String[] groupNames) {
    String sql = CustomSQLUtil.get(FIND_BY_USERS_GROUPS);

    if (groupNames.length == 0) {
        return StringUtil.replace(sql, new String[] { "[$USERS_GROUPS_JOIN$]", "[$USERS_GROUPS_WHERE$]" },
                new String[] { StringPool.BLANK, StringPool.BLANK });
    }//from  w w w  . ja  v  a  2 s. c  o  m

    StringBundler sb = new StringBundler(groupNames.length * 2 - 1);

    for (int i = 0; i < groupNames.length; i++) {
        sb.append(StringPool.QUESTION);

        if ((i + 1) < groupNames.length) {
            sb.append(StringPool.COMMA);
        }
    }

    return StringUtil.replace(sql, new String[] { "[$USERS_GROUPS_JOIN$]", "[$USERS_GROUPS_WHERE$]" },
            new String[] { "INNER JOIN Group_ ON Group_.groupId = Users_Groups.groupId",
                    "AND Group_.name NOT IN (" + sb.toString() + ")" });
}

From source file:com.liferay.documentlibrary.hook.filter.DLRecordFilter.java

License:Open Source License

/**
 * Get FileEntry object by passing document download URL in array.
 * User will not have permission to download document then it will throw Principal Exception
 * @param pathArray/*  w  ww . jav  a2s  . c om*/
 * @return
 * @throws Exception
 */
protected FileEntry getFileEntry(String[] pathArray) throws Exception {
    if (pathArray.length == 1) {
        long dlFileShortcutId = GetterUtil.getLong(pathArray[0]);

        DLFileShortcut dlFileShortcut = DLAppServiceUtil.getFileShortcut(dlFileShortcutId);

        return DLAppServiceUtil.getFileEntry(dlFileShortcut.getToFileEntryId());
    } else if (pathArray.length == 2) {
        long groupId = GetterUtil.getLong(pathArray[0]);

        return DLAppServiceUtil.getFileEntryByUuidAndGroupId(pathArray[1], groupId);
    } else if (pathArray.length == 3) {
        long groupId = GetterUtil.getLong(pathArray[0]);
        long folderId = GetterUtil.getLong(pathArray[1]);
        String fileName = HttpUtil.decodeURL(pathArray[2]);

        if (fileName.contains(StringPool.QUESTION)) {
            fileName = fileName.substring(0, fileName.indexOf(StringPool.QUESTION));
        }

        return DLAppServiceUtil.getFileEntry(groupId, folderId, fileName);
    } else {
        long groupId = GetterUtil.getLong(pathArray[0]);

        String uuid = pathArray[3];

        return DLAppServiceUtil.getFileEntryByUuidAndGroupId(uuid, groupId);
    }
}

From source file:com.liferay.iframe.web.internal.display.context.IFrameDisplayContext.java

License:Open Source License

public String getIframeSrc() {
    if (_iFrameSrc != null) {
        return _iFrameSrc;
    }/*from   w w  w . j a v  a  2 s . c om*/

    _iFrameSrc = StringPool.BLANK;

    if (_iFramePortletInstanceConfiguration.relative()) {
        _iFrameSrc = _themeDisplay.getPathContext();
    }

    _iFrameSrc += (String) _request.getAttribute(IFrameWebKeys.IFRAME_SRC);

    if (!ListUtil.isEmpty(getIFrameVariables())) {
        if (_iFrameSrc.contains(StringPool.QUESTION)) {
            _iFrameSrc += StringPool.AMPERSAND;
        } else {
            _iFrameSrc += StringPool.QUESTION;
        }

        _iFrameSrc += StringUtil.merge(getIFrameVariables(), StringPool.AMPERSAND);
    }

    return _iFrameSrc;
}

From source file:com.liferay.journal.internal.upgrade.v1_1_0.UpgradeDocumentLibraryTypeContent.java

License:Open Source License

protected FileEntry getFileEntryByDocumentLibraryURL(String url) throws PortalException {

    int x = url.indexOf("/documents/");

    int y = url.indexOf(StringPool.QUESTION);

    if (y == -1) {
        y = url.length();//from w  w  w .ja v a2 s  .  c o  m
    }

    url = url.substring(x, y);

    String[] parts = StringUtil.split(url, CharPool.SLASH);

    long groupId = GetterUtil.getLong(parts[2]);

    String uuid = null;

    if (parts.length == 5) {
        uuid = getUuidByDocumentLibraryURLWithoutUuid(parts);
    } else {
        uuid = parts[5];
    }

    return _dlAppLocalService.getFileEntryByUuidAndGroupId(uuid, groupId);
}

From source file:com.liferay.journal.internal.upgrade.v1_1_1.UpgradeFileUploadsConfiguration.java

License:Open Source License

protected void upgradeFileUploadsConfiguration() throws Exception {
    JournalFileUploadsConfiguration defaultConfig = ConfigurableUtil
            .createConfigurable(JournalFileUploadsConfiguration.class, new HashMapDictionary<>());

    Dictionary properties = new HashMapDictionary();

    properties.put("imageExtensions", _prefsProps.getStringArray(_OLD_KEY_JOURNAL_IMAGE_EXTENSIONS,
            StringPool.COMMA, defaultConfig.imageExtensions()));
    properties.put("largeImageMaxSize",
            _prefsProps.getLong(_OLD_KEY_JOURNAL_IMAGE_SMALL_MAX_SIZE, defaultConfig.smallImageMaxSize()));

    Configuration configuration = _configurationAdmin
            .getConfiguration(JournalFileUploadsConfiguration.class.getName(), StringPool.QUESTION);

    configuration.update(properties);//from  ww w . ja  v a2 s  .  co m

    PortletPreferences portletPreferences = _prefsProps.getPreferences();

    portletPreferences.reset(_OLD_KEY_JOURNAL_IMAGE_EXTENSIONS);
    portletPreferences.reset(_OLD_KEY_JOURNAL_IMAGE_SMALL_MAX_SIZE);
}

From source file:com.liferay.knowledgebase.util.KnowledgeBaseUtil.java

License:Open Source License

public static String getKBArticleURL(long plid, long resourcePrimKey, int status, String portalURL,
        boolean maximized) {

    StringBundler sb = new StringBundler(11);

    sb.append(portalURL);/*from   w  w  w. ja  va 2s.  c o m*/
    sb.append(PortalUtil.getPathMain());
    sb.append("/portal/knowledge_base/find_kb_article");
    sb.append(StringPool.QUESTION);
    sb.append("plid");
    sb.append(StringPool.EQUAL);
    sb.append(String.valueOf(plid));
    sb.append(StringPool.AMPERSAND);
    sb.append("resourcePrimKey");
    sb.append(StringPool.EQUAL);
    sb.append(String.valueOf(resourcePrimKey));

    String url = sb.toString();

    if (status != WorkflowConstants.STATUS_APPROVED) {
        url = url.concat(StringPool.AMPERSAND).concat("status").concat(StringPool.EQUAL)
                .concat(String.valueOf(status));
    }

    if (maximized) {
        url = url.concat(StringPool.AMPERSAND).concat("maximized").concat(StringPool.EQUAL)
                .concat(String.valueOf(maximized));
    }

    return url;
}