diff --git a/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java b/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java index 527b792..1c9178e 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java +++ b/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java @@ -832,8 +832,13 @@ public class ConvertToDataValueObjectModel { LOG.debug("toLifecycleInformationDV called for: " + li); LifecycleInformationDV liDV = new LifecycleInformationDV(); + liDV.setPhase(li.getPhase()); liDV.setErrorMessages(li.getErrorMessages()); liDV.setLastInvokedStep(li.getLastInvokedStep()); + + if(li.getLastEvent()!=null) + liDV.setLastEvent(li.getLastEvent().getEvent()); + liDV.setLastOperationStatus(toLifecycleInformationDVStatus(li.getLastOperationStatus())); liDV.setWarningMessages(li.getWarningMessages()); liDV.setAsJSONString(toJSON(li)); diff --git a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java index 82710a6..9630984 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java +++ b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java @@ -219,7 +219,7 @@ public class ProjectsCaller { JSONObject jObject = new JSONObject(toJSON); JsonPath jsonPath = JsonPath.compile("$.countByPhase[*]._id.phase"); JSONArray phases = jsonPath.read(jObject, configuration); - HashSet listdata = new HashSet(phases.length()); + HashSet listdata = new HashSet(phases.length()); for (int i = 0; i < phases.length(); i++) { listdata.add(phases.get(i).toString()); } @@ -228,7 +228,7 @@ public class ProjectsCaller { return idsPhases; } } - + LOG.info("getIDsPhases returning null"); return null; } @@ -262,20 +262,38 @@ public class ProjectsCaller { return phasesArr; } } - + LOG.info("getPhases returning null"); return null; } + /** + * Delete project. + * + * @param projectID the project ID + * @param force the force + * @throws RemoteException the remote exception + */ + public void deleteProject(String profileID, String projectID, boolean force) throws RemoteException { + LOG.info("deleteProject called for projectID {}", projectID); + Projects client = (Projects) getClient(profileID); + + if (force) + client.deleteById(projectID, force); + else + client.deleteById(projectID); + + return; + } /** * Query on mongo. * - * @param profileID the profile ID + * @param profileID the profile ID * @param totalItems the total items - * @param offset the offset - * @param limit the limit - * @param filter the filter + * @param offset the offset + * @param limit the limit + * @param filter the filter * @return the iterator * @throws Exception the exception */ @@ -343,7 +361,7 @@ public class ProjectsCaller { for (ItemFieldDV itemField : orderByFields) { if (itemField.getJsonFields() != null) { for (String field : itemField.getJsonFields()) { - String fieldFullPath = String.format("%s.%s", itemField.getProjection(),field); + String fieldFullPath = String.format("%s.%s", itemField.getProjection(), field); orderingFields.add(fieldFullPath); } } @@ -425,19 +443,20 @@ public class ProjectsCaller { } - //TESTING MODE - REMOVING DIRTY DOCUMENTS + //REMOVING DIRTY DOCUMENTS + /* BasicDBObject bsValid_Document = new BasicDBObject(); bsValid_Document.append("$exists", true); bsValid_Document.append("$ne", null); query.append("_theDocument", bsValid_Document); - + BasicDBObject bsValidLfc = new BasicDBObject(); bsValidLfc.append("$ne", null); - query.append("_lifecycleInformation._phase", bsValidLfc); + query.append("_lifecycleInformation._phase", bsValidLfc);*/ - BasicDBObject bsDocumentExists = new BasicDBObject(); - bsDocumentExists.append("$exists", false); - query.append("theDocument", bsDocumentExists); +// BasicDBObject bsDocumentExists = new BasicDBObject(); +// bsDocumentExists.append("$exists", false); +// query.append("theDocument", bsDocumentExists); // BasicDBObject bsNotEqualEmpty = new BasicDBObject(); // bsNotEqualEmpty.append("$ne", null); diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/GeoNaItemRef.java b/src/main/java/org/gcube/application/geoportalcommon/shared/GeoNaItemRef.java index d82bc08..7405505 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/GeoNaItemRef.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/GeoNaItemRef.java @@ -19,7 +19,7 @@ public class GeoNaItemRef implements Serializable { // this is the mongoID private String itemId; - private String itemType; + private String itemType; //this is the profileID private String itemName; private PublicLink restrictedLink; diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java index 208b307..46063ed 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java @@ -19,6 +19,7 @@ public class LifecycleInformationDV extends BasicLifecycleInformationDV { private List errorMessages; private List warningMessages; private String asJSONString; + private String lastEvent; /** * Instantiates a new lifecycle information DV. @@ -30,20 +31,20 @@ public class LifecycleInformationDV extends BasicLifecycleInformationDV { /** * Instantiates a new lifecycle information DV. * - * @param phase the phase - * @param lastInvokedStep the last invoked step - * @param lastOperationStatus the last operation status - * @param errorMessages the error messages - * @param warningMessages the warning messages + * @param lastInvokedStep the last invoked step + * @param errorMessages the error messages + * @param warningMessages the warning messages + * @param asJSONString the as JSON string + * @param lastEvent the last event */ - public LifecycleInformationDV(String phase, String lastInvokedStep, Status lastOperationStatus, - List errorMessages, List warningMessages) { + public LifecycleInformationDV(String lastInvokedStep, List errorMessages, List warningMessages, + String asJSONString, String lastEvent) { super(); - this.phase = phase; this.lastInvokedStep = lastInvokedStep; - this.lastOperationStatus = lastOperationStatus; this.errorMessages = errorMessages; this.warningMessages = warningMessages; + this.asJSONString = asJSONString; + this.lastEvent = lastEvent; } /** @@ -146,6 +147,25 @@ public class LifecycleInformationDV extends BasicLifecycleInformationDV { } + /** + * Sets the last event. + * + * @param lastEvent the new last event + */ + public void setLastEvent(String lastEvent) { + this.lastEvent = lastEvent; + + } + + /** + * Gets the last event. + * + * @return the last event + */ + public String getLastEvent() { + return lastEvent; + } + /** * Gets the as JSON string. * @@ -155,21 +175,24 @@ public class LifecycleInformationDV extends BasicLifecycleInformationDV { return asJSONString; } + /** + * To string. + * + * @return the string + */ @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("LifecycleInformationDV [phase="); - builder.append(phase); - builder.append(", lastInvokedStep="); + builder.append("LifecycleInformationDV [lastInvokedStep="); builder.append(lastInvokedStep); - builder.append(", lastOperationStatus="); - builder.append(lastOperationStatus); builder.append(", errorMessages="); builder.append(errorMessages); builder.append(", warningMessages="); builder.append(warningMessages); builder.append(", asJSONString="); builder.append(asJSONString); + builder.append(", lastEvent="); + builder.append(lastEvent); builder.append("]"); return builder.toString(); }