• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AssetTag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.liferay.portlet.asset.model.AssetTag的典型用法代码示例。如果您正苦于以下问题:Java AssetTag类的具体用法?Java AssetTag怎么用?Java AssetTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AssetTag类属于com.liferay.portlet.asset.model包,在下文中一共展示了AssetTag类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTagsMap

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
private Map<Long, AssetTag> getTagsMap() {
    if (tagsMap == null) {
        tagsMap = new HashMap<Long, AssetTag>();

        List<AssetTag> tags = null;

        try {
            tags = AssetTagLocalServiceUtil.getAssetTags(0, AssetTagLocalServiceUtil.getAssetTagsCount());
        } catch (Exception e) {
            logger.error(e);
        }

        if (tags == null) {
            tags = new ArrayList<AssetTag>();
        }

        for (AssetTag assetTag : tags) {
            tagsMap.put(assetTag.getTagId(), assetTag);
        }
    }

    return tagsMap;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:24,代码来源:NewsletterListController.java


示例2: getAssetTags

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
private List<AssetTag> getAssetTags(Newsletter newsletter) throws SystemException {
    List<AssetTag> assetTags = new ArrayList<AssetTag>();

    if (newsletter == null) {
        return assetTags;
    }

    List<Label> labels = newsletter.getLabels();
    for (Label label : labels) {
        Long tagId = label.getTagId();
        AssetTag assetTag = getTagsMap().get(tagId);
        if (assetTag != null) {
            assetTags.add(assetTag);
        }
    }

    Locale locale = LiferayUtil.getThemeDisplay().getLocale();
    Collections.sort(assetTags, new AssetTagComparator(locale));

    return assetTags;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:22,代码来源:NewsletterListController.java


示例3: getTags

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public List<AssetTag> getTags() {
        if (tags == null) {
            try {
                tags = AssetTagLocalServiceUtil.getAssetTags(0, AssetTagLocalServiceUtil.getAssetTagsCount());
            } catch (Exception e) {
                logger.error(e);
            }

            if (tags == null) {
                tags = new ArrayList<AssetTag>();
            }

            Locale locale = LiferayUtil.getThemeDisplay().getLocale();
            Collections.sort(tags, new AssetTagComparator(locale));
        }

//        logger.info("getTags: {0}db", new Object[]{tags.size()});
//        for (AssetTag tag : tags) {
//            logger.info("tag: {0} {1}", new Object[]{String.valueOf(tag.getTagId()), tag.getName()});            
//        }

        return tags;
    }
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:24,代码来源:NewsletterEditController.java


示例4: onLabelChange

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public void onLabelChange() {
    //logger.info("onLabelChange: {0}", new Object[]{""});

    List<Label> labels = new ArrayList<Label>();

    try {
        for (AssetTag assetTag : getSelectedTags()) {
            Label label = getLabel(assetTag);
            label.setTagId(assetTag.getTagId());

            labels.add(label);
        }

        getElem().setLabels(labels);
    } catch (Exception e) {
        logger.error(e);
    }
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:19,代码来源:NewsletterEditController.java


示例5: getLabel

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
private Label getLabel(AssetTag assetTag) throws SystemException {
    if (assetTag == null) {
        return null;
    }

    Long tagId = assetTag.getTagId();

    Label savedLabel = null;

    savedLabel = LabelLocalServiceUtil.findByTagId(tagId);

    if (savedLabel == null) {
        savedLabel = new LabelImpl();
        savedLabel.setTagId(tagId);
        savedLabel = LabelLocalServiceUtil.addLabel(savedLabel);
    }

    return savedLabel;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:20,代码来源:NewsletterEditController.java


示例6: getAsString

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
    if (o == null) {
        return null;
    }
    
    long categoryId = ((AssetTag) o).getTagId();
    return StringUtil.toString(categoryId);
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:9,代码来源:AssetTagConverter.java


示例7: getTags

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
private String getTags(Newsletter newsletter) throws SystemException {
    List<String> tagNames = new ArrayList<String>();

    List<AssetTag> assetTags = getAssetTags(newsletter);
    for (AssetTag assetTag : assetTags) {
        tagNames.add(assetTag.getName());
    }

    return StringUtil.toCSV(tagNames);
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:11,代码来源:NewsletterListController.java


示例8: setTags

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public void setTags(List<AssetTag> tags) {
    this.tags = tags;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:4,代码来源:NewsletterEditController.java


示例9: getTagsMap

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
private Map<Long, AssetTag> getTagsMap() {
    Map<Long, AssetTag> tagsMap = new HashMap<Long, AssetTag>();

    for (AssetTag assetTag : getTags()) {
        tagsMap.put(assetTag.getTagId(), assetTag);
    }

    return tagsMap;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:10,代码来源:NewsletterEditController.java


示例10: getSelectedTags

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public List<AssetTag> getSelectedTags() {
        if (selectedTags == null) {
            selectedTags = new ArrayList<AssetTag>();

            Map<Long, AssetTag> tagsMap = getTagsMap();

            try {
                List<Label> labels = getElem().getLabels();
                for (Label tag : labels) {
                    Long assetTagId = tag.getTagId();
                    AssetTag assetTag = tagsMap.get(assetTagId);

                    if (assetTag == null) {
                        logger.warn("NINCS assetTag!!! {0}", new Object[]{tag});
                    } else {
                        selectedTags.add(assetTag);
                    }
                }
            } catch (Exception e) {
                logger.error(e);
            }

            Locale locale = LiferayUtil.getThemeDisplay().getLocale();
            Collections.sort(selectedTags, new AssetTagComparator(locale));
        }

//        logger.info("newsletter tags: {0}db", new Object[]{selectedTags.size()});
//        for (AssetTag tag : selectedTags) {
//            logger.info("newsletter tag: {0} {1}", new Object[]{String.valueOf(tag.getTagId()), tag.getName()});            
//        }          

        return selectedTags;
    }
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:34,代码来源:NewsletterEditController.java


示例11: setSelectedTags

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public void setSelectedTags(List<AssetTag> selectedTags) {
    this.selectedTags = selectedTags;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:4,代码来源:NewsletterEditController.java


示例12: getAssetTagByName

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
private AssetTag getAssetTagByName(String tagName) throws Exception {
    AssetTag savedAssetTag = null;

    if (StringUtil.isEmpty(tagName)) {
        return savedAssetTag;
    }

    Map<Long, AssetTag> tagsMap = getTagsMap();
    for (Map.Entry<Long, AssetTag> entry : tagsMap.entrySet()) {
        AssetTag assetTag = entry.getValue();

        String assetTagName = assetTag.getName();

        if (tagName.equalsIgnoreCase(assetTagName)) {
            savedAssetTag = assetTag;
            break;
        }
    }

    if (savedAssetTag == null) {
        String assetTagClassName = AssetTag.class.getName();
        Long tagId = CounterLocalServiceUtil.increment(assetTagClassName);
        savedAssetTag = AssetTagLocalServiceUtil.createAssetTag(tagId);
        savedAssetTag.setName(tagName);

        User user = LiferayUtil.getActiveUser();
        if (user != null) {
            savedAssetTag.setUserId(user.getUserId());
            savedAssetTag.setCompanyId(user.getCompanyId());
            Long groupId = null;
            try {
                groupId = user.getGroupId();
            } catch (Exception e) {
                logger.error(e);
            }
            savedAssetTag.setGroupId(groupId);
        }

        Date date = DateUtil.getCurrentDate();
        savedAssetTag.setCreateDate(date);
        savedAssetTag.setModifiedDate(date);

        AssetTagLocalServiceUtil.updateAssetTag(savedAssetTag, true);
        savedAssetTag = AssetTagLocalServiceUtil.getTag(tagId);
    }

    if (savedAssetTag == null) {
        throw new IllegalStateException();
    }

    return savedAssetTag;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:53,代码来源:NewsletterEditController.java


示例13: createLabel

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public void createLabel() {
    //logger.info("createLabel: {0}", new Object[]{labelStr});

    if (StringUtil.isEmpty(labelStr)) {
        return;
    }

    try {
        AssetTag savedAssetTag = getAssetTagByName(labelStr);
        Label savedLabel = getLabel(savedAssetTag);

        List<Label> oldLabels = getElem().getLabels();
        List<Label> labels = new ArrayList<Label>();
        labels.addAll(oldLabels);
        labels.add(savedLabel);

        getElem().setLabels(labels);

        setTags(null);
        setSelectedTags(null);
        setLabelStr(null);

    } catch (Exception e) {
        logger.error(e);
        addErrorMessage(e);
    }

}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:29,代码来源:NewsletterEditController.java


示例14: removeLabel

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public void removeLabel(AssetTag assetTag) {
    //logger.info("removeLabel: {0}", new Object[]{assetTag});

    if (assetTag == null) {
        return;
    }

    Long tagId = assetTag.getTagId();

    Label labelToDelete = null;

    try {
        List<Label> oldLabels = getElem().getLabels();
        for (Label label : oldLabels) {
            Long labelTagId = label.getTagId();

            if (tagId.equals(labelTagId)) {
                labelToDelete = label;
                break;
            }
        }

        List<Label> labels = new ArrayList<Label>();
        labels.addAll(oldLabels);
        labels.remove(labelToDelete);

        getElem().setLabels(labels);

        setSelectedTags(null);

    } catch (Exception e) {
        logger.error(e);
    }
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:35,代码来源:NewsletterEditController.java


示例15: compare

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
public int compare(AssetTag o1, AssetTag o2) {
    String name1 = StringUtil.toString(o1 != null ? o1.getName() : null);
    String name2 = StringUtil.toString(o2 != null ? o2.getName() : null);
    
    return collator.compare(name1, name2);
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:7,代码来源:AssetTagComparator.java


示例16: setupAssets

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
protected void setupAssets(String fileName) throws Exception {
	List<AssetTag> assetTags = AssetTagLocalServiceUtil.getGroupTags(
		groupId);

	for (AssetTag assetTag : assetTags) {
		AssetTagLocalServiceUtil.deleteAssetTag(assetTag);
	}

	RepositoryLocalServiceUtil.deleteRepositories(groupId);

	JournalArticleLocalServiceUtil.deleteArticles(groupId);

	DDMTemplateLocalServiceUtil.deleteTemplates(groupId);

	DDMStructureLocalServiceUtil.deleteStructures(groupId);

	JSONObject jsonObject = getJSONObject(fileName);

	if (jsonObject != null) {
		JSONArray assetsJSONArray = jsonObject.getJSONArray("assets");

		setupAssets(assetsJSONArray);
	}

	addDLFileEntries(_DL_DOCUMENTS_DIR_NAME);

	addJournalArticles(
		StringPool.BLANK, StringPool.BLANK, _JOURNAL_ARTICLES_DIR_NAME);

	addDDMStructures(StringPool.BLANK, _JOURNAL_DDM_STRUCTURES_DIR_NAME);

	addDDMTemplates(StringPool.BLANK, _JOURNAL_DDM_TEMPLATES_DIR_NAME);
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:34,代码来源:FileSystemImporter.java


示例17: setupAssets

import com.liferay.portlet.asset.model.AssetTag; //导入依赖的package包/类
protected void setupAssets(String fileName) throws Exception {
	if (!isCompanyGroup()) {
		List<AssetTag> assetTags = AssetTagLocalServiceUtil.getGroupTags(
			groupId);

		for (AssetTag assetTag : assetTags) {
			AssetTagLocalServiceUtil.deleteAssetTag(assetTag);
		}

		RepositoryLocalServiceUtil.deleteRepositories(groupId);

		JournalArticleLocalServiceUtil.deleteArticles(groupId);

		DDMTemplateLocalServiceUtil.deleteTemplates(groupId);

		DDMStructureLocalServiceUtil.deleteStructures(groupId);
	}

	JSONObject jsonObject = getJSONObject(fileName);

	if (jsonObject != null) {
		JSONArray assetsJSONArray = jsonObject.getJSONArray("assets");

		setupAssets(assetsJSONArray);
	}

	addDLFileEntries(_DL_DOCUMENTS_DIR_NAME);

	addApplicationDisplayTemplates(_APPLICATION_DISPLAY_TEMPLATE_DIR_NAME);

	addDDLStructures(_DDL_STRUCTURE_DIR_NAME);

	addDDMStructures(StringPool.BLANK, _JOURNAL_DDM_STRUCTURES_DIR_NAME);

	addDDMTemplates(StringPool.BLANK, _JOURNAL_DDM_TEMPLATES_DIR_NAME);

	addJournalArticles(
		StringPool.BLANK, StringPool.BLANK, _JOURNAL_ARTICLES_DIR_NAME);

	addLayoutTemplate(_LAYOUT_TEMPLATE_DIR_NAME);
}
 
开发者ID:rivetlogic,项目名称:liferay-voice-command,代码行数:42,代码来源:FileSystemImporter.java



注:本文中的com.liferay.portlet.asset.model.AssetTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExecResult类代码示例发布时间:2022-05-22
下一篇:
Java AESWrapEngine类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap