@Override protected void doExportStagedModel(PortletDataContext portletDataContext, Repository repository) throws Exception { Element repositoryElement = portletDataContext.getExportDataElement(repository); Folder folder = DLAppLocalServiceUtil.getFolder(repository.getDlFolderId()); if (folder.getModel() instanceof DLFolder) { DLFolder dlFolder = (DLFolder) folder.getModel(); repositoryElement.addAttribute("hidden", String.valueOf(dlFolder.isHidden())); } portletDataContext.addClassedModel( repositoryElement, ExportImportPathUtil.getModelPath(repository), repository); List<RepositoryEntry> repositoryEntries = RepositoryEntryLocalServiceUtil.getRepositoryEntries(repository.getRepositoryId()); for (RepositoryEntry repositoryEntry : repositoryEntries) { StagedModelDataHandlerUtil.exportReferenceStagedModel( portletDataContext, repository, repositoryEntry, PortletDataContext.REFERENCE_TYPE_CHILD); } }
protected void initByRepositoryId(long repositoryId) { _repositoryId = repositoryId; _groupId = repositoryId; try { Repository repository = repositoryService.getRepository(repositoryId); _repositoryId = repository.getRepositoryId(); _groupId = repository.getGroupId(); _dlFolderId = repository.getDlFolderId(); } catch (Exception e) { } }
@Override public boolean isInHiddenFolder() { try { Repository repository = RepositoryLocalServiceUtil.getRepository(getRepositoryId()); long dlFolderId = repository.getDlFolderId(); DLFolder dlFolder = DLFolderLocalServiceUtil.getFolder(dlFolderId); return dlFolder.isHidden(); } catch (Exception e) { } return false; }
@Override protected void initByRepositoryId(long repositoryId) { setGroupId(repositoryId); setRepositoryId(repositoryId); try { com.liferay.portal.model.Repository repository = repositoryService.getRepository(repositoryId); setDlFolderId(repository.getDlFolderId()); setGroupId(repository.getGroupId()); setRepositoryId(repository.getRepositoryId()); } catch (Exception e) { } }
@Override public boolean isInHiddenFolder() { try { long repositoryId = getRepositoryId(); Repository repository = RepositoryLocalServiceUtil.getRepository(repositoryId); long dlFolderId = repository.getDlFolderId(); DLFolder dlFolder = DLFolderLocalServiceUtil.getFolder(dlFolderId); return dlFolder.isHidden(); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn(e, e); } } return false; }