Java Code Examples for com.liferay.portal.kernel.util.StringBundler.append()

The following are Jave code examples for showing how to use append() of the com.liferay.portal.kernel.util.StringBundler class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: opencps-v2   File: DictItemGroupPersistenceImpl.java   View Source Code Vote up 6 votes
/**
 * Returns the first dict item group in the ordered set where uuid = ?.
 *
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching dict item group
 * @throws NoSuchDictItemGroupException if a matching dict item group could not be found
 */
@Override
public DictItemGroup findByUuid_First(String uuid,
	OrderByComparator<DictItemGroup> orderByComparator)
	throws NoSuchDictItemGroupException {
	DictItemGroup dictItemGroup = fetchByUuid_First(uuid, orderByComparator);

	if (dictItemGroup != null) {
		return dictItemGroup;
	}

	StringBundler msg = new StringBundler(4);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("uuid=");
	msg.append(uuid);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchDictItemGroupException(msg.toString());
}
 
Example 2
Project: opencps-v2   File: DictItemPersistenceImpl.java   View Source Code Vote up 6 votes
/**
 * Returns the first dict item in the ordered set where uuid = &#63;.
 *
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching dict item
 * @throws NoSuchDictItemException if a matching dict item could not be found
 */
@Override
public DictItem findByUuid_First(String uuid,
	OrderByComparator<DictItem> orderByComparator)
	throws NoSuchDictItemException {
	DictItem dictItem = fetchByUuid_First(uuid, orderByComparator);

	if (dictItem != null) {
		return dictItem;
	}

	StringBundler msg = new StringBundler(4);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("uuid=");
	msg.append(uuid);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchDictItemException(msg.toString());
}
 
Example 3
Project: opencps-v2   File: DictCollectionPersistenceImpl.java   View Source Code Vote up 6 votes
/**
 * Returns the first dict collection in the ordered set where uuid = &#63; and companyId = &#63;.
 *
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching dict collection
 * @throws NoSuchDictCollectionException if a matching dict collection could not be found
 */
@Override
public DictCollection findByUuid_C_First(String uuid, long companyId,
	OrderByComparator<DictCollection> orderByComparator)
	throws NoSuchDictCollectionException {
	DictCollection dictCollection = fetchByUuid_C_First(uuid, companyId,
			orderByComparator);

	if (dictCollection != null) {
		return dictCollection;
	}

	StringBundler msg = new StringBundler(6);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("uuid=");
	msg.append(uuid);

	msg.append(", companyId=");
	msg.append(companyId);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchDictCollectionException(msg.toString());
}
 
Example 4
Project: opencps-v2   File: DictItemGroupPersistenceImpl.java   View Source Code Vote up 6 votes
/**
 * Returns the last dict item group in the ordered set where uuid = &#63;.
 *
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching dict item group
 * @throws NoSuchDictItemGroupException if a matching dict item group could not be found
 */
@Override
public DictItemGroup findByUuid_Last(String uuid,
	OrderByComparator<DictItemGroup> orderByComparator)
	throws NoSuchDictItemGroupException {
	DictItemGroup dictItemGroup = fetchByUuid_Last(uuid, orderByComparator);

	if (dictItemGroup != null) {
		return dictItemGroup;
	}

	StringBundler msg = new StringBundler(4);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("uuid=");
	msg.append(uuid);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchDictItemGroupException(msg.toString());
}
 
Example 5
Project: liferay-gsearch   File: GSearchKeywordSuggesterImpl.java   View Source Code Vote up 6 votes
/**
 * Get completion suggester
 * 
 * @param configuration
 * @param locale
 * @param keywords
 * @return
 * @throws Exception
 */
protected Suggester getCompletionSuggester(
	JSONObject configuration, Locale locale, String keywords) throws Exception {

	StringBundler sb = new StringBundler();

	sb.append(configuration.getString("fieldPrefix"));

	if (configuration.getBoolean(("isLocalized"))) {
		sb.append(locale.toString());
	}
	sb.append(configuration.getString("fieldSuffix"));
	
	CompletionSuggester suggester = new CompletionSuggester(
		configuration.getString("suggesterName"), sb.toString(), keywords);
	
	suggester.setSize(configuration.getInt("numberOfSuggestions"));
	
	String analyzer = configuration.getString("analyzer");

	if (analyzer != null) {
		suggester.setAnalyzer(analyzer);
	}

	return suggester;
}
 
