Migrated the deleteProject. Updated the LifecycleInformationDV

This commit is contained in:
Francesco Mangiacrapa 2022-09-01 16:41:01 +02:00
parent 8c302a4110
commit b629928f36
4 changed files with 76 additions and 29 deletions

View File

@ -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));

View File

@ -267,6 +267,24 @@ public class ProjectsCaller {
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<Project> client = (Projects<Project>) getClient(profileID);
if (force)
client.deleteById(projectID, force);
else
client.deleteById(projectID);
return;
}
/**
* Query on mongo.
@ -425,7 +443,8 @@ 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);
@ -433,11 +452,11 @@ public class ProjectsCaller {
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);

View File

@ -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;

View File

@ -19,6 +19,7 @@ public class LifecycleInformationDV extends BasicLifecycleInformationDV {
private List<String> errorMessages;
private List<String> 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 asJSONString the as JSON string
* @param lastEvent the last event
*/
public LifecycleInformationDV(String phase, String lastInvokedStep, Status lastOperationStatus,
List<String> errorMessages, List<String> warningMessages) {
public LifecycleInformationDV(String lastInvokedStep, List<String> errorMessages, List<String> 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();
}