Mandatory parameters utils
This commit is contained in:
parent
bdefe8bbc5
commit
283c72dec7
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.application.cms.plugins.requests;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.bson.Document;
|
||||||
|
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||||
|
import org.gcube.application.geoportal.common.model.profile.Profile;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BaseExecutionRequest {
|
||||||
|
|
||||||
|
Profile profile;
|
||||||
|
ProfiledDocument document;
|
||||||
|
Document callParameters;
|
||||||
|
|
||||||
|
public final String getMandatory(String param) throws InvalidRequestException {
|
||||||
|
return getMandatory(param,callParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String getMandatory(String param,Document params) throws InvalidRequestException {
|
||||||
|
if(!params.containsKey(param)) throw new InvalidRequestException("Missing mandatory parameter "+param);
|
||||||
|
return params.getString(param);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||||
import org.gcube.application.geoportal.common.model.profile.Profile;
|
import org.gcube.application.geoportal.common.model.profile.Profile;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class EventExecutionRequest {
|
public class EventExecutionRequest extends BaseExecutionRequest{
|
||||||
|
|
||||||
public static class Events{
|
public static class Events{
|
||||||
public static final String ON_INIT_DOCUMENT="@@@INIT_DOCUMENT@@";
|
public static final String ON_INIT_DOCUMENT="@@@INIT_DOCUMENT@@";
|
||||||
|
@ -15,9 +15,8 @@ public class EventExecutionRequest {
|
||||||
public static final String ON_DELETE_DOCUMENT="@@@DELETE_DOCUMENT@@";
|
public static final String ON_DELETE_DOCUMENT="@@@DELETE_DOCUMENT@@";
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile profile;
|
|
||||||
ProfiledDocument document;
|
|
||||||
String event;
|
String event;
|
||||||
Document callParameters;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,7 @@ import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||||
import org.gcube.application.geoportal.common.model.profile.Profile;
|
import org.gcube.application.geoportal.common.model.profile.Profile;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class MaterializationRequest {
|
public class MaterializationRequest extends BaseExecutionRequest{
|
||||||
|
|
||||||
|
|
||||||
ProfiledDocument document;
|
|
||||||
Document parameters;
|
|
||||||
Profile profile;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.gcube.application.geoportal.common.model.document.accounting.User;
|
||||||
import org.gcube.application.geoportal.common.model.profile.Profile;
|
import org.gcube.application.geoportal.common.model.profile.Profile;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class StepExecutionRequest {
|
public class StepExecutionRequest extends BaseExecutionRequest{
|
||||||
|
|
||||||
public static class Steps{
|
public static class Steps{
|
||||||
|
|
||||||
|
@ -20,10 +20,8 @@ public class StepExecutionRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Profile profile;
|
|
||||||
ProfiledDocument document;
|
|
||||||
String step;
|
String step;
|
||||||
Document callParameters;
|
|
||||||
User user;
|
User user;
|
||||||
Context context;
|
Context context;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue