Example usage for com.liferay.portal.kernel.util StringUtil appendParentheticalSuffix

List of usage examples for com.liferay.portal.kernel.util StringUtil appendParentheticalSuffix

Introduction

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

Prototype

public static String appendParentheticalSuffix(String s, String suffix) 

Source Link

Document

Returns the original string with an appended space followed by the suffix surrounded by parentheses.

Usage

From source file:com.liferay.asset.categories.admin.web.internal.exportimport.data.handler.AssetCategoryStagedModelDataHandler.java

License:Open Source License

protected String getCategoryName(String uuid, long groupId, long parentCategoryId, String name,
        long vocabularyId, int count) throws Exception {

    AssetCategory category = _assetCategoryLocalService.fetchCategory(groupId, parentCategoryId, name,
            vocabularyId);/*from   w  w  w  .  ja  v a 2 s .co m*/

    if ((category == null) || (Validator.isNotNull(uuid) && uuid.equals(category.getUuid()))) {

        return name;
    }

    name = StringUtil.appendParentheticalSuffix(name, count);

    return getCategoryName(uuid, groupId, parentCategoryId, name, vocabularyId, ++count);
}

From source file:com.liferay.asset.categories.admin.web.internal.exportimport.data.handler.AssetVocabularyStagedModelDataHandler.java

License:Open Source License

protected String getVocabularyName(String uuid, long groupId, String name, int count) throws Exception {

    AssetVocabulary vocabulary = _assetVocabularyLocalService.fetchGroupVocabulary(groupId, name);

    if (vocabulary == null) {
        return name;
    }/*  w  w  w  .j  av a 2s .  c om*/

    if (Validator.isNotNull(uuid) && uuid.equals(vocabulary.getUuid())) {
        return name;
    }

    name = StringUtil.appendParentheticalSuffix(name, count);

    return getVocabularyName(uuid, groupId, name, ++count);
}

From source file:com.liferay.document.library.internal.exportimport.data.handler.FolderStagedModelDataHandler.java

License:Open Source License

protected String getFolderName(String uuid, long groupId, long parentFolderId, String name, int count)
        throws Exception {

    Folder folder = FolderUtil.fetchByR_P_N(groupId, parentFolderId, name);

    if (folder == null) {
        FileEntry fileEntry = FileEntryUtil.fetchByR_F_T(groupId, parentFolderId, name);

        if (fileEntry == null) {
            return name;
        }//  www.  j  a v  a 2  s  .  c o m
    } else if (Validator.isNotNull(uuid) && uuid.equals(folder.getUuid())) {
        return name;
    }

    name = StringUtil.appendParentheticalSuffix(name, count);

    return getFolderName(uuid, groupId, parentFolderId, name, ++count);
}

From source file:com.liferay.dynamic.data.mapping.util.BaseDDMDisplay.java

License:Open Source License

@Override
public String getEditTemplateTitle(DDMStructure structure, DDMTemplate template, Locale locale) {

    if ((structure != null) && (template != null)) {
        return StringUtil.appendParentheticalSuffix(template.getName(locale), structure.getName(locale));
    } else if (structure != null) {
        ResourceBundle resourceBundle = getResourceBundle(locale);

        return LanguageUtil.format(resourceBundle, "new-template-for-structure-x", structure.getName(locale),
                false);/* www .  ja v a2  s .  c  o m*/
    } else if (template != null) {
        return template.getName(locale);
    }

    return getDefaultEditTemplateTitle(locale);
}

From source file:com.liferay.journal.exportimport.data.handler.JournalFolderStagedModelDataHandler.java

License:Open Source License

protected String getFolderName(String uuid, long groupId, long parentFolderId, String name, int count)
        throws Exception {

    JournalFolder folder = _journalFolderLocalService.fetchFolder(groupId, parentFolderId, name);

    if (folder == null) {
        return name;
    }//www . j  av a  2  s . c om

    if (Validator.isNotNull(uuid) && uuid.equals(folder.getUuid())) {
        return name;
    }

    name = StringUtil.appendParentheticalSuffix(name, count);

    return getFolderName(uuid, groupId, parentFolderId, name, ++count);
}

From source file:com.liferay.portlet.documentlibrary.lar.DLPortletDataHandlerImpl.java

License:Open Source License

/**
 * @see {@link PortletImporter#getAssetCategoryName(String, long, long,
 *      String, int)}/*from   www . j  ava 2s .  c  o  m*/
 * @see {@link PortletImporter#getAssetVocabularyName(String, long, String,
 *      int)}
 */
protected static String getFileEntryTypeName(String uuid, long groupId, String name, int count)
        throws Exception {

    DLFileEntryType dlFileEntryType = DLFileEntryTypeUtil.fetchByG_N(groupId, name);

    if (dlFileEntryType == null) {
        return name;
    }

    if (Validator.isNotNull(uuid) && uuid.equals(dlFileEntryType.getUuid())) {

        return name;
    }

    name = StringUtil.appendParentheticalSuffix(name, count);

    return getFileEntryTypeName(uuid, groupId, name, ++count);
}

From source file:com.liferay.portlet.documentlibrary.lar.DLPortletDataHandlerImpl.java

License:Open Source License

/**
 * @see {@link PortletImporter#getAssetCategoryName(String, long, long,
 *      String, int)}/*from   ww  w.  ja v  a2s .  com*/
 * @see {@link PortletImporter#getAssetVocabularyName(String, long, String,
 *      int)}
 */
protected static String getFolderName(String uuid, long groupId, long parentFolderId, String name, int count)
        throws Exception {

    Folder folder = FolderUtil.fetchByR_P_N(groupId, parentFolderId, name);

    if (folder == null) {
        return name;
    }

    if (Validator.isNotNull(uuid) && uuid.equals(folder.getUuid())) {
        return name;
    }

    name = StringUtil.appendParentheticalSuffix(name, count);

    return getFolderName(uuid, groupId, parentFolderId, name, ++count);
}