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:
parent
7d5e7a4978
commit
521901629f
|
@ -53,7 +53,7 @@ public class TagsPanel extends Composite{
|
|||
|
||||
public TagsPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
tagsEnterListBox.setVisible(true);
|
||||
tagsEnterListBox.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue