Example usage for com.liferay.portal.kernel.util UnicodeProperties toString

List of usage examples for com.liferay.portal.kernel.util UnicodeProperties toString

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.abubusoft.liferay.linkedin.action.AddLinkedinExpandoFieldsAction.java

License:Open Source License

protected void addColumn(long tableId, String name, UnicodeProperties properties)
        throws PortalException, SystemException {
    ExpandoColumn column = ExpandoColumnLocalServiceUtil.getColumn(tableId, name);

    if (column != null) {
        return;//from   w w w . j ava2s  .co m
    }

    ExpandoColumn linkedIn = ExpandoColumnLocalServiceUtil.addColumn(tableId, name,
            ExpandoColumnConstants.STRING);

    ExpandoColumnLocalServiceUtil.updateTypeSettings(linkedIn.getColumnId(), properties.toString());
}

From source file:com.abubusoft.liferay.twitter.action.AddTwitterExpandoFieldsAction.java

License:Open Source License

protected void addColumn(long tableId, String name, UnicodeProperties properties)
        throws PortalException, SystemException {
    ExpandoColumn column = ExpandoColumnLocalServiceUtil.getColumn(tableId, name);

    if (column != null) {
        return;/*from  ww w.j  a va2 s.  co  m*/
    }

    ExpandoColumn twitterId = ExpandoColumnLocalServiceUtil.addColumn(tableId, name,
            ExpandoColumnConstants.STRING);

    ExpandoColumnLocalServiceUtil.updateTypeSettings(twitterId.getColumnId(), properties.toString());
}

From source file:com.liferay.calendar.portlet.CalendarPortlet.java

License:Open Source License

protected String getNotificationTypeSettings(ActionRequest actionRequest, NotificationType notificationType) {

    UnicodeProperties notificationTypeSettingsProperties = new UnicodeProperties(true);

    if (notificationType == NotificationType.EMAIL) {
        String fromAddress = ParamUtil.getString(actionRequest, "fromAddress");
        String fromName = ParamUtil.getString(actionRequest, "fromName");

        notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_ADDRESS,
                fromAddress);/*w  ww  .  ja  va  2s . c  o  m*/
        notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_NAME,
                fromName);
    }

    return notificationTypeSettingsProperties.toString();
}

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

License:Open Source License

public static CalendarNotificationTemplate addCalendarNotificationTemplate(Calendar calendar,
        NotificationTemplateType notificationTemplateType, String fromAddress, String fromName, String subject,
        String body) throws PortalException {

    UnicodeProperties notificationTypeSettingsProperties = new UnicodeProperties(true);

    notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_ADDRESS,
            fromAddress);//  w  ww .  j ava2s.co m
    notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_NAME, fromName);

    User user = UserLocalServiceUtil.getUser(calendar.getUserId());

    return CalendarNotificationTemplateLocalServiceUtil.addCalendarNotificationTemplate(calendar.getUserId(),
            calendar.getCalendarId(), NotificationType.EMAIL, notificationTypeSettingsProperties.toString(),
            notificationTemplateType, subject, body, createServiceContext(user));
}

From source file:com.liferay.content.targeting.service.test.util.GroupTestUtil.java

License:Open Source License

public static Group updateDisplaySettings(long groupId, Locale[] availableLocales, Locale defaultLocale)
        throws Exception {

    UnicodeProperties typeSettingsProperties = new UnicodeProperties();

    boolean inheritLocales = false;

    if ((availableLocales == null) && (defaultLocale == null)) {
        inheritLocales = true;// w  w w.  j a  v a 2s .  c o  m
    }

    typeSettingsProperties.put("inheritLocales", String.valueOf(inheritLocales));

    if (availableLocales != null) {
        typeSettingsProperties.put(PropsKeys.LOCALES,
                StringUtil.merge(LocaleUtil.toLanguageIds(availableLocales)));
    }

    if (defaultLocale != null) {
        typeSettingsProperties.put("languageId", LocaleUtil.toLanguageId(defaultLocale));
    }

    Group group = GroupLocalServiceUtil.updateGroup(groupId, typeSettingsProperties.toString());

    ThreadLocalCacheManager.clearAll(Lifecycle.REQUEST);

    return group;
}

From source file:com.liferay.exportimport.controller.PortletExportController.java

License:Open Source License

protected void exportExpandoTables(PortletDataContext portletDataContext) throws Exception {

    Document document = SAXReaderUtil.createDocument();

    Element rootElement = document.addElement("expando-tables");

    Map<String, List<ExpandoColumn>> expandoColumnsMap = portletDataContext.getExpandoColumns();

    for (Map.Entry<String, List<ExpandoColumn>> entry : expandoColumnsMap.entrySet()) {

        String className = entry.getKey();

        Element expandoTableElement = rootElement.addElement("expando-table");

        expandoTableElement.addAttribute("class-name", className);

        List<ExpandoColumn> expandoColumns = entry.getValue();

        for (ExpandoColumn expandoColumn : expandoColumns) {
            Element expandoColumnElement = expandoTableElement.addElement("expando-column");

            expandoColumnElement.addAttribute("column-id", String.valueOf(expandoColumn.getColumnId()));
            expandoColumnElement.addAttribute("name", expandoColumn.getName());
            expandoColumnElement.addAttribute("type", String.valueOf(expandoColumn.getType()));

            DocUtil.add(expandoColumnElement, "default-data", expandoColumn.getDefaultData());

            Element typeSettingsElement = expandoColumnElement.addElement("type-settings");

            UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties();

            typeSettingsElement.addCDATA(typeSettingsProperties.toString());
        }/*from  www  .  j av  a2 s  . c o m*/
    }

    portletDataContext.addZipEntry(ExportImportPathUtil.getRootPath(portletDataContext) + "/expando-tables.xml",
            document.formattedString());
}

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

@Override
public void deleteLastImportSettings(Group liveGroup, boolean privateLayout) throws PortalException {

    List<Layout> layouts = _layoutLocalService.getLayouts(liveGroup.getGroupId(), privateLayout);

    for (Layout layout : layouts) {
        UnicodeProperties typeSettingsProperties = layout.getTypeSettingsProperties();

        Set<String> keys = new HashSet<>();

        for (String key : typeSettingsProperties.keySet()) {
            if (key.startsWith("last-import-")) {
                keys.add(key);/*from   ww  w . j  a  va2  s . com*/
            }
        }

        if (keys.isEmpty()) {
            continue;
        }

        for (String key : keys) {
            typeSettingsProperties.remove(key);
        }

        _layoutLocalService.updateLayout(layout.getGroupId(), layout.getPrivateLayout(), layout.getLayoutId(),
                typeSettingsProperties.toString());
    }
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

protected void updateLastPublishDate(LayoutSet layoutSet, Date lastPublishDate) throws Exception {

    UnicodeProperties settingsProperties = layoutSet.getSettingsProperties();

    settingsProperties.setProperty("last-publish-date", String.valueOf(lastPublishDate.getTime()));

    LayoutSetLocalServiceUtil.updateSettings(layoutSet.getGroupId(), layoutSet.isPrivateLayout(),
            settingsProperties.toString());
}

From source file:com.liferay.google.action.AddGoogleExpandoFieldsAction.java

License:Open Source License

protected void addColumn(long tableId, String name, UnicodeProperties properties)
        throws PortalException, SystemException {

    ExpandoColumn column = ExpandoColumnLocalServiceUtil.getColumn(tableId, name);

    if (column != null) {
        return;//from   ww  w  .  ja v  a2s. c o  m
    }

    ExpandoColumn googleRefreshToken = ExpandoColumnLocalServiceUtil.addColumn(tableId, name,
            ExpandoColumnConstants.STRING);

    ExpandoColumnLocalServiceUtil.updateTypeSettings(googleRefreshToken.getColumnId(), properties.toString());
}

From source file:com.liferay.google.login.hook.events.AddGoogleExpandoColumnsAction.java

License:Open Source License

protected void addExpandoColumn(ExpandoTable expandoTable, String name, UnicodeProperties properties)
        throws Exception {

    ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name);

    if (expandoColumn != null) {
        return;/*  w  ww  .  j ava  2  s.co  m*/
    }

    expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name,
            ExpandoColumnConstants.STRING);

    ExpandoColumnLocalServiceUtil.updateTypeSettings(expandoColumn.getColumnId(), properties.toString());
}