Search in sources :

Example 21 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazLocalServiceImpl method updateBaz.

@Override
public Baz updateBaz(long bazId, ServiceContext serviceContext) throws PortalException {
    Baz baz = bazPersistence.findByPrimaryKey(bazId);
    baz.setModifiedDate(serviceContext.getModifiedDate(null));
    baz = bazPersistence.update(baz);
    WorkflowHandlerRegistryUtil.startWorkflowInstance(baz.getCompanyId(), baz.getGroupId(), baz.getUserId(), Baz.class.getName(), baz.getPrimaryKey(), baz, serviceContext);
    return baz;
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz)

Example 22 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testCreate.

@Test
public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Baz baz = _persistence.create(pk);
    Assert.assertNotNull(baz);
    Assert.assertEquals(baz.getPrimaryKey(), pk);
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 23 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.

@Test
public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    Baz newBaz = addBaz();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newBaz.getPrimaryKey());
    Map<Serializable, Baz> bazs = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(1, bazs.size());
    Assert.assertEquals(newBaz, bazs.get(newBaz.getPrimaryKey()));
}
Also used : Serializable(java.io.Serializable) Baz(com.liferay.blade.workflow.basic.model.Baz) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 24 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testDynamicQueryByPrimaryKeyMissing.

@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Baz.class, _dynamicQueryClassLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("bazId", RandomTestUtil.nextLong()));
    List<Baz> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(0, result.size());
}
Also used : DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Baz(com.liferay.blade.workflow.basic.model.Baz) Test(org.junit.Test)

Example 25 with Baz

use of com.liferay.blade.workflow.basic.model.Baz in project liferay-blade-samples by liferay.

the class BazPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.

@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
    Baz newBaz = addBaz();
    long pk = RandomTestUtil.nextLong();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newBaz.getPrimaryKey());
    primaryKeys.add(pk);
    Map<Serializable, Baz> bazs = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(1, bazs.size());
    Assert.assertEquals(newBaz, bazs.get(newBaz.getPrimaryKey()));
}
Also used : Serializable(java.io.Serializable) Baz(com.liferay.blade.workflow.basic.model.Baz) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Baz (com.liferay.blade.workflow.basic.model.Baz)39 Test (org.junit.Test)14 StringBundler (com.liferay.petra.string.StringBundler)13 NoSuchBazException (com.liferay.blade.workflow.basic.exception.NoSuchBazException)12 Session (com.liferay.portal.kernel.dao.orm.Session)7 Query (com.liferay.portal.kernel.dao.orm.Query)6 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)5 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)5 BazImpl (com.liferay.blade.workflow.basic.model.impl.BazImpl)4 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)4 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)3 Serializable (java.io.Serializable)3 HashSet (java.util.HashSet)3 User (com.liferay.portal.kernel.model.User)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Function (java.util.function.Function)2 ManifestSummary (com.liferay.exportimport.kernel.lar.ManifestSummary)1 StagedModelDataHandler (com.liferay.exportimport.kernel.lar.StagedModelDataHandler)1