protected Element addExportDataRootElement( PortletDataContext portletDataContext) { Document document = SAXReaderUtil.createDocument(); Class<?> clazz = getClass(); Element rootElement = document.addElement(clazz.getSimpleName()); rootElement.addAttribute( "self-path", ExportImportPathUtil.getPortletDataPath(portletDataContext)); portletDataContext.setExportDataRootElement(rootElement); return rootElement; }
protected Object[] addSearchResults( String[] queryTerms, String keywords, int startPage, int itemsPerPage, int total, int start, String title, String searchPath, String format, ThemeDisplay themeDisplay) { int totalPages = 0; if ((total % itemsPerPage) == 0) { totalPages = total / itemsPerPage; } else { totalPages = (total / itemsPerPage) + 1; } int previousPage = startPage - 1; int nextPage = startPage + 1; Document doc = SAXReaderUtil.createDocument(); if (format.equals("rss")) { return addSearchResultsRSS( doc, queryTerms, keywords, startPage, itemsPerPage, total, start, totalPages, previousPage, nextPage, title, searchPath, themeDisplay); } return addSearchResultsAtom( doc, queryTerms, keywords, startPage, itemsPerPage, total, start, totalPages, previousPage, nextPage, title, searchPath, themeDisplay); }
protected String toXML(Map<String, String> expandoValuesMap) { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("root"); for (Map.Entry<String, String> entry : expandoValuesMap.entrySet()) { Element dynamicElementElement = rootElement.addElement( "dynamic-element"); String name = entry.getKey(); String data = entry.getValue(); dynamicElementElement.addAttribute("name", name); dynamicElementElement.addAttribute( "default-language-id", LocalizationUtil.getDefaultLanguageId(data)); addDynamicContentElements(dynamicElementElement, name, data); } return document.asXML(); }
@Override public void exportLocks(PortletDataContext portletDataContext) throws Exception { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("locks"); Map<String, Lock> locksMap = portletDataContext.getLocks(); for (Map.Entry<String, Lock> entry : locksMap.entrySet()) { Lock lock = entry.getValue(); String entryKey = entry.getKey(); int pos = entryKey.indexOf(CharPool.POUND); String className = entryKey.substring(0, pos); String key = entryKey.substring(pos + 1); String path = getLockPath(portletDataContext, className, key, lock); Element assetElement = rootElement.addElement("asset"); assetElement.addAttribute("path", path); assetElement.addAttribute("class-name", className); assetElement.addAttribute("key", key); portletDataContext.addZipEntry(path, lock); } portletDataContext.addZipEntry( ExportImportPathUtil.getRootPath(portletDataContext) + "/locks.xml", document.formattedString()); }
public void exportDeletionSystemEvents( PortletDataContext portletDataContext) throws Exception { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("deletion-system-events"); Set<StagedModelType> deletionSystemEventStagedModelTypes = portletDataContext.getDeletionSystemEventStagedModelTypes(); if (!deletionSystemEventStagedModelTypes.isEmpty() && MapUtil.getBoolean( portletDataContext.getParameterMap(), PortletDataHandlerKeys.DELETIONS)) { doExportDeletionSystemEvents( portletDataContext, rootElement, deletionSystemEventStagedModelTypes); } portletDataContext.addZipEntry( ExportImportPathUtil.getRootPath(portletDataContext) + "/deletion-system-events.xml", document.formattedString()); }
throws Exception { Document document = SAXReaderUtil.createDocument();
throws Exception { Document document = SAXReaderUtil.createDocument();
private String _getAssetEntryXml( String assetEntryType, String assetEntryUuid) { String xml = null; try { Document document = SAXReaderUtil.createDocument(StringPool.UTF8); Element assetEntryElement = document.addElement("asset-entry"); Element assetEntryTypeElement = assetEntryElement.addElement( "asset-entry-type"); assetEntryTypeElement.addText(assetEntryType); Element assetEntryUuidElement = assetEntryElement.addElement( "asset-entry-uuid"); assetEntryUuidElement.addText(assetEntryUuid); xml = document.formattedString(StringPool.BLANK); } catch (IOException ioe) { if (_log.isWarnEnabled()) { _log.warn(ioe, ioe); } } return xml; }
private static String _getAssetEntryXml( String assetEntryType, String assetEntryUuid) { String xml = null; try { Document document = SAXReaderUtil.createDocument(StringPool.UTF8); Element assetEntryElement = document.addElement("asset-entry"); Element assetEntryTypeElement = assetEntryElement.addElement( "asset-entry-type"); assetEntryTypeElement.addText(assetEntryType); Element assetEntryUuidElement = assetEntryElement.addElement( "asset-entry-uuid"); assetEntryUuidElement.addText(assetEntryUuid); xml = document.formattedString(StringPool.BLANK); } catch (IOException ioe) { if (_log.isWarnEnabled()) { _log.warn(ioe, ioe); } } return xml; }
document = SAXReaderUtil.createDocument(pageElement); document = SAXReaderUtil.createDocument(pageElement);
formInstanceId); Document document = SAXReaderUtil.createDocument();
@Override public void exportAssetLinks(PortletDataContext portletDataContext) throws Exception { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("links"); Element exportDataRootElement = portletDataContext.getExportDataRootElement(); try { portletDataContext.setExportDataRootElement(rootElement); List<AssetLink> assetLinks = _assetLinkLocalService.getLinks( portletDataContext.getGroupId(), portletDataContext.getStartDate(), portletDataContext.getEndDate(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); for (AssetLink assetLink : assetLinks) { StagedAssetLink stagedAssetLink = ModelAdapterUtil.adapt( assetLink, AssetLink.class, StagedAssetLink.class); portletDataContext.addClassedModel( portletDataContext.getExportDataElement(stagedAssetLink), ExportImportPathUtil.getModelPath(stagedAssetLink), stagedAssetLink); } } finally { portletDataContext.setExportDataRootElement(exportDataRootElement); } portletDataContext.addZipEntry( ExportImportPathUtil.getRootPath(portletDataContext) + "/links.xml", document.formattedString()); }
throws Exception { Document document = SAXReaderUtil.createDocument();
Document newDocument = SAXReaderUtil.createDocument();
portletDataContext.setScopeLayoutUuid(scopeLayoutUuid); Document document = SAXReaderUtil.createDocument();
Document document = SAXReaderUtil.createDocument();
Document document = SAXReaderUtil.createDocument();