This commit is contained in:
Francesco Mangiacrapa 2023-03-14 10:51:02 +01:00
parent 0dcdd2bf32
commit 2bc5d3a192
1 changed files with 13 additions and 25 deletions

View File

@ -173,7 +173,7 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
Project indexingProject = request.getDocument();
// Evaluate to display project IDs
log.info("Evaluating Last ID in relationship chain. Current ID is {}", indexingProject.getId());
log.info("Evaluating relationship chain. Current ID is {}", indexingProject.getId());
try {
ArrayList<Project> projects = new ArrayList<>();
ProjectAccess access = ImplementationProvider.get().getProvidedObjectByClass(ProjectAccess.class);
@ -210,48 +210,36 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
}
log.trace("Checking from LAST.. ");
//I'm ignoring the phase, this code is called on
// SUBMIT (DRAFT-> PENDING_APPROVAL)
// APPROVE (PENDING_APPROVAL -> PUBLISH
//
//Operation (go to PENDING APPROVAL or PUBLISHED) called on the indexingProject
for (int i = 0; i < projects.size(); i++) {
Project p = projects.get(i);
String phase = p.getLifecycleInformation().getPhase();
// IS TO DISPLAY EMPTY? Step into only once. Indexing the first project that is in PENDING APPROVAL or PUBLISHED
// IS TO DISPLAY EMPTY? Step into only once.
// Indexing the first project that is in PENDING APPROVAL or PUBLISHED or
// updating the phase of the indexing (selected) project
if (toDisplayId.isEmpty()) {
// IF PHASE IS PENDING APPROVAL OR PUBLISHED adding toDisplayId
if ((phase.equals(Phases.PENDING_APPROVAL) || phase.equals(Phases.PUBLISHED))) {
toDisplayId.add(p.getId());
}else if(p.getId().compareTo(indexingProject.getId())==0) {
//Means that the operation is is called on indexing project from DRAFT phase to PENDING_APPROVAL or PUBLISH
} else if (p.getId().compareTo(indexingProject.getId()) == 0) {
// Means that the operation has been called on the indexing project from DRAFT
// phase to PENDING_APPROVAL or PUBLISH
toDisplayId.add(p.getId());
}
} else {
// Hides the centroid regardless of project phase
toHideIds.add(p.getId());
// IF PHASE IS PENDING APPROVAL OR PUBLISHED adding (the remaining) toHideIds
// switch (phase) {
// case Phases.PENDING_APPROVAL:
// case Phases.PUBLISHED: {
// toHideIds.add(p.getId());
// break;
// }
// }
}
}
toReturn.put("_toHideIds", toHideIds);
toReturn.put("_toDisplayIds", toDisplayId);
log.info("Indexing request for "+indexingProject.getProfileID()+" [ID {}] with to _toHideIds {} and _toDisplayIds {} ",
log.info(
"Indexing request for " + indexingProject.getProfileID()
+ " [ID {}] with to _toHideIds {} and _toDisplayIds {} ",
indexingProject.getId(), toHideIds, toDisplayId);
return toReturn;
} catch (Exception e) {