Search in sources :

Example 46 with StringBundler

use of com.liferay.petra.string.StringBundler in project liferay-blade-samples by liferay.

the class BazCacheModel method toString.

@Override
public String toString() {
    StringBundler sb = new StringBundler(25);
    sb.append("{uuid=");
    sb.append(uuid);
    sb.append(", bazId=");
    sb.append(bazId);
    sb.append(", groupId=");
    sb.append(groupId);
    sb.append(", companyId=");
    sb.append(companyId);
    sb.append(", userId=");
    sb.append(userId);
    sb.append(", userName=");
    sb.append(userName);
    sb.append(", createDate=");
    sb.append(createDate);
    sb.append(", modifiedDate=");
    sb.append(modifiedDate);
    sb.append(", status=");
    sb.append(status);
    sb.append(", statusByUserId=");
    sb.append(statusByUserId);
    sb.append(", statusByUserName=");
    sb.append(statusByUserName);
    sb.append(", statusDate=");
    sb.append(statusDate);
    sb.append("}");
    return sb.toString();
}
Also used : StringBundler(com.liferay.petra.string.StringBundler)

Example 47 with StringBundler

use of com.liferay.petra.string.StringBundler in project liferay-blade-samples by liferay.

the class BazModelImpl method toString.

@Override
public String toString() {
    Map<String, Function<Baz, Object>> attributeGetterFunctions = getAttributeGetterFunctions();
    StringBundler sb = new StringBundler(4 * attributeGetterFunctions.size() + 2);
    sb.append("{");
    for (Map.Entry<String, Function<Baz, Object>> entry : attributeGetterFunctions.entrySet()) {
        String attributeName = entry.getKey();
        Function<Baz, Object> attributeGetterFunction = entry.getValue();
        sb.append(attributeName);
        sb.append("=");
        sb.append(attributeGetterFunction.apply((Baz) this));
        sb.append(", ");
    }
    if (sb.index() > 1) {
        sb.setIndex(sb.index() - 1);
    }
    sb.append("}");
    return sb.toString();
}
Also used : Function(java.util.function.Function) Baz(com.liferay.blade.workflow.basic.model.Baz) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringBundler(com.liferay.petra.string.StringBundler)

Example 48 with StringBundler

use of com.liferay.petra.string.StringBundler in project liferay-blade-samples by liferay.

the class BazModelImpl method toXmlString.

@Override
public String toXmlString() {
    Map<String, Function<Baz, Object>> attributeGetterFunctions = getAttributeGetterFunctions();
    StringBundler sb = new StringBundler(5 * attributeGetterFunctions.size() + 4);
    sb.append("<model><model-name>");
    sb.append(getModelClassName());
    sb.append("</model-name>");
    for (Map.Entry<String, Function<Baz, Object>> entry : attributeGetterFunctions.entrySet()) {
        String attributeName = entry.getKey();
        Function<Baz, Object> attributeGetterFunction = entry.getValue();
        sb.append("<column><column-name>");
        sb.append(attributeName);
        sb.append("</column-name><column-value><![CDATA[");
        sb.append(attributeGetterFunction.apply((Baz) this));
        sb.append("]]></column-value></column>");
    }
    sb.append("</model>");
    return sb.toString();
}
Also used : Function(java.util.function.Function) Baz(com.liferay.blade.workflow.basic.model.Baz) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringBundler(com.liferay.petra.string.StringBundler)

Example 49 with StringBundler

use of com.liferay.petra.string.StringBundler in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method findByUuid_First.

/**
 * Returns the first bar 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 bar
 * @throws NoSuchBarException if a matching bar could not be found
 */
@Override
public Bar findByUuid_First(String uuid, OrderByComparator<Bar> orderByComparator) throws NoSuchBarException {
    Bar bar = fetchByUuid_First(uuid, orderByComparator);
    if (bar != null) {
        return bar;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append("}");
    throw new NoSuchBarException(msg.toString());
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) NoSuchBarException(com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException) StringBundler(com.liferay.petra.string.StringBundler)

Example 50 with StringBundler

use of com.liferay.petra.string.StringBundler in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method findByUUID_G.

/**
 * Returns the bar where uuid = &#63; and groupId = &#63; or throws a <code>NoSuchBarException</code> if it could not be found.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the matching bar
 * @throws NoSuchBarException if a matching bar could not be found
 */
@Override
public Bar findByUUID_G(String uuid, long groupId) throws NoSuchBarException {
    Bar bar = fetchByUUID_G(uuid, groupId);
    if (bar == 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("}");
        if (_log.isDebugEnabled()) {
            _log.debug(msg.toString());
        }
        throw new NoSuchBarException(msg.toString());
    }
    return bar;
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) NoSuchBarException(com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException) StringBundler(com.liferay.petra.string.StringBundler)

Aggregations

StringBundler (com.liferay.petra.string.StringBundler)90 Query (com.liferay.portal.kernel.dao.orm.Query)45 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)38 Session (com.liferay.portal.kernel.dao.orm.Session)35 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)31 Foo (com.liferay.blade.basic.model.Foo)17 Bar (com.liferay.blade.samples.servicebuilder.adq.model.Bar)17 NoSuchFooException (com.liferay.blade.basic.exception.NoSuchFooException)16 NoSuchBarException (com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException)16 HashMap (java.util.HashMap)14 LinkedHashMap (java.util.LinkedHashMap)14 Map (java.util.Map)14 Function (java.util.function.Function)14 Qux (com.liferay.blade.workflow.asset.model.Qux)13 Baz (com.liferay.blade.workflow.basic.model.Baz)13 NoSuchQuxException (com.liferay.blade.workflow.asset.exception.NoSuchQuxException)12 NoSuchBazException (com.liferay.blade.workflow.basic.exception.NoSuchBazException)12 List (java.util.List)4 Country (com.liferay.blade.samples.dspservicebuilder.model.Country)3 Country (com.liferay.blade.samples.jdbcservicebuilder.model.Country)3