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

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

Introduction

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

Prototype

String UNDERLINE

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

Click Source Link

Usage

From source file:au.com.permeance.liferay.portlets.workflow.JournalStructureBrowseEntry.java

License:Open Source License

public String getId() {
    if (structure != null) {
        return Long.toString(structure.getGroupId()) + StringPool.UNDERLINE + structure.getStructureKey();
    }// www .ja  v a 2  s  . com
    return DEFAULT_ID;
}

From source file:com.beorn.onlinepayment.rule.ConditionRegistry.java

License:Open Source License

public JSONObject toJSONObject(PortletConfig portletConfig, Locale locale) throws JSONException {
    JSONObject result = new JSONObject();

    for (ConditionClassDeclaration conditionClassDeclaration : _conditionClassDeclarations) {
        Class<?> entryClass = conditionClassDeclaration.getConditionClass();
        List<FieldDeclaration> entryFieldDeclarations = conditionClassDeclaration.getFieldDeclarations();

        JSONArray fields = new JSONArray();
        for (FieldDeclaration entryFieldDeclaration : entryFieldDeclarations) {
            String fieldName = entryFieldDeclaration.getName();
            if (fieldName.startsWith(StringPool.UNDERLINE))
                fieldName = fieldName.substring(1);

            ConditionField conditionField = entryFieldDeclaration.getConditionField();

            String label = LanguageUtil.get(portletConfig, locale, conditionField.label());

            JSONObject field = new JSONObject();
            field.put("type", entryFieldDeclaration.getTypeName());
            field.put("label", label);
            field.put("name", fieldName);
            field.put("hint", conditionField.hint());

            fields.put(field);/*from  w w w .j a v a 2s  .  c  o  m*/
        }

        JSONObject conditionClass = new JSONObject();
        conditionClass.put("fields", fields);
        result.put(entryClass.getName(), conditionClass);
    }

    return result;
}

From source file:com.custom.portal.verify.CustomVerifyDocumentLibrary.java

License:Open Source License

protected void checkTitles() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(DLFileEntry.class);

    Criterion criterion1 = RestrictionsFactoryUtil.like("title", "%/%");
    Criterion criterion2 = RestrictionsFactoryUtil.like("title", "%\\\\%");

    dynamicQuery.add(RestrictionsFactoryUtil.or(criterion1, criterion2));

    List<DLFileEntry> dlFileEntries = DLFileEntryLocalServiceUtil.dynamicQuery(dynamicQuery);

    for (DLFileEntry dlFileEntry : dlFileEntries) {
        TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(dlFileEntry.getModelClassName(),
                dlFileEntry.getFileEntryId());

        if (trashEntry != null) {
            continue;
        }/*from  w ww .  jav  a  2s.c  o  m*/

        String title = dlFileEntry.getTitle();

        String newTitle = title.replace(StringPool.SLASH, StringPool.BLANK);

        newTitle = newTitle.replace(StringPool.BACK_SLASH, StringPool.UNDERLINE);

        dlFileEntry.setTitle(newTitle);

        DLFileEntryLocalServiceUtil.updateDLFileEntry(dlFileEntry);

        DLFileVersion dlFileVersion = dlFileEntry.getFileVersion();

        dlFileVersion.setTitle(newTitle);

        DLFileVersionLocalServiceUtil.updateDLFileVersion(dlFileVersion);

        if (_log.isDebugEnabled()) {
            _log.debug("Invalid document title " + title + "renamed to " + newTitle);
        }
    }
}

From source file:com.fmdp.webform.util.WebFormUtil.java

License:Open Source License

public static String getNewDatabaseTableName(String portletId) throws SystemException {

    long formId = CounterLocalServiceUtil.increment(WebFormUtil.class.getName());

    return portletId + StringPool.UNDERLINE + formId;
}

From source file:com.idetronic.subur.portlet.SuburAdmin.java

private Map<Locale, String> getLocalizationMap(String parameter)

