use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceTest method testDynamicQueryByPrimaryKeyMissing.
@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Qux.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("quxId", RandomTestUtil.nextLong()));
List<Qux> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxLocalServiceBaseImpl method getExportActionableDynamicQuery.
@Override
public ExportActionableDynamicQuery getExportActionableDynamicQuery(final PortletDataContext portletDataContext) {
final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
@Override
public long performCount() throws PortalException {
ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
StagedModelType stagedModelType = getStagedModelType();
long modelAdditionCount = super.performCount();
manifestSummary.addModelAdditionCount(stagedModelType, modelAdditionCount);
long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext, stagedModelType);
manifestSummary.addModelDeletionCount(stagedModelType, modelDeletionCount);
return modelAdditionCount;
}
};
initActionableDynamicQuery(exportActionableDynamicQuery);
exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
@Override
public void addCriteria(DynamicQuery dynamicQuery) {
Criterion modifiedDateCriterion = portletDataContext.getDateRangeCriteria("modifiedDate");
Criterion statusDateCriterion = portletDataContext.getDateRangeCriteria("statusDate");
if ((modifiedDateCriterion != null) && (statusDateCriterion != null)) {
Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
disjunction.add(modifiedDateCriterion);
disjunction.add(statusDateCriterion);
dynamicQuery.add(disjunction);
}
Property workflowStatusProperty = PropertyFactoryUtil.forName("status");
if (portletDataContext.isInitialPublication()) {
dynamicQuery.add(workflowStatusProperty.ne(WorkflowConstants.STATUS_IN_TRASH));
} else {
StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil.getStagedModelDataHandler(Qux.class.getName());
dynamicQuery.add(workflowStatusProperty.in(stagedModelDataHandler.getExportableStatuses()));
}
}
});
exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Qux>() {
@Override
public void performAction(Qux qux) throws PortalException {
StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, qux);
}
});
exportActionableDynamicQuery.setStagedModelType(new StagedModelType(PortalUtil.getClassNameId(Qux.class.getName())));
return exportActionableDynamicQuery;
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceImpl method findByUuid_C_Last.
/**
* Returns the last qux in the ordered set where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @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_C_Last(String uuid, long companyId, OrderByComparator<Qux> orderByComparator) throws NoSuchQuxException {
Qux qux = fetchByUuid_C_Last(uuid, companyId, orderByComparator);
if (qux != null) {
return qux;
}
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("}");
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 findByUUID_G.
/**
* Returns the qux where uuid = ? and groupId = ? or throws a <code>NoSuchQuxException</code> if it could not be found.
*
* @param uuid the uuid
* @param groupId the group ID
* @return the matching qux
* @throws NoSuchQuxException if a matching qux could not be found
*/
@Override
public Qux findByUUID_G(String uuid, long groupId) throws NoSuchQuxException {
Qux qux = fetchByUUID_G(uuid, groupId);
if (qux == 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 NoSuchQuxException(msg.toString());
}
return qux;
}
use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.
the class QuxPersistenceImpl method remove.
/**
* Removes the qux with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param primaryKey the primary key of the qux
* @return the qux that was removed
* @throws NoSuchQuxException if a qux with the primary key could not be found
*/
@Override
public Qux remove(Serializable primaryKey) throws NoSuchQuxException {
Session session = null;
try {
session = openSession();
Qux qux = (Qux) session.get(QuxImpl.class, primaryKey);
if (qux == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchQuxException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
return remove(qux);
} catch (NoSuchQuxException nsee) {
throw nsee;
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
}
Aggregations