Search in sources :

Example 16 with Baz

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

the class BazModelImpl method toString.

@Override
public String toString() {
    Map<String, Function<Baz, Object>> attributeGetterFunctions = getAttributeGetterFunctions();
    StringBundler sb = new StringBundler(4 * attributeGetterFunctions.size() + 2);
    sb.append("{");
    for (Map.Entry<String, Function<Baz, Object>> entry : attributeGetterFunctions.entrySet()) {
        String attributeName = entry.getKey();
        Function<Baz, Object> attributeGetterFunction = entry.getValue();
        sb.append(attributeName);
        sb.append("=");
        sb.append(attributeGetterFunction.apply((Baz) this));
        sb.append(", ");
    }
    if (sb.index() > 1) {
        sb.setIndex(sb.index() - 1);
    }
    sb.append("}");
    return sb.toString();
}
Also used : Function(java.util.function.Function) Baz(com.liferay.blade.workflow.basic.model.Baz) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringBundler(com.liferay.petra.string.StringBundler)

Example 17 with Baz

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

the class BazModelImpl method toXmlString.

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

Example 18 with Baz

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

the class BazModelImpl method equals.

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

Example 19 with Baz

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

the class BazLocalServiceImpl method addBaz.

@Override
public Baz addBaz(long userId, long groupId, ServiceContext serviceContext) throws PortalException {
    User user = userLocalService.getUser(userId);
    Baz baz = bazPersistence.create(counterLocalService.increment());
    baz.setGroupId(groupId);
    baz.setCompanyId(user.getCompanyId());
    baz.setUserId(user.getUserId());
    baz.setUserName(user.getFullName());
    baz.setCreateDate(serviceContext.getCreateDate(null));
    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 : User(com.liferay.portal.kernel.model.User) Baz(com.liferay.blade.workflow.basic.model.Baz)

Example 20 with Baz

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

the class BazLocalServiceImpl method updateStatus.

@Override
public Baz updateStatus(long userId, long bazId, int status) throws PortalException {
    User user = userLocalService.getUser(userId);
    Baz baz = getBaz(bazId);
    baz.setStatus(status);
    baz.setStatusByUserId(user.getUserId());
    baz.setStatusByUserName(user.getFullName());
    baz.setStatusDate(new Date());
    return updateBaz(baz);
}
Also used : User(com.liferay.portal.kernel.model.User) Baz(com.liferay.blade.workflow.basic.model.Baz) Date(java.util.Date)

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