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

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

Introduction

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

Prototype

String TRUE

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

Click Source Link

Usage

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;
    }/*from   ww w  .j av a  2  s. 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.polls.util.PollsUtil.java

License:Open Source License

public static void savePollsVote(HttpServletRequest request, HttpServletResponse response,
        long pollsQuestionId) {

    Cookie cookie = new Cookie(_getCookieName(pollsQuestionId), StringPool.TRUE);

    cookie.setMaxAge((int) (Time.WEEK / 1000));
    cookie.setPath(StringPool.SLASH);//from   w  w  w.  j ava 2  s. c  o m

    CookieKeys.addCookie(request, response, cookie);
}

From source file:com.liferay.polls.web.internal.portlet.util.PollsUtil.java

License:Open Source License

public static void saveVote(HttpServletRequest request, HttpServletResponse response, long questionId) {

    Cookie cookie = new Cookie(_getCookieName(questionId), StringPool.TRUE);

    cookie.setMaxAge((int) (Time.WEEK / 1000));
    cookie.setPath(StringPool.SLASH);//from   w  w w .j  a v a  2 s . com

    CookieKeys.addCookie(request, response, cookie);
}

From source file:com.liferay.so.hook.upgrade.v3_0_0.UpgradeDocumentLibrary.java

License:Open Source License

protected void updateManualCheckInRequired(long companyId) throws Exception {

    final ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId,
            DLFileEntry.class.getName(), ExpandoTableConstants.DEFAULT_TABLE_NAME, DL.MANUAL_CHECK_IN_REQUIRED);

    if (expandoColumn == null) {
        return;//from   w  ww  .  j a  va  2  s. c o  m
    }

    ActionableDynamicQuery actionableDynamicQuery = new ExpandoValueActionableDynamicQuery() {

        @Override
        protected void addCriteria(DynamicQuery dynamicQuery) {
            Property columnIdProperty = PropertyFactoryUtil.forName("columnId");

            dynamicQuery.add(columnIdProperty.eq(expandoColumn.getColumnId()));

            Property dataProperty = PropertyFactoryUtil.forName("data");

            dynamicQuery.add(dataProperty.eq(StringPool.TRUE));
        }

        @Override
        protected void performAction(Object object) throws PortalException {

            ExpandoValue expandoValue = (ExpandoValue) object;

            DLFileVersion dlFileVersion = DLFileVersionLocalServiceUtil
                    .fetchDLFileVersion(expandoValue.getClassPK());

            if ((dlFileVersion == null) || dlFileVersion.isDraft()) {
                return;
            }

            DLFileEntry dlFileEntry = dlFileVersion.getFileEntry();

            dlFileEntry.setManualCheckInRequired(true);

            DLFileEntryLocalServiceUtil.updateDLFileEntry(dlFileEntry);
        }

    };

    actionableDynamicQuery.performActions();

    ExpandoColumnLocalServiceUtil.deleteColumn(expandoColumn);
}

From source file:com.liferay.so.invitemembers.portlet.InviteMembersPortlet.java

License:Open Source License

protected void doSendInvite(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    long groupId = ParamUtil.getLong(actionRequest, "groupId");
    long[] receiverUserIds = getLongArray(actionRequest, "receiverUserIds");
    String[] receiverEmailAddresses = getStringArray(actionRequest, "receiverEmailAddresses");
    long invitedRoleId = ParamUtil.getLong(actionRequest, "invitedRoleId");
    long invitedTeamId = ParamUtil.getLong(actionRequest, "invitedTeamId");

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

    if (!UserLocalServiceUtil.hasGroupUser(groupId, themeDisplay.getUserId())) {

        return;//w  w  w  . j  ava2s  . c om
    }

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    long plid = themeDisplay.getPlid();

    Layout layout = LayoutLocalServiceUtil.getLayout(plid);

    if (layout.isPrivateLayout()) {
        Group guestGroup = GroupLocalServiceUtil.getGroup(themeDisplay.getCompanyId(), GroupConstants.GUEST);

        plid = guestGroup.getDefaultPublicPlid();
    }

    PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, PortletKeys.NOTIFICATIONS, plid,
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcPath", "/notifications/view.jsp");
    portletURL.setParameter("actionable", StringPool.TRUE);
    portletURL.setWindowState(WindowState.MAXIMIZED);

    serviceContext.setAttribute("redirectURL", portletURL.toString());

    String createAccountURL = getCreateAccountURL(PortalUtil.getHttpServletRequest(actionRequest),
            themeDisplay);

    serviceContext.setAttribute("createAccountURL", createAccountURL);

    serviceContext.setAttribute("loginURL", themeDisplay.getURLSignIn());

    MemberRequestLocalServiceUtil.addMemberRequests(themeDisplay.getUserId(), groupId, receiverUserIds,
            invitedRoleId, invitedTeamId, serviceContext);

    MemberRequestLocalServiceUtil.addMemberRequests(themeDisplay.getUserId(), groupId, receiverEmailAddresses,
            invitedRoleId, invitedTeamId, serviceContext);
}

From source file:com.liferay.util.WordpressUtil.java

License:Open Source License

private static void readPreferences(PortletPreferences preferences) {
    _importBlogEntries = GetterUtil.getBoolean(preferences.getValue("importBlogEntries", StringPool.TRUE));

    _importCategories = GetterUtil.getBoolean(preferences.getValue("importTags", StringPool.TRUE));

    _importPages = GetterUtil.getBoolean(preferences.getValue("importPages", StringPool.TRUE));

    _importTags = GetterUtil.getBoolean(preferences.getValue("importTags", StringPool.TRUE));

    _userMappings = new HashMap<String, String>();

    _vocabularyName = GetterUtil.getString(preferences.getValue("wordpressVocabularyName", _vocabularyName));

    String userMappings = GetterUtil.getString(preferences.getValue("userMappings", StringPool.BLANK));

    BufferedReader reader = new BufferedReader(new StringReader(userMappings));

    String line = StringPool.BLANK;

    try {//from   w w w  . ja  v a  2  s.  c  o m
        while ((line = reader.readLine()) != null) {
            String[] pair = line.split("=");

            if (pair.length == 2) {
                _userMappings.put(pair[0], pair[1]);
            } else {
                System.err.println("Line \"" + line + "\" " + "is not a valid user mapping");
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:com.rivetlogic.portal.search.elasticsearch.indexer.document.ElasticsearchDocumentJSONBuilder.java

License:Open Source License

/**
 * Check if liferay Document is of type hidden.
 *
 * @param document the document/* w  w  w  . j  a  va 2s  . co m*/
 * @return true, if is document hidden
 */
private boolean isDocumentHidden(Document document) {
    Field hiddenField = document.getField(ElasticsearchIndexerConstants.HIDDEN);
    String hiddenFlag = (hiddenField == null) ? "" : hiddenField.getValue();
    if (StringPool.TRUE.equalsIgnoreCase(hiddenFlag)) {
        return true;
    }
    return false;
}