minor fix for checking type product in delete methods
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@134922 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
64c9a8060b
commit
1894ed250c
|
@ -25,6 +25,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
@JsonIgnoreProperties(value = {"author", "author_contact", "extras", "product_type"}, ignoreUnknown = true) // ignore in serialization/deserialization
|
||||
public class Common {
|
||||
|
||||
public static final String PRODUCT_TYPE_KEY = "Product type";
|
||||
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
|
||||
|
@ -93,7 +95,7 @@ public class Common {
|
|||
|
||||
// automatically compiled
|
||||
@JsonProperty("product_type")
|
||||
@CustomField(key="Product type")
|
||||
@CustomField(key=PRODUCT_TYPE_KEY)
|
||||
@Tag
|
||||
private String productType;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
|||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
||||
|
@ -302,8 +303,8 @@ public class GrsfPublisherFisheryService {
|
|||
|
||||
}
|
||||
|
||||
// get extras and check there is the field Fishery Name that is mandatory for fishery
|
||||
if(fisheryInCkan.getExtrasAsHashMap().containsKey("Fishery Name")){
|
||||
// get extras and check there is the product type
|
||||
if(fisheryInCkan.getExtrasAsHashMap().get(Common.PRODUCT_TYPE_KEY).equals(THIS_TYPE)){
|
||||
logger.warn("Ok, this is a fishery, removing it");
|
||||
boolean deleted = catalogue.deleteProduct(fisheryInCkan.getId(), catalogue.getApiKeyFromUsername(username), true);
|
||||
if(deleted){
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
|||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.StockRecord;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
||||
|
@ -290,8 +291,8 @@ public class GrsfPublisherStockService {
|
|||
|
||||
}
|
||||
|
||||
// get extras and check there is the field Assessment distribution area that is mandatory for stock
|
||||
if(stockInCkan.getExtrasAsHashMap().containsKey("Stock Name")){
|
||||
// get extras and check there is the product type
|
||||
if(stockInCkan.getExtrasAsHashMap().get(Common.PRODUCT_TYPE_KEY).equals(THIS_TYPE)){
|
||||
|
||||
logger.warn("Ok, this is a stock, removing it");
|
||||
boolean deleted = catalogue.deleteProduct(stockInCkan.getId(), catalogue.getApiKeyFromUsername(username), true);
|
||||
|
|
Loading…
Reference in New Issue