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. 46
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  6. 18
      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.

46
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));
}
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{
@ -112,32 +125,35 @@ public class AdvancedOperationPortlet extends MVCPortlet {
Privati.checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
_log.info("intPraticaId: "+intPraticaId);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
int destinationUO = AdvancedOperationUtil.getDestinationUO(intPratica);
_log.info("intPratica uo: "+intPratica.getUnitaOperativa());
if (AdvancedOperationUtil.evalUO(intPratica)) {
_setUO(intPratica, destinationUO);
}
_log.info("intPratica uo: "+intPratica.getUnitaOperativa());
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);
IntPraticaLocalServiceUtil.updateIntPratica(intPratica);
Indexer intPraticaIndexer = IndexerRegistryUtil.getIndexer(IntPratica.class);
intPraticaIndexer.reindex(intPratica);
Indexer controlloPraticaIndexer = IndexerRegistryUtil.getIndexer(ControlloPratica.class);
List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
if(!controlloPraticas.isEmpty()){
for(ControlloPratica controlloPratica : controlloPraticas){
if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){
controlloPraticaIndexer.reindex(intPratica);
}
}
}
IntPraticaLocalServiceUtil.reIndexFasciolo(intPratica.getIntPraticaId(), intPratica.getCompanyId());
// Indexer intPraticaIndexer = IndexerRegistryUtil.getIndexer(IntPratica.class);
// intPraticaIndexer.reindex(intPratica);
// Indexer controlloPraticaIndexer = IndexerRegistryUtil.getIndexer(ControlloPratica.class);
// List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
// if(!controlloPraticas.isEmpty()){
// for(ControlloPratica controlloPratica : controlloPraticas){
// if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){
// controlloPraticaIndexer.reindex(intPratica);
// }
// }
// }
}
public void ripristinaPraticaVidimata(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{

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

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

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

@ -232,30 +232,6 @@
</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)){ %>
<aui:col span="3">
<liferay-portlet:actionURL

Caricamento…
Annulla
Salva