Example 6
Project: opencps-v2   File: DictItemGroupPersistenceImpl.java   View Source Code Vote up 6 votes
/**
 * Returns the first dict item group in the ordered set where groupId = &#63; and dictItemId = &#63;.
 *
 * @param groupId the group ID
 * @param dictItemId the dict item ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching dict item group
 * @throws NoSuchDictItemGroupException if a matching dict item group could not be found
 */
@Override
public DictItemGroup findByF_dictItemId_First(long groupId,
	long dictItemId, OrderByComparator<DictItemGroup> orderByComparator)
	throws NoSuchDictItemGroupException {
	DictItemGroup dictItemGroup = fetchByF_dictItemId_First(groupId,
			dictItemId, orderByComparator);

	if (dictItemGroup != null) {
		return dictItemGroup;
	}

	StringBundler msg = new StringBundler(6);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("groupId=");
	msg.append(groupId);

	msg.append(", dictItemId=");
	msg.append(dictItemId);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchDictItemGroupException(msg.toString());
}
 
Example 7
Project: opencps-v2   File: CommentPersistenceImpl.java   View Source Code Vote up 6 votes
/**
 * Returns the last comment in the ordered set where groupId = &#63;.
 *
 * @param groupId the group ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching comment
 * @throws NoSuchCommentException if a matching comment could not be found
 */
@Override
public Comment findByF_groupId_Last(long groupId,
	OrderByComparator<Comment> orderByComparator)
	throws NoSuchCommentException {
	Comment comment = fetchByF_groupId_Last(groupId, orderByComparator);

	if (comment != null) {
		return comment;
	}

	StringBundler msg = new StringBundler(4);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("groupId=");
	msg.append(groupId);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchCommentException(msg.toString());
}
 
Example 8
Project: ch-inofix-timetracker   File: EntriesChecker.java   View Source Code Vote up 5 votes
protected String getEntryRowIds() {
    StringBundler sb = new StringBundler(13);

    sb.append("['");
    sb.append(_liferayPortletResponse.getNamespace());
    sb.append(RowChecker.ROW_IDS);
    sb.append(TaskRecord.class.getSimpleName());
    sb.append("']");

    return sb.toString();
}
 
Example 9
Project: liferay-gsearch   File: DLFileEntryItemBuilder.java   View Source Code Vote up 5 votes
/**
 * {@inheritDoc}
 */
@Override
public String getLink() {

	StringBundler sb = new StringBundler();
	sb.append(PortalUtil.getPortalURL(_portletRequest));
	sb.append("/documents/");
	sb.append(_document.get(Field.SCOPE_GROUP_ID));
	sb.append("/");
	sb.append(_document.get(Field.FOLDER_ID));
	sb.append("/");
	sb.append(_document.get("path"));

	return sb.toString();
}
 
Example 10
Project: liferay-gsearch   File: JournalArticleItemBuilder.java   View Source Code Vote up 5 votes
/**
 * Get a view url for an article which is not bound to a layout or has a
 * default view page.
 * 
 * @return url string
 * @throws PortalException
 */
protected String getNotLayoutBoundJournalArticleUrl()
	throws PortalException {

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

	Layout layout = GSearchUtil.getLayoutByFriendlyURL(
		_portletRequest, _assetPublisherPageFriendlyURL);

	String assetPublisherInstanceId =
		GSearchUtil.findDefaultAssetPublisherInstanceId(layout);

	JournalArticle journalArticle = getJournalArticle();

	StringBundler sb = new StringBundler();
	sb.append(PortalUtil.getLayoutFriendlyURL(layout, themeDisplay));
	sb.append("/-/asset_publisher/");
	sb.append(assetPublisherInstanceId);
	sb.append("/content/");
	sb.append(journalArticle.getUrlTitle());
	sb.append("?_");
	sb.append(AssetPublisherPortletKeys.ASSET_PUBLISHER);
	sb.append("_INSTANCE_");
	sb.append(assetPublisherInstanceId);
	sb.append("_groupId=");
	sb.append(journalArticle.getGroupId());

	return sb.toString();
}
 
