本文整理汇总了Java中com.liferay.portal.service.ServiceContext.getUserId方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext.getUserId方法的具体用法?Java ServiceContext.getUserId怎么用?Java ServiceContext.getUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.service.ServiceContext
的用法示例。
在下文中一共展示了ServiceContext.getUserId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCompetence
import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
@Indexable(type=IndexableType.REINDEX)
public Competence updateCompetence(Competence competence, ServiceContext serviceContext) throws SystemException, PortalException {
competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "title");
competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "description");
Competence competenceReturn = competencePersistence.update(competence, true);
Locale locale=new Locale(serviceContext.getLanguageId());
long userId=serviceContext.getUserId();
AssetEntryLocalServiceUtil.updateEntry(
userId, competence.getGroupId(), Competence.class.getName(),
competence.getCompetenceId(), competence.getUuid(),0, serviceContext.getAssetCategoryIds(),
serviceContext.getAssetTagNames(), true, null, null,
new java.util.Date(System.currentTimeMillis()), null,
ContentTypes.TEXT_HTML, competence.getTitle(), competence.getDescription(locale), competence.getDescription(locale), null, null, 0, 0,
null, false);
return competenceReturn;
}
示例2: modCompetence
import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
@Indexable(type=IndexableType.REINDEX)
public Competence modCompetence (Competence competence, ServiceContext serviceContext) throws SystemException, PortalException {
competence.setExpandoBridgeAttributes(serviceContext);
competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "title");
competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "description");
Locale locale=new Locale(serviceContext.getLanguageId());
competencePersistence.update(competence, true);
long userId=serviceContext.getUserId();
AssetEntryLocalServiceUtil.updateEntry(
userId, competence.getGroupId(), Competence.class.getName(),
competence.getCompetenceId(), competence.getUuid(),0, serviceContext.getAssetCategoryIds(),
serviceContext.getAssetTagNames(), true, null, null,
new java.util.Date(System.currentTimeMillis()), null,
ContentTypes.TEXT_HTML, competence.getTitle(), competence.getDescription(locale), competence.getDescription(locale), null, null, 0, 0,
null, false);
return competence;
}
示例3: modLearningActivity
import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
public LearningActivity modLearningActivity (LearningActivity larn,
ServiceContext serviceContext)
throws SystemException, PortalException {
larn = LmsLocaleUtil.checkDefaultLocale(LearningActivity.class, larn, "title");
larn = LmsLocaleUtil.checkDefaultLocale(LearningActivity.class, larn, "description");
learningActivityPersistence.update(larn, false);
long userId=serviceContext.getUserId();
assetEntryLocalService.updateEntry(
userId, larn.getGroupId(), LearningActivity.class.getName(),
larn.getActId(), larn.getUuid(),larn.getTypeId(), serviceContext.getAssetCategoryIds(),
serviceContext.getAssetTagNames(), true, null, null,
new java.util.Date(System.currentTimeMillis()), null,
ContentTypes.TEXT_HTML, larn.getTitle(), null, larn.getDescription(),null, null, 0, 0,
null, false);
SocialActivityLocalServiceUtil.addActivity(
larn.getUserId(), larn.getGroupId(),
LearningActivity.class.getName(), larn.getActId(),
1, StringPool.BLANK, 0);
//auditing
AuditingLogFactory.audit(larn.getCompanyId(), larn.getGroupId(), LearningActivity.class.getName(), larn.getPrimaryKey(), serviceContext.getUserId(), AuditConstants.UPDATE, null);
return larn;
}
示例4: addCompetence
import com.liferay.portal.service.ServiceContext; //导入方法依赖的package包/类
@Indexable(type=IndexableType.REINDEX)
public Competence addCompetence (String title, String description,boolean generateCertificate,ServiceContext serviceContext)
throws SystemException, PortalException
{
long userId=serviceContext.getUserId();
Competence competence = competencePersistence.create(counterLocalService.increment(Competence.class.getName()));
competence.setCompanyId(serviceContext.getCompanyId());
competence.setGroupId(serviceContext.getScopeGroupId());
competence.setDiplomaTemplate(ParamUtil.getString(serviceContext.getRequest(),"template",StringPool.BLANK ),serviceContext.getLocale());
competence.setDiplomaBackground(ParamUtil.getLong(serviceContext.getRequest(), "diplomaBackground", 0));
competence.setDiplomaAdditional(ParamUtil.getLong(serviceContext.getRequest(), "diplomaAdditional", 0));
competence.setGenerateCertificate(generateCertificate);
competence.setUserId(userId);
competence.setDescription(description,serviceContext.getLocale());
competence.setTitle(title,serviceContext.getLocale());
competence.setStatus(WorkflowConstants.STATUS_APPROVED);
competence.setExpandoBridgeAttributes(serviceContext);
competence.setPage((String)serviceContext.getAttribute("page"));
competencePersistence.update(competence, true);
competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "title");
competence = LmsLocaleUtil.checkDefaultLocale(Competence.class, competence, "description");
try
{
resourceLocalService.addResources(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(),
userId,Competence.class.getName(), competence.getPrimaryKey(), false,true, true);
}
catch(Exception e)
{
e.printStackTrace();
}
AssetEntryLocalServiceUtil.updateEntry(userId, competence.getGroupId(), Competence.class.getName(),
competence.getCompetenceId(), competence.getUuid(),0, serviceContext.getAssetCategoryIds(),
serviceContext.getAssetTagNames(), true, null, null,new java.util.Date(System.currentTimeMillis()), null,
ContentTypes.TEXT_HTML, competence.getTitle(),
competence.getDescription(serviceContext.getLocale()), competence.getDescription(serviceContext.getLocale()),
null, null, 0, 0,null, false);
//creating group
return competence;
}