Sfoglia il codice sorgente

Task dei miei ruoli con controllo di unità operativa

master
Salvatore La Manna 4 anni fa
parent
commit
ac52878722
  1. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java
  2. 74
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java
  3. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java
  4. 63
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java
  5. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  6. 14
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp
  7. 54
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp
  8. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailAttachmentPersistenceImpl.java
  9. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailPersistenceImpl.java
  10. 1
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailTemplatePersistenceImpl.java
  11. 4
      liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/service.properties
  12. 70
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java

@ -1282,6 +1282,10 @@ public class ValidazionePraticaUtil {
firme.remove(TipoSoggettoUtil.DIRETTORE_LAVORI);
}
if (intPratica.getTipoProcedura().equals(Constants.PROCEDURA_P9)) {
firme.remove(TipoSoggettoUtil.PROGETTISTA);
}
if (intPratica.getTipoProcedura().equals(Constants.PROCEDURA_P10)) {
firme.remove(TipoSoggettoUtil.PROGETTISTA);
firme.remove(TipoSoggettoUtil.DIRETTORE_LAVORI);

74
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java

@ -45,6 +45,7 @@ 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.AvvisoUtil;
import it.tref.liferay.portos.bo.util.Constants;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
import it.tref.liferay.portos.mailmanager.model.Email;
import it.tref.liferay.portos.mailmanager.model.EmailAttachment;
import it.tref.liferay.portos.mailmanager.model.EmailConstants;
@ -65,6 +66,7 @@ import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
import com.liferay.portal.kernel.cache.SingleVMPoolUtil;
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
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;
@ -76,6 +78,12 @@ import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
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.WorkflowLogManager;
import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowTask;
import com.liferay.portal.kernel.workflow.WorkflowTaskManager;
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil;
import com.liferay.portal.model.Company;
import com.liferay.portal.model.Contact;
import com.liferay.portal.model.EmailAddress;
@ -92,6 +100,7 @@ import com.liferay.portal.model.RoleConstants;
import com.liferay.portal.model.SystemEvent;
import com.liferay.portal.model.User;
import com.liferay.portal.model.UserPersonalSite;
import com.liferay.portal.model.WorkflowInstanceLink;
import com.liferay.portal.service.CompanyLocalServiceUtil;
import com.liferay.portal.service.ContactLocalServiceUtil;
import com.liferay.portal.service.EmailAddressLocalServiceUtil;
@ -106,6 +115,9 @@ import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.SystemEventLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil;
import com.liferay.portal.workflow.kaleo.model.KaleoInstance;
import com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil;
import com.liferay.portlet.asset.model.AssetEntry;
import com.liferay.portlet.asset.model.AssetTag;
import com.liferay.portlet.asset.model.AssetVocabulary;
@ -211,23 +223,55 @@ public class ManutenzioneDatabase {
pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE);
if (pratiche.size() > 0) {
for (IntPratica pratica : pratiche) {
int destinazione = 0;
try {
User user = UserLocalServiceUtil.getUser(pratica.getStatusByUserId());
List<Integer> uos = UnitaOperativeUtil.getUnitaOperative(user);
for (int uo : uos) {
if (uo > destinazione) {
destinazione = uo;
List<ControlloPratica> controlli = ControlloPraticaLocalServiceUtil
.findByIntPratica(pratica.getIntPraticaId());
if (controlli.size() > 0) {
ControlloPratica controllo = controlli.get(controlli.size() - 1);
long companyId = controllo.getCompanyId();
long groupId = controllo.getGroupId();
List<WorkflowLog> logs = null;
try {
WorkflowInstanceLink workflowInstancelink = WorkflowInstanceLinkLocalServiceUtil
.getWorkflowInstanceLink(companyId, groupId,
ControlloPratica.class.getName(), controllo.getPrimaryKey());
long workflowInstanceId = workflowInstancelink.getWorkflowInstanceId();
WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil
.getWorkflowInstance(controllo.getCompanyId(), workflowInstanceId);
List<Integer> types = new ArrayList<>();
types.add(WorkflowLog.TASK_ASSIGN);
logs = WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(companyId,
workflowInstanceId, types, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} catch (PortalException e) {
logs = new ArrayList<>();
}
for (WorkflowLog log : logs) {
long userId = log.getUserId();
if (0 != userId) {
int destinazione = 0;
try {
User user = UserLocalServiceUtil.getUser(userId);
if (Validator.isNotNull(user)) {
List<Integer> uos = UnitaOperativeUtil.getUnitaOperative(user);
for (int uo : uos) {
if (uo > destinazione) {
destinazione = uo;
}
}
}
} catch (PortalException e) {
}
if ((0 != destinazione) && (destinazione != pratica.getUnitaOperativa())) {
esitoLog(
esito,
"Pratica " + pratica.getNumeroProgetto() + "/"
+ pratica.getIntPraticaId() + ", "
+ pratica.getUnitaOperativa() + " -> " + destinazione
+ " (" + userId + ")");
pratica.setUnitaOperativa(destinazione);
IntPraticaLocalServiceUtil.updateIntPratica(pratica);
}
}
}
} catch (PortalException e) {
}
if (destinazione != pratica.getUnitaOperativa()) {
esitoLog(esito,
"Pratica " + pratica.getIntPraticaId() + ", " + pratica.getUnitaOperativa()
+ " -> " + destinazione);
pratica.setUnitaOperativa(destinazione);
IntPraticaLocalServiceUtil.updateIntPratica(pratica);
}
}
start += pratiche.size();

2
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java

@ -162,7 +162,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase
file = "geologo";
break;
case TipoSoggettoUtil.PROGETTISTA:
if (ambitoProfessione.equalsIgnoreCase("architettonico")) {
if (Validator.isNull(ambitoProfessione) || ambitoProfessione.equalsIgnoreCase("architettonico") || ambitoProfessione.equalsIgnoreCase("altro")) {
file = "progettista_architettonico";
} else {
file = "calcolista";

63
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java

@ -39,11 +39,11 @@ import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
@ -69,7 +69,6 @@ import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil;
import com.liferay.portal.kernel.workflow.WorkflowTask;
import com.liferay.portal.model.ResourceConstants;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
import com.liferay.portal.model.UserGroupRole;
import com.liferay.portal.service.RoleLocalServiceUtil;
@ -500,38 +499,43 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil
.getControlloPratica(controlloPraticaId);
boolean preassegnazione = (0 == IntPraticaLocalServiceUtil.getIntPratica(
controlloPratica.getIntPraticaId()).getUnitaOperativa());
int unitaOperativa = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId())
.getUnitaOperativa();
boolean preassegnazione = (0 == unitaOperativa);
long companyId = controlloPratica.getCompanyId();
long role = RoleLocalServiceUtil.getRole(companyId,
long roleId = RoleLocalServiceUtil.getRole(companyId,
preassegnazione ? "portos_assegnatore" : "portos_istruttore").getRoleId();
List<UserGroupRole> userGroupRoles = UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole(
controlloPratica.getGroupId(), role);
controlloPratica.getGroupId(), roleId);
_log.info("preassegnazione=" + preassegnazione + ", roleid=" + role);
Map<String, JSONObject> sorted = new TreeMap<>();
for (UserGroupRole userGroupRole : userGroupRoles) {
User user = userGroupRole.getUser();
long userId = user.getUserId();
if (preassegnazione) {
for (int uo : UnitaOperativeUtil.getUnitaOperative(user)) {
String label = ("U.O. " + uo + ": " + user.getFullName()).toUpperCase();
if (preassegnazione) {
Set<Integer> unitaOperative = new HashSet<>();
for (UserGroupRole userGroupRole : userGroupRoles) {
User user = userGroupRole.getUser();
unitaOperative.addAll(UnitaOperativeUtil.getUnitaOperative(user));
}
for (Integer uo : unitaOperative) {
if (0 != uo) {
JSONObject unita = JSONFactoryUtil.createJSONObject();
unita.put("label", "Unità operativa " + uo);
unita.put("value", "--UO--" + uo);
unita.put("default", false);
sorted.put(String.format("%6d", uo), unita);
}
}
} else {
for (UserGroupRole userGroupRole : userGroupRoles) {
User user = userGroupRole.getUser();
if (UnitaOperativeUtil.getUnitaOperative(user).contains(unitaOperativa)) {
JSONObject istruttore = JSONFactoryUtil.createJSONObject();
istruttore.put("label", label);
istruttore.put("value", userId);
istruttore.put("label", user.getFullName().toUpperCase());
istruttore.put("value", user.getUserId());
istruttore.put("default", false);
sorted.put(label, istruttore);
sorted.put((user.getLastName() + user.getFirstName()).toUpperCase(), istruttore);
}
} else {
String label = user.getFullName().toUpperCase();
JSONObject istruttore = JSONFactoryUtil.createJSONObject();
istruttore.put("label", label);
istruttore.put("value", userId);
istruttore.put("default", false);
sorted.put(label, istruttore);
}
}
@ -643,15 +647,6 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi
controlloPratica.setModifiedDate(new Date());
ControlloPratica result = controlloPraticaPersistence.update(controlloPratica);
// Map<String,Serializable>
// wfContext=WorkflowUtil.getWorkflowContext(controlloPratica);
// wfContext.put("ingloba_variante","Varianti inglobate nel controllo");
// long
// workflowInstanceId=WorkflowUtil.getWorkflowInstanceId(controlloPratica);
// ServiceContext serviceContext =
// (ServiceContext) wfContext.get("serviceContext");
// WorkflowInstanceManagerUtil.updateWorkflowContext(controlloPratica.getCompanyId(),
// workflowInstanceId, wfContext);
try {
WorkflowTask lastTask = WorkflowUtil.getLastTask(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), null, controlloPratica);

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
##
build.namespace=portos_bo
build.number=2833
build.date=1610446715034
build.number=2836
build.date=1610469830245
build.auto.upgrade=true
##

14
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp

@ -231,19 +231,7 @@ String keywords = StringPool.BLANK;
</c:if>
</div>
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Sorteggiata">
<% Sorteggio sorteggio = SorteggioLocalServiceUtil.findByIntPratica(intPraticaId); %>
<c:if test="<%= sorteggio != null %>">
<span title="Sorteggiata ed estratta">
<i class="relative fa fa-check-square txt-green" style="font-size:33px"></i>
</span>
</c:if>
<c:if test="<%= (intPratica.getDtSorteggio() != null) && (sorteggio == null) %>">
<span title="Sorteggiata e non estratta">
<i class="relative fa fa-minus-square txt-orange" style="font-size:33px"></i>
</span>
</c:if>
</liferay-ui:search-container-column-text>
<!-- SORTEGGIATA -->
<liferay-ui:search-container-column-text name="n-progetto" href="<%=viewURL %>" cssClass="">
<%= intPratica.getTitle(locale,true) %>
</liferay-ui:search-container-column-text>

54
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp

@ -1133,7 +1133,7 @@
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-sostegno-pendio") %>:
<%=LanguageUtil.get(pageContext, "geo-opere-di-sostegno") %>:
</div>
<div class="col-sm-6 col-md-2">
<% String geoOpereDiSostegno = BeanPropertiesUtil.getString(dettPratica, "geoOpereDiSostegno"); %>
@ -1191,6 +1191,46 @@
</c:if>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-rischio-geomorfologico") %>:
</div>
<div class="col-sm-6 col-md-2">
<% String geoRischioGeomorfologicoPai = BeanPropertiesUtil.getString(dettPratica, "geoRischioGeomorfologicoPai"); %>
<c:if test="<%= Validator.isNotNull(geoRischioGeomorfologicoPai) %>">
<strong><%= LanguageUtil.get(pageContext, "geo-rischio-geomorfologico-"+geoRischioGeomorfologicoPai) %></strong>
</c:if>
</div>
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-pericolosita-idraulica-pai") %>:
</div>
<div class="col-sm-6 col-md-2">
<% String geoPericolositaIdraulicaPai = BeanPropertiesUtil.getString(dettPratica, "geoPericolositaIdraulicaPai"); %>
<c:if test="<%= Validator.isNotNull(geoPericolositaIdraulicaPai) %>">
<strong><%= LanguageUtil.get(pageContext, "geo-pericolosita-idraulica-pai-"+geoPericolositaIdraulicaPai) %></strong>
</c:if>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-rischio-idraulico-pai") %>:
</div>
<div class="col-sm-6 col-md-2">
<% String geoRischioIdraulicoPai = BeanPropertiesUtil.getString(dettPratica, "geoRischioIdraulicoPai"); %>
<c:if test="<%= Validator.isNotNull(geoRischioIdraulicoPai) %>">
<strong><%= LanguageUtil.get(pageContext, "geo-rischio-idraulico-pai-"+geoRischioIdraulicoPai) %></strong>
</c:if>
</div>
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-presenza-prescrizioni") %>:
</div>
<div class="col-sm-6 col-md-2">
<% String geoPresenzaPrescrizioni = BeanPropertiesUtil.getString(dettPratica, "geoPresenzaPrescrizioni"); %>
<c:if test="<%= Validator.isNotNull(geoPresenzaPrescrizioni) %>">
<strong><%= LanguageUtil.get(pageContext, "geo-presenza-prescrizioni-"+geoPresenzaPrescrizioni) %></strong>
</c:if>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-fattibilita-sismica") %>:
@ -1231,17 +1271,7 @@
</c:if>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-presenza-prescrizioni") %>:
</div>
<div class="col-sm-6 col-md-2">
<% String geoPresenzaPrescrizioni = BeanPropertiesUtil.getString(dettPratica, "geoPresenzaPrescrizioni"); %>
<c:if test="<%= Validator.isNotNull(geoPresenzaPrescrizioni) %>">
<strong><%= LanguageUtil.get(pageContext, "geo-presenza-prescrizioni-"+geoPresenzaPrescrizioni) %></strong>
</c:if>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<%=LanguageUtil.get(pageContext, "geo-note-prescrizioni") %>:

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailAttachmentPersistenceImpl.java

@ -42,7 +42,6 @@ import it.tref.liferay.portos.mailmanager.NoSuchEmailAttachmentException;
import it.tref.liferay.portos.mailmanager.model.EmailAttachment;
import it.tref.liferay.portos.mailmanager.model.impl.EmailAttachmentImpl;
import it.tref.liferay.portos.mailmanager.model.impl.EmailAttachmentModelImpl;
import it.tref.liferay.portos.mailmanager.service.persistence.EmailAttachmentPersistence;
import java.io.Serializable;

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailPersistenceImpl.java

@ -44,7 +44,6 @@ import it.tref.liferay.portos.mailmanager.NoSuchEmailException;
import it.tref.liferay.portos.mailmanager.model.Email;
import it.tref.liferay.portos.mailmanager.model.impl.EmailImpl;
import it.tref.liferay.portos.mailmanager.model.impl.EmailModelImpl;
import it.tref.liferay.portos.mailmanager.service.persistence.EmailPersistence;
import java.io.Serializable;

1
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailTemplatePersistenceImpl.java

@ -46,7 +46,6 @@ import it.tref.liferay.portos.mailmanager.NoSuchEmailTemplateException;
import it.tref.liferay.portos.mailmanager.model.EmailTemplate;
import it.tref.liferay.portos.mailmanager.model.impl.EmailTemplateImpl;
import it.tref.liferay.portos.mailmanager.model.impl.EmailTemplateModelImpl;
import it.tref.liferay.portos.mailmanager.service.persistence.EmailTemplatePersistence;
import java.io.Serializable;

4
liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
##
build.namespace=portos_Mail
build.number=82
build.date=1607506075611
build.number=83
build.date=1610446343471
build.auto.upgrade=true
##

70
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java

@ -1,6 +1,7 @@
package it.tref.liferay.portos.kaleo.hook.struts;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants;
@ -13,7 +14,6 @@ import it.tref.liferay.portos.kaleo.util.WorkflowUtil;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
@ -56,6 +56,8 @@ import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.kernel.workflow.WorkflowException;
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;
@ -68,14 +70,17 @@ import com.liferay.portal.model.LayoutTypePortlet;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.Portlet;
import com.liferay.portal.model.User;
import com.liferay.portal.model.WorkflowInstanceLink;
import com.liferay.portal.security.auth.PrincipalException;
import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.PortletLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.portal.service.UserGroupRoleLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.workflow.kaleo.model.KaleoInstance;
@ -86,10 +91,17 @@ import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServ
public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
private final static Log _log = LogFactoryUtil.getLog(EditWorkflowTaskAction.class);
private final static List<String> valoriAmmessi = Arrays.asList(StatoPraticaConstants.ANNULLATA,
StatoPraticaConstants.CONFORME, StatoPraticaConstants.INTEGRAZIONE,
StatoPraticaConstants.NON_CONFORME, StatoPraticaConstants.NO_PARERE,
StatoPraticaConstants.PREAVVISO_CONTRARIO);
@SuppressWarnings("serial")
private final static List<String> valoriAmmessi = new ArrayList<String>() {
{
add(StatoPraticaConstants.ANNULLATA);
add(StatoPraticaConstants.CONFORME);
add(StatoPraticaConstants.INTEGRAZIONE);
add(StatoPraticaConstants.NON_CONFORME);
add(StatoPraticaConstants.NO_PARERE);
add(StatoPraticaConstants.PREAVVISO_CONTRARIO);
}
};
@Override
public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig,
@ -158,6 +170,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
String transitionName = ParamUtil.getString(actionRequest, "transitionName");
String comment = ParamUtil.getString(actionRequest, "comment");
boolean aggiorna = true;
// ADT: bug mancata problema assegnazione WF
checkPresenzaIstruttore(transitionName, workflowTaskId);
@ -185,23 +198,48 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction {
} else if (transitionName.equalsIgnoreCase("Riassegna") || transitionName.equalsIgnoreCase("assegna")) {
HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil
.getHttpServletRequest(actionRequest));
String istr = httpServletRequest.getParameter("kaleo--istruttore--") != null ? httpServletRequest
.getParameter("kaleo--istruttore--").trim() : StringPool.BLANK;
if (istr.isEmpty()) {
String istruttore = httpServletRequest.getParameter("kaleo--istruttore--");
if (Validator.isNull(istruttore)) {
_log.error("controllo validazione completamento task = " + transitionName + " -"
+ workflowTaskId + " non riuscito - istruttore non presente nel workflow");
throw new PortalException("controllo validazione completamento task riassegna non riuscito");
}
if (istruttore.startsWith("--UO--")) {
aggiorna = false;
KaleoTaskInstanceToken taskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil
.getKaleoTaskInstanceToken(workflowTaskId);
if (taskInstanceToken.getClassName().equals(ControlloPratica.class.getName())) {
ControlloPratica controllo = ControlloPraticaLocalServiceUtil
.getControlloPratica(taskInstanceToken.getClassPK());
IntPratica pratica = IntPraticaLocalServiceUtil
.getIntPratica(controllo.getIntPraticaId());
long companyId = controllo.getCompanyId();
long roleId = RoleLocalServiceUtil.getRole(companyId, "portos_assegnatore").getRoleId();
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());
pratica.setUnitaOperativa(uo);
IntPraticaLocalServiceUtil.updateIntPratica(pratica);
WorkflowTaskManagerUtil
.assignWorkflowTaskToRole(companyId, taskInstanceToken.getUserId(),
workflowTaskId, roleId, "Trasferito all'UO " + uo
+ " per assegnazione all'istruttore", null,
instance.getWorkflowContext());
}
}
}
Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();
workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName);
WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext);
WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
workflowTaskId, transitionName, comment, workflowContext);
if (aggiorna) {
Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();
workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName);
WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext);
WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(),
themeDisplay.getUserId(), workflowTaskId, transitionName, comment, workflowContext);
}
}
protected void relaseTask(ActionRequest actionRequest) throws Exception {

Caricamento…
Annulla
Salva