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

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

Introduction

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

Prototype

String AMPERSAND

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

Click Source Link

Usage

From source file:com.liferay.adaptive.media.blogs.internal.exportimport.content.processor.AdaptiveMediaBlogsEntryExportImportContentProcessorTest.java

License:Open Source License

@Test
public void testExportContentWithNoReferencesDoesNotEscape() throws Exception {

    String content = StringPool.AMPERSAND;

    _makeOverridenProcessorReturn(content);

    Assert.assertEquals(/*from  ww  w.  jav a 2  s.co  m*/
            _blogsExportImportContentProcessor.replaceExportContentReferences(_portletDataContext, _blogsEntry,
                    content, false, false),
            _blogsExportImportContentProcessor.replaceExportContentReferences(_portletDataContext,
                    Mockito.mock(BlogsEntry.class), content, false, true));
}

From source file:com.liferay.adaptive.media.blogs.internal.exportimport.content.processor.AMBlogsEntryExportImportContentProcessorTest.java

License:Open Source License

@Test
public void testExportContentWithNoReferencesDoesNotEscape() throws Exception {

    String content = StringPool.AMPERSAND;

    _makeOverridenProcessorReturn(content);

    Assert.assertEquals(//from   ww w .j a v a 2 s.com
            _amBlogsEntryExportImportContentProcessor.replaceExportContentReferences(_portletDataContext,
                    _blogsEntry, content, false, false),
            _amBlogsEntryExportImportContentProcessor.replaceExportContentReferences(_portletDataContext,
                    Mockito.mock(BlogsEntry.class), content, false, true));
}

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

License:Open Source License

public static BBBMeeting endMeeting(long bbbMeetingId) throws PortalException {

    BBBMeeting bbbMeeting = BBBMeetingLocalServiceUtil.getBBBMeeting(bbbMeetingId);

    StringBundler sb = new StringBundler(7);

    sb.append(BBBConstants.API_PARAMETER_MEETING_ID);
    sb.append(StringPool.EQUAL);//from  ww  w  .ja v a 2  s  . c om
    sb.append(bbbMeeting.getBbbMeetingId());
    sb.append(StringPool.AMPERSAND);
    sb.append(BBBConstants.API_PARAMETER_PASSWORD);
    sb.append(StringPool.EQUAL);
    sb.append(HtmlUtil.escapeURL(bbbMeeting.getModeratorPassword()));

    execute(bbbMeeting, BBBConstants.API_METHOD_END, sb.toString());

    BBBMeetingLocalServiceUtil.updateStatus(bbbMeetingId, BBBMeetingConstants.STATUS_COMPLETED);

    return bbbMeeting;
}

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

License:Open Source License

public static String getJoinURL(BBBParticipant bbbParticipant, String userName) throws PortalException {

    if (!userName.equals(bbbParticipant.getName())) {
        bbbParticipant = BBBParticipantLocalServiceUtil.addBBBParticipant(bbbParticipant.getUserId(),
                bbbParticipant.getGroupId(), bbbParticipant.getBbbMeetingId(), userName, null,
                bbbParticipant.getType(), BBBParticipantConstants.STATUS_INVITED, new ServiceContext());
    }/*from  w  w  w .j  av  a  2 s .  c o m*/

    StringBundler sb = new StringBundler(11);

    sb.append(BBBConstants.API_PARAMETER_FULL_NAME);
    sb.append(StringPool.EQUAL);
    sb.append(HtmlUtil.escapeURL(bbbParticipant.getName()));
    sb.append(StringPool.AMPERSAND);
    sb.append(BBBConstants.API_PARAMETER_MEETING_ID);
    sb.append(StringPool.EQUAL);

    BBBMeeting bbbMeeting = BBBMeetingLocalServiceUtil.getBBBMeeting(bbbParticipant.getBbbMeetingId());

    sb.append(bbbMeeting.getBbbMeetingId());

    sb.append(StringPool.AMPERSAND);
    sb.append(BBBConstants.API_PARAMETER_PASSWORD);
    sb.append(StringPool.EQUAL);

    if (bbbParticipant.getType() == BBBParticipantConstants.TYPE_MODERATOR) {

        sb.append(HtmlUtil.escapeURL(bbbMeeting.getModeratorPassword()));
    } else {
        sb.append(HtmlUtil.escapeURL(bbbMeeting.getAttendeePassword()));
    }

    BBBServer bbbServer = BBBServerLocalServiceUtil.getBBBServer(bbbMeeting.getBbbServerId());

    return getURL(bbbServer, BBBConstants.API_METHOD_JOIN, sb.toString());
}

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

License:Open Source License

