use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method testUpdateExisting.
@Test
public void testUpdateExisting() throws Exception {
long pk = RandomTestUtil.nextLong();
Qux newQux = _persistence.create(pk);
newQux.setUuid(RandomTestUtil.randomString());
newQux.setGroupId(RandomTestUtil.nextLong());
newQux.setCompanyId(RandomTestUtil.nextLong());
newQux.setUserId(RandomTestUtil.nextLong());
newQux.setUserName(RandomTestUtil.randomString());
newQux.setCreateDate(RandomTestUtil.nextDate());
newQux.setModifiedDate(RandomTestUtil.nextDate());
newQux.setStatus(RandomTestUtil.nextInt());
newQux.setStatusByUserId(RandomTestUtil.nextLong());
newQux.setStatusByUserName(RandomTestUtil.randomString());
newQux.setStatusDate(RandomTestUtil.nextDate());
_quxs.add(_persistence.update(newQux));
Qux existingQux = _persistence.findByPrimaryKey(newQux.getPrimaryKey());
Assert.assertEquals(existingQux.getUuid(), newQux.getUuid());
Assert.assertEquals(existingQux.getQuxId(), newQux.getQuxId());
Assert.assertEquals(existingQux.getGroupId(), newQux.getGroupId());
Assert.assertEquals(existingQux.getCompanyId(), newQux.getCompanyId());
Assert.assertEquals(existingQux.getUserId(), newQux.getUserId());
Assert.assertEquals(existingQux.getUserName(), newQux.getUserName());
Assert.assertEquals(Time.getShortTimestamp(existingQux.getCreateDate()), Time.getShortTimestamp(newQux.getCreateDate()));
Assert.assertEquals(Time.getShortTimestamp(existingQux.getModifiedDate()), Time.getShortTimestamp(newQux.getModifiedDate()));
Assert.assertEquals(existingQux.getStatus(), newQux.getStatus());
Assert.assertEquals(existingQux.getStatusByUserId(), newQux.getStatusByUserId());
Assert.assertEquals(existingQux.getStatusByUserName(), newQux.getStatusByUserName());
Assert.assertEquals(Time.getShortTimestamp(existingQux.getStatusDate()), Time.getShortTimestamp(newQux.getStatusDate()));
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceImpl method findByUuid_C.
/**
* Returns an ordered range of all the quxs where uuid = ? and companyId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to <code>QueryUtil#ALL_POS</code> will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not <code>QueryUtil#ALL_POS</code>), then the query will include the default ORDER BY logic from <code>QuxModelImpl</code>. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of quxs
* @param end the upper bound of the range of quxs (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the ordered range of matching quxs
*/
@Override
public List<Qux> findByUuid_C(String uuid, long companyId, int start, int end, OrderByComparator<Qux> orderByComparator, boolean retrieveFromCache) {
uuid = Objects.toString(uuid, "");
boolean pagination = true;
FinderPath finderPath = null;
Object[] finderArgs = null;
if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) {
pagination = false;
finderPath = _finderPathWithoutPaginationFindByUuid_C;
finderArgs = new Object[] { uuid, companyId };
} else {
finderPath = _finderPathWithPaginationFindByUuid_C;
finderArgs = new Object[] { uuid, companyId, start, end, orderByComparator };
}
List<Qux> list = null;
if (retrieveFromCache) {
list = (List<Qux>) finderCache.getResult(finderPath, finderArgs, this);
if ((list != null) && !list.isEmpty()) {
for (Qux qux : list) {
if (!uuid.equals(qux.getUuid()) || (companyId != qux.getCompanyId())) {
list = null;
break;
}
}
}
}
if (list == null) {
StringBundler query = null;
if (orderByComparator != null) {
query = new StringBundler(4 + (orderByComparator.getOrderByFields().length * 2));
} else {
query = new StringBundler(4);
}
query.append(_SQL_SELECT_QUX_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
query.append(_FINDER_COLUMN_UUID_C_UUID_3);
} else {
bindUuid = true;
query.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
if (orderByComparator != null) {
appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
} else if (pagination) {
query.append(QuxModelImpl.ORDER_BY_JPQL);
}
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(companyId);
if (!pagination) {
list = (List<Qux>) QueryUtil.list(q, getDialect(), start, end, false);
Collections.sort(list);
list = Collections.unmodifiableList(list);
} else {
list = (List<Qux>) QueryUtil.list(q, getDialect(), start, end);
}
cacheResult(list);
finderCache.putResult(finderPath, finderArgs, list);
} catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
} finally {
closeSession(session);
}
}
return list;
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceImpl method findByUuid_Last.
/**
* Returns the last qux 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 last matching qux
* @throws NoSuchQuxException if a matching qux could not be found
*/
@Override
public Qux findByUuid_Last(String uuid, OrderByComparator<Qux> orderByComparator) throws NoSuchQuxException {
Qux qux = fetchByUuid_Last(uuid, orderByComparator);
if (qux != null) {
return qux;
}
StringBundler msg = new StringBundler(4);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append("}");
throw new NoSuchQuxException(msg.toString());
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceImpl method clearCache.
@Override
public void clearCache(List<Qux> quxs) {
finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
for (Qux qux : quxs) {
entityCache.removeResult(entityCacheEnabled, QuxImpl.class, qux.getPrimaryKey());
clearUniqueFindersCache((QuxModelImpl) qux, true);
}
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceImpl method findByUuid_First.
/**
* Returns the first qux 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 qux
* @throws NoSuchQuxException if a matching qux could not be found
*/
@Override
public Qux findByUuid_First(String uuid, OrderByComparator<Qux> orderByComparator) throws NoSuchQuxException {
Qux qux = fetchByUuid_First(uuid, orderByComparator);
if (qux != null) {
return qux;
}
StringBundler msg = new StringBundler(4);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append("}");
throw new NoSuchQuxException(msg.toString());
}
Aggregations