List of usage examples for com.liferay.portal.kernel.util PortalUtil getValidUserId
public static long getValidUserId(long companyId, long userId) throws PortalException
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMStructureLocalServiceImpl.java
License:Open Source License
/** * Updates the structure matching the class name ID, structure key, and * group, replacing its old parent structure, name map, description map, and * XSD with new ones./*from w ww.j a v a2 s. c o m*/ * * @param groupId the primary key of the group * @param parentStructureId the primary key of the new parent structure * @param classNameId the primary key of the class name for the * structure's related model * @param structureKey the unique string identifying the structure * @param nameMap the structure's new locales and localized names * @param descriptionMap the structure's new locales and localized * description * @param definition the structure's new XML schema definition * @param serviceContext the service context to be applied. Can set the * structure's modification date. * @return the updated structure * @deprecated As of 2.1.0, replaced by {@link #updateStructure(long, long, * long, long, String, Map, Map, DDMForm, DDMFormLayout, * ServiceContext)} */ @Deprecated @Override public DDMStructure updateStructure(long groupId, long parentStructureId, long classNameId, String structureKey, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String definition, ServiceContext serviceContext) throws PortalException { DDMStructure structure = ddmStructurePersistence.findByG_C_S(groupId, classNameId, structureKey); long userId = PortalUtil.getValidUserId(structure.getCompanyId(), serviceContext.getUserId()); ddmXML.validateXML(definition); DDMForm ddmForm = ddmFormXSDDeserializer.deserialize(definition); DDMFormLayout ddmFormLayout = ddm.getDefaultDDMFormLayout(ddmForm); structureKey = getStructureKey(structureKey); return doUpdateStructure(userId, parentStructureId, nameMap, descriptionMap, ddmForm, ddmFormLayout, serviceContext, structure); }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMStructureLocalServiceImpl.java
License:Open Source License
/** * Updates the structure matching the structure ID, replacing its old parent * structure, name map, description map, and XSD with new ones. * * @param structureId the primary key of the structure * @param parentStructureId the primary key of the new parent structure * @param nameMap the structure's new locales and localized names * @param descriptionMap the structure's new locales and localized * descriptions//from w w w. ja v a 2 s . co m * @param definition the structure's new XML schema definition * @param serviceContext the service context to be applied. Can set the * structure's modification date. * @return the updated structure * @deprecated As of 2.1.0, replaced by {@link #updateStructure(long, long, * long, Map, Map, DDMForm, DDMFormLayout, ServiceContext)} */ @Deprecated @Override public DDMStructure updateStructure(long structureId, long parentStructureId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String definition, ServiceContext serviceContext) throws PortalException { DDMStructure structure = ddmStructurePersistence.findByPrimaryKey(structureId); long userId = PortalUtil.getValidUserId(structure.getCompanyId(), serviceContext.getUserId()); ddmXML.validateXML(definition); DDMForm ddmForm = ddmFormXSDDeserializer.deserialize(definition); DDMFormLayout ddmFormLayout = ddm.getDefaultDDMFormLayout(ddmForm); return doUpdateStructure(userId, parentStructureId, nameMap, descriptionMap, ddmForm, ddmFormLayout, serviceContext, structure); }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMStructureLocalServiceImpl.java
License:Open Source License
/** * Updates the structure matching the structure ID, replacing its XSD with a * new one./*from www. ja v a2 s .c om*/ * * @param structureId the primary key of the structure * @param definition the structure's new XML schema definition * @param serviceContext the service context to be applied. Can set the * structure's modification date. * @return the updated structure * @deprecated As of 2.1.0, replaced by {@link #updateStructure(long, * DDMForm, DDMFormLayout, ServiceContext)} */ @Deprecated @Override public DDMStructure updateXSD(long structureId, String definition, ServiceContext serviceContext) throws PortalException { DDMStructure structure = ddmStructurePersistence.findByPrimaryKey(structureId); long userId = PortalUtil.getValidUserId(structure.getCompanyId(), serviceContext.getUserId()); ddmXML.validateXML(definition); DDMForm ddmForm = ddmFormXSDDeserializer.deserialize(definition); DDMFormLayout ddmFormLayout = ddm.getDefaultDDMFormLayout(ddmForm); return doUpdateStructure(userId, structure.getParentStructureId(), structure.getNameMap(), structure.getDescriptionMap(), ddmForm, ddmFormLayout, serviceContext, structure); }
From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java
License:Open Source License
protected void checkArticlesByDisplayDate(Date displayDate) throws PortalException { String portletId = PortletProviderUtil.getPortletId(JournalArticle.class.getName(), PortletProvider.Action.EDIT); List<JournalArticle> articles = journalArticlePersistence.findByLtD_S(displayDate, WorkflowConstants.STATUS_SCHEDULED); for (JournalArticle article : articles) { long userId = PortalUtil.getValidUserId(article.getCompanyId(), article.getUserId()); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCommand(Constants.UPDATE); String layoutFullURL = PortalUtil.getLayoutFullURL(article.getGroupId(), portletId); serviceContext.setLayoutFullURL(layoutFullURL); serviceContext.setScopeGroupId(article.getGroupId()); journalArticleLocalService.updateStatus(userId, article, WorkflowConstants.STATUS_APPROVED, null, serviceContext, new HashMap<String, Serializable>()); }//from w ww. ja v a2 s. co m }