Sfoglia il codice sorgente

fix reindex pratica

feature/advanced-operation
marcoalderighi 2 anni fa
parent
commit
70f4933bd2
  1. BIN
      liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar
  2. BIN
      liferay-plugins-sdk-6.2/dist/portos-kaleo-shared-6.2.0.1.jar
  3. BIN
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar
  4. BIN
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-kaleo-shared.jar
  5. 44
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  6. 12
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java
  7. 24
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

BIN
liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar vendored

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/dist/portos-kaleo-shared-6.2.0.1.jar vendored

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-kaleo-shared.jar

File binario non mostrato.

44
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java

@ -91,6 +91,19 @@ public class AdvancedOperationPortlet extends MVCPortlet {
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
} }
public void reindexPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
Privati.checkIfUserIsCompanyAdmin(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) {
_log.info("AdvancedOperationPortlet --- Reindexing fascicolo of IntPraticaId " + intPraticaId);
IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, themeDisplay.getCompanyId());
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void fixStatusPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ public void fixStatusPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
@ -112,32 +125,35 @@ public class AdvancedOperationPortlet extends MVCPortlet {
Privati.checkIfUserIsCompanyAdmin(actionRequest); Privati.checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
_log.info("intPraticaId: "+intPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
int destinationUO = AdvancedOperationUtil.getDestinationUO(intPratica); int destinationUO = AdvancedOperationUtil.getDestinationUO(intPratica);
_log.info("intPratica uo: "+intPratica.getUnitaOperativa());
if (AdvancedOperationUtil.evalUO(intPratica)) { if (AdvancedOperationUtil.evalUO(intPratica)) {
_setUO(intPratica, destinationUO); _setUO(intPratica, destinationUO);
} }
_log.info("intPratica uo: "+intPratica.getUnitaOperativa());
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
} }
private void _setUO(IntPratica intPratica, int uo) throws SystemException, SearchException{ private void _setUO(IntPratica intPratica, int uo) throws SystemException, PortalException{
_log.info("uo: "+uo);
intPratica.setUnitaOperativa(uo); intPratica.setUnitaOperativa(uo);
IntPraticaLocalServiceUtil.updateIntPratica(intPratica); IntPraticaLocalServiceUtil.updateIntPratica(intPratica);
Indexer intPraticaIndexer = IndexerRegistryUtil.getIndexer(IntPratica.class); IntPraticaLocalServiceUtil.reIndexFasciolo(intPratica.getIntPraticaId(), intPratica.getCompanyId());
intPraticaIndexer.reindex(intPratica);
Indexer controlloPraticaIndexer = IndexerRegistryUtil.getIndexer(ControlloPratica.class); // Indexer intPraticaIndexer = IndexerRegistryUtil.getIndexer(IntPratica.class);
List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()); // intPraticaIndexer.reindex(intPratica);
if(!controlloPraticas.isEmpty()){ // Indexer controlloPraticaIndexer = IndexerRegistryUtil.getIndexer(ControlloPratica.class);
for(ControlloPratica controlloPratica : controlloPraticas){ // List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){ // if(!controlloPraticas.isEmpty()){
controlloPraticaIndexer.reindex(intPratica); // for(ControlloPratica controlloPratica : controlloPraticas){
} // if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){
} // controlloPraticaIndexer.reindex(intPratica);
} // }
// }
// }
} }
public void ripristinaPraticaVidimata(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ public void ripristinaPraticaVidimata(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{

12
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java

@ -283,19 +283,15 @@ public class AdvancedOperationUtil {
} }
public static SortedSet<Integer> getIstruttoreUOs(IntPratica intPratica){ public static SortedSet<Integer> getIstruttoreUOs(IntPratica intPratica){
WorkflowTask lastTask = getLastTask(intPratica);
if(Validator.isNotNull(lastTask)){
long assigneeUserId = lastTask.getAssigneeUserId();
try { try {
if(-1 != assigneeUserId){ User tecnicoIstruttore = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
User assignee = UserLocalServiceUtil.getUser(assigneeUserId); if(-1 != tecnicoIstruttore.getUserId()){
return UserUtil.getUnitaOperative(assignee); return UserUtil.getUnitaOperative(tecnicoIstruttore);
} }
} catch (SystemException | PortalException e){ } catch (SystemException e) {
_log.error("AOP ==> Error while analyzing IntPratica: " + intPratica.getIntPraticaId()); _log.error("AOP ==> Error while analyzing IntPratica: " + intPratica.getIntPraticaId());
_log.error(e,e); _log.error(e,e);
} }
}
return null; return null;
} }

24
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

@ -232,30 +232,6 @@
</div> </div>
<% } %> <% } %>
<% if(AdvancedOperationUtil.evalUO(intPratica)){ %>
<aui:col span="3">
<liferay-portlet:actionURL
name="fixUO"
var="fixUOURL" >
<liferay-portlet:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>"/>
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionfixUO = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"fixUO','Sei sicuro di voler cambiare l unita operativa di questa pratica?')";
%>
<aui:form action="<%= fixUOURL %>" method="post" name="fixUO">
<aui:button
type="button"
cssClass="btn-primary"
name="fixUOBtn"
onClick='<%= functionfixUO %>'
value="Fixa l'unita operativa"
>
</aui:button>
</aui:form>
</aui:col>
<% } %>
<% if(AdvancedOperationUtil.isPraticaAnnullata(intPratica)){ %> <% if(AdvancedOperationUtil.isPraticaAnnullata(intPratica)){ %>
<aui:col span="3"> <aui:col span="3">
<liferay-portlet:actionURL <liferay-portlet:actionURL

Caricamento…
Annulla
Salva