public static Document getMeetingInfoDocument(long bbbMeetingId) throws PortalException {

    BBBMeeting bbbMeeting = BBBMeetingLocalServiceUtil.getBBBMeeting(bbbMeetingId);

    StringBundler sb = new StringBundler(7);

    sb.append(BBBConstants.API_PARAMETER_MEETING_ID);
    sb.append(StringPool.EQUAL);/*  w  w  w .jav  a  2 s.c o m*/
    sb.append(bbbMeeting.getBbbMeetingId());
    sb.append(StringPool.AMPERSAND);
    sb.append(BBBConstants.API_PARAMETER_PASSWORD);
    sb.append(StringPool.EQUAL);
    sb.append(bbbMeeting.getModeratorPassword());

    Document document = execute(bbbMeeting, BBBConstants.API_METHOD_GET_MEETING_INFO, sb.toString());

    Element element = document.getRootElement();

    String returnCode = getText(element, BBBConstants.API_RESPONSE_RETURN_CODE);

    if (returnCode.equals(BBBConstants.API_RESPONSE_FAILED)) {
        throw new SystemException();
    }

    return document;
}

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

License:Open Source License

public static BBBMeeting startMeeting(long bbbMeetingId, boolean recordMeeting) throws PortalException {

    BBBMeeting bbbMeeting = BBBMeetingLocalServiceUtil.getBBBMeeting(bbbMeetingId);

    if (bbbMeeting.getStatus() != BBBMeetingConstants.STATUS_SCHEDULED) {
        return bbbMeeting;
    }//  ww  w  .ja v a  2s . c  o m

    StringBundler sb = new StringBundler(15);

    sb.append(BBBConstants.API_PARAMETER_MEETING_ID);
    sb.append(StringPool.EQUAL);
    sb.append(bbbMeeting.getBbbMeetingId());
    sb.append(StringPool.AMPERSAND);
    sb.append(BBBConstants.API_PARAMETER_NAME);
    sb.append(StringPool.EQUAL);
    sb.append(HtmlUtil.escapeURL(bbbMeeting.getName()));

    if (recordMeeting) {
        sb.append(StringPool.AMPERSAND);
        sb.append(BBBConstants.API_PARAMETER_RECORD);
        sb.append(StringPool.EQUAL);
        sb.append(StringPool.TRUE);
    }

    sb.append(StringPool.AMPERSAND);
    sb.append(BBBConstants.API_PARAMETER_WELCOME);
    sb.append(StringPool.EQUAL);

    String welcomeMessage = ContentUtil.get("com/liferay/bbb/dependencies/meeting_welcome_message.tmpl");

    sb.append(HtmlUtil.escapeURL(welcomeMessage));

    bbbMeeting.setBbbServerId(getBbbServerId());

    Document document = execute(bbbMeeting, BBBConstants.API_METHOD_CREATE, sb.toString());

    Element element = document.getRootElement();

    String returnCode = getText(element, BBBConstants.API_RESPONSE_RETURN_CODE);

    if (returnCode.equals(BBBConstants.API_RESPONSE_FAILED)) {
        throw new SystemException();
    }

    bbbMeeting.setAttendeePassword(getText(element, BBBConstants.API_PARAMETER_ATTENDEE_PW));
    bbbMeeting.setModeratorPassword(getText(element, BBBConstants.API_PARAMETER_MODERATOR_PW));
    bbbMeeting.setStatus(BBBMeetingConstants.STATUS_IN_PROGRESS);

    BBBMeetingLocalServiceUtil.updateBBBMeeting(bbbMeeting);

    return bbbMeeting;
}

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 w  w  . j a  v  a  2s  . com

    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.iframe.web.internal.display.context.IFrameDisplayContext.java

License:Open Source License

public String getIframeSrc() {
    if (_iFrameSrc != null) {
        return _iFrameSrc;
    }// w ww. j  a  v a 2 s .co  m

    _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.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  .j  a va2 s.c  om*/
    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;
}

From source file:com.liferay.portlet.asset.model.BaseAssetRenderer.java

License:Open Source License

protected String getURLViewInContext(LiferayPortletRequest liferayPortletRequest, String noSuchEntryRedirect,
        String path, String primaryKeyParameterName, long primaryKeyParameterValue) {

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

    StringBundler sb = new StringBundler(11);

    sb.append(themeDisplay.getPortalURL());
    sb.append(themeDisplay.getPathMain());
    sb.append(path);/*  w  w  w. j  a  va 2 s. co m*/
    sb.append("?p_l_id=");
    sb.append(themeDisplay.getPlid());
    sb.append("&noSuchEntryRedirect=");
    sb.append(HttpUtil.encodeURL(noSuchEntryRedirect));
    sb.append(StringPool.AMPERSAND);
    sb.append(primaryKeyParameterName);
    sb.append(StringPool.EQUAL);
    sb.append(primaryKeyParameterValue);

    return sb.toString();
}