List of usage examples for com.liferay.portal.kernel.xml Element addAttribute
public Element addAttribute(String name, String value);
From source file:com.liferay.portlet.dynamicdatamapping.storage.XMLStorageAdapter.java
License:Open Source License
private void _updateField(Element dynamicElementElement, String fieldName, String value) { Element dynamicContentElement = dynamicElementElement.element("dynamic-content"); dynamicElementElement.addAttribute("name", fieldName); dynamicContentElement.clearContent(); dynamicContentElement.addCDATA(value); }
From source file:com.liferay.portlet.journal.lar.JournalContentPortletDataHandlerImpl.java
License:Open Source License
@Override protected String doExportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { portletDataContext.addPermissions("com.liferay.portlet.journal", portletDataContext.getScopeGroupId()); String articleId = portletPreferences.getValue("articleId", null); if (articleId == null) { if (_log.isWarnEnabled()) { _log.warn("No article id found in preferences of portlet " + portletId); }/*from w w w . ja va2s . com*/ return StringPool.BLANK; } long articleGroupId = GetterUtil.getLong(portletPreferences.getValue("groupId", StringPool.BLANK)); if (articleGroupId <= 0) { if (_log.isWarnEnabled()) { _log.warn("No group id found in preferences of portlet " + portletId); } return StringPool.BLANK; } long previousScopeGroupId = portletDataContext.getScopeGroupId(); if (articleGroupId != portletDataContext.getScopeGroupId()) { portletDataContext.setScopeGroupId(articleGroupId); } JournalArticle article = null; try { article = JournalArticleLocalServiceUtil.getLatestArticle(articleGroupId, articleId, WorkflowConstants.STATUS_APPROVED); } catch (NoSuchArticleException nsae) { } if (article == null) { try { article = JournalArticleLocalServiceUtil.getLatestArticle(articleGroupId, articleId, WorkflowConstants.STATUS_EXPIRED); } catch (NoSuchArticleException nsae) { } } Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("journal-content-data"); if (article == null) { portletDataContext.setScopeGroupId(previousScopeGroupId); return document.formattedString(); } String path = JournalPortletDataHandlerImpl.getArticlePath(portletDataContext, article); Element articleElement = rootElement.addElement("article"); articleElement.addAttribute("path", path); Element dlFileEntryTypesElement = rootElement.addElement("dl-file-entry-types"); Element dlFoldersElement = rootElement.addElement("dl-folders"); Element dlFilesElement = rootElement.addElement("dl-file-entries"); Element dlFileRanksElement = rootElement.addElement("dl-file-ranks"); JournalPortletDataHandlerImpl.exportArticle(portletDataContext, rootElement, rootElement, rootElement, dlFileEntryTypesElement, dlFoldersElement, dlFilesElement, dlFileRanksElement, article, false); portletDataContext.setScopeGroupId(previousScopeGroupId); return document.formattedString(); }
From source file:com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl.java
License:Open Source License
public static void exportArticle(PortletDataContext portletDataContext, Element articlesElement, Element structuresElement, Element templatesElement, Element dlFileEntryTypesElement, Element dlFoldersElement, Element dlFileEntriesElement, Element dlFileRanksElement, Element dlRepositoriesElement, Element dlRepositoryEntriesElement, JournalArticle article, String preferenceTemplateId, boolean checkDateRange) throws Exception { if (checkDateRange && !portletDataContext.isWithinDateRange(article.getModifiedDate())) { return;//from www. j a v a 2 s . co m } if ((article.getStatus() != WorkflowConstants.STATUS_APPROVED) && (article.getStatus() != WorkflowConstants.STATUS_EXPIRED)) { return; } String path = getArticlePath(portletDataContext, article); if (!portletDataContext.isPathNotProcessed(path)) { return; } // Clone this article to make sure changes to its content are never // persisted article = (JournalArticle) article.clone(); Element articleElement = (Element) articlesElement .selectSingleNode("//article[@path='".concat(path).concat("']")); if (articleElement == null) { articleElement = articlesElement.addElement("article"); } articleElement.addAttribute("article-resource-uuid", article.getArticleResourceUuid()); if (Validator.isNotNull(article.getStructureId())) { JournalStructure structure = JournalStructureLocalServiceUtil.getStructure(article.getGroupId(), article.getStructureId(), true); articleElement.addAttribute("structure-uuid", structure.getUuid()); exportStructure(portletDataContext, structuresElement, structure); } String templateId = article.getTemplateId(); if (Validator.isNotNull(preferenceTemplateId)) { templateId = preferenceTemplateId; } if (Validator.isNotNull(templateId)) { JournalTemplate template = JournalTemplateLocalServiceUtil.getTemplate(article.getGroupId(), templateId, true); articleElement.addAttribute("template-uuid", template.getUuid()); exportTemplate(portletDataContext, templatesElement, dlFileEntryTypesElement, dlFoldersElement, dlFileEntriesElement, dlFileRanksElement, dlRepositoriesElement, dlRepositoryEntriesElement, template); } Image smallImage = ImageUtil.fetchByPrimaryKey(article.getSmallImageId()); if (article.isSmallImage() && (smallImage != null)) { String smallImagePath = getArticleSmallImagePath(portletDataContext, article); articleElement.addAttribute("small-image-path", smallImagePath); article.setSmallImageType(smallImage.getType()); portletDataContext.addZipEntry(smallImagePath, smallImage.getTextObj()); } if (portletDataContext.getBooleanParameter(_NAMESPACE, "images")) { String imagePath = getArticleImagePath(portletDataContext, article); articleElement.addAttribute("image-path", imagePath); List<JournalArticleImage> articleImages = JournalArticleImageUtil.findByG_A_V(article.getGroupId(), article.getArticleId(), article.getVersion()); for (JournalArticleImage articleImage : articleImages) { Image image = null; try { image = ImageUtil.findByPrimaryKey(articleImage.getArticleImageId()); } catch (NoSuchImageException nsie) { continue; } if (image.getTextObj() == null) { continue; } String articleImagePath = getArticleImagePath(portletDataContext, article, articleImage, image); if (!portletDataContext.isPathNotProcessed(articleImagePath)) { continue; } portletDataContext.addZipEntry(articleImagePath, image.getTextObj()); } } article.setStatusByUserUuid(article.getStatusByUserUuid()); if (portletDataContext.getBooleanParameter(_NAMESPACE, "embedded-assets")) { String content = exportReferencedContent(portletDataContext, dlFileEntryTypesElement, dlFoldersElement, dlFileEntriesElement, dlFileRanksElement, dlRepositoriesElement, dlRepositoryEntriesElement, articleElement, article.getContent()); article.setContent(content); } portletDataContext.addClassedModel(articleElement, path, article, _NAMESPACE); }
From source file:com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl.java
License:Open Source License
protected static String exportDLFileEntries(PortletDataContext portletDataContext, Element dlFileEntryTypesElement, Element dlFoldersElement, Element dlFileEntriesElement, Element dlFileRanksElement, Element dlRepositoriesElement, Element dlRepositoryEntriesElement, Element entityElement, String content, boolean checkDateRange) throws Exception { Group group = GroupLocalServiceUtil.getGroup(portletDataContext.getGroupId()); if (group.isStagingGroup()) { group = group.getLiveGroup();/*www . java2 s . c om*/ } if (group.isStaged() && !group.isStagedRemotely() && !group.isStagedPortlet(PortletKeys.DOCUMENT_LIBRARY)) { return content; } StringBuilder sb = new StringBuilder(content); int beginPos = content.length(); int currentLocation = -1; while (true) { currentLocation = content.lastIndexOf("/c/document_library/get_file?", beginPos); if (currentLocation == -1) { currentLocation = content.lastIndexOf("/documents/", beginPos); } if (currentLocation == -1) { return sb.toString(); } beginPos = currentLocation; int endPos1 = content.indexOf(CharPool.APOSTROPHE, beginPos); int endPos2 = content.indexOf(CharPool.CLOSE_BRACKET, beginPos); int endPos3 = content.indexOf(CharPool.CLOSE_CURLY_BRACE, beginPos); int endPos4 = content.indexOf(CharPool.CLOSE_PARENTHESIS, beginPos); int endPos5 = content.indexOf(CharPool.LESS_THAN, beginPos); int endPos6 = content.indexOf(CharPool.QUESTION, beginPos); int endPos7 = content.indexOf(CharPool.QUOTE, beginPos); int endPos8 = content.indexOf(CharPool.SPACE, beginPos); int endPos = endPos1; if ((endPos == -1) || ((endPos2 != -1) && (endPos2 < endPos))) { endPos = endPos2; } if ((endPos == -1) || ((endPos3 != -1) && (endPos3 < endPos))) { endPos = endPos3; } if ((endPos == -1) || ((endPos4 != -1) && (endPos4 < endPos))) { endPos = endPos4; } if ((endPos == -1) || ((endPos5 != -1) && (endPos5 < endPos))) { endPos = endPos5; } if ((endPos == -1) || ((endPos6 != -1) && (endPos6 < endPos))) { endPos = endPos6; } if ((endPos == -1) || ((endPos7 != -1) && (endPos7 < endPos))) { endPos = endPos7; } if ((endPos == -1) || ((endPos8 != -1) && (endPos8 < endPos))) { endPos = endPos8; } if ((beginPos == -1) || (endPos == -1)) { break; } try { String oldParameters = content.substring(beginPos, endPos); while (oldParameters.contains(StringPool.AMPERSAND_ENCODED)) { oldParameters = oldParameters.replace(StringPool.AMPERSAND_ENCODED, StringPool.AMPERSAND); } Map<String, String[]> map = new HashMap<String, String[]>(); if (oldParameters.startsWith("/documents/")) { String[] pathArray = oldParameters.split(StringPool.SLASH); map.put("groupId", new String[] { pathArray[2] }); if (pathArray.length == 4) { map.put("uuid", new String[] { pathArray[3] }); } else if (pathArray.length == 5) { map.put("folderId", new String[] { pathArray[3] }); String name = HttpUtil.decodeURL(pathArray[4]); int pos = name.indexOf(StringPool.QUESTION); if (pos != -1) { name = name.substring(0, pos); } map.put("name", new String[] { name }); } else if (pathArray.length > 5) { String uuid = pathArray[5]; int pos = uuid.indexOf(StringPool.QUESTION); if (pos != -1) { uuid = uuid.substring(0, pos); } map.put("uuid", new String[] { uuid }); } } else { oldParameters = oldParameters.substring(oldParameters.indexOf(CharPool.QUESTION) + 1); map = HttpUtil.parameterMapFromString(oldParameters); } FileEntry fileEntry = null; String uuid = MapUtil.getString(map, "uuid"); if (Validator.isNotNull(uuid)) { String groupIdString = MapUtil.getString(map, "groupId"); long groupId = GetterUtil.getLong(groupIdString); if (groupIdString.equals("@group_id@")) { groupId = portletDataContext.getScopeGroupId(); } fileEntry = DLAppLocalServiceUtil.getFileEntryByUuidAndGroupId(uuid, groupId); } else { String folderIdString = MapUtil.getString(map, "folderId"); if (Validator.isNotNull(folderIdString)) { long folderId = GetterUtil.getLong(folderIdString); String name = MapUtil.getString(map, "name"); String groupIdString = MapUtil.getString(map, "groupId"); long groupId = GetterUtil.getLong(groupIdString); if (groupIdString.equals("@group_id@")) { groupId = portletDataContext.getScopeGroupId(); } fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folderId, name); } } if (fileEntry == null) { beginPos--; continue; } DLPortletDataHandlerImpl.exportFileEntry(portletDataContext, dlFileEntryTypesElement, dlFoldersElement, dlFileEntriesElement, dlFileRanksElement, dlRepositoriesElement, dlRepositoryEntriesElement, fileEntry, checkDateRange); Element dlReferenceElement = entityElement.addElement("dl-reference"); dlReferenceElement.addAttribute("default-repository", String.valueOf(fileEntry.isDefaultRepository())); String path = null; if (fileEntry.isDefaultRepository()) { path = DLPortletDataHandlerImpl.getFileEntryPath(portletDataContext, fileEntry); } else { path = DLPortletDataHandlerImpl.getRepositoryEntryPath(portletDataContext, fileEntry.getFileEntryId()); } dlReferenceElement.addAttribute("path", path); String dlReference = "[$dl-reference=" + path + "$]"; sb.replace(beginPos, endPos, dlReference); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug(e, e); } else if (_log.isWarnEnabled()) { _log.warn(e.getMessage()); } } beginPos--; } return sb.toString(); }
From source file:com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl.java
License:Open Source License
protected static void exportStructure(PortletDataContext portletDataContext, Element structuresElement, JournalStructure structure) throws Exception { String path = getStructurePath(portletDataContext, structure); if (!portletDataContext.isPathNotProcessed(path)) { return;// ww w .ja v a 2s. co m } Element structureElement = structuresElement.addElement("structure"); String parentStructureId = structure.getParentStructureId(); if (Validator.isNotNull(parentStructureId)) { try { JournalStructure parentStructure = JournalStructureLocalServiceUtil .getStructure(structure.getGroupId(), parentStructureId, true); structureElement.addAttribute("parent-structure-uuid", parentStructure.getUuid()); exportStructure(portletDataContext, structuresElement, parentStructure); } catch (NoSuchStructureException nsse) { } } portletDataContext.addClassedModel(structureElement, path, structure, _NAMESPACE); }
From source file:com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl.java
License:Open Source License
protected static void exportTemplate(PortletDataContext portletDataContext, Element templatesElement, Element dlFileEntryTypesElement, Element dlFoldersElement, Element dlFileEntriesElement, Element dlFileRanksElement, Element dlRepositoriesElement, Element dlRepositoryEntriesElement, JournalTemplate template) throws Exception { String path = getTemplatePath(portletDataContext, template); if (!portletDataContext.isPathNotProcessed(path)) { return;// w ww .jav a 2 s .c om } // Clone this template to make sure changes to its content are never // persisted template = (JournalTemplate) template.clone(); Element templateElement = templatesElement.addElement("template"); if (template.isSmallImage()) { String smallImagePath = getTemplateSmallImagePath(portletDataContext, template); templateElement.addAttribute("small-image-path", smallImagePath); Image smallImage = ImageUtil.fetchByPrimaryKey(template.getSmallImageId()); template.setSmallImageType(smallImage.getType()); portletDataContext.addZipEntry(smallImagePath, smallImage.getTextObj()); } if (portletDataContext.getBooleanParameter(_NAMESPACE, "embedded-assets")) { String content = exportReferencedContent(portletDataContext, dlFileEntryTypesElement, dlFoldersElement, dlFileEntriesElement, dlFileRanksElement, dlRepositoriesElement, dlRepositoryEntriesElement, templateElement, template.getXsl()); template.setXsl(content); } portletDataContext.addClassedModel(templateElement, path, template, _NAMESPACE); }
From source file:com.liferay.portlet.journal.lar.JournalPortletDataHandlerImpl.java
License:Open Source License
@Override protected String doExportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { portletDataContext.addPermissions("com.liferay.portlet.journal", portletDataContext.getScopeGroupId()); Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("journal-data"); rootElement.addAttribute("group-id", String.valueOf(portletDataContext.getScopeGroupId())); Element structuresElement = rootElement.addElement("structures"); List<JournalStructure> structures = JournalStructureUtil.findByGroupId(portletDataContext.getScopeGroupId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, new StructurePKComparator(true)); //Modification start long processedItems = 0, itemsToprocess = 0; itemsToprocess += structures.size(); Element templatesElement = rootElement.addElement("templates"); Element dlFileEntryTypesElement = rootElement.addElement("dl-file-entry-types"); Element dlFoldersElement = rootElement.addElement("dl-folders"); Element dlFilesElement = rootElement.addElement("dl-file-entries"); Element dlFileRanksElement = rootElement.addElement("dl-file-ranks"); Element dlRepositoriesElement = rootElement.addElement("dl-repositories"); Element dlRepositoryEntriesElement = rootElement.addElement("dl-repository-entries"); List<JournalTemplate> templates = JournalTemplateUtil.findByGroupId(portletDataContext.getScopeGroupId()); itemsToprocess += templates.size();// w w w .j av a 2 s . c om Element feedsElement = rootElement.addElement("feeds"); List<JournalFeed> feeds = JournalFeedUtil.findByGroupId(portletDataContext.getScopeGroupId()); itemsToprocess += feeds.size(); List<JournalArticle> articles = new ArrayList<JournalArticle>(); if (portletDataContext.getBooleanParameter(_NAMESPACE, "web-content")) { articles = JournalArticleUtil.findByGroupId(portletDataContext.getScopeGroupId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, new ArticleIDComparator(true)); } itemsToprocess += articles.size(); StagingProgressUpdaterThreadLocal.getMonitor().getComponent(PublishProcessProgressMonitor.COMPONENT_JOURNAL) .setItemsCount(itemsToprocess); for (JournalStructure structure : structures) { StagingProgressUpdaterThreadLocal.getMonitor() .getComponent(PublishProcessProgressMonitor.COMPONENT_JOURNAL) .setItemsProcessed(processedItems++); if (portletDataContext.isWithinDateRange(structure.getModifiedDate())) { exportStructure(portletDataContext, structuresElement, structure); } } for (JournalTemplate template : templates) { StagingProgressUpdaterThreadLocal.getMonitor() .getComponent(PublishProcessProgressMonitor.COMPONENT_JOURNAL) .setItemsProcessed(processedItems++); if (portletDataContext.isWithinDateRange(template.getModifiedDate())) { exportTemplate(portletDataContext, templatesElement, dlFileEntryTypesElement, dlFoldersElement, dlFilesElement, dlFileRanksElement, dlRepositoriesElement, dlRepositoryEntriesElement, template); } } for (JournalFeed feed : feeds) { StagingProgressUpdaterThreadLocal.getMonitor() .getComponent(PublishProcessProgressMonitor.COMPONENT_JOURNAL) .setItemsProcessed(processedItems++); if (portletDataContext.isWithinDateRange(feed.getModifiedDate())) { exportFeed(portletDataContext, feedsElement, feed); } } Element articlesElement = rootElement.addElement("articles"); for (JournalArticle article : articles) { StagingProgressUpdaterThreadLocal.getMonitor() .getComponent(PublishProcessProgressMonitor.COMPONENT_JOURNAL) .setItemsProcessed(processedItems++); exportArticle(portletDataContext, articlesElement, structuresElement, templatesElement, dlFileEntryTypesElement, dlFoldersElement, dlFilesElement, dlFileRanksElement, dlRepositoriesElement, dlRepositoryEntriesElement, article, null, true); } //Modification end return document.formattedString(); }
From source file:com.liferay.portlet.journal.model.impl.JournalStructureImpl.java
License:Open Source License
protected void addParentStructureId(Element parentEl, String parentStructureId) { Iterator<Element> itr = parentEl.elements(_DYNAMIC_ELEMENT).iterator(); while (itr.hasNext()) { Element dynamicEl = itr.next(); dynamicEl.addAttribute(_PARENT_STRUCTURE_ID, parentStructureId); addParentStructureId(dynamicEl, parentStructureId); }/* w w w. j a va2 s.c o m*/ }
From source file:com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.java
License:Open Source License
protected void copyArticleImages(JournalArticle oldArticle, JournalArticle newArticle) throws Exception { Document contentDoc = SAXReaderUtil.read(oldArticle.getContent()); XPath xPathSelector = SAXReaderUtil.createXPath("//dynamic-element[@type='image']"); List<Node> imageNodes = xPathSelector.selectNodes(contentDoc); for (Node imageNode : imageNodes) { Element imageEl = (Element) imageNode; String instanceId = imageEl.attributeValue("instance-id"); String name = imageEl.attributeValue("name"); List<Element> dynamicContentEls = imageEl.elements("dynamic-content"); for (Element dynamicContentEl : dynamicContentEls) { long imageId = GetterUtil.getLong(dynamicContentEl.attributeValue("id")); String languageId = dynamicContentEl.attributeValue("language-id"); Image oldImage = null; try { oldImage = imageLocalService.getImage(imageId); } catch (NoSuchImageException nsie) { continue; }/*w ww . j ava2s. c o m*/ imageId = journalArticleImageLocalService.getArticleImageId(newArticle.getGroupId(), newArticle.getArticleId(), newArticle.getVersion(), instanceId, name, languageId); imageLocalService.updateImage(imageId, oldImage.getTextObj()); String elContent = "/image/journal/article?img_id=" + imageId + "&t=" + WebServerServletTokenUtil.getToken(imageId); dynamicContentEl.setText(elContent); dynamicContentEl.addAttribute("id", String.valueOf(imageId)); } } newArticle.setContent(contentDoc.formattedString()); }
From source file:com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.java
License:Open Source License
protected void formatImage(long groupId, String articleId, double version, boolean incrementVersion, Element el, String elInstanceId, String elName, Map<String, byte[]> images) throws PortalException, SystemException { List<Element> imageContents = el.elements("dynamic-content"); for (Element dynamicContent : imageContents) { String elLanguage = dynamicContent.attributeValue("language-id", StringPool.BLANK); if (!elLanguage.equals(StringPool.BLANK)) { elLanguage = "_" + elLanguage; }//from ww w .j a v a 2 s .c o m long imageId = journalArticleImageLocalService.getArticleImageId(groupId, articleId, version, elInstanceId, elName, elLanguage); double oldVersion = MathUtil.format(version - 0.1, 1, 1); long oldImageId = 0; if ((oldVersion >= 1) && incrementVersion) { oldImageId = journalArticleImageLocalService.getArticleImageId(groupId, articleId, oldVersion, elInstanceId, elName, elLanguage); } String elContent = "/image/journal/article?img_id=" + imageId + "&t=" + WebServerServletTokenUtil.getToken(imageId); if (dynamicContent.getText().equals("delete")) { dynamicContent.setText(StringPool.BLANK); imageLocalService.deleteImage(imageId); String defaultElLanguage = ""; if (!Validator.isNotNull(elLanguage)) { defaultElLanguage = "_" + LocaleUtil.toLanguageId(LocaleUtil.getDefault()); } long defaultImageId = journalArticleImageLocalService.getArticleImageId(groupId, articleId, version, elInstanceId, elName, defaultElLanguage); imageLocalService.deleteImage(defaultImageId); continue; } byte[] bytes = images.get(elInstanceId + "_" + elName + elLanguage); if ((bytes != null) && (bytes.length > 0)) { dynamicContent.setText(elContent); dynamicContent.addAttribute("id", String.valueOf(imageId)); imageLocalService.updateImage(imageId, bytes); continue; } if ((version > JournalArticleConstants.VERSION_DEFAULT) && (incrementVersion)) { Image oldImage = null; if (oldImageId > 0) { oldImage = imageLocalService.getImage(oldImageId); } if (oldImage != null) { dynamicContent.setText(elContent); dynamicContent.addAttribute("id", String.valueOf(imageId)); bytes = oldImage.getTextObj(); imageLocalService.updateImage(imageId, bytes); } continue; } Image image = imageLocalService.getImage(imageId); if (image != null) { dynamicContent.setText(elContent); dynamicContent.addAttribute("id", String.valueOf(imageId)); continue; } long contentImageId = GetterUtil.getLong(HttpUtil.getParameter(dynamicContent.getText(), "img_id")); if (contentImageId <= 0) { contentImageId = GetterUtil .getLong(HttpUtil.getParameter(dynamicContent.getText(), "img_id", false)); } if (contentImageId > 0) { image = imageLocalService.getImage(contentImageId); if (image != null) { dynamicContent.addAttribute("id", String.valueOf(contentImageId)); continue; } } String defaultElLanguage = ""; if (!Validator.isNotNull(elLanguage)) { defaultElLanguage = "_" + LocaleUtil.toLanguageId(LocaleUtil.getDefault()); } long defaultImageId = journalArticleImageLocalService.getArticleImageId(groupId, articleId, version, elInstanceId, elName, defaultElLanguage); Image defaultImage = imageLocalService.getImage(defaultImageId); if (defaultImage != null) { dynamicContent.setText(elContent); dynamicContent.addAttribute("id", String.valueOf(defaultImageId)); bytes = defaultImage.getTextObj(); imageLocalService.updateImage(defaultImageId, bytes); continue; } if (Validator.isNotNull(elLanguage)) { dynamicContent.setText(StringPool.BLANK); } } }