use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFetchByPrimaryKeyMissing.
@Test
public void testFetchByPrimaryKeyMissing() throws Exception {
long pk = RandomTestUtil.nextLong();
Foo missingFoo = _persistence.fetchByPrimaryKey(pk);
Assert.assertNull(missingFoo);
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testDynamicQueryByProjectionExisting.
@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
Foo newFoo = addFoo();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Foo.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("fooId"));
Object newFooId = newFoo.getFooId();
dynamicQuery.add(RestrictionsFactoryUtil.in("fooId", new Object[] { newFooId }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Object existingFooId = result.get(0);
Assert.assertEquals(existingFooId, newFooId);
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testCreate.
@Test
public void testCreate() throws Exception {
long pk = RandomTestUtil.nextLong();
Foo foo = _persistence.create(pk);
Assert.assertNotNull(foo);
Assert.assertEquals(foo.getPrimaryKey(), pk);
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooModelImpl method toModel.
/**
* Converts the soap model instance into a normal model instance.
*
* @param soapModel the soap model instance to convert
* @return the normal model instance
*/
public static Foo toModel(FooSoap soapModel) {
if (soapModel == null) {
return null;
}
Foo model = new FooImpl();
model.setUuid(soapModel.getUuid());
model.setFooId(soapModel.getFooId());
model.setGroupId(soapModel.getGroupId());
model.setCompanyId(soapModel.getCompanyId());
model.setUserId(soapModel.getUserId());
model.setUserName(soapModel.getUserName());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setField1(soapModel.getField1());
model.setField2(soapModel.isField2());
model.setField3(soapModel.getField3());
model.setField4(soapModel.getField4());
model.setField5(soapModel.getField5());
return model;
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooLocalServiceBaseImpl 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) {
portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
}
});
exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Foo>() {
@Override
public void performAction(Foo foo) throws PortalException {
StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, foo);
}
});
exportActionableDynamicQuery.setStagedModelType(new StagedModelType(PortalUtil.getClassNameId(Foo.class.getName())));
return exportActionableDynamicQuery;
}
Aggregations