Minor changes

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129092 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-06-13 14:30:14 +00:00
parent e80da80e69
commit d24bf215e3
2 changed files with 11 additions and 34 deletions

View File

@ -218,6 +218,7 @@
<modules>
<module>org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher</module>
</modules>
<style>PRETTY</style>
</configuration>
</plugin>
<plugin>

View File

@ -60,30 +60,6 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
// Logger
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(CKANPublisherServicesImpl.class);
/**
* Get the current scope (/gcube is returned if in development)
* @return
*/
private String getCurrentScope(){
//if(isWithinPortal())
return ScopeProvider.instance.get();
// else
// return "/gcube"; // Development
}
// /**
// * Get the scope in which we look for metadata
// * @return
// */
// private String getMetadataScope(){
// if(isWithinPortal())
// return ScopeProvider.instance.get();
// else
// return "/gcube/devsec/devVRE"; // Development
// }
/**
* Return the ckan catalogue url for this scope.
* @return
@ -93,7 +69,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
logger.debug("Request for catalogue url");
try{
String currentScope = getCurrentScope();
String currentScope = ScopeProvider.instance.get();
return CKanUtilsFactory.getInstance().getCkanUtilsForScope(currentScope).getCatalogueUrl();
}catch(Exception e){
logger.error("Failed to retrieve catalogue url information", e);
@ -112,7 +88,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
logger.debug("Request for user api key");
try{
String currentScope = getCurrentScope();
String currentScope = ScopeProvider.instance.get();
return CKanUtilsFactory.getInstance().getCkanUtilsForScope(currentScope).getApiKeyFromUser(owner);
}catch(Exception e){
logger.error("Failed to retrieve api key for user " + owner, e);
@ -132,7 +108,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
try{
String currentScope = getCurrentScope();
String currentScope = ScopeProvider.instance.get();
return CKanUtilsFactory.getInstance().getCkanUtilsForScope(currentScope).getOrganizationsNamesByUser(owner);
}catch(Exception e){
@ -164,7 +140,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
*/
private String findLicenseIdByLicense(String chosenLicense) {
String currentScope = getCurrentScope();
String currentScope = ScopeProvider.instance.get();
try {
return CKanUtilsFactory.getInstance().getCkanUtilsForScope(currentScope).findLicenseIdByLicense(chosenLicense);
} catch (Exception e) {
@ -238,7 +214,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
logger.info("Request for CKAN licenses");
try {
String currentScope = getCurrentScope();
String currentScope = ScopeProvider.instance.get();
List<String> titlesLicenses;
titlesLicenses = CKanUtilsFactory.getInstance().getCkanUtilsForScope(currentScope).getLicenseTitles();
// return the bean
@ -306,11 +282,11 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
bean.setResourcesIds(childrenIds);
// retrieve the metadata
List<MetaDataProfileBean> metadataBeans = getMetadataProfilesList();
bean.setMetadataList(metadataBeans);
}
// retrieve the metadata
List<MetaDataProfileBean> metadataBeans = getMetadataProfilesList();
bean.setMetadataList(metadataBeans);
}catch(Exception e){
logger.error("Error while retrieving folder information", e);
@ -559,7 +535,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
logger.debug("Setting visibility of the dataset");
// set its visibility (true means public, false means private)
boolean mustbePrivate = !created.getVisibility();
String currentScope = getCurrentScope();
String currentScope = ScopeProvider.instance.get();
CKanUtilsFactory.getInstance().
getCkanUtilsForScope(currentScope).