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
This commit is contained in:
Costantino Perciante 2017-04-06 12:42:00 +00:00
parent 7d5e7a4978
commit 521901629f
3 changed files with 8 additions and 5 deletions

View File

@ -53,7 +53,7 @@ public class TagsPanel extends Composite{
public TagsPanel() {
initWidget(uiBinder.createAndBindUi(this));
tagsEnterListBox.setVisible(true);
tagsEnterListBox.setVisible(false);
}

View File

@ -252,13 +252,16 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
*/
private List<String> discoverTagsVocabulary(String context) {
logger.debug("Looking for vocabulary of tags in this context " + context);
String keyPerVocabulary = UtilMethods.concatenateSessionKeyScope("TAGS_VOCABULARY", context); // TODO REMOVE
List<String> vocabulary = (List<String>) 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();

View File

@ -31,7 +31,7 @@ import com.liferay.portal.kernel.log.LogFactoryUtil;
public class DiscoverTagsList {
private static final Log logger = LogFactoryUtil.getLog(CKANPublisherServicesImpl.class);
List<String> tagsVocabulary;
private List<String> 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());