protected String extractDDMContent(JournalArticle article, String languageId) throws Exception { DDMStructure ddmStructure = _ddmStructureLocalService.fetchStructure( article.getGroupId(), PortalUtil.getClassNameId(JournalArticle.class), article.getDDMStructureKey(), true); if (ddmStructure == null) { return StringPool.BLANK; } DDMFormValues ddmFormValues = null; try { Fields fields = JournalConverterUtil.getDDMFields(ddmStructure, article.getDocument()); ddmFormValues = FieldsToDDMFormValuesConverterUtil.convert(ddmStructure, fields); } catch (Exception e) { return StringPool.BLANK; } if (ddmFormValues == null) { return StringPool.BLANK; } return DDMIndexerUtil.extractAttributes( ddmStructure, ddmFormValues, LocaleUtil.fromLanguageId(languageId)); }
protected void addDDMStructureAttributes(Document document, JournalArticle article) throws Exception { DDMStructure ddmStructure = _ddmStructureLocalService.fetchStructure( article.getGroupId(), PortalUtil.getClassNameId(JournalArticle.class), article.getDDMStructureKey(), true); if (ddmStructure == null) { return; } document.addKeyword(Field.CLASS_TYPE_ID, ddmStructure.getStructureId()); DDMFormValues ddmFormValues = null; try { Fields fields = JournalConverterUtil.getDDMFields(ddmStructure, article.getDocument()); ddmFormValues = FieldsToDDMFormValuesConverterUtil.convert(ddmStructure, fields); } catch (Exception e) { return; } if (ddmFormValues != null) { DDMIndexerUtil.addAttributes(document, ddmStructure, ddmFormValues); } }