|
|
@ -5,6 +5,7 @@ import it.tref.liferay.portos.bo.model.IntPratica; |
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; |
|
|
|
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.UnitaOperativeUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.AzioniPraticheUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.AzioniPraticheUtil; |
|
|
|
import it.tref.liferay.portos.kaleo.model.FormLog; |
|
|
|
import it.tref.liferay.portos.kaleo.model.FormLog; |
|
|
|
import it.tref.liferay.portos.kaleo.service.ClpSerializer; |
|
|
|
import it.tref.liferay.portos.kaleo.service.ClpSerializer; |
|
|
@ -70,7 +71,6 @@ import com.liferay.portal.model.LayoutTypePortlet; |
|
|
|
import com.liferay.portal.model.Organization; |
|
|
|
import com.liferay.portal.model.Organization; |
|
|
|
import com.liferay.portal.model.Portlet; |
|
|
|
import com.liferay.portal.model.Portlet; |
|
|
|
import com.liferay.portal.model.User; |
|
|
|
import com.liferay.portal.model.User; |
|
|
|
import com.liferay.portal.model.WorkflowInstanceLink; |
|
|
|
|
|
|
|
import com.liferay.portal.security.auth.PrincipalException; |
|
|
|
import com.liferay.portal.security.auth.PrincipalException; |
|
|
|
import com.liferay.portal.service.GroupLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.GroupLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.OrganizationLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.OrganizationLocalServiceUtil; |
|
|
@ -80,12 +80,13 @@ import com.liferay.portal.service.ServiceContext; |
|
|
|
import com.liferay.portal.service.ServiceContextFactory; |
|
|
|
import com.liferay.portal.service.ServiceContextFactory; |
|
|
|
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.UserLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.UserLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.theme.ThemeDisplay; |
|
|
|
import com.liferay.portal.theme.ThemeDisplay; |
|
|
|
import com.liferay.portal.util.PortalUtil; |
|
|
|
import com.liferay.portal.util.PortalUtil; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoInstance; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoInstance; |
|
|
|
|
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoInstanceToken; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; |
|
|
|
import com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil; |
|
|
|
import com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.workflow.kaleo.service.KaleoInstanceTokenLocalServiceUtil; |
|
|
|
import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServiceUtil; |
|
|
|
import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServiceUtil; |
|
|
|
|
|
|
|
|
|
|
|
public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
|
public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
@ -143,6 +144,8 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (cmd.equals("removeUO")) { |
|
|
|
|
|
|
|
removeUO(actionRequest); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, |
|
|
|
originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, |
|
|
|
actionRequest, actionResponse); |
|
|
|
actionRequest, actionResponse); |
|
|
@ -206,30 +209,18 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
|
} |
|
|
|
} |
|
|
|
if (istruttore.startsWith("--UO--")) { |
|
|
|
if (istruttore.startsWith("--UO--")) { |
|
|
|
aggiorna = false; |
|
|
|
aggiorna = false; |
|
|
|
KaleoTaskInstanceToken taskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil |
|
|
|
ControlloPratica controllo = WorkflowUtil.getControlloPratica(workflowTaskId); |
|
|
|
.getKaleoTaskInstanceToken(workflowTaskId); |
|
|
|
IntPratica pratica = IntPraticaLocalServiceUtil.getIntPratica(controllo.getIntPraticaId()); |
|
|
|
if (taskInstanceToken.getClassName().equals(ControlloPratica.class.getName())) { |
|
|
|
|
|
|
|
ControlloPratica controllo = ControlloPraticaLocalServiceUtil |
|
|
|
|
|
|
|
.getControlloPratica(taskInstanceToken.getClassPK()); |
|
|
|
|
|
|
|
IntPratica pratica = IntPraticaLocalServiceUtil |
|
|
|
|
|
|
|
.getIntPratica(controllo.getIntPraticaId()); |
|
|
|
|
|
|
|
long companyId = controllo.getCompanyId(); |
|
|
|
long companyId = controllo.getCompanyId(); |
|
|
|
long roleId = RoleLocalServiceUtil.getRole(companyId, "portos_assegnatore").getRoleId(); |
|
|
|
long roleId = RoleLocalServiceUtil.getRole(companyId, "portos_assegnatore").getRoleId(); |
|
|
|
int uo = Integer.parseInt(istruttore.substring(6)); |
|
|
|
int uo = Integer.parseInt(istruttore.substring(6)); |
|
|
|
WorkflowInstanceLink link = WorkflowInstanceLinkLocalServiceUtil.getWorkflowInstanceLink( |
|
|
|
|
|
|
|
companyId, controllo.getGroupId(), ControlloPratica.class.getName(), |
|
|
|
|
|
|
|
controllo.getPrimaryKey()); |
|
|
|
|
|
|
|
WorkflowInstance instance = WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, |
|
|
|
|
|
|
|
link.getWorkflowInstanceId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WorkflowTaskManagerUtil.assignWorkflowTaskToRole(companyId, themeDisplay.getUserId(), |
|
|
|
|
|
|
|
workflowTaskId, roleId, "Trasferito all'UO " + uo |
|
|
|
|
|
|
|
+ " per assegnazione all'istruttore.\n" + comment, null, |
|
|
|
|
|
|
|
WorkflowUtil.getWorkflowContext(controllo)); |
|
|
|
pratica.setUnitaOperativa(uo); |
|
|
|
pratica.setUnitaOperativa(uo); |
|
|
|
IntPraticaLocalServiceUtil.updateIntPratica(pratica); |
|
|
|
IntPraticaLocalServiceUtil.updateIntPratica(pratica); |
|
|
|
WorkflowTaskManagerUtil |
|
|
|
|
|
|
|
.assignWorkflowTaskToRole(companyId, taskInstanceToken.getUserId(), |
|
|
|
|
|
|
|
workflowTaskId, roleId, "Trasferito all'UO " + uo |
|
|
|
|
|
|
|
+ " per assegnazione all'istruttore", null, |
|
|
|
|
|
|
|
instance.getWorkflowContext()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -242,6 +233,27 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void removeUO(ActionRequest actionRequest) throws PortalException, SystemException { |
|
|
|
|
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long workflowTaskId = ParamUtil.getLong(actionRequest, "workflowTaskId"); |
|
|
|
|
|
|
|
String comment = ParamUtil.getString(actionRequest, "comment"); |
|
|
|
|
|
|
|
ControlloPratica controllo = WorkflowUtil.getControlloPratica(workflowTaskId); |
|
|
|
|
|
|
|
IntPratica pratica = IntPraticaLocalServiceUtil.getIntPratica(controllo.getIntPraticaId()); |
|
|
|
|
|
|
|
long companyId = themeDisplay.getCompanyId(); |
|
|
|
|
|
|
|
long userId = themeDisplay.getUserId(); |
|
|
|
|
|
|
|
Map<String, Serializable> workflowContext = WorkflowUtil.getWorkflowContext(controllo); |
|
|
|
|
|
|
|
long roleId = RoleLocalServiceUtil.getRole(companyId, "portos_assegnatore").getRoleId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WorkflowTaskManagerUtil.assignWorkflowTaskToUser(companyId, userId, workflowTaskId, userId, |
|
|
|
|
|
|
|
StringPool.BLANK, null, workflowContext); |
|
|
|
|
|
|
|
WorkflowTaskManagerUtil.assignWorkflowTaskToRole(companyId, userId, workflowTaskId, roleId, |
|
|
|
|
|
|
|
"Rimosso dalla unità operativa " + pratica.getUnitaOperativa() + ".\n" + comment, null, |
|
|
|
|
|
|
|
workflowContext); |
|
|
|
|
|
|
|
pratica.setUnitaOperativa(0); |
|
|
|
|
|
|
|
IntPraticaLocalServiceUtil.updateIntPratica(pratica); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void relaseTask(ActionRequest actionRequest) throws Exception { |
|
|
|
protected void relaseTask(ActionRequest actionRequest) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
@ -422,9 +434,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
|
|
|
|
|
|
|
long workflowTaskId = ParamUtil.getLong(renderRequest, "workflowTaskId"); |
|
|
|
long workflowTaskId = ParamUtil.getLong(renderRequest, "workflowTaskId"); |
|
|
|
|
|
|
|
|
|
|
|
WorkflowTask workflowTask = null; |
|
|
|
WorkflowTask workflowTask = null; |
|
|
|
|
|
|
|
|
|
|
|
if (workflowTaskId > 0) { |
|
|
|
if (workflowTaskId > 0) { |
|
|
|
workflowTask = WorkflowTaskManagerUtil.getWorkflowTask(themeDisplay.getCompanyId(), |
|
|
|
workflowTask = WorkflowTaskManagerUtil.getWorkflowTask(themeDisplay.getCompanyId(), |
|
|
|
workflowTaskId); |
|
|
|
workflowTaskId); |
|
|
@ -438,31 +448,34 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { |
|
|
|
renderRequest.setAttribute("assegna-value", valoreTransizioneAssegna); |
|
|
|
renderRequest.setAttribute("assegna-value", valoreTransizioneAssegna); |
|
|
|
|
|
|
|
|
|
|
|
// Gestione permessi action button
|
|
|
|
// Gestione permessi action button
|
|
|
|
ControlloPratica controlloPratica = getControlloPratica(workflowTask.getWorkflowInstanceId()); |
|
|
|
ControlloPratica controllo = getControlloPratica(workflowTask.getWorkflowInstanceId()); |
|
|
|
|
|
|
|
|
|
|
|
// ADT BUG BO ID=33
|
|
|
|
// ADT BUG BO ID=33
|
|
|
|
renderRequest.setAttribute( |
|
|
|
renderRequest.setAttribute( |
|
|
|
"historyWorkflowEsitiLogs", |
|
|
|
"historyWorkflowEsitiLogs", |
|
|
|
getHistoryWorkfloLogs(themeDisplay, workflowTask.getWorkflowInstanceId(), renderRequest, |
|
|
|
getHistoryWorkfloLogs(themeDisplay, workflowTask.getWorkflowInstanceId(), renderRequest, |
|
|
|
controlloPratica)); |
|
|
|
controllo)); |
|
|
|
|
|
|
|
|
|
|
|
long groupIdTerritorio = controlloPratica.getGroupId(); |
|
|
|
|
|
|
|
Group group = GroupLocalServiceUtil.getGroup(groupIdTerritorio); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Group group = GroupLocalServiceUtil.getGroup(controllo.getGroupId()); |
|
|
|
User user = themeDisplay.getUser(); |
|
|
|
User user = themeDisplay.getUser(); |
|
|
|
Organization org = OrganizationLocalServiceUtil.getOrganization(group.getClassPK()); |
|
|
|
Organization org = OrganizationLocalServiceUtil.getOrganization(group.getClassPK()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int unitaOperativa = WorkflowUtil.getIntPratica(workflowTaskId).getUnitaOperativa(); |
|
|
|
|
|
|
|
List<Integer> unitaOperativeUtente = UnitaOperativeUtil.getUnitaOperative(user); |
|
|
|
boolean canPortosAssegnatore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), |
|
|
|
boolean canPortosAssegnatore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), |
|
|
|
org.getGroupId(), "portos_assegnatore"); |
|
|
|
org.getGroupId(), "portos_assegnatore") |
|
|
|
boolean canPortosApprovatore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), |
|
|
|
&& (unitaOperativeUtente.contains(unitaOperativa) || unitaOperativeUtente.contains(0)); |
|
|
|
org.getGroupId(), "portos_approvatore"); |
|
|
|
|
|
|
|
|
|
|
|
KaleoInstance instance = KaleoInstanceLocalServiceUtil.getKaleoInstance(workflowTask |
|
|
|
|
|
|
|
.getWorkflowInstanceId()); |
|
|
|
|
|
|
|
KaleoInstanceToken rootToken = KaleoInstanceTokenLocalServiceUtil.getKaleoInstanceToken(instance |
|
|
|
|
|
|
|
.getRootKaleoInstanceTokenId()); |
|
|
|
|
|
|
|
|
|
|
|
boolean canPortosIstruttore = UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), |
|
|
|
boolean canRemoveUO = canPortosAssegnatore && (0 != unitaOperativa) |
|
|
|
org.getGroupId(), "portos_istruttore"); |
|
|
|
&& rootToken.getCurrentKaleoNodeName().equalsIgnoreCase("Assegnazione"); |
|
|
|
|
|
|
|
|
|
|
|
renderRequest.setAttribute("canPortosAssegnatore", canPortosAssegnatore); |
|
|
|
renderRequest.setAttribute("canPortosAssegnatore", canPortosAssegnatore); |
|
|
|
renderRequest.setAttribute("canPortosApprovatore", canPortosApprovatore); |
|
|
|
renderRequest.setAttribute("canRemoveUO", canRemoveUO); |
|
|
|
renderRequest.setAttribute("canPortosIstruttore", canPortosIstruttore); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return originalStrutsPortletAction.render(originalStrutsPortletAction, portletConfig, renderRequest, |
|
|
|
return originalStrutsPortletAction.render(originalStrutsPortletAction, portletConfig, renderRequest, |
|
|
|
renderResponse); |
|
|
|
renderResponse); |
|
|
|