@Override protected void doImportStagedModel(PortletDataContext portletDataContext, PollsVote vote) throws Exception { Map<Long, Long> questionIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(PollsQuestion.class); long questionId = MapUtil.getLong(questionIds, vote.getQuestionId(), vote.getQuestionId()); Map<Long, Long> choiceIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(PollsChoice.class); long choiceId = MapUtil.getLong(choiceIds, vote.getChoiceId(), vote.getChoiceId()); ServiceContext serviceContext = portletDataContext.createServiceContext(vote); serviceContext.setCreateDate(vote.getVoteDate()); if (portletDataContext.isDataStrategyMirror()) { PollsVote existingVote = fetchStagedModelByUuidAndGroupId(vote.getUuid(), portletDataContext.getScopeGroupId()); if (existingVote == null) { serviceContext.setUuid(vote.getUuid()); } } try { PollsVoteLocalServiceUtil.addVote(vote.getUserId(), questionId, choiceId, serviceContext); } catch (DuplicateVoteException dve) { } }
public void processAction(ActionEvent actionEvent) throws AbortProcessingException { try { FolderUserObject folderUserObject = docLibModelBean.getSelectedFolderUserObject(); DLFolder dlFolder = folderUserObject.getDlFolder(); long groupId = dlFolder.getGroupId(); long repositoryId = dlFolder.getRepositoryId(); boolean mountPoint = dlFolder.getMountPoint(); long parentFolderId = dlFolder.getFolderId(); ServiceContext serviceContext = new ServiceContext(); // Temporary: Make the default setting be that community members can view the file. Need to // develop a // "Viewable By" permissions Facelet composite component UI similar to // portal-web/docroot/html/taglib/ui/input_permissions/page.jsp serviceContext.setAddGroupPermissions(true); DLFolderServiceUtil.addFolder( groupId, repositoryId, mountPoint, parentFolderId, folderName, folderDescription, serviceContext); docLibModelBean.forceTreeRequery(); logger.debug("Added folderName=[{0}] description=[{1}]", folderName, folderDescription); } catch (Exception e) { logger.error(e.getMessage(), e); liferayFacesContext.addGlobalUnexpectedErrorMessage(); } docLibViewBean.setPopupRendered(false); }
protected ServiceContext getServiceContext() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); serviceContext.setAttribute("fileEntryTypeId", _contractDLFileEntryTypeId); Map<String, Serializable> expandoBridgeAttributes = serviceContext.getExpandoBridgeAttributes(); expandoBridgeAttributes.put(_EXPANDO_ATTRIBUTE_NAME, StringPool.BLANK); serviceContext.setExpandoBridgeAttributes(expandoBridgeAttributes); DLFileEntryType fileEntryType = DLFileEntryTypeLocalServiceUtil.getFileEntryType(_contractDLFileEntryTypeId); List<DDMStructure> ddmStructures = fileEntryType.getDDMStructures(); for (DDMStructure ddmStructure : ddmStructures) { DDMFormValues ddmFormValues = createDDMFormValues(ddmStructure.getDDMForm()); for (String fieldName : ddmStructure.getFieldNames()) { DDMFormFieldValue ddmFormFieldValue = createDDMFormFieldValue(fieldName); ddmFormValues.addDDMFormFieldValue(ddmFormFieldValue); } serviceContext.setAttribute( DDMFormValues.class.getName() + ddmStructure.getStructureId(), ddmFormValues); } return serviceContext; }
public static Folder getGadgetEditorRootFolder(long repositoryId) throws Exception { Folder folder = null; try { folder = DLAppServiceUtil.getFolder( repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, _GADGET_EDITOR_ROOT_FOLDER_NAME); } catch (Exception e) { } if (folder == null) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(repositoryId); folder = DLAppServiceUtil.addFolder( repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, _GADGET_EDITOR_ROOT_FOLDER_NAME, StringPool.BLANK, serviceContext); } return folder; }
protected void searchComments() throws Exception { ServiceContext serviceContext = ServiceTestUtil.getServiceContext(); serviceContext.setScopeGroupId(group.getGroupId()); SearchContext searchContext = ServiceTestUtil.getSearchContext(); searchContext.setIncludeDiscussions(true); BaseModel<?> parentBaseModel = getParentBaseModel(group, serviceContext); int initialBaseModelsSearchCount = searchBaseModelsCount(getBaseModelClass(), group.getGroupId(), searchContext); baseModel = addBaseModel(parentBaseModel, true, serviceContext); Assert.assertEquals( initialBaseModelsSearchCount + 1, searchBaseModelsCount(getBaseModelClass(), group.getGroupId(), searchContext)); addComment(baseModel, getSearchKeywords(), serviceContext); Assert.assertEquals( initialBaseModelsSearchCount + 2, searchBaseModelsCount(getBaseModelClass(), group.getGroupId(), searchContext)); }
@Override public int searchCount( long companyId, long userId, String taskName, String assetType, Long[] assetPrimaryKey, Date dueDateGT, Date dueDateLT, Boolean completed, Boolean searchByUserRoles, boolean andOperator) throws WorkflowException { try { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setUserId(userId); return KaleoTaskInstanceTokenLocalServiceUtil.searchCount( taskName, assetType, assetPrimaryKey, dueDateGT, dueDateLT, completed, searchByUserRoles, andOperator, serviceContext); } catch (Exception e) { throw new WorkflowException(e); } }
@Override public long getAttachmentsFolderId() { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return _attachmentsFolderId; } ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(getGroupId(), PortletKeys.BACKGROUND_TASK); if (repository == null) { return DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; } try { Folder folder = PortletFileRepositoryUtil.getPortletFolder( repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getBackgroundTaskId())); _attachmentsFolderId = folder.getFolderId(); } catch (Exception e) { } return _attachmentsFolderId; }
public TitlesDepartmentUnitUnitGroup addTitlesDepartmentUnitUnitGroup( long titlesId, long departmentId, long unitId, long unitGroupId, ServiceContext serviceContext) { try { TitlesDepartmentUnitUnitGroup o = titlesDepartmentUnitUnitGroupPersistence.create(counterLocalService.increment()); o.setTitlesId(titlesId); o.setUnitGroupId(unitGroupId); o.setUnitId(unitId); o.setDepartmentId(departmentId); o.setCreateDate(new Date()); o.setModifiedDate(new Date()); o.setGroupId(serviceContext.getScopeGroupId()); o.setCompanyId(serviceContext.getCompanyId()); o.setUserId(serviceContext.getUserId()); return super.addTitlesDepartmentUnitUnitGroup(o); } catch (SystemException e) { LOGGER.info(e); } return null; }
@Override public Folder addAttachmentsFolder() throws PortalException, SystemException { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return PortletFileRepositoryUtil.getPortletFolder(_attachmentsFolderId); } ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.addPortletRepository( getGroupId(), PortletKeys.MESSAGE_BOARDS, serviceContext); MBThread thread = getThread(); Folder threadFolder = thread.addAttachmentsFolder(); Folder folder = PortletFileRepositoryUtil.addPortletFolder( getUserId(), repository.getRepositoryId(), threadFolder.getFolderId(), String.valueOf(getMessageId()), serviceContext); _attachmentsFolderId = folder.getFolderId(); return folder; }
@Before public void setUp() throws Exception { _group = ServiceTestUtil.addGroup(); String name = "Test Folder"; String description = "This is a test folder."; ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(_group.getGroupId()); try { DLAppServiceHttp.deleteFolder( TestPropsValues.getHttpPrincipal(), _group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, name); } catch (Exception e) { } _folder = DLAppServiceHttp.addFolder( TestPropsValues.getHttpPrincipal(), _group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, name, description, serviceContext); }
@Override public AnonymousUser addAnonymousUser( long userId, String lastIp, String typeSettings, ServiceContext serviceContext) throws PortalException, SystemException { User user = UserLocalServiceUtil.fetchUser(userId); Date now = new Date(); long anonymousUserId = CounterLocalServiceUtil.increment(); AnonymousUser anonymousUser = anonymousUserPersistence.create(anonymousUserId); anonymousUser.setCompanyId(serviceContext.getCompanyId()); if (user != null) { anonymousUser.setUserId(user.getUserId()); anonymousUser.setUserName(user.getFullName()); } anonymousUser.setCreateDate(serviceContext.getCreateDate(now)); anonymousUser.setModifiedDate(serviceContext.getModifiedDate(now)); anonymousUser.setLastIp(lastIp); anonymousUser.setTypeSettings(typeSettings); anonymousUserPersistence.update(anonymousUser); return anonymousUser; }
public void updateConfiguration(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { try { ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); long scopeGroupId = serviceContext.getScopeGroupId(); Group scopeGroup = GroupLocalServiceUtil.getGroup(scopeGroupId); if (scopeGroup.isStagingGroup()) { scopeGroup = scopeGroup.getLiveGroup(); } UnicodeProperties typeSettingsProperties = scopeGroup.getTypeSettingsProperties(); UnicodeProperties properties = PropertiesParamUtil.getProperties(actionRequest, "settings--"); typeSettingsProperties.putAll(properties); GroupServiceUtil.updateGroup(scopeGroup.getGroupId(), scopeGroup.getTypeSettings()); } catch (Exception e) { SessionErrors.add(actionRequest, e.getClass().getName()); } }
@Override public void cascadeFileEntryTypes(long userId, DLFolder dlFolder) throws PortalException { long[] groupIds = PortalUtil.getCurrentAndAncestorSiteGroupIds(dlFolder.getGroupId()); List<DLFileEntryType> dlFileEntryTypes = getFolderFileEntryTypes(groupIds, dlFolder.getFolderId(), true); List<Long> fileEntryTypeIds = getFileEntryTypeIds(dlFileEntryTypes); long defaultFileEntryTypeId = getDefaultFileEntryTypeId(dlFolder.getFolderId()); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(dlFolder.getCompanyId()); serviceContext.setScopeGroupId(dlFolder.getGroupId()); serviceContext.setUserId(userId); cascadeFileEntryTypes( userId, dlFolder.getGroupId(), dlFolder.getFolderId(), defaultFileEntryTypeId, fileEntryTypeIds, serviceContext); }
protected Field createField( DDMStructure ddmStructure, String fieldName, List<Serializable> fieldValues, ServiceContext serviceContext) { Field field = new Field(); field.setDDMStructureId(ddmStructure.getStructureId()); String languageId = GetterUtil.getString( serviceContext.getAttribute("languageId"), serviceContext.getLanguageId()); Locale locale = LocaleUtil.fromLanguageId(languageId); String defaultLanguageId = GetterUtil.getString(serviceContext.getAttribute("defaultLanguageId")); Locale defaultLocale = LocaleUtil.fromLanguageId(defaultLanguageId); if (fieldName.startsWith(StringPool.UNDERLINE)) { locale = LocaleUtil.getSiteDefault(); defaultLocale = LocaleUtil.getSiteDefault(); } field.setDefaultLocale(defaultLocale); field.setName(fieldName); field.setValues(locale, fieldValues); return field; }
@Override public List<WorkflowTask> getWorkflowTasksByWorkflowInstance( long companyId, Long userId, long workflowInstanceId, Boolean completed, int start, int end, OrderByComparator<WorkflowTask> orderByComparator) throws WorkflowException { try { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); if (userId != null) { serviceContext.setUserId(userId); } List<KaleoTaskInstanceToken> kaleoTaskInstanceTokens = KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceTokens( workflowInstanceId, completed, start, end, KaleoTaskInstanceTokenOrderByComparator.getOrderByComparator(orderByComparator), serviceContext); return toWorkflowTasks(kaleoTaskInstanceTokens); } catch (Exception e) { throw new WorkflowException(e); } }
@Override public PollsChoice addChoice( long userId, long questionId, String name, String description, ServiceContext serviceContext) throws PortalException { validate(name, description); User user = userPersistence.findByPrimaryKey(userId); Date now = new Date(); long choiceId = counterLocalService.increment(); PollsChoice choice = pollsChoicePersistence.create(choiceId); choice.setUuid(serviceContext.getUuid()); choice.setGroupId(serviceContext.getScopeGroupId()); choice.setCompanyId(user.getCompanyId()); choice.setUserId(user.getUserId()); choice.setUserName(user.getFullName()); choice.setCreateDate(serviceContext.getCreateDate(now)); choice.setModifiedDate(serviceContext.getModifiedDate(now)); choice.setQuestionId(questionId); choice.setName(name); choice.setDescription(description); pollsChoicePersistence.update(choice); return choice; }
@Override public List<WorkflowTask> search( long companyId, long userId, String keywords, String[] assetTypes, Boolean completed, Boolean searchByUserRoles, int start, int end, OrderByComparator<WorkflowTask> orderByComparator) throws WorkflowException { try { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setUserId(userId); List<KaleoTaskInstanceToken> kaleoTaskInstanceTokens = KaleoTaskInstanceTokenLocalServiceUtil.search( keywords, assetTypes, completed, searchByUserRoles, start, end, KaleoTaskInstanceTokenOrderByComparator.getOrderByComparator(orderByComparator), serviceContext); return toWorkflowTasks(kaleoTaskInstanceTokens); } catch (Exception e) { throw new WorkflowException(e); } }
@Override protected String getTitle( JSONObject jsonObject, AssetRenderer<?> assetRenderer, ServiceContext serviceContext) { MBMessage mbMessage = MBMessageLocalServiceUtil.fetchMBMessage(jsonObject.getLong("classPK")); AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName( assetRenderer.getClassName()); String typeName = assetRendererFactory.getTypeName(serviceContext.getLocale()); ResourceBundle resourceBundle = ResourceBundle.getBundle("content.Language", serviceContext.getLocale()); if ((mbMessage != null) && mbMessage.isDiscussion()) { return LanguageUtil.format( resourceBundle, "x-mentioned-you-in-a-comment-in-a-x", new String[] { HtmlUtil.escape(assetRenderer.getUserName()), StringUtil.toLowerCase(HtmlUtil.escape(typeName)) }, false); } else { return LanguageUtil.format( resourceBundle, "x-mentioned-you-in-a-x", new String[] { HtmlUtil.escape(assetRenderer.getUserName()), StringUtil.toLowerCase(HtmlUtil.escape(typeName)) }, false); } }
@Override protected void doImportStagedModel(PortletDataContext portletDataContext, AssetTag assetTag) throws Exception { long userId = portletDataContext.getUserId(assetTag.getUserUuid()); ServiceContext serviceContext = createServiceContext(portletDataContext, assetTag); AssetTag existingAssetTag = fetchStagedModelByUuidAndGroupId(assetTag.getUuid(), portletDataContext.getScopeGroupId()); AssetTag importedAssetTag = null; if (existingAssetTag == null) { serviceContext.setUuid(assetTag.getUuid()); importedAssetTag = AssetTagLocalServiceUtil.addTag( userId, portletDataContext.getScopeGroupId(), assetTag.getName(), serviceContext); } else { importedAssetTag = AssetTagLocalServiceUtil.updateTag( userId, existingAssetTag.getTagId(), assetTag.getName(), serviceContext); } portletDataContext.importClassedModel(assetTag, importedAssetTag); }
protected String[] readAssetTagNames(long userId, WikiNode node, String content) throws PortalException { Matcher matcher = _categoriesPattern.matcher(content); List<String> assetTagNames = new ArrayList<String>(); while (matcher.find()) { String categoryName = matcher.group(1); categoryName = normalize(categoryName, 75); AssetTag assetTag = null; try { assetTag = AssetTagLocalServiceUtil.getTag(node.getGroupId(), categoryName); } catch (NoSuchTagException nste) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(node.getGroupId()); assetTag = AssetTagLocalServiceUtil.addTag(userId, categoryName, null, serviceContext); } assetTagNames.add(assetTag.getName()); } if (content.contains(_WORK_IN_PROGRESS)) { assetTagNames.add(_WORK_IN_PROGRESS_TAG); } return assetTagNames.toArray(new String[assetTagNames.size()]); }
@Override public Folder addAttachmentsFolder() throws PortalException { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return PortletFileRepositoryUtil.getPortletFolder(_attachmentsFolderId); } ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.addPortletRepository( getGroupId(), PortletKeys.BACKGROUND_TASK, serviceContext); Folder folder = PortletFileRepositoryUtil.addPortletFolder( getUserId(), repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getBackgroundTaskId()), serviceContext); _attachmentsFolderId = folder.getFolderId(); return folder; }
protected FileEntry addFileEntry( long folderId, String sourceFileName, String title, byte[] bytes, int workflowAction) throws Exception { String description = StringPool.BLANK; String changeLog = StringPool.BLANK; if ((bytes == null) && Validator.isNotNull(sourceFileName)) { bytes = CONTENT.getBytes(); } ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setWorkflowAction(workflowAction); return DLAppServiceUtil.addFileEntry( TestPropsValues.getGroupId(), folderId, sourceFileName, ContentTypes.TEXT_PLAIN, title, description, changeLog, bytes, serviceContext); }
@Override protected BaseModel<?> addBaseModelWithClassType( BaseModel<?> parentBaseModel, String keywords, ServiceContext serviceContext) throws Exception { if (_ddmStructure == null) { _ddmStructure = DDMStructureTestUtil.addStructure( serviceContext.getScopeGroupId(), JournalArticle.class.getName()); } if (_ddmTemplate == null) { _ddmTemplate = DDMTemplateTestUtil.addTemplate( serviceContext.getScopeGroupId(), _ddmStructure.getStructureId()); } String content = DDMStructureTestUtil.getSampleStructuredContent(); return JournalTestUtil.addArticleWithXMLContent( serviceContext.getScopeGroupId(), content, _ddmStructure.getStructureKey(), _ddmTemplate.getTemplateKey()); }
protected FileEntry updateFileEntry( long fileEntryId, String sourceFileName, String title, boolean majorVersion) throws Exception { String description = StringPool.BLANK; String changeLog = StringPool.BLANK; byte[] bytes = null; if (Validator.isNotNull(sourceFileName)) { bytes = CONTENT.getBytes(); } ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); return DLAppServiceUtil.updateFileEntry( fileEntryId, sourceFileName, ContentTypes.TEXT_PLAIN, title, description, changeLog, majorVersion, bytes, serviceContext); }
@Override public AnonymousUser getAnonymousUser(HttpServletRequest request, long userId) throws PortalException, SystemException { long companyId = PortalUtil.getCompanyId(request); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); AnonymousUser anonymousUser = AnonymousUserLocalServiceUtil.fetchAnonymousUserByUserId(userId); if (anonymousUser == null) { anonymousUser = getAnonymousUserFromCookie(request); if ((anonymousUser == null) || ((anonymousUser.getUserId() != 0) && (anonymousUser.getUserId() != userId))) { anonymousUser = AnonymousUserLocalServiceUtil.addAnonymousUser( userId, request.getRemoteAddr(), null, serviceContext); } else { anonymousUser = AnonymousUserLocalServiceUtil.updateAnonymousUser( anonymousUser.getAnonymousUserId(), userId, request.getRemoteAddr(), anonymousUser.getTypeSettings(), serviceContext); } } return anonymousUser; }
@Override protected void doImportStagedModel(PortletDataContext portletDataContext, WikiNode node) throws Exception { long userId = portletDataContext.getUserId(node.getUserUuid()); ServiceContext serviceContext = portletDataContext.createServiceContext(node); WikiNode importedNode = null; if (portletDataContext.isDataStrategyMirror()) { WikiNode existingNode = WikiNodeLocalServiceUtil.fetchNodeByUuidAndGroupId( node.getUuid(), portletDataContext.getScopeGroupId()); String initialNodeName = PropsValues.WIKI_INITIAL_NODE_NAME; if ((existingNode == null) && initialNodeName.equals(node.getName())) { WikiNode initialNode = WikiNodeLocalServiceUtil.fetchNode( portletDataContext.getScopeGroupId(), node.getName()); if (initialNode != null) { WikiNodeLocalServiceUtil.deleteWikiNode(initialNode); } } if (existingNode == null) { serviceContext.setUuid(node.getUuid()); importedNode = WikiNodeLocalServiceUtil.addNode( userId, node.getName(), node.getDescription(), serviceContext); } else { importedNode = WikiNodeLocalServiceUtil.updateNode( existingNode.getNodeId(), node.getName(), node.getDescription(), serviceContext); } } else { String initialNodeName = PropsValues.WIKI_INITIAL_NODE_NAME; if (initialNodeName.equals(node.getName())) { WikiNode initialNode = WikiNodeLocalServiceUtil.fetchNode( portletDataContext.getScopeGroupId(), node.getName()); if (initialNode != null) { WikiNodeLocalServiceUtil.deleteWikiNode(initialNode); } } String nodeName = getNodeName(portletDataContext, node, node.getName(), 2); importedNode = WikiNodeLocalServiceUtil.addNode(userId, nodeName, node.getDescription(), serviceContext); } portletDataContext.importClassedModel(node, importedNode); }
/* * NOTE FOR DEVELOPERS: * * Never reference this interface directly. Always use {@link org.oep.core.datamgt.parameter.service.DefaultParameterLocalServiceUtil} to access the default parameter local service. */ @Indexable(type = IndexableType.REINDEX) public DefaultParameter addDefaultParameter( String applicationName, String title, String parameterName, String parameterValue, int changeable, ServiceContext serviceContext) throws SystemException, PortalException { validate(applicationName, title, parameterName, parameterValue); long id = counterLocalService.increment(); DefaultParameter defaultParameter = defaultParameterPersistence.create(id); Date now = new Date(); defaultParameter.setApplicationName(applicationName); defaultParameter.setTitle(title); defaultParameter.setParameterName(parameterName); defaultParameter.setParameterValue(parameterValue); defaultParameter.setCreateDate(serviceContext.getCreateDate(now)); defaultParameter.setCompanyId(serviceContext.getCompanyId()); defaultParameter.setChangeable(changeable); defaultParameterPersistence.update(defaultParameter); if (_log.isInfoEnabled()) { _log.info("Create new default parameter " + id); } return getDefaultParameter(id); }
@Override public List<WorkflowTask> getWorkflowTasksByRole( long companyId, long roleId, Boolean completed, int start, int end, OrderByComparator<WorkflowTask> orderByComparator) throws WorkflowException { try { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); List<KaleoTaskInstanceToken> kaleoTaskInstanceTokens = KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceTokens( Role.class.getName(), roleId, completed, start, end, KaleoTaskInstanceTokenOrderByComparator.getOrderByComparator(orderByComparator), serviceContext); return toWorkflowTasks(kaleoTaskInstanceTokens); } catch (Exception e) { throw new WorkflowException(e); } }
@Override public CalendarResource updateCalendarResource( long calendarResourceId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, boolean active, ServiceContext serviceContext) throws PortalException { // Calendar resource validate(nameMap); CalendarResource calendarResource = calendarResourcePersistence.findByPrimaryKey(calendarResourceId); calendarResource.setModifiedDate(serviceContext.getModifiedDate(null)); calendarResource.setNameMap(nameMap); calendarResource.setDescriptionMap(descriptionMap); calendarResource.setActive(active); calendarResourcePersistence.update(calendarResource); // Asset updateAsset( calendarResource.getUserId(), calendarResource, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames()); return calendarResource; }
protected void addFileEntry(boolean rootFolder) throws PortalException, SystemException { long folderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; if (!rootFolder) { folderId = _folder.getFolderId(); } String fileName = "Title.txt"; String description = StringPool.BLANK; String changeLog = StringPool.BLANK; String content = "Content: Enterprise. Open Source. For Life."; byte[] bytes = content.getBytes(); ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddCommunityPermissions(true); serviceContext.setAddGuestPermissions(true); _fileEntry = DLAppServiceUtil.addFileEntry( _groupId, folderId, fileName, description, changeLog, bytes, serviceContext); }