{

    Locale[] locales = LanguageUtil.getAvailableLocales();

    Map<Locale, String> map = new HashMap<Locale, String>();

    for (Locale locale : locales) {
        String languageId = LocaleUtil.toLanguageId(locale);

        String localeParameter = parameter.concat(StringPool.UNDERLINE).concat(languageId);

        map.put(locale, parameter);// www .ja v a 2  s .com
    }

    return map;
}

From source file:com.liferay.adaptive.media.image.internal.scaler.AMGIFImageScaler.java

License:Open Source License

protected String getResizeFitValues(AMImageConfigurationEntry amImageConfigurationEntry) {

    Map<String, String> properties = amImageConfigurationEntry.getProperties();

    int maxHeight = GetterUtil.getInteger(properties.get("max-height"));

    String maxHeightString = StringPool.UNDERLINE;

    if (maxHeight != 0) {
        maxHeightString = String.valueOf(maxHeight);
    }// w  w w  . j  ava2s .  co  m

    int maxWidth = GetterUtil.getInteger(properties.get("max-width"));

    String maxWidthString = StringPool.UNDERLINE;

    if (maxWidth != 0) {
        maxWidthString = String.valueOf(maxWidth);
    }

    return maxWidthString.concat("x").concat(maxHeightString);
}

From source file:com.liferay.calendar.test.util.CalendarStagingTestUtil.java

License:Open Source License

public static void publishLayouts(Group liveGroup, boolean enableCalendarStaging) throws PortalException {

    Group stagingGroup = liveGroup.getStagingGroup();

    Map<String, String[]> parameters = ExportImportConfigurationParameterMapFactory.buildParameterMap();

    addStagingAttribute(parameters, PortletDataHandlerKeys.DELETIONS, true);
    addStagingAttribute(parameters, PortletDataHandlerKeys.PORTLET_CONFIGURATION_ALL, false);
    addStagingAttribute(parameters,/*from www .ja v  a  2s .c  om*/
            PortletDataHandlerKeys.PORTLET_DATA + StringPool.UNDERLINE + CalendarPortletKeys.CALENDAR,
            enableCalendarStaging);
    addStagingAttribute(parameters, PortletDataHandlerKeys.PORTLET_DATA_ALL, false);
    addStagingAttribute(parameters, PortletDataHandlerKeys.PORTLET_SETUP_ALL, false);

    StagingUtil.publishLayouts(TestPropsValues.getUserId(), stagingGroup.getGroupId(), liveGroup.getGroupId(),
            false, parameters);
}

From source file:com.liferay.calendar.util.CalendarBookingIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(Object obj) throws Exception {
    CalendarBooking calendarBooking = (CalendarBooking) obj;

    Document document = getBaseModelDocument(PORTLET_ID, calendarBooking);

    Locale defaultLocale = LocaleUtil.getSiteDefault();

    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);

    String descriptionDefaultLanguageId = LocalizationUtil
            .getDefaultLanguageId(calendarBooking.getDescription());

    String[] descriptionLanguageIds = getLanguageIds(defaultLanguageId, calendarBooking.getDescription());

    for (String descriptionLanguageId : descriptionLanguageIds) {
        String description = calendarBooking.getDescription(descriptionLanguageId);

        if (descriptionLanguageId.equals(descriptionDefaultLanguageId)) {
            document.addText(Field.DESCRIPTION, description);
        }/* w  ww. j  a  va2  s  .c o m*/

        document.addText(Field.DESCRIPTION.concat(StringPool.UNDERLINE).concat(descriptionLanguageId),
                description);
    }

    String titleDefaultLanguageId = LocalizationUtil.getDefaultLanguageId(calendarBooking.getTitle());

    String[] titleLanguageIds = getLanguageIds(defaultLanguageId, calendarBooking.getTitle());

    for (String titleLanguageId : titleLanguageIds) {
        String title = calendarBooking.getTitle(titleLanguageId);

        if (titleLanguageId.equals(titleDefaultLanguageId)) {
            document.addText(Field.TITLE, title);
        }

        document.addText(Field.TITLE.concat(StringPool.UNDERLINE).concat(titleLanguageId), title);
    }

    String calendarBookingId = String.valueOf(calendarBooking.getCalendarBookingId());

    if (calendarBooking.isInTrash()) {
        calendarBookingId = TrashUtil.getOriginalTitle(calendarBookingId);
    }

    document.addKeyword("calendarBookingId", calendarBookingId);

    document.addText("defaultLanguageId", defaultLanguageId);
    document.addNumber("endTime", calendarBooking.getEndTime());
    document.addText("location", calendarBooking.getLocation());
    document.addNumber("startTime", calendarBooking.getStartTime());

    return document;
}

