Confronta commit
Nessun commit in comune. '492f39f3634e0d5e8fb4a4bc0aada7213b0a6110' e '6b0d6ae2bea6d49993232c5bb289cbbba686acf0' hanno storie completamente diverse.
492f39f363
...
6b0d6ae2be
24 ha cambiato i file con 112 aggiunte e 163 eliminazioni
@ -1,68 +0,0 @@ |
|||||||
package it.mwg.sismica.bo.util; |
|
||||||
|
|
||||||
import it.mwg.sismica.bo.shared.util.Generics; |
|
||||||
import it.tref.liferay.portos.bo.model.ControlloPratica; |
|
||||||
|
|
||||||
import java.util.Arrays; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import com.liferay.portal.kernel.dao.orm.QueryUtil; |
|
||||||
import com.liferay.portal.kernel.exception.PortalException; |
|
||||||
import com.liferay.portal.kernel.exception.SystemException; |
|
||||||
import com.liferay.portal.kernel.log.Log; |
|
||||||
import com.liferay.portal.kernel.log.LogFactoryUtil; |
|
||||||
import com.liferay.portal.kernel.util.StringPool; |
|
||||||
import com.liferay.portal.kernel.workflow.WorkflowInstance; |
|
||||||
import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; |
|
||||||
import com.liferay.portal.kernel.workflow.WorkflowLog; |
|
||||||
import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil; |
|
||||||
import com.liferay.portal.kernel.workflow.WorkflowTask; |
|
||||||
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; |
|
||||||
import com.liferay.portal.kernel.workflow.comparator.WorkflowComparatorFactoryUtil; |
|
||||||
import com.liferay.portal.model.User; |
|
||||||
import com.liferay.portal.model.WorkflowInstanceLink; |
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil; |
|
||||||
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; |
|
||||||
|
|
||||||
public class WorkflowUtil { |
|
||||||
|
|
||||||
private static final Log _log = LogFactoryUtil.getLog(WorkflowUtil.class); |
|
||||||
|
|
||||||
public static String provenienza(ControlloPratica cp) { |
|
||||||
|
|
||||||
String provenienza = StringPool.DASH; |
|
||||||
long companyId = cp.getCompanyId(); |
|
||||||
try { |
|
||||||
WorkflowInstanceLink link = WorkflowInstanceLinkLocalServiceUtil.getWorkflowInstanceLink(companyId, |
|
||||||
cp.getGroupId(), ControlloPratica.class.getName(), cp.getPrimaryKey()); |
|
||||||
WorkflowInstance instance = WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, |
|
||||||
link.getWorkflowInstanceId()); |
|
||||||
List<WorkflowLog> logs = WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(companyId, |
|
||||||
instance.getWorkflowInstanceId(), Arrays.asList(WorkflowLog.TASK_ASSIGN), QueryUtil.ALL_POS, |
|
||||||
QueryUtil.ALL_POS, WorkflowComparatorFactoryUtil.getLogCreateDateComparator(true)); |
|
||||||
String taskName = null; |
|
||||||
long userId = 0; |
|
||||||
for (WorkflowLog log : logs) { |
|
||||||
if (log.getAuditUserId() != 0 && log.getRoleId() == 0 && log.getWorkflowTaskId() != 0) { |
|
||||||
WorkflowTask task = WorkflowTaskManagerUtil.getWorkflowTask(companyId, log.getWorkflowTaskId()); |
|
||||||
if (task.isCompleted()) { |
|
||||||
taskName = task.getName(); |
|
||||||
} |
|
||||||
if (log.getUserId() != log.getAuditUserId() || task.isCompleted()) { |
|
||||||
userId = log.getAuditUserId(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
if (userId != 0) { |
|
||||||
User audit = UserLocalServiceUtil.fetchUser(userId); |
|
||||||
provenienza = Generics.capitalizeFull(audit.getFullName()); |
|
||||||
if (null != taskName) { |
|
||||||
provenienza += " (" + taskName + ')'; |
|
||||||
} |
|
||||||
} |
|
||||||
} catch (PortalException | SystemException e) { |
|
||||||
_log.error(e, e); |
|
||||||
} |
|
||||||
return provenienza; |
|
||||||
} |
|
||||||
} |
|
Caricamento…
Reference in new issue