diff --git a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java index f3801fe..5604293 100644 --- a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java +++ b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java @@ -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 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 { - - 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; -// } -// } + } else { + // Hides the centroid regardless of project phase + toHideIds.add(p.getId()); } } 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) {