@Override protected BaseModel<?> addBaseModel( BaseModel<?> parentBaseModel, boolean approved, ServiceContext serviceContext) throws Exception { DLFolder dlFolder = (DLFolder) parentBaseModel; String content = "Content: Enterprise. Open Source. For Life."; serviceContext = (ServiceContext) serviceContext.clone(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH); FileEntry fileEntry = DLAppServiceUtil.addFileEntry( dlFolder.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "Text.txt", ContentTypes.TEXT_PLAIN, getSearchKeywords(), StringPool.BLANK, StringPool.BLANK, content.getBytes(), serviceContext); return DLAppServiceUtil.addFileShortcut( dlFolder.getGroupId(), dlFolder.getFolderId(), fileEntry.getFileEntryId(), serviceContext); }
@Override protected BaseModel<?> getParentBaseModel(Group group, ServiceContext serviceContext) throws Exception { serviceContext = (ServiceContext) serviceContext.clone(); serviceContext.setWorkflowAction(WorkflowConstants.STATUS_APPROVED); return WikiNodeLocalServiceUtil.addNode( TestPropsValues.getUserId(), RandomTestUtil.randomString(_NODE_NAME_MAX_LENGTH), RandomTestUtil.randomString(), serviceContext); }
@Override protected BaseModel<?> addBaseModelWithWorkflow( BaseModel<?> parentBaseModel, boolean approved, ServiceContext serviceContext) throws Exception { serviceContext = (ServiceContext) serviceContext.clone(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT); String title = getSearchKeywords(); title += RandomTestUtil.randomString(_PAGE_TITLE_MAX_LENGTH - title.length()); return WikiTestUtil.addPage( TestPropsValues.getUserId(), serviceContext.getScopeGroupId(), (Long) parentBaseModel.getPrimaryKeyObj(), title, approved); }
@Override protected BaseModel<?> updateBaseModel(long primaryKey, ServiceContext serviceContext) throws Exception { WikiPage page = WikiPageLocalServiceUtil.getPageByPageId(primaryKey); serviceContext = (ServiceContext) serviceContext.clone(); return WikiPageLocalServiceUtil.updatePage( TestPropsValues.getUserId(), page.getNodeId(), page.getTitle(), page.getVersion(), RandomTestUtil.randomString(), RandomTestUtil.randomString(), false, page.getFormat(), page.getParentTitle(), page.getRedirectTitle(), serviceContext); }