From source file:com.liferay.content.targeting.portlet.ContentTargetingPortlet.java

License:Open Source License

protected List<RuleInstance> getRulesFromRequest(PortletRequest request, PortletResponse response)
        throws Exception {

    List<RuleInstance> ruleInstances = new ArrayList<RuleInstance>();

    String userSegmentRules = ParamUtil.getString(request, "userSegmentRules");

    if (Validator.isNull(userSegmentRules)) {
        return ruleInstances;
    }// w  ww  . j  a va 2  s.co  m

    JSONObject jSONObject = JSONFactoryUtil.createJSONObject(userSegmentRules);

    String rules = jSONObject.getString("fields");

    JSONArray jSONArray = JSONFactoryUtil.createJSONArray(rules);

    for (int i = 0; i < jSONArray.length(); i++) {
        JSONObject jSONObjectRule = jSONArray.getJSONObject(i);

        long ruleInstanceId = 0;
        String type = jSONObjectRule.getString("type");

        if (type.contains(StringPool.UNDERLINE)) {
            String[] ids = type.split(StringPool.UNDERLINE);

            ruleInstanceId = GetterUtil.getLong(ids[1]);
            type = ids[0];
        }

        String id = jSONObjectRule.getString("id");

        Map<String, String> ruleValues = getJSONValues(jSONObjectRule.getJSONArray("data"),
                response.getNamespace(), id);

        RuleInstance ruleInstance = _ruleInstanceLocalService.createRuleInstance(ruleInstanceId);

        ruleInstance.setRuleKey(type);
        ruleInstance.setValues(ruleValues);
        ruleInstance.setRuleGuid(id);

        ruleInstances.add(ruleInstance);
    }

    return ruleInstances;
}

From source file:com.liferay.content.targeting.portlet.ContentTargetingPortlet.java

License:Open Source License

protected List<TrackingActionInstance> getTrackingActionsFromRequest(PortletRequest request,
        PortletResponse response) throws Exception {

    List<TrackingActionInstance> trackingActionsInstances = new ArrayList<TrackingActionInstance>();

    String campaignTrackingActions = ParamUtil.getString(request, "campaignTrackingActions");

    if (Validator.isNull(campaignTrackingActions)) {
        return trackingActionsInstances;
    }// ww w  .  j  av a  2  s . c  o m

    JSONObject jSONObject = JSONFactoryUtil.createJSONObject(campaignTrackingActions);

    String trackingActions = jSONObject.getString("fields");

    JSONArray jSONArray = JSONFactoryUtil.createJSONArray(trackingActions);

    for (int i = 0; i < jSONArray.length(); i++) {
        JSONObject jSONObjectTrackingAction = jSONArray.getJSONObject(i);

        long trackingActionInstanceId = 0;
        String type = jSONObjectTrackingAction.getString("type");

        if (type.contains(StringPool.UNDERLINE)) {
            String[] ids = type.split(StringPool.UNDERLINE);

            trackingActionInstanceId = GetterUtil.getLong(ids[1]);
            type = ids[0];
        }

        String id = jSONObjectTrackingAction.getString("id");

        Map<String, String> trackingActionValues = getJSONValues(jSONObjectTrackingAction.getJSONArray("data"),
                response.getNamespace(), id);

        TrackingActionInstance trackingActionInstance = _trackingActionInstanceLocalService
                .createTrackingActionInstance(trackingActionInstanceId);

        trackingActionInstance.setTrackingActionKey(type);
        trackingActionInstance.setValues(trackingActionValues);
        trackingActionInstance.setTrackingActionGuid(id);

        trackingActionsInstances.add(trackingActionInstance);
    }

    return trackingActionsInstances;
}