当前位置: 首页>>代码示例>>Java>>正文


Java AssetTagLocalServiceUtil类代码示例

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


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

示例1: getTagsMap

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的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: getTags

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的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

示例3: doGetDocument

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的package包/类
@Override
protected Document doGetDocument(Object obj) throws Exception {
	Competence entry = (Competence)obj;

	long companyId = entry.getCompanyId();
	long groupId = getParentGroupId(entry.getGroupId());
	long scopeGroupId = entry.getGroupId();
	long userId = entry.getUserId();
	long entryId = entry.getCompetenceId();
	String title = entry.getTitle();

	AssetEntry assetEntry=AssetEntryLocalServiceUtil.getEntry(Competence.class.getName(), entryId);
	String content=entry.getDescription();

	long[] assetCategoryIds = AssetCategoryLocalServiceUtil.getCategoryIds(
			Competence.class.getName(), entryId);

	String[] assetTagNames = AssetTagLocalServiceUtil.getTagNames(
			Competence.class.getName(), entryId);

	Document document = new DocumentImpl();
	document.addUID(PORTLET_ID, entryId);

	document.addKeyword(Field.CLASS_PK, entryId);
	document.addKeyword(Field.ENTRY_CLASS_NAME, Competence.class.getName());
	document.addKeyword(Field.COMPANY_ID, companyId);
	document.addKeyword(Field.PORTLET_ID, PORTLET_ID);
	document.addKeyword(Field.GROUP_ID, groupId);
	document.addKeyword(Field.SCOPE_GROUP_ID, scopeGroupId);
	document.addKeyword(Field.USER_ID, userId);
	
	document.addText(Field.TITLE, title);
	document.addText(Field.CONTENT, content);
	document.addText(Field.DESCRIPTION, assetEntry.getSummary());
	document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
	document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);
	
	return document;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:40,代码来源:CompetenceIndexer.java

示例4: getAsObject

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的package包/类
public Object getAsObject(FacesContext fc, UIComponent uic, String assetTagId) {
    if (StringUtil.isEmpty(assetTagId)) {
        return null;
    }
    
    try {
        return AssetTagLocalServiceUtil.getAssetTag(Long.parseLong(assetTagId));
    } catch (Exception ex) {
        logger.error(ex);
    } 
    
    return null;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:14,代码来源:AssetTagConverter.java

示例5: getAssetTagByName

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的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

示例6: doGetDocument

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的package包/类
@Override
	protected Document doGetDocument(Object obj) throws Exception {
//		_log.debug("doGetDocument()");
		Application application = (Application) obj;
        long companyId = application.getCompanyId();
//        long groupId = getParentGroupId(application.getGroupId());
//        long scopeGroupId = application.getGroupId();
//        long groupId = 20102;
//        long scopeGroupId = 20102;
      
        long userId = application.getUserId();
        long resourcePrimKey = application.getPrimaryKey();
        String title = application.getName().toLowerCase();
        String content = "";
        String description = application.getDescription().toLowerCase();
        String regions = application.getRegionString().toLowerCase();
        String categoryString = application.getCategoryString().toLowerCase();
        String targetOS = application.getTargetOS().toLowerCase();
        content = content + " " + application.getRegionString().toLowerCase();
        content = content + " " + application.getCategoryString().toLowerCase();
        content = content + " " + application.getTargetOS().toLowerCase();
//        content = content + " " + application.getMinTargetOSVersion();

        
        Date modifiedDate = application.getModifiedDate();

       long[] assetCategoryIds = AssetCategoryLocalServiceUtil.getCategoryIds(Application.class.getName(), resourcePrimKey);
       
       List<AssetCategory> categories = AssetCategoryLocalServiceUtil.getCategories(Application.class.getName(), resourcePrimKey);

       String[] assetCategoryNames = StringUtil.split(ListUtil.toString(categories, "name"));
       
       // EE lets you do this quicker: 
       
       // String[] assetCategoryNames =
       //     AssetCategoryLocalServiceUtil.getCategoryNames(
       //         Slogan.class.getName(), resourcePrimKey);
       
       String[] assetTagNames = AssetTagLocalServiceUtil.getTagNames(Application.class.getName(), resourcePrimKey);

        Document document = new DocumentImpl();

        document.addUID(PORTLET_ID, resourcePrimKey);

        document.addDate("modifiedDate", modifiedDate);
        document.addKeyword(Field.COMPANY_ID, companyId);
        document.addKeyword(Field.PORTLET_ID, PORTLET_ID);
//        document.addKeyword(Field.GROUP_ID, groupId);
//        document.addKeyword(Field.SCOPE_GROUP_ID, scopeGroupId);
        document.addKeyword(Field.USER_ID, userId);
        document.addText(Field.TITLE, title);
        document.addText(Field.CONTENT, content);
        document.addText(Field.DESCRIPTION, description);
        document.addText("regions", regions);
        document.addText("categoryString", categoryString);
        document.addText("targetOS", targetOS);
        document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
        document.addKeyword("assetCategoryNames", assetCategoryNames);
        //document.addKeyword(Field.ASSET_CATEGORY_NAMES, assetCategoryNames);
        document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);
        document.addKeyword(Field.ENTRY_CLASS_NAME, Application.class.getName());
        document.addKeyword(Field.ENTRY_CLASS_PK, resourcePrimKey);
        
        return document;
	}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:66,代码来源:ApplicationIndexer.java

示例7: doGetDocument

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的package包/类
@Override
protected Document doGetDocument(Object obj) throws Exception {
	Course entry = (Course)obj;
	AssetEntry asset=AssetEntryLocalServiceUtil.getEntry(Course.class.getName(), entry.getCourseId());
	long companyId = entry.getCompanyId();
	long groupId = getParentGroupId(entry.getGroupId());
	long scopeGroupId = entry.getGroupId();
	long userId = entry.getUserId();
	User user=UserLocalServiceUtil.getUser(userId);
	String userName = user.getFullName();
	long entryId = entry.getCourseId();
	String title = entry.getTitle();
	String content = HtmlUtil.extractText(entry.getDescription());
	Date displayDate = asset.getPublishDate();

	long[] assetCategoryIds =AssetCategoryLocalServiceUtil.getCategoryIds(Course.class.getName(), entryId);
	String[] assetTagNames =AssetTagLocalServiceUtil.getTagNames(Course.class.getName(), entryId);

	ExpandoBridge expandoBridge = entry.getExpandoBridge();

	Document document = new DocumentImpl();

	document.addUID(PORTLET_ID, entryId);

	document.addModifiedDate(displayDate);

	document.addKeyword(Field.COMPANY_ID, companyId);
	document.addKeyword(Field.PORTLET_ID, PORTLET_ID);
	document.addKeyword(Field.GROUP_ID, groupId);
	document.addKeyword(Field.SCOPE_GROUP_ID, scopeGroupId);
	document.addKeyword(Field.USER_ID, userId);
	document.addText(Field.USER_NAME, userName);

	document.addText(Field.TITLE, title);
	document.addText(Field.CONTENT, content);
	document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
	document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);

	document.addKeyword(Field.ENTRY_CLASS_NAME, LearningActivity.class.getName());
	document.addKeyword(Field.ENTRY_CLASS_PK, entryId);

	ExpandoBridgeIndexerUtil.addAttributes(document, expandoBridge);

	return document;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:46,代码来源:CourseIndexer.java

示例8: setupAssets

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的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

示例9: setupAssets

import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; //导入依赖的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.service.AssetTagLocalServiceUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。