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


Java ServiceContext.setAssetTagNames方法代码示例

本文整理汇总了Java中com.liferay.portal.service.ServiceContext.setAssetTagNames方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext.setAssetTagNames方法的具体用法?Java ServiceContext.setAssetTagNames怎么用?Java ServiceContext.setAssetTagNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.service.ServiceContext的用法示例。


在下文中一共展示了ServiceContext.setAssetTagNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setExtraContent

import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void setExtraContent(Course course, String actionId, ServiceContext serviceContext)
		throws PortalException, SystemException {
	if((Validator.isNumber(PropsUtil.get("lms.course.default.evaluations")))&&("ADD_COURSE".equals(actionId))) {
		ServiceContext evaluationServiceContext = ServiceContextFactory.getInstance(serviceContext.getRequest());
		long numOfEvaluations = _numOfEvaluations.get();
		Locale locale = LocaleThreadLocal.getThemeDisplayLocale();
		
		if(locale==null) {
			if(Validator.isNotNull(serviceContext.getLanguageId())){
				locale = LocaleUtil.fromLanguageId(serviceContext.getLanguageId());
			}
			else {
				locale = LocaleUtil.getDefault();
			}
		}
		long[] assetCategoryIds=new long[0];
		evaluationServiceContext.setAssetCategoryIds(assetCategoryIds);
		evaluationServiceContext.setAssetLinkEntryIds(assetCategoryIds);
		String[] emptyArray=new String[0];
		
		evaluationServiceContext.setAssetTagNames(emptyArray);
		evaluationServiceContext.setGroupPermissions(emptyArray);
		evaluationServiceContext.setGuestPermissions(emptyArray);
		evaluationServiceContext.setDeriveDefaultPermissions(true);
	
		
		for(int currentEvaluation=1;currentEvaluation<=numOfEvaluations;currentEvaluation++) {
			
			Map<Locale,String> evaluationTitle = new HashMap<Locale, String>(1);
			evaluationTitle.put(locale, LanguageUtil.format(locale, "evaluation.number", new Object[]{currentEvaluation}));

			LearningActivityLocalServiceUtil.addLearningActivity(course.getUserId(), course.getGroupCreatedId(), WorkflowConstants.STATUS_APPROVED, 
					evaluationTitle, evaluationTitle, 8 /* Evaluation */, null, null, 0, 0, 0, 0, null, null, null, 0, 0, evaluationServiceContext);
		}	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:38,代码来源:EvaluationAvgCourseEval.java

示例2: importLearningActivity

import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
/**
 * Función para importar las actividades del módulo
 * @param context 
 * @param entryElement elemento módulo
 * @param serviceContext
 * @param userId
 * @param newModule módulo nuevo al que pertenecerá
 * @param actElement elemento actividad
 * @throws SystemException 
 * @throws PortalException 
 */
public static long importLearningActivity(PortletDataContext context, Element entryElement, ServiceContext serviceContext, long userId, Module newModule, Element actElement, LearningActivity larn) throws SystemException, PortalException {

	if(larn != null){
		
		log.info("*********************ACTIVIDAD ID ANTIGUO: " + larn.getActId() + "**************************");
		log.info("***************TIPO DE ACTIVIDAD: " + larn.getTypeId() + "**************************");
		
		serviceContext.setAssetCategoryIds(context.getAssetCategoryIds(LearningActivity.class, larn.getActId()));
		serviceContext.setAssetTagNames(context.getAssetTagNames(LearningActivity.class, larn.getActId()));
		serviceContext.setUserId(userId);
		serviceContext.setCompanyId(context.getCompanyId());
		serviceContext.setScopeGroupId(context.getScopeGroupId());
		
		larn.setGroupId(newModule.getGroupId());
		larn.setModuleId(newModule.getModuleId());

		LearningActivity newLarn=LearningActivityLocalServiceUtil.addLearningActivity(larn,serviceContext);
		serviceContext.setScopeGroupId(newLarn.getGroupId());
		
		//Para actividad de recurso externo
		if(larn.getTypeId() == 2){
			//changeExtraContentDocumentIds(newLarn, newModule, userId, context, serviceContext);
		}
		
		
		//Seteo de contenido propio de la actividad
		log.debug("***IMPORT EXTRA CONTENT****");
		LearningActivityType learningActivityType=new LearningActivityTypeRegistry().getLearningActivityType(larn.getTypeId());
		
		String importExtraContentResult = null;
		try {
			importExtraContentResult = learningActivityType.importExtraContent(newLarn, userId, context, serviceContext, actElement);
		} catch (Exception e) {
			e.printStackTrace();
		} 

		log.debug("++++ importExtraContentResult:"+importExtraContentResult);
		
		log.debug("***FIN IMPORT EXTRA CONTENT****");
		
		importDLFileEntries(newLarn, userId, context, serviceContext, actElement);
		
		importDescriptionFileActivities(newLarn, userId, context, serviceContext, actElement);

		importQuestions(newLarn, userId, context, serviceContext, actElement);

		return newLarn.getActId();
	}else{
	
		return 0;
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:65,代码来源:LearningActivityImport.java


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