Example 11
Project: opencps-v2   File: DictItemPersistenceImpl.java   View Source Code Vote up 5 votes
/**
 * Returns the first dict item in the ordered set where groupId = &#63; and dictCollectionId = &#63; and parentItemId = &#63; and level = &#63;.
 *
 * @param groupId the group ID
 * @param dictCollectionId the dict collection ID
 * @param parentItemId the parent item ID
 * @param level the level
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching dict item
 * @throws NoSuchDictItemException if a matching dict item could not be found
 */
@Override
public DictItem findByF_parentItemId_level_First(long groupId,
	long dictCollectionId, long parentItemId, int level,
	OrderByComparator<DictItem> orderByComparator)
	throws NoSuchDictItemException {
	DictItem dictItem = fetchByF_parentItemId_level_First(groupId,
			dictCollectionId, parentItemId, level, orderByComparator);

	if (dictItem != null) {
		return dictItem;
	}

	StringBundler msg = new StringBundler(10);

	msg.append(_NO_SUCH_ENTITY_WITH_KEY);

	msg.append("groupId=");
	msg.append(groupId);

	msg.append(", dictCollectionId=");
	msg.append(dictCollectionId);

	msg.append(", parentItemId=");
	msg.append(parentItemId);

	msg.append(", level=");
	msg.append(level);

	msg.append(StringPool.CLOSE_CURLY_BRACE);

	throw new NoSuchDictItemException(msg.toString());
}
 
Example 12
Project: liferay-gsearch   File: DLFileEntryItemBuilder.java   View Source Code Vote up 5 votes
/**
 * Get index translated field name for a Tikaraw metadata field.
 * 
 * @param key
 * @return
 * @throws Exception
 */
protected String getTikaRawMetadataField(String key) throws Exception {

	StringBundler sb = new StringBundler();
	
	sb.append("ddm__text__");
	sb.append(String.valueOf(getTikaRawStructureId()));
	sb.append("__TIFF_IMAGE_");
	sb.append(key);
	sb.append("_");
	sb.append(_locale.toString());

	return sb.toString();
}
 
Example 13
Project: opencps-v2   File: DictCollectionPersistenceImpl.java   View Source Code Vote up 5 votes
/**
 * Returns the dict collection where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchDictCollectionException} if it could not be found.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the matching dict collection
 * @throws NoSuchDictCollectionException if a matching dict collection could not be found
 */
@Override
public DictCollection findByUUID_G(String uuid, long groupId)
	throws NoSuchDictCollectionException {
	DictCollection dictCollection = fetchByUUID_G(uuid, groupId);

	if (dictCollection == null) {
		StringBundler msg = new StringBundler(6);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("uuid=");
		msg.append(uuid);

		msg.append(", groupId=");
		msg.append(groupId);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		if (_log.isDebugEnabled()) {
			_log.debug(msg.toString());
		}

		throw new NoSuchDictCollectionException(msg.toString());
	}

	return dictCollection;
}
 
Example 14
Project: opencps-v2   File: VotingResultPersistenceImpl.java   View Source Code Vote up 5 votes
/**
 * Returns the voting result where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchVotingResultException} if it could not be found.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the matching voting result
 * @throws NoSuchVotingResultException if a matching voting result could not be found
 */
@Override
public VotingResult findByUUID_G(String uuid, long groupId)
	throws NoSuchVotingResultException {
	VotingResult votingResult = fetchByUUID_G(uuid, groupId);

	if (votingResult == null) {
		StringBundler msg = new StringBundler(6);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("uuid=");
		msg.append(uuid);

		msg.append(", groupId=");
		msg.append(groupId);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		if (_log.isDebugEnabled()) {
			_log.debug(msg.toString());
		}

		throw new NoSuchVotingResultException(msg.toString());
	}

	return votingResult;
}
 
Example 15
Project: opencps-v2   File: DictItemPersistenceImpl.java   View Source Code Vote up 5 votes
/**
 * Returns the dict item where itemCode = &#63; and dictCollectionId = &#63; or throws a {@link NoSuchDictItemException} if it could not be found.
 *
 * @param itemCode the item code
 * @param dictCollectionId the dict collection ID
 * @return the matching dict item
 * @throws NoSuchDictItemException if a matching dict item could not be found
 */
@Override
public DictItem findByIC_DCI(String itemCode, long dictCollectionId)
	throws NoSuchDictItemException {
	DictItem dictItem = fetchByIC_DCI(itemCode, dictCollectionId);

	if (dictItem == null) {
		StringBundler msg = new StringBundler(6);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("itemCode=");
		msg.append(itemCode);

		msg.append(", dictCollectionId=");
		msg.append(dictCollectionId);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		if (_log.isDebugEnabled()) {
			_log.debug(msg.toString());
		}

		throw new NoSuchDictItemException(msg.toString());
	}

	return dictItem;
}
 
Example 16
Project: opencps-v2   File: VotingResultPersistenceImpl.java   View Source Code Vote up 4 votes
/**
 * Returns the number of voting results where uuid = &#63;.
 *
 * @param uuid the uuid
 * @return the number of matching voting results
 */
@Override
public int countByUuid(String uuid) {
	FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID;

	Object[] finderArgs = new Object[] { uuid };

	Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

	if (count == null) {
		StringBundler query = new StringBundler(2);

		query.append(_SQL_COUNT_VOTINGRESULT_WHERE);

		boolean bindUuid = false;

		if (uuid == null) {
			query.append(_FINDER_COLUMN_UUID_UUID_1);
		}
		else if (uuid.equals(StringPool.BLANK)) {
			query.append(_FINDER_COLUMN_UUID_UUID_3);
		}
		else {
			bindUuid = true;

			query.append(_FINDER_COLUMN_UUID_UUID_2);
		}

		String sql = query.toString();

		Session session = null;

		try {
			session = openSession();

			Query q = session.createQuery(sql);

			QueryPos qPos = QueryPos.getInstance(q);

			if (bindUuid) {
				qPos.add(uuid);
			}

			count = (Long)q.uniqueResult();

			finderCache.putResult(finderPath, finderArgs, count);
		}
		catch (Exception e) {
			finderCache.removeResult(finderPath, finderArgs);

			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	return count.intValue();
}
 
Example 17
Project: opencps-v2   File: DictGroupPersistenceImpl.java   View Source Code Vote up 4 votes
/**
 * Returns the number of dict groups where uuid = &#63; and groupId = &#63;.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the number of matching dict groups
 */
@Override
public int countByUUID_G(String uuid, long groupId) {
	FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_G;

	Object[] finderArgs = new Object[] { uuid, groupId };

	Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

	if (count == null) {
		StringBundler query = new StringBundler(3);

		query.append(_SQL_COUNT_DICTGROUP_WHERE);

		boolean bindUuid = false;

		if (uuid == null) {
			query.append(_FINDER_COLUMN_UUID_G_UUID_1);
		}
		else if (uuid.equals(StringPool.BLANK)) {
			query.append(_FINDER_COLUMN_UUID_G_UUID_3);
		}
		else {
			bindUuid = true;

			query.append(_FINDER_COLUMN_UUID_G_UUID_2);
		}

		query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);

		String sql = query.toString();

		Session session = null;

		try {
			session = openSession();

			Query q = session.createQuery(sql);

			QueryPos qPos = QueryPos.getInstance(q);

			if (bindUuid) {
				qPos.add(uuid);
			}

			qPos.add(groupId);

			count = (Long)q.uniqueResult();

			finderCache.putResult(finderPath, finderArgs, count);
		}
		catch (Exception e) {
			finderCache.removeResult(finderPath, finderArgs);

			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	return count.intValue();
}
 
Example 18
Project: opencps-v2   File: DictItemPersistenceImpl.java   View Source Code Vote up 2 votes
/**
 * Returns the number of dict items where dictCollectionId = &#63;.
 *
 * @param dictCollectionId the dict collection ID
 * @return the number of matching dict items
 */
@Override
public int countByF_dictCollectionId(long dictCollectionId) {
	FinderPath finderPath = FINDER_PATH_COUNT_BY_F_DICTCOLLECTIONID;

	Object[] finderArgs = new Object[] { dictCollectionId };

	Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

	if (count == null) {
		StringBundler query = new StringBundler(2);

		query.append(_SQL_COUNT_DICTITEM_WHERE);

		query.append(_FINDER_COLUMN_F_DICTCOLLECTIONID_DICTCOLLECTIONID_2);

		String sql = query.toString();

		Session session = null;

		try {
			session = openSession();

			Query q = session.createQuery(sql);

			QueryPos qPos = QueryPos.getInstance(q);

			qPos.add(dictCollectionId);

			count = (Long)q.uniqueResult();

			finderCache.putResult(finderPath, finderArgs, count);
		}
		catch (Exception e) {
			finderCache.removeResult(finderPath, finderArgs);

			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	return count.intValue();
}
 
Example 19
Project: opencps-v2   File: DictItemGroupPersistenceImpl.java   View Source Code Vote up 2 votes
/**
 * Returns the number of dict item groups where groupId = &#63; and dictGroupId = &#63; and dictItemId = &#63;.
 *
 * @param groupId the group ID
 * @param dictGroupId the dict group ID
 * @param dictItemId the dict item ID
 * @return the number of matching dict item groups
 */
@Override
public int countByF_dictItemId_dictGroupId(long groupId, long dictGroupId,
	long dictItemId) {
	FinderPath finderPath = FINDER_PATH_COUNT_BY_F_DICTITEMID_DICTGROUPID;

	Object[] finderArgs = new Object[] { groupId, dictGroupId, dictItemId };

	Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

	if (count == null) {
		StringBundler query = new StringBundler(4);

		query.append(_SQL_COUNT_DICTITEMGROUP_WHERE);

		query.append(_FINDER_COLUMN_F_DICTITEMID_DICTGROUPID_GROUPID_2);

		query.append(_FINDER_COLUMN_F_DICTITEMID_DICTGROUPID_DICTGROUPID_2);

		query.append(_FINDER_COLUMN_F_DICTITEMID_DICTGROUPID_DICTITEMID_2);

		String sql = query.toString();

		Session session = null;

		try {
			session = openSession();

			Query q = session.createQuery(sql);

			QueryPos qPos = QueryPos.getInstance(q);

			qPos.add(groupId);

			qPos.add(dictGroupId);

			qPos.add(dictItemId);

			count = (Long)q.uniqueResult();

			finderCache.putResult(finderPath, finderArgs, count);
		}
		catch (Exception e) {
			finderCache.removeResult(finderPath, finderArgs);

			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	return count.intValue();
}
 
Example 20
Project: opencps-v2   File: DictCollectionPersistenceImpl.java   View Source Code Vote up 2 votes
/**
 * Returns the number of dict collections where groupId = &#63;.
 *
 * @param groupId the group ID
 * @return the number of matching dict collections
 */
@Override
public int countByF_dictCollectionByGroup(long groupId) {
	FinderPath finderPath = FINDER_PATH_COUNT_BY_F_DICTCOLLECTIONBYGROUP;

	Object[] finderArgs = new Object[] { groupId };

	Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

	if (count == null) {
		StringBundler query = new StringBundler(2);

		query.append(_SQL_COUNT_DICTCOLLECTION_WHERE);

		query.append(_FINDER_COLUMN_F_DICTCOLLECTIONBYGROUP_GROUPID_2);

		String sql = query.toString();

		Session session = null;

		try {
			session = openSession();

			Query q = session.createQuery(sql);

			QueryPos qPos = QueryPos.getInstance(q);

			qPos.add(groupId);

			count = (Long)q.uniqueResult();

			finderCache.putResult(finderPath, finderArgs, count);
		}
		catch (Exception e) {
			finderCache.removeResult(finderPath, finderArgs);

			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	return count.intValue();
}