List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_IN_TRASH
int STATUS_IN_TRASH
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_IN_TRASH.
Click Source Link
From source file:com.liferay.wiki.web.internal.portlet.action.GetPageAttachmentAction.java
License:Open Source License
protected void getFile(long nodeId, String title, String fileName, int status, HttpServletRequest request, HttpServletResponse response) throws Exception { WikiPage wikiPage = _wikiPageService.getPage(nodeId, title); FileEntry fileEntry = PortletFileRepositoryUtil.getPortletFileEntry(wikiPage.getGroupId(), wikiPage.getAttachmentsFolderId(), fileName); if ((status != WorkflowConstants.STATUS_IN_TRASH) && fileEntry.isInTrash()) { return;/*from www .j a v a2 s .c o m*/ } if (fileEntry.isInTrash()) { fileName = TrashUtil.getOriginalTitle(fileEntry.getTitle()); } InputStream is = fileEntry.getContentStream(); FlashMagicBytesUtil.Result flashMagicBytesUtilResult = FlashMagicBytesUtil.check(is); if (flashMagicBytesUtilResult.isFlash()) { fileName = FileUtil.stripExtension(fileName) + ".swf"; } is = flashMagicBytesUtilResult.getInputStream(); ServletResponseUtil.sendFile(request, response, fileName, is, fileEntry.getSize(), fileEntry.getMimeType()); }
From source file:com.liferay.wiki.web.internal.trash.WikiNodeTrashHandler.java
License:Open Source License
@Override public int getTrashModelsCount(long classPK) throws PortalException { return _wikiPageLocalService.getPagesCount(classPK, true, WorkflowConstants.STATUS_IN_TRASH); }
From source file:com.liferay.wiki.web.internal.trash.WikiNodeTrashHandler.java
License:Open Source License
@Override public List<TrashedModel> getTrashModelTrashedModels(long classPK, int start, int end, OrderByComparator<?> obc) throws PortalException { List<WikiPage> pages = _wikiPageLocalService.getPages(classPK, true, WorkflowConstants.STATUS_IN_TRASH, start, end, (OrderByComparator<WikiPage>) obc); List<TrashedModel> trashedModels = new ArrayList<>(pages.size()); for (WikiPage page : pages) { trashedModels.add(page);/*from www .jav a 2s.c o m*/ } return trashedModels; }
From source file:com.liferay.wiki.web.internal.trash.WikiPageTrashHandler.java
License:Open Source License
@Override public List<TrashedModel> getTrashModelTrashedModels(long classPK, int start, int end, OrderByComparator obc) throws PortalException { List<TrashedModel> trashedModels = new ArrayList<>(); WikiPage page = _wikiPageLocalService.getPage(classPK); List<WikiPage> pages = _wikiPageLocalService.getChildren(page.getNodeId(), true, page.getTitle(), WorkflowConstants.STATUS_IN_TRASH, start, end, obc); for (WikiPage curPage : pages) { trashedModels.add(curPage);/* w w w . j av a 2 s . com*/ } return trashedModels; }
From source file:com.liferay.wiki.web.internal.trash.WikiPageTrashHandler.java
License:Open Source License
protected void checkRestorableEntry(long classPK, long trashEntryId, long containerModelId, String originalTitle, String newName) throws PortalException { WikiPage page = _wikiPageLocalService.getLatestPage(classPK, WorkflowConstants.STATUS_ANY, false); if (containerModelId == TrashEntryConstants.DEFAULT_CONTAINER_ID) { containerModelId = page.getNodeId(); }//ww w. j a v a2 s .co m if (Validator.isNotNull(newName)) { originalTitle = newName; } WikiPageResource duplicatePageResource = _wikiPageResourceLocalService.fetchPageResource(containerModelId, originalTitle); if (duplicatePageResource != null) { RestoreEntryException ree = new RestoreEntryException(RestoreEntryException.DUPLICATE); WikiPage duplicatePage = _wikiPageLocalService.getLatestPage(duplicatePageResource.getResourcePrimKey(), WorkflowConstants.STATUS_ANY, false); ree.setDuplicateEntryId(duplicatePage.getResourcePrimKey()); ree.setOldName(duplicatePage.getTitle()); ree.setTrashEntryId(trashEntryId); throw ree; } else { List<WikiPage> pages = _wikiPageLocalService.getDependentPages(page.getNodeId(), true, page.getTitle(), WorkflowConstants.STATUS_IN_TRASH); for (WikiPage curPage : pages) { checkRestorableEntry(curPage.getResourcePrimKey(), 0, containerModelId, curPage.getTitle(), _trashHelper.getOriginalTitle(curPage.getTitle())); } } }
From source file:com.xtivia.boostcamp.service.base.ProductLocalServiceBaseImpl.java
License:Open Source License
@Override public ExportActionableDynamicQuery getExportActionableDynamicQuery( final PortletDataContext portletDataContext) { final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() { @Override//from w ww. j a v a 2 s. c o m public long performCount() throws PortalException { ManifestSummary manifestSummary = portletDataContext.getManifestSummary(); StagedModelType stagedModelType = getStagedModelType(); long modelAdditionCount = super.performCount(); manifestSummary.addModelAdditionCount(stagedModelType, modelAdditionCount); long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext, stagedModelType); manifestSummary.addModelDeletionCount(stagedModelType, modelDeletionCount); return modelAdditionCount; } }; initActionableDynamicQuery(exportActionableDynamicQuery); exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() { @Override public void addCriteria(DynamicQuery dynamicQuery) { Criterion modifiedDateCriterion = portletDataContext.getDateRangeCriteria("modifiedDate"); Criterion statusDateCriterion = portletDataContext.getDateRangeCriteria("statusDate"); if ((modifiedDateCriterion != null) && (statusDateCriterion != null)) { Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); disjunction.add(modifiedDateCriterion); disjunction.add(statusDateCriterion); dynamicQuery.add(disjunction); } Property workflowStatusProperty = PropertyFactoryUtil.forName("status"); if (portletDataContext.isInitialPublication()) { dynamicQuery.add(workflowStatusProperty.ne(WorkflowConstants.STATUS_IN_TRASH)); } else { StagedModelDataHandler<?> stagedModelDataHandler = StagedModelDataHandlerRegistryUtil .getStagedModelDataHandler(Product.class.getName()); dynamicQuery.add(workflowStatusProperty.in(stagedModelDataHandler.getExportableStatuses())); } } }); exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId()); exportActionableDynamicQuery .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Product>() { @Override public void performAction(Product product) throws PortalException { StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, product); } }); exportActionableDynamicQuery .setStagedModelType(new StagedModelType(PortalUtil.getClassNameId(Product.class.getName()))); return exportActionableDynamicQuery; }
From source file:jorgediazest.indexchecker.model.IndexCheckerModel.java
License:Open Source License
public Criterion generateQueryFilter() { if (!this.isWorkflowEnabled()) { return null; }/* w ww .j a v a 2 s . c o m*/ return this.generateCriterionFilter("status=" + WorkflowConstants.STATUS_APPROVED + "+" + "status=" + WorkflowConstants.STATUS_IN_TRASH); }
From source file:jorgediazest.indexchecker.model.JournalArticle.java
License:Open Source License
public Map<Long, Data> getData(String[] attributes, String mapKeyAttribute, Criterion filter) throws Exception { if (indexAllVersions) { return super.getData(attributes, mapKeyAttribute, filter); }/* www. j av a 2 s .c o m*/ Map<Long, Data> dataMap = new HashMap<Long, Data>(); Criterion filterStatusApproved = this.generateCriterionFilter( "status=" + WorkflowConstants.STATUS_APPROVED + "+status=" + WorkflowConstants.STATUS_IN_TRASH); addMissingJournalArticles(attributes, filter, filterStatusApproved, dataMap); Criterion filterStatusNotApproved = this.generateCriterionFilter( "status<>" + WorkflowConstants.STATUS_APPROVED + ",status<>" + WorkflowConstants.STATUS_IN_TRASH); addMissingJournalArticles(attributes, filter, filterStatusNotApproved, dataMap); Map<Long, Data> dataMap2 = new HashMap<Long, Data>(); for (Data data : dataMap.values()) { dataMap2.put((Long) data.get(mapKeyAttribute), data); } return dataMap2; }
From source file:jorgediazest.indexchecker.model.JournalArticleQuery.java
License:Open Source License
public Map<Long, Data> getData(String[] attributes, String mapKeyAttribute, Criterion filter) throws Exception { if (indexAllVersions) { return super.getData(attributes, mapKeyAttribute, filter); }// w ww . java 2s. com String[] attributes2 = new String[attributes.length]; for (int i = 0; i < attributes.length; i++) { if (attributes[i].equals("version")) { attributes2[i] = "max(version)"; } else { attributes2[i] = attributes[i]; } } Criterion filterStatusApproved = getModel().generateCriterionFilter( "status=" + WorkflowConstants.STATUS_APPROVED + "+status=" + WorkflowConstants.STATUS_IN_TRASH); Criterion conjuctionFilterStatusApproved = ModelUtil.generateConjunctionQueryFilter(filter, filterStatusApproved); Map<Long, Data> dataMap = super.getData(attributes2, "resourcePrimKey", conjuctionFilterStatusApproved); Criterion filterStatusNotApproved = getModel().generateCriterionFilter( "status<>" + WorkflowConstants.STATUS_APPROVED + ",status<>" + WorkflowConstants.STATUS_IN_TRASH); Criterion conjuctionFilterStatusNotApproved = ModelUtil.generateConjunctionQueryFilter(filter, filterStatusNotApproved); Map<Long, Data> dataMapNotApproved = super.getData(attributes2, "resourcePrimKey", conjuctionFilterStatusNotApproved); for (Entry<Long, Data> entry : dataMapNotApproved.entrySet()) { if (!dataMap.containsKey(entry.getKey())) { dataMap.put(entry.getKey(), entry.getValue()); } } Map<Long, Data> dataMapResult = new HashMap<Long, Data>(); for (Data data : dataMap.values()) { dataMapResult.put((Long) data.get(mapKeyAttribute), data); } return dataMapResult; }
From source file:jorgediazest.indexchecker.model.WikiNode.java
License:Open Source License
@Override public Criterion generateQueryFilter() { return this.generateCriterionFilter("status=" + WorkflowConstants.STATUS_IN_TRASH); }