|
|
@ -3,6 +3,8 @@ package it.tref.liferay.portos.bo.search; |
|
|
|
import it.tref.liferay.portos.bo.model.ControlloPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.ControlloPratica; |
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; |
|
|
|
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.PortosIndexField; |
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowConstants; |
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowConstants; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.DateFormat; |
|
|
|
import java.text.DateFormat; |
|
|
@ -11,7 +13,6 @@ import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
import java.util.Properties; |
|
|
|
import java.util.Properties; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
@ -59,24 +60,13 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
public static final DateFormat DATE_FORMAT_STRING = new SimpleDateFormat("dd/MM/yyyy"); |
|
|
|
public static final DateFormat DATE_FORMAT_STRING = new SimpleDateFormat("dd/MM/yyyy"); |
|
|
|
|
|
|
|
|
|
|
|
public static Hits searchMieiTask(HttpServletRequest request, User user, int start, int end) { |
|
|
|
public static Hits searchMieiTask(HttpServletRequest request, User user, int start, int end) { |
|
|
|
|
|
|
|
|
|
|
|
// Parametro proveniente dalla ricerca
|
|
|
|
|
|
|
|
int ufficioSearch = ParamUtil.getInteger(request, "ufficio"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean searchForExport = ParamUtil.getBoolean(request, "searchForExport", false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
|
|
|
|
if (ParamUtil.getBoolean(request, "searchForExport", false)) { |
|
|
|
if (searchForExport) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setStart(start); |
|
|
|
searchContext.setStart(start); |
|
|
@ -85,7 +75,6 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
|
|
|
|
|
|
|
|
// Gestione Ordinamento
|
|
|
|
// Gestione Ordinamento
|
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
|
|
|
|
|
|
|
|
Hits hits = null; |
|
|
|
Hits hits = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
// Condizioni necessarie per questa ricerca :
|
|
|
|
// Condizioni necessarie per questa ricerca :
|
|
|
@ -104,50 +93,36 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
|
|
|
|
|
|
|
|
// Ricavo i groupId relativi all utente che effettua la ricerca per
|
|
|
|
// Ricavo i groupId relativi all utente che effettua la ricerca per
|
|
|
|
// filtrare
|
|
|
|
// filtrare
|
|
|
|
|
|
|
|
long ufficio = ParamUtil.getLong(request, "ufficio"); |
|
|
|
if (ufficioSearch != 0 && ufficioSearch != -1) { |
|
|
|
if (ufficio != 0 && ufficio != -1) { |
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", ufficio); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
|
|
|
|
ufficioSearch); |
|
|
|
|
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
.getUserId()); |
|
|
|
.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Condizioni aggiuntive
|
|
|
|
// Condizioni aggiuntive
|
|
|
|
retrieveQuery(request, user, booleanQuery, searchContext); |
|
|
|
retrieveQuery(request, user, booleanQuery, searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (ParseException | SearchException | SystemException e) { |
|
|
|
} catch (ParseException | SearchException | SystemException e) { |
|
|
|
_log.error(e, e); |
|
|
|
_log.error(e, e); |
|
|
|
} |
|
|
|
} |
|
|
@ -156,24 +131,13 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Hits searchTaskMieiRuoli(HttpServletRequest request, User user, int start, int end) { |
|
|
|
public static Hits searchTaskMieiRuoli(HttpServletRequest request, User user, int start, int end) { |
|
|
|
|
|
|
|
|
|
|
|
// Parametro proveniente dalla ricerca
|
|
|
|
|
|
|
|
int ufficioSearch = ParamUtil.getInteger(request, "ufficio"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
|
|
|
|
if (ParamUtil.getBoolean(request, "searchForExport", false)) { |
|
|
|
boolean searchForExport = ParamUtil.getBoolean(request, "searchForExport", false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (searchForExport) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setStart(start); |
|
|
|
searchContext.setStart(start); |
|
|
@ -184,29 +148,24 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
Hits hits = null; |
|
|
|
Hits hits = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
// Condizioni necessarie per questa ricerca :
|
|
|
|
// Condizioni necessarie per questa ricerca :
|
|
|
|
// entryClassName=ControlloPratica & roleIds tra i taskAssigneeIds
|
|
|
|
// entryClassName=ControlloPratica & roleIds tra i taskAssigneeIds
|
|
|
|
TermQuery entryClassNameTermQuery = TermQueryFactoryUtil.create(searchContext, "entryClassName", |
|
|
|
TermQuery entryClassNameTermQuery = TermQueryFactoryUtil.create(searchContext, "entryClassName", |
|
|
|
ControlloPratica.class.getName()); |
|
|
|
ControlloPratica.class.getName()); |
|
|
|
TermQuery statusTermQuery = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
TermQuery statusTermQuery = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
WorkflowConstants.STATUS_PENDING); |
|
|
|
WorkflowConstants.STATUS_PENDING); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery booleanQueryRoleIds = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery booleanQueryRoleIds = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
List<Organization> organizationUserList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
List<Organization> organizationUserList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
.getUserId()); |
|
|
|
.getUserId()); |
|
|
|
List<Role> organizationRoleList = null; |
|
|
|
List<Role> organizationRoleList = null; |
|
|
|
|
|
|
|
|
|
|
|
for (Organization org : organizationUserList) { |
|
|
|
for (Organization org : organizationUserList) { |
|
|
|
organizationRoleList = RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), |
|
|
|
organizationRoleList = RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
|
|
|
|
|
|
|
|
for (Role role : organizationRoleList) { |
|
|
|
for (Role role : organizationRoleList) { |
|
|
|
TermQuery roleIdTerm = TermQueryFactoryUtil.create(searchContext, "taskAssigneeRoleIds", |
|
|
|
TermQuery roleIdTerm = TermQueryFactoryUtil.create(searchContext, "taskAssigneeRoleIds", |
|
|
|
("R" + role.getRoleId() + "G" + org.getGroupId())); |
|
|
|
("R" + role.getRoleId() + "G" + org.getGroupId())); |
|
|
|
booleanQueryRoleIds.add(roleIdTerm, BooleanClauseOccur.SHOULD); |
|
|
|
booleanQueryRoleIds.add(roleIdTerm, BooleanClauseOccur.SHOULD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
@ -226,42 +185,45 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
|
|
|
|
|
|
|
|
// Ricavo i groupId relativi all utente che effettua la ricerca per
|
|
|
|
// Ricavo i groupId relativi all utente che effettua la ricerca per
|
|
|
|
// filtrare
|
|
|
|
// filtrare
|
|
|
|
|
|
|
|
long ufficio = ParamUtil.getLong(request, "ufficio"); |
|
|
|
if (ufficioSearch != 0 && ufficioSearch != -1) { |
|
|
|
if (ufficio != 0 && ufficio != -1) { |
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", ufficio); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
|
|
|
|
ufficioSearch); |
|
|
|
|
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
.getUserId()); |
|
|
|
.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> uos = UnitaOperativeUtil.getUnitaOperative(user); |
|
|
|
|
|
|
|
if ((uos.size() > 0) && !uos.contains(0)) { |
|
|
|
|
|
|
|
BooleanQuery uoQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
|
|
|
|
for (int uo : uos) { |
|
|
|
|
|
|
|
TermQuery tq = TermQueryFactoryUtil.create(searchContext, |
|
|
|
|
|
|
|
PortosIndexField.UNITA_OPERATIVA, uo); |
|
|
|
|
|
|
|
uoQuery.add(tq, BooleanClauseOccur.SHOULD); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
booleanQuery.add(uoQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Condizioni aggiuntive
|
|
|
|
// Condizioni aggiuntive
|
|
|
|
retrieveQuery(request, user, booleanQuery, searchContext); |
|
|
|
retrieveQuery(request, user, booleanQuery, searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_log.info("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
|
|
|
|
|
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
|
|
|
|
|
|
|
@ -276,26 +238,14 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Hits searchAltriTask(HttpServletRequest request, User user, int start, int end) { |
|
|
|
public static Hits searchAltriTask(HttpServletRequest request, User user, int start, int end) { |
|
|
|
|
|
|
|
|
|
|
|
// List<ControlloPratica> lista = new ArrayList<ControlloPratica>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Parametro proveniente dalla ricerca
|
|
|
|
|
|
|
|
int ufficioSearch = ParamUtil.getInteger(request, "ufficio"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
|
|
|
|
|
|
|
|
boolean searchForExport = ParamUtil.getBoolean(request, "searchForExport", false); |
|
|
|
boolean searchForExport = ParamUtil.getBoolean(request, "searchForExport", false); |
|
|
|
|
|
|
|
|
|
|
|
if (searchForExport) { |
|
|
|
if (searchForExport) { |
|
|
|
|
|
|
|
|
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setStart(start); |
|
|
|
searchContext.setStart(start); |
|
|
@ -306,7 +256,6 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
Hits hits = null; |
|
|
|
Hits hits = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
// Condizioni necessarie per questa ricerca :
|
|
|
|
// Condizioni necessarie per questa ricerca :
|
|
|
|
// entryClassName=ControlloPratica &
|
|
|
|
// entryClassName=ControlloPratica &
|
|
|
|
// roleIds non e tra i taskAssigneeIds
|
|
|
|
// roleIds non e tra i taskAssigneeIds
|
|
|
@ -323,7 +272,6 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
for (Organization org : organizationUserList) { |
|
|
|
for (Organization org : organizationUserList) { |
|
|
|
organizationRoleList = RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), |
|
|
|
organizationRoleList = RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
|
|
|
|
|
|
|
|
for (Role role : organizationRoleList) { |
|
|
|
for (Role role : organizationRoleList) { |
|
|
|
TermQuery roleIdTerm = TermQueryFactoryUtil.create(searchContext, "taskAssigneeRoleIds", |
|
|
|
TermQuery roleIdTerm = TermQueryFactoryUtil.create(searchContext, "taskAssigneeRoleIds", |
|
|
|
(role.getRoleId() + "-" + org.getGroupId())); |
|
|
|
(role.getRoleId() + "-" + org.getGroupId())); |
|
|
@ -348,72 +296,39 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
|
|
|
|
|
|
|
|
// Ricavo i groupId relativi all utente che effettua la ricerca per
|
|
|
|
// Ricavo i groupId relativi all utente che effettua la ricerca per
|
|
|
|
// filtrare
|
|
|
|
// filtrare
|
|
|
|
|
|
|
|
long ufficio = ParamUtil.getLong(request, "ufficio"); |
|
|
|
if (ufficioSearch != 0 && ufficioSearch != -1) { |
|
|
|
if (ufficio != 0 && ufficio != -1) { |
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", ufficio); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
|
|
|
|
ufficioSearch); |
|
|
|
|
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
.getUserId()); |
|
|
|
.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Condizioni aggiuntive
|
|
|
|
// Condizioni aggiuntive
|
|
|
|
retrieveQuery(request, user, booleanQuery, searchContext); |
|
|
|
retrieveQuery(request, user, booleanQuery, searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (ParseException | SearchException | SystemException e) { |
|
|
|
// for (Document doc : hits.toList()) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// String controlloPraticaId = doc.get("controlloPraticaId");
|
|
|
|
|
|
|
|
// if (Validator.isNotNull(controlloPraticaId)) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// ControlloPratica controlloPratica =
|
|
|
|
|
|
|
|
// ControlloPraticaLocalServiceUtil.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId));
|
|
|
|
|
|
|
|
// if (Validator.isNotNull(controlloPratica)) {
|
|
|
|
|
|
|
|
// lista.add(controlloPratica);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SearchException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SystemException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
_log.error(e, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return hits; |
|
|
|
return hits; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -421,119 +336,62 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
User user, int start, int end) { |
|
|
|
User user, int start, int end) { |
|
|
|
|
|
|
|
|
|
|
|
List<ControlloPratica> lista = new ArrayList<ControlloPratica>(); |
|
|
|
List<ControlloPratica> lista = new ArrayList<ControlloPratica>(); |
|
|
|
|
|
|
|
|
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
|
|
|
|
|
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
|
|
|
|
|
|
|
|
// Gestione Ordinamento
|
|
|
|
// Gestione Ordinamento
|
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
Hits hits = null; |
|
|
|
Hits hits = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery entryClassNameTermQuery = TermQueryFactoryUtil.create(searchContext, "entryClassName", |
|
|
|
TermQuery entryClassNameTermQuery = TermQueryFactoryUtil.create(searchContext, "entryClassName", |
|
|
|
ControlloPratica.class.getName()); |
|
|
|
ControlloPratica.class.getName()); |
|
|
|
|
|
|
|
|
|
|
|
TermQuery statusTermQuery = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
TermQuery statusTermQuery = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
WorkflowConstants.STATUS_PENDING); |
|
|
|
WorkflowConstants.STATUS_PENDING); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
booleanQuery.add(entryClassNameTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(entryClassNameTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(statusTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(statusTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
// BooleanQuery booleanQueryAttivita =
|
|
|
|
String dataDa = ParamUtil.getString(request, "dataRichiestaInizio"); |
|
|
|
// BooleanQueryFactoryUtil.create(searchContext);
|
|
|
|
String dataAl = ParamUtil.getString(request, "dataRichiestaFine"); |
|
|
|
// TermQuery assegnazioneTerm =
|
|
|
|
if (Validator.isNotNull(dataDa) || Validator.isNotNull(dataAl)) { |
|
|
|
// TermQueryFactoryUtil.create(searchContext, "workflowState",
|
|
|
|
if (Validator.isNull(dataDa)) { |
|
|
|
// " Assegnazione");
|
|
|
|
dataDa = "00000000"; |
|
|
|
// TermQuery approvazioneTerm =
|
|
|
|
} else { |
|
|
|
// TermQueryFactoryUtil.create(searchContext, "workflowState",
|
|
|
|
dataDa = DATE_FORMAT_LUCENE.format(DATE_FORMAT_STRING.parse(dataDa)); |
|
|
|
// "Approvazione");
|
|
|
|
} |
|
|
|
//
|
|
|
|
if (Validator.isNull(dataAl)) { |
|
|
|
// booleanQueryAttivita.add(assegnazioneTerm,
|
|
|
|
dataAl = DATE_FORMAT_LUCENE.format(new Date()); |
|
|
|
// BooleanClauseOccur.SHOULD);
|
|
|
|
} else { |
|
|
|
// booleanQueryAttivita.add(approvazioneTerm,
|
|
|
|
dataAl = DATE_FORMAT_LUCENE.format(DATE_FORMAT_STRING.parse(dataAl)); |
|
|
|
// BooleanClauseOccur.SHOULD);
|
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// booleanQuery.add(booleanQueryAttivita, BooleanClauseOccur.MUST);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String dataDaSearch = ParamUtil.getString(request, "dataRichiestaInizio"); |
|
|
|
|
|
|
|
String dataAlSearch = ParamUtil.getString(request, "dataRichiestaFine"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch != null && !dataDaSearch.equals("")) |
|
|
|
|
|
|
|
&& (dataAlSearch != null && !dataAlSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDaSearch); |
|
|
|
|
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAlSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
|
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
|
|
|
|
DATE_FORMAT_LUCENE.format(dataAlApp), true, true); |
|
|
|
|
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch == null || dataDaSearch.equals("")) |
|
|
|
|
|
|
|
&& (dataAlSearch != null && !dataDaSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAlSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
|
|
|
|
"dataInizioProcedimento", "00000000", DATE_FORMAT_LUCENE.format(dataAlApp), true, |
|
|
|
|
|
|
|
true); |
|
|
|
|
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch != null && !dataDaSearch.equals("")) |
|
|
|
|
|
|
|
&& (dataAlSearch == null || dataAlSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDaSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
"dataInizioProcedimento", dataDa, dataAl, true, true); |
|
|
|
DATE_FORMAT_LUCENE.format(new Date()), true, true); |
|
|
|
|
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
_log.debug("Number of hints found : " + hits.getLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (Document doc : hits.toList()) { |
|
|
|
for (Document doc : hits.toList()) { |
|
|
|
|
|
|
|
|
|
|
|
String controlloPraticaId = doc.get("controlloPraticaId"); |
|
|
|
String controlloPraticaId = doc.get("controlloPraticaId"); |
|
|
|
if (Validator.isNotNull(controlloPraticaId)) { |
|
|
|
if (Validator.isNotNull(controlloPraticaId)) { |
|
|
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId)); |
|
|
|
.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId)); |
|
|
|
if (Validator.isNotNull(controlloPratica)) { |
|
|
|
if (Validator.isNotNull(controlloPratica)) { |
|
|
|
lista.add(controlloPratica); |
|
|
|
lista.add(controlloPratica); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
} catch (ParseException | SearchException | SystemException | java.text.ParseException e) { |
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SearchException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SystemException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (java.text.ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
_log.error(e, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -542,19 +400,13 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
|
|
|
|
|
|
|
|
public static List<ControlloPratica> searchTaskPerEsportazionePO(HttpServletRequest request, User user, |
|
|
|
public static List<ControlloPratica> searchTaskPerEsportazionePO(HttpServletRequest request, User user, |
|
|
|
int start, int end) { |
|
|
|
int start, int end) { |
|
|
|
|
|
|
|
|
|
|
|
List<ControlloPratica> lista = new ArrayList<ControlloPratica>(); |
|
|
|
List<ControlloPratica> lista = new ArrayList<ControlloPratica>(); |
|
|
|
|
|
|
|
|
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
|
|
|
|
|
|
|
|
// Gestione Ordinamento
|
|
|
|
// Gestione Ordinamento
|
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
searchContext.setSorts(getOrderedQuery(request)); |
|
|
|
Hits hits = null; |
|
|
|
Hits hits = null; |
|
|
@ -562,128 +414,63 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery entryClassNameTermQuery = TermQueryFactoryUtil.create(searchContext, "entryClassName", |
|
|
|
TermQuery entryClassNameTermQuery = TermQueryFactoryUtil.create(searchContext, "entryClassName", |
|
|
|
ControlloPratica.class.getName()); |
|
|
|
ControlloPratica.class.getName()); |
|
|
|
|
|
|
|
|
|
|
|
TermQuery userIdTermQuery = TermQueryFactoryUtil.create(searchContext, "taskAssigneeUserId", |
|
|
|
TermQuery userIdTermQuery = TermQueryFactoryUtil.create(searchContext, "taskAssigneeUserId", |
|
|
|
user.getUserId()); |
|
|
|
user.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
TermQuery statusTermQuery = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
TermQuery statusTermQuery = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
WorkflowConstants.STATUS_PENDING); |
|
|
|
WorkflowConstants.STATUS_PENDING); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
booleanQuery.add(entryClassNameTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(entryClassNameTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(userIdTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(userIdTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(statusTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(statusTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
// BooleanQuery booleanQueryAttivita =
|
|
|
|
String dataDa = ParamUtil.getString(request, "dataRichiestaInizio"); |
|
|
|
// BooleanQueryFactoryUtil.create(searchContext);
|
|
|
|
String dataAl = ParamUtil.getString(request, "dataRichiestaFine"); |
|
|
|
// TermQuery assegnazioneTerm =
|
|
|
|
if (Validator.isNotNull(dataDa) || Validator.isNotNull(dataAl)) { |
|
|
|
// TermQueryFactoryUtil.create(searchContext, "workflowState",
|
|
|
|
if (Validator.isNull(dataDa)) { |
|
|
|
// " Assegnazione");
|
|
|
|
dataDa = "00000000"; |
|
|
|
// TermQuery approvazioneTerm =
|
|
|
|
} else { |
|
|
|
// TermQueryFactoryUtil.create(searchContext, "workflowState",
|
|
|
|
dataDa = DATE_FORMAT_LUCENE.format(DATE_FORMAT_STRING.parse(dataDa)); |
|
|
|
// "Approvazione");
|
|
|
|
} |
|
|
|
//
|
|
|
|
if (Validator.isNull(dataAl)) { |
|
|
|
// booleanQueryAttivita.add(assegnazioneTerm,
|
|
|
|
dataAl = DATE_FORMAT_LUCENE.format(new Date()); |
|
|
|
// BooleanClauseOccur.SHOULD);
|
|
|
|
} else { |
|
|
|
// booleanQueryAttivita.add(approvazioneTerm,
|
|
|
|
dataAl = DATE_FORMAT_LUCENE.format(DATE_FORMAT_STRING.parse(dataAl)); |
|
|
|
// BooleanClauseOccur.SHOULD);
|
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// booleanQuery.add(booleanQueryAttivita, BooleanClauseOccur.MUST);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String dataDaSearch = ParamUtil.getString(request, "dataRichiestaInizio"); |
|
|
|
|
|
|
|
String dataAlSearch = ParamUtil.getString(request, "dataRichiestaFine"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch != null && !dataDaSearch.equals("")) |
|
|
|
|
|
|
|
&& (dataAlSearch != null && !dataAlSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDaSearch); |
|
|
|
|
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAlSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
|
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
|
|
|
|
DATE_FORMAT_LUCENE.format(dataAlApp), true, true); |
|
|
|
|
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch == null || dataDaSearch.equals("")) |
|
|
|
|
|
|
|
&& (dataAlSearch != null && !dataDaSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAlSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
|
|
|
|
"dataInizioProcedimento", "00000000", DATE_FORMAT_LUCENE.format(dataAlApp), true, |
|
|
|
|
|
|
|
true); |
|
|
|
|
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch != null && !dataDaSearch.equals("")) |
|
|
|
|
|
|
|
&& (dataAlSearch == null || dataAlSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDaSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
"dataInizioProcedimento", dataDa, dataAl, true, true); |
|
|
|
DATE_FORMAT_LUCENE.format(new Date()), true, true); |
|
|
|
|
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (Document doc : hits.toList()) { |
|
|
|
for (Document doc : hits.toList()) { |
|
|
|
|
|
|
|
|
|
|
|
String controlloPraticaId = doc.get("controlloPraticaId"); |
|
|
|
String controlloPraticaId = doc.get("controlloPraticaId"); |
|
|
|
if (Validator.isNotNull(controlloPraticaId)) { |
|
|
|
if (Validator.isNotNull(controlloPraticaId)) { |
|
|
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil |
|
|
|
.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId)); |
|
|
|
.fetchControlloPratica(GetterUtil.getLong(controlloPraticaId)); |
|
|
|
if (Validator.isNotNull(controlloPratica)) { |
|
|
|
if (Validator.isNotNull(controlloPratica)) { |
|
|
|
lista.add(controlloPratica); |
|
|
|
lista.add(controlloPratica); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (ParseException | SearchException | SystemException | java.text.ParseException e) { |
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SearchException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SystemException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (java.text.ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
_log.error(e, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return lista; |
|
|
|
return lista; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Hits searchTaskConclusi(HttpServletRequest request, User user, int start, int end) { |
|
|
|
public static Hits searchTaskConclusi(HttpServletRequest request, User user, int start, int end) { |
|
|
|
|
|
|
|
|
|
|
|
// List<ControlloPratica> lista = new ArrayList<ControlloPratica>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
SearchContext searchContext = SearchContextFactory.getInstance(request); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
searchContext.setKeywords(OVERRIDE_KEYWORDS.toString()); |
|
|
|
|
|
|
|
if (ParamUtil.getBoolean(request, "searchForExport", false)) { |
|
|
|
boolean searchForExport = ParamUtil.getBoolean(request, "searchForExport", false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (searchForExport) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
int maxEnd = GetterUtil.getInteger(PropsUtil.get(PropsKeys.INDEX_FILTER_SEARCH_LIMIT)); |
|
|
|
|
|
|
|
|
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setStart(0); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setEnd(maxEnd); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
searchContext.setAttribute("paginationType", "none"); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setAttribute("paginationType", "more"); |
|
|
|
searchContext.setStart(start); |
|
|
|
searchContext.setStart(start); |
|
|
@ -709,17 +496,13 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
for (Organization org : organizationUserList) { |
|
|
|
for (Organization org : organizationUserList) { |
|
|
|
organizationRoleList = RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), |
|
|
|
organizationRoleList = RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
|
|
|
|
|
|
|
|
for (Role role : organizationRoleList) { |
|
|
|
for (Role role : organizationRoleList) { |
|
|
|
TermQuery roleIdTerm = TermQueryFactoryUtil.create(searchContext, "taskAssigneeRoleIds", |
|
|
|
TermQuery roleIdTerm = TermQueryFactoryUtil.create(searchContext, "taskAssigneeRoleIds", |
|
|
|
(role.getRoleId() + "-" + org.getGroupId())); |
|
|
|
(role.getRoleId() + "-" + org.getGroupId())); |
|
|
|
booleanQueryRoleIds.add(roleIdTerm, BooleanClauseOccur.SHOULD); |
|
|
|
booleanQueryRoleIds.add(roleIdTerm, BooleanClauseOccur.SHOULD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery booleanQueryStatus = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery booleanQueryStatus = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
|
|
|
|
|
|
|
|
TermQuery statusDenied = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
TermQuery statusDenied = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
WorkflowConstants.STATUS_DENIED); |
|
|
|
WorkflowConstants.STATUS_DENIED); |
|
|
|
booleanQueryStatus.add(statusDenied, BooleanClauseOccur.SHOULD); |
|
|
|
booleanQueryStatus.add(statusDenied, BooleanClauseOccur.SHOULD); |
|
|
@ -729,10 +512,8 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
TermQuery statusIncomplete = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
TermQuery statusIncomplete = TermQueryFactoryUtil.create(searchContext, "status", |
|
|
|
WorkflowConstants.STATUS_INCOMPLETE); |
|
|
|
WorkflowConstants.STATUS_INCOMPLETE); |
|
|
|
booleanQueryStatus.add(statusIncomplete, BooleanClauseOccur.SHOULD); |
|
|
|
booleanQueryStatus.add(statusIncomplete, BooleanClauseOccur.SHOULD); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
booleanQuery.add(entryClassNameTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(entryClassNameTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
if (organizationUserList != null && !organizationUserList.isEmpty() |
|
|
|
if (organizationUserList != null && !organizationUserList.isEmpty() |
|
|
|
&& organizationRoleList != null && !organizationRoleList.isEmpty()) { |
|
|
|
&& organizationRoleList != null && !organizationRoleList.isEmpty()) { |
|
|
|
booleanQuery.add(booleanQueryRoleIds, BooleanClauseOccur.MUST_NOT); |
|
|
|
booleanQuery.add(booleanQueryRoleIds, BooleanClauseOccur.MUST_NOT); |
|
|
@ -744,19 +525,14 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
// filtrare
|
|
|
|
// filtrare
|
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
List<Organization> organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user |
|
|
|
.getUserId()); |
|
|
|
.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
BooleanQuery groupIdsQuery = BooleanQueryFactoryUtil.create(searchContext); |
|
|
|
|
|
|
|
|
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
if (Validator.isNotNull(organizationList) && !organizationList.isEmpty()) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
for (Organization org : organizationList) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", |
|
|
|
org.getGroupId()); |
|
|
|
org.getGroupId()); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
groupIdsQuery.add(singleGroupIdQuery, BooleanClauseOccur.SHOULD); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(groupIdsQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "groupId", 0L); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
@ -768,18 +544,11 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
_log.debug("User " + user.getScreenName() + " Request query : " + booleanQuery.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
hits = SearchEngineUtil.search(searchContext, booleanQuery); |
|
|
|
|
|
|
|
|
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
if (_log.isDebugEnabled()) { |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
_log.debug("Number of hint find : " + hits.getLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (ParseException | SearchException | SystemException e) { |
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SearchException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (SystemException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
_log.error(e, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -799,8 +568,8 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
// ADT ADT BUG BO ID = 8
|
|
|
|
// ADT ADT BUG BO ID = 8
|
|
|
|
String istruttoreId = ParamUtil.getString(request, "istruttore"); |
|
|
|
String istruttoreId = ParamUtil.getString(request, "istruttore"); |
|
|
|
|
|
|
|
|
|
|
|
String dataDaSearch = ParamUtil.getString(request, "dataRichiestaInizio"); |
|
|
|
String dataDa = ParamUtil.getString(request, "dataRichiestaInizio"); |
|
|
|
String dataAlSearch = ParamUtil.getString(request, "dataRichiestaFine"); |
|
|
|
String dataAl = ParamUtil.getString(request, "dataRichiestaFine"); |
|
|
|
String comune = ParamUtil.getString(request, "comune"); |
|
|
|
String comune = ParamUtil.getString(request, "comune"); |
|
|
|
String tipoProcedura = ParamUtil.getString(request, "tipoProcedura"); |
|
|
|
String tipoProcedura = ParamUtil.getString(request, "tipoProcedura"); |
|
|
|
String tipoAttivita = ParamUtil.getString(request, "tipoAttivita"); |
|
|
|
String tipoAttivita = ParamUtil.getString(request, "tipoAttivita"); |
|
|
@ -808,28 +577,22 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
// ADT - BUG-11 Aggiunta filtro ricerca
|
|
|
|
// ADT - BUG-11 Aggiunta filtro ricerca
|
|
|
|
String controlloObbligatorioSearch = ParamUtil.getString(request, "controlloObbligatorio"); |
|
|
|
String controlloObbligatorioSearch = ParamUtil.getString(request, "controlloObbligatorio"); |
|
|
|
String sorteggiataSearch = ParamUtil.getString(request, "sorteggiata"); |
|
|
|
String sorteggiataSearch = ParamUtil.getString(request, "sorteggiata"); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
if (tipoAttivita != null && !tipoAttivita.equals("") && !tipoAttivita.equals("-1")) { |
|
|
|
if (tipoAttivita != null && !tipoAttivita.equals("") && !tipoAttivita.equals("-1")) { |
|
|
|
TermQuery tipoAttivitaTermQuery = TermQueryFactoryUtil.create(searchContext, "workflowState", |
|
|
|
TermQuery tipoAttivitaTermQuery = TermQueryFactoryUtil.create(searchContext, "workflowState", |
|
|
|
tipoAttivita); |
|
|
|
tipoAttivita); |
|
|
|
booleanQuery.add(tipoAttivitaTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(tipoAttivitaTermQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (numeroProgettoSearch != null && !numeroProgettoSearch.equals("")) { |
|
|
|
if (numeroProgettoSearch != null && !numeroProgettoSearch.equals("")) { |
|
|
|
TermQuery numeroProgettoTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery numeroProgettoTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"numeroProgetto", numeroProgettoSearch); |
|
|
|
"numeroProgetto", numeroProgettoSearch); |
|
|
|
booleanQuery.add(numeroProgettoTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(numeroProgettoTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (protocolloSearch != null && !protocolloSearch.equals("")) { |
|
|
|
if (protocolloSearch != null && !protocolloSearch.equals("")) { |
|
|
|
TermQuery protocolloSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery protocolloSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"protocollo", protocolloSearch); |
|
|
|
"protocollo", protocolloSearch); |
|
|
|
booleanQuery.add(protocolloSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(protocolloSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (tipoPraticaSearch != null && !tipoPraticaSearch.equals("") && !tipoPraticaSearch.equals("-1")) { |
|
|
|
if (tipoPraticaSearch != null && !tipoPraticaSearch.equals("") && !tipoPraticaSearch.equals("-1")) { |
|
|
|
TermQuery tipoPraticaSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery tipoPraticaSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"tipoPratica", tipoPraticaSearch); |
|
|
|
"tipoPratica", tipoPraticaSearch); |
|
|
@ -839,118 +602,84 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
// Gestione StatoPratica
|
|
|
|
// Gestione StatoPratica
|
|
|
|
if (statoPraticaSearch != null && !statoPraticaSearch.equals("") |
|
|
|
if (statoPraticaSearch != null && !statoPraticaSearch.equals("") |
|
|
|
&& !statoPraticaSearch.equals("-1")) { |
|
|
|
&& !statoPraticaSearch.equals("-1")) { |
|
|
|
|
|
|
|
|
|
|
|
if (statoPraticaSearch.equals(StatoPraticaConstants.COLLAUDO_PARZIALE)) { |
|
|
|
if (statoPraticaSearch.equals(StatoPraticaConstants.COLLAUDO_PARZIALE)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery collaudoParzialeSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery collaudoParzialeSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"collaudoParziale", "true"); |
|
|
|
"collaudoParziale", "true"); |
|
|
|
booleanQuery.add(collaudoParzialeSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(collaudoParzialeSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.COLLAUDO)) { |
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.COLLAUDO)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery collaudoSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery collaudoSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"collaudoCompletato", "true"); |
|
|
|
"collaudoCompletato", "true"); |
|
|
|
booleanQuery.add(collaudoSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(collaudoSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.FINE_LAVORI)) { |
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.FINE_LAVORI)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery fineLavoriSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery fineLavoriSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"fineLavoriCompletati", "true"); |
|
|
|
"fineLavoriCompletati", "true"); |
|
|
|
booleanQuery.add(fineLavoriSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(fineLavoriSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.FINE_LAVORI_PARZIALE)) { |
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.FINE_LAVORI_PARZIALE)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery fineLavoriParzialiSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery fineLavoriParzialiSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"fineLavoriParziali", "true"); |
|
|
|
"fineLavoriParziali", "true"); |
|
|
|
booleanQuery.add(fineLavoriParzialiSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(fineLavoriParzialiSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.SORTEGGIATA)) { |
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.SORTEGGIATA)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery sorteggiataSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery sorteggiataSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"lavorazioneSorteggiata", "true"); |
|
|
|
"lavorazioneSorteggiata", "true"); |
|
|
|
booleanQuery.add(sorteggiataSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(sorteggiataSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.SOTTOPOSTA_A_PARERE)) { |
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.SOTTOPOSTA_A_PARERE)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery sottopostaParereSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery sottopostaParereSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"sottopostoAParere", "true"); |
|
|
|
"sottopostoAParere", "true"); |
|
|
|
booleanQuery.add(sottopostaParereSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(sottopostaParereSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.VARIATA)) { |
|
|
|
} else if (statoPraticaSearch.equals(StatoPraticaConstants.VARIATA)) { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery sottopostaParereSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery sottopostaParereSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"variata", "true"); |
|
|
|
"variata", "true"); |
|
|
|
booleanQuery.add(sottopostaParereSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(sottopostaParereSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
TermQuery statoPraticaSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery statoPraticaSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"statoPratica", statoPraticaSearch); |
|
|
|
"statoPratica", statoPraticaSearch); |
|
|
|
booleanQuery.add(statoPraticaSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(statoPraticaSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (committenteSearch != null && !committenteSearch.equals("")) { |
|
|
|
if (committenteSearch != null && !committenteSearch.equals("")) { |
|
|
|
TermQuery committenteSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery committenteSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"committenti", committenteSearch.toUpperCase()); |
|
|
|
"committenti", committenteSearch.toUpperCase()); |
|
|
|
booleanQuery.add(committenteSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(committenteSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (soggettiInterconnessiSearch != null && !soggettiInterconnessiSearch.equals("")) { |
|
|
|
if (soggettiInterconnessiSearch != null && !soggettiInterconnessiSearch.equals("")) { |
|
|
|
TermQuery soggettiInterconnessiSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
TermQuery soggettiInterconnessiSearchTermQuery = TermQueryFactoryUtil.create(searchContext, |
|
|
|
"soggettiInterconnessi", soggettiInterconnessiSearch.toUpperCase()); |
|
|
|
"soggettiInterconnessi", soggettiInterconnessiSearch.toUpperCase()); |
|
|
|
booleanQuery.add(soggettiInterconnessiSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(soggettiInterconnessiSearchTermQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (istruttoreId != null && !istruttoreId.equals("") && !istruttoreId.equals("-1")) { |
|
|
|
if (istruttoreId != null && !istruttoreId.equals("") && !istruttoreId.equals("-1")) { |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "istruttoreUserId", |
|
|
|
TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "istruttoreUserId", |
|
|
|
istruttoreId); |
|
|
|
istruttoreId); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((dataDa != null && !dataDa.equals("")) && (dataAl != null && !dataAl.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
if ((dataDaSearch != null && !dataDaSearch.equals("")) |
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDa); |
|
|
|
&& (dataAlSearch != null && !dataAlSearch.equals(""))) { |
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAl); |
|
|
|
|
|
|
|
|
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDaSearch); |
|
|
|
|
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAlSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
DATE_FORMAT_LUCENE.format(dataAlApp), true, true); |
|
|
|
DATE_FORMAT_LUCENE.format(dataAlApp), true, true); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((dataDa == null || dataDa.equals("")) && (dataAl != null && !dataDa.equals(""))) { |
|
|
|
if ((dataDaSearch == null || dataDaSearch.equals("")) |
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAl); |
|
|
|
&& (dataAlSearch != null && !dataDaSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataAlApp = DATE_FORMAT_STRING.parse(dataAlSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
"dataInizioProcedimento", "00000000", DATE_FORMAT_LUCENE.format(dataAlApp), true, |
|
|
|
"dataInizioProcedimento", "00000000", DATE_FORMAT_LUCENE.format(dataAlApp), true, |
|
|
|
true); |
|
|
|
true); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((dataDa != null && !dataDa.equals("")) && (dataAl == null || dataAl.equals(""))) { |
|
|
|
if ((dataDaSearch != null && !dataDaSearch.equals("")) |
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDa); |
|
|
|
&& (dataAlSearch == null || dataAlSearch.equals(""))) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date dataDaApp = DATE_FORMAT_STRING.parse(dataDaSearch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
TermRangeQuery dateSearchTermRangeQuery = TermRangeQueryFactoryUtil.create(searchContext, |
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
"dataInizioProcedimento", DATE_FORMAT_LUCENE.format(dataDaApp), |
|
|
|
DATE_FORMAT_LUCENE.format(new Date()), true, true); |
|
|
|
DATE_FORMAT_LUCENE.format(new Date()), true, true); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(dateSearchTermRangeQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (comune != null && !comune.equals("") && !comune.equals("-1")) { |
|
|
|
if (comune != null && !comune.equals("") && !comune.equals("-1")) { |
|
|
|
TermQuery comuneTermQuery = TermQueryFactoryUtil.create(searchContext, "comuneId", comune); |
|
|
|
TermQuery comuneTermQuery = TermQueryFactoryUtil.create(searchContext, "comuneId", comune); |
|
|
|
booleanQuery.add(comuneTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(comuneTermQuery, BooleanClauseOccur.MUST); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (Validator.isNotNull(tipoProcedura)) { |
|
|
|
if (Validator.isNotNull(tipoProcedura)) { |
|
|
|
TermQuery termQuery = TermQueryFactoryUtil.create(searchContext, "tipoProcedura", |
|
|
|
TermQuery termQuery = TermQueryFactoryUtil.create(searchContext, "tipoProcedura", |
|
|
|
tipoProcedura); |
|
|
|
tipoProcedura); |
|
|
@ -970,33 +699,24 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
sorteggiataSearch); |
|
|
|
sorteggiataSearch); |
|
|
|
booleanQuery.add(sorteggiataTermQuery, BooleanClauseOccur.MUST); |
|
|
|
booleanQuery.add(sorteggiataTermQuery, BooleanClauseOccur.MUST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (ParseException | java.text.ParseException e) { |
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
|
|
|
|
} catch (java.text.ParseException e) { |
|
|
|
|
|
|
|
_log.error(e, e); |
|
|
|
_log.error(e, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Sort[] getOrderedQuery(HttpServletRequest request) { |
|
|
|
private static Sort[] getOrderedQuery(HttpServletRequest request) { |
|
|
|
|
|
|
|
|
|
|
|
Properties properties = PropsUtil.getProperties("elasticsearch.", true); |
|
|
|
Properties properties = PropsUtil.getProperties("elasticsearch.", true); |
|
|
|
|
|
|
|
|
|
|
|
String orderField = ParamUtil.getString(request, "ordinaPer", "numeroProgetto"); |
|
|
|
String orderField = ParamUtil.getString(request, "ordinaPer", "numeroProgetto"); |
|
|
|
String orderType = ParamUtil.getString(request, "ordinaTipo", "desc"); |
|
|
|
String orderType = ParamUtil.getString(request, "ordinaTipo", "desc"); |
|
|
|
|
|
|
|
|
|
|
|
List<Sort> sortes = new ArrayList<Sort>(); |
|
|
|
List<Sort> sortes = new ArrayList<Sort>(); |
|
|
|
Sort sort = new Sort(); |
|
|
|
Sort sort = new Sort(); |
|
|
|
|
|
|
|
|
|
|
|
if (orderField != null && !orderField.equals("") && !orderField.equals("-1")) { |
|
|
|
if (orderField != null && !orderField.equals("") && !orderField.equals("-1")) { |
|
|
|
|
|
|
|
|
|
|
|
if (properties.size() > 0) { |
|
|
|
if (properties.size() > 0) { |
|
|
|
sort.setFieldName(orderField + "_sortable"); |
|
|
|
sort.setFieldName(orderField + "_sortable"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
sort.setFieldName(orderField); |
|
|
|
sort.setFieldName(orderField); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (orderField.equals("numeroProgetto")) { |
|
|
|
if (orderField.equals("numeroProgetto")) { |
|
|
|
sort.setType(Sort.INT_TYPE); |
|
|
|
sort.setType(Sort.INT_TYPE); |
|
|
|
} else if (orderField.equals("protocollo")) { |
|
|
|
} else if (orderField.equals("protocollo")) { |
|
|
@ -1008,9 +728,7 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
} else if (orderField.equals("tipoPratica")) { |
|
|
|
} else if (orderField.equals("tipoPratica")) { |
|
|
|
sort.setType(Sort.INT_TYPE); |
|
|
|
sort.setType(Sort.INT_TYPE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (orderType != null && !orderType.equals("") && !orderType.equals("-1")) { |
|
|
|
if (orderType != null && !orderType.equals("") && !orderType.equals("-1")) { |
|
|
|
if (orderType.equals("desc")) { |
|
|
|
if (orderType.equals("desc")) { |
|
|
|
sort.setReverse(false); |
|
|
|
sort.setReverse(false); |
|
|
@ -1018,9 +736,7 @@ public class ControlloPraticaAdvancedSearch { |
|
|
|
sort.setReverse(true); |
|
|
|
sort.setReverse(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sortes.add(sort); |
|
|
|
sortes.add(sort); |
|
|
|
|
|
|
|
|
|
|
|
return sortes.toArray(new Sort[0]); |
|
|
|
return sortes.toArray(new Sort[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|