Search in sources :

Example 16 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxModelImpl method equals.

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof Qux)) {
        return false;
    }
    Qux qux = (Qux) obj;
    long primaryKey = qux.getPrimaryKey();
    if (getPrimaryKey() == primaryKey) {
        return true;
    } else {
        return false;
    }
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux)

Example 17 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxModelImpl method toXmlString.

@Override
public String toXmlString() {
    Map<String, Function<Qux, 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<Qux, Object>> entry : attributeGetterFunctions.entrySet()) {
        String attributeName = entry.getKey();
        Function<Qux, Object> attributeGetterFunction = entry.getValue();
        sb.append("<column><column-name>");
        sb.append(attributeName);
        sb.append("</column-name><column-value><![CDATA[");
        sb.append(attributeGetterFunction.apply((Qux) this));
        sb.append("]]></column-value></column>");
    }
    sb.append("</model>");
    return sb.toString();
}
Also used : Function(java.util.function.Function) Qux(com.liferay.blade.workflow.asset.model.Qux) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringBundler(com.liferay.petra.string.StringBundler)

Example 18 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxLocalServiceImpl method addQux.

@Override
public Qux addQux(long userId, long groupId, ServiceContext serviceContext) throws PortalException {
    User user = userLocalService.getUser(userId);
    Qux qux = quxPersistence.create(counterLocalService.increment());
    qux.setGroupId(groupId);
    qux.setCompanyId(user.getCompanyId());
    qux.setUserId(user.getUserId());
    qux.setUserName(user.getFullName());
    qux.setCreateDate(serviceContext.getCreateDate(null));
    qux.setModifiedDate(serviceContext.getModifiedDate(null));
    qux = quxPersistence.update(qux);
    assetEntryLocalService.updateEntry(userId, qux.getGroupId(), qux.getCreateDate(), qux.getModifiedDate(), Qux.class.getName(), qux.getQuxId(), qux.getUuid(), 0, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), false, false, null, null, null, null, ContentTypes.TEXT, String.valueOf(qux.getPrimaryKey()), null, StringPool.BLANK, null, null, 0, 0, serviceContext.getAssetPriority());
    WorkflowHandlerRegistryUtil.startWorkflowInstance(qux.getCompanyId(), qux.getGroupId(), qux.getUserId(), Qux.class.getName(), qux.getPrimaryKey(), qux, serviceContext);
    return qux;
}
Also used : User(com.liferay.portal.kernel.model.User) Qux(com.liferay.blade.workflow.asset.model.Qux)

Example 19 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxLocalServiceImpl method updateQux.

@Override
public Qux updateQux(long quxId, ServiceContext serviceContext) throws PortalException {
    Qux qux = quxPersistence.findByPrimaryKey(quxId);
    qux.setModifiedDate(serviceContext.getModifiedDate(null));
    qux = quxPersistence.update(qux);
    WorkflowHandlerRegistryUtil.startWorkflowInstance(qux.getCompanyId(), qux.getGroupId(), qux.getUserId(), Qux.class.getName(), qux.getPrimaryKey(), qux, serviceContext);
    return qux;
}
Also used : Qux(com.liferay.blade.workflow.asset.model.Qux)

Example 20 with Qux

use of com.liferay.blade.workflow.asset.model.Qux in project liferay-blade-samples by liferay.

the class QuxPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.

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

Aggregations

Qux (com.liferay.blade.workflow.asset.model.Qux)39 Test (org.junit.Test)14 StringBundler (com.liferay.petra.string.StringBundler)13 NoSuchQuxException (com.liferay.blade.workflow.asset.exception.NoSuchQuxException)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 QuxImpl (com.liferay.blade.workflow.asset.model.impl.QuxImpl)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