From 521901629fa941246547291505343ad67333c162 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Thu, 6 Apr 2017 12:42:00 +0000 Subject: [PATCH] system:type property is now added automatically. Fixed discovery tags vocabulary class git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@146619 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ui/dataset/resources/TagsPanel.java | 2 +- .../server/CKANPublisherServicesImpl.java | 7 +++++-- .../server/utils/DiscoverTagsList.java | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/dataset/resources/TagsPanel.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/dataset/resources/TagsPanel.java index 37e8ae8..2e3596d 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/dataset/resources/TagsPanel.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/dataset/resources/TagsPanel.java @@ -53,7 +53,7 @@ public class TagsPanel extends Composite{ public TagsPanel() { initWidget(uiBinder.createAndBindUi(this)); - tagsEnterListBox.setVisible(true); + tagsEnterListBox.setVisible(false); } diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java index 0ad4f13..85ce7cd 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java @@ -252,13 +252,16 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C */ private List discoverTagsVocabulary(String context) { + logger.debug("Looking for vocabulary of tags in this context " + context); String keyPerVocabulary = UtilMethods.concatenateSessionKeyScope("TAGS_VOCABULARY", context); // TODO REMOVE List vocabulary = (List) getThreadLocalRequest().getSession().getAttribute(keyPerVocabulary); - if(vocabulary != null){ + if(vocabulary == null){ vocabulary = new DiscoverTagsList(context).getTagsVocabulary(); getThreadLocalRequest().getSession().setAttribute(keyPerVocabulary, vocabulary); } + + logger.debug("Vocabulary for tags is " + vocabulary); return vocabulary; } @@ -285,7 +288,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C // add Type for custom fields if(toCreate.getChosenType() != null) - customFields.put("Type", Arrays.asList(toCreate.getChosenType())); + customFields.put("system:type", Arrays.asList(toCreate.getChosenType())); boolean setPublic = toCreate.getVisibility(); diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/DiscoverTagsList.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/DiscoverTagsList.java index 9063621..f968aa2 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/DiscoverTagsList.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/DiscoverTagsList.java @@ -31,7 +31,7 @@ import com.liferay.portal.kernel.log.LogFactoryUtil; public class DiscoverTagsList { private static final Log logger = LogFactoryUtil.getLog(CKANPublisherServicesImpl.class); - List tagsVocabulary; + private List tagsVocabulary; private final static String APPLICATION_PROFILE_NAME = "Tags"; private final static String QUERY = "for $profile in collection('/db/Profiles/GenericResource')//Resource " + @@ -62,7 +62,7 @@ public class DiscoverTagsList { Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement(); XPathHelper helper = new XPathHelper(node); tagsVocabulary = helper.evaluate("/Resource/Profile/Body/tags/tag/text()"); - logger.trace("Retrieved tags " + tagsVocabulary); + logger.debug("Retrieved tags " + tagsVocabulary); } }catch(Exception e){ logger.warn("Failed to retrieve this information " + e.getMessage());