publish-product methods publish private products

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@133166 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-10-13 12:24:39 +00:00
parent a0a0dd48b5
commit da21b374aa
3 changed files with 10 additions and 23 deletions

View File

@ -202,7 +202,7 @@ public class GrsfPublisherFisheryService {
List<ResourceBean> resources = HelperMethods.getResourcesFromBean(record, username);
// if confirmed, set to visible TODO anyway if it is confirmed we should another method
boolean setPublic = record.getStatus() == org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status.Confirmed;
boolean setPublic = false;
// check the license id
String license = null;

View File

@ -25,6 +25,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean
import org.gcube.data_catalogue.grsf_publish_ws.utils.AssociationToGroupThread;
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue;
import org.gcube.datacatalogue.ckanutillibrary.models.ResourceBean;
import org.gcube.datacatalogue.ckanutillibrary.models.RolesCkanGroupOrOrg;
import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods;
import org.slf4j.LoggerFactory;
@ -88,18 +89,18 @@ public class GrsfPublisherStockService {
ResponseCreationBean responseBean = new ResponseCreationBean();
Status status = Status.INTERNAL_SERVER_ERROR;
String id = "";
// validate the bean
logger.debug("Start validating bean...");
Response responseAfterValidation = HelperMethods.validateBeanAndResources(record);
if(responseAfterValidation == null)
logger.debug("Bean validation successful");
else{
logger.warn("Bean validation failed");
return responseAfterValidation;
}
try{
@ -189,23 +190,10 @@ public class GrsfPublisherStockService {
}else{
// evaluate the resources TODO
// List<Resource> resourcesRecord = record.getResources();
// List<ResourceBean> resources = null;
// if(resourcesRecord != null && !resourcesRecord.isEmpty()){
// resources = new ArrayList<ResourceBean>();
// for (Resource res : resourcesRecord) {
// logger.debug("Trying to add resource " + res);
// if(res.getName() != null && res.getUrl() != null)
// resources.add(new ResourceBean(res.getUrl(), res.getName(), res.getDescription(), null, username, null, null));
// else
// logger.warn("Unable to add resource because url or name is null");
// }
// }
// evaluate the resources
List<ResourceBean> resources = HelperMethods.getResourcesFromBean(record, username);
// if confirmed, set to visible TODO anyway if it is confirmed we should another method
boolean setPublic = record.getStatus() == org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status.Confirmed;
boolean setPublic = false;
// check the license id
String license = null;

View File

@ -23,7 +23,6 @@ import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DatabaseSource;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Resource;
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Source;
@ -409,7 +408,7 @@ public abstract class HelperMethods {
* @param record
* @return
*/
public static List<ResourceBean> getResourcesFromBean(FisheryRecord record, String username) {
public static List<ResourceBean> getResourcesFromBean(Common record, String username) {
List<ResourceBean> toReturn = new ArrayList<ResourceBean>();
List<DatabaseSource> databaseSources = record.getDatabaseSources();