protected Timer parseTimerElement(Element timerElement, boolean isTaskTimer) { String name = timerElement.elementText("name"); String description = timerElement.elementText("description"); boolean blocking = GetterUtil.getBoolean(timerElement.elementText("blocking"), !isTaskTimer); Timer timer = new Timer(name, description, blocking); Element delayElement = timerElement.element("delay"); DelayDuration delayDuration = parseDelay(delayElement); timer.setDelayDuration(delayDuration); if (!blocking) { Element recurrenceElement = timerElement.element("recurrence"); DelayDuration recurrence = parseDelay(recurrenceElement); timer.setRecurrence(recurrence); } Element timerActions = timerElement.element("timer-actions"); parseTimerActions(timerActions, timer); return timer; }
protected void parseTransition(Definition definition, Element nodeElement) { String sourceName = nodeElement.elementText("name"); Node sourceNode = definition.getNode(sourceName); Element transitionsElement = nodeElement.element("transitions"); if (transitionsElement == null) { return; } List<Element> transitionElements = transitionsElement.elements("transition"); for (Element transitionElement : transitionElements) { String transitionName = transitionElement.elementText("name"); String targetName = transitionElement.elementText("target"); Node targetNode = definition.getNode(targetName); boolean defaultValue = GetterUtil.getBoolean(transitionElement.elementText("default"), true); Transition transition = new Transition(transitionName, sourceNode, targetNode, defaultValue); Element timerElement = transitionElement.element("timer"); if (timerElement != null) { Timer timer = parseTimerElement(timerElement, false); transition.setTimers(timer); } sourceNode.addTransition(transition); } }
protected void parseNotificationElements( List<Element> notificationElements, NotificationAware notificationAware) { if (notificationElements.isEmpty()) { return; } Set<Notification> notifications = new HashSet<Notification>(notificationElements.size()); for (Element notificationElement : notificationElements) { String name = notificationElement.elementText("name"); String description = notificationElement.elementText("description"); String executionType = notificationElement.elementText("execution-type"); String template = notificationElement.elementText("template"); String templateLanguage = notificationElement.elementText("template-language"); Notification notification = new Notification(name, description, executionType, template, templateLanguage); List<Element> notificationTypeElements = notificationElement.elements("notification-type"); for (Element notificationTypeElement : notificationTypeElements) { notification.addNotificationType(notificationTypeElement.getText()); } Element recipientsElement = notificationElement.element("recipients"); parseRecipients(recipientsElement, notification); notifications.add(notification); } notificationAware.setNotifications(notifications); }
protected Task parseTask(Element taskElement) { String name = taskElement.elementText("name"); String description = taskElement.elementText("description"); Task task = new Task(name, description); String metadata = taskElement.elementText("metadata"); task.setMetadata(metadata); Element actionsElement = taskElement.element("actions"); parseActionsElement(actionsElement, task); Element assignmentsElement = taskElement.element("assignments"); if (assignmentsElement != null) { Set<Assignment> assignments = parseAssignments(assignmentsElement); task.setAssignments(assignments); } Element timersElement = taskElement.element("task-timers"); parseTaskTimerElements(timersElement, task); return task; }
protected String getDynamicDDMStructureXSD(String fileName, String dynamicDDMStructureName) throws DocumentException { List<Element> structureElements = getDDMStructures(fileName); for (Element structureElement : structureElements) { boolean dynamicStructure = GetterUtil.getBoolean(structureElement.elementText("dynamic-structure")); if (!dynamicStructure) { continue; } String name = structureElement.elementText("name"); if (!name.equals(dynamicDDMStructureName)) { continue; } Element structureElementRootElement = structureElement.element("root"); return structureElementRootElement.asXML(); } return null; }
/* * Reads 'resource-bundle' property from portlet.xml * */ private static boolean readPortletXML( String xml, ServletContext servletContext, String bundleName) throws DocumentException { boolean resourceBundleSpecified = false; Document document = SAXReaderUtil.read(xml, true); Element rootElement = document.getRootElement(); for (Element portletElement : rootElement.elements("portlet")) { String resourceBundleString = portletElement.elementText("resource-bundle"); if (StringUtils.isNotBlank(resourceBundleString)) { String resourceBundleName = portletElement.elementText("resource-bundle").replace('.', '/'); if (resourceBundleName != null) { resourceBundleSpecified = true; processBundle(resourceBundleName, servletContext, bundleName); } } } return resourceBundleSpecified; }
protected void importSQL() throws Exception { Class<?> clazz = getClass(); ClassLoader classLoader = clazz.getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream("/resources/data/sql.xml"); String xml = new String(FileUtil.getBytes(inputStream)); Document document = SAXReaderUtil.read(xml); Element rootElement = document.getRootElement(); List<Element> batchElements = rootElement.elements("batch"); for (Element batchElement : batchElements) { String testSQL = batchElement.elementText("test-sql"); int count = getCount(testSQL); if (count > 0) { continue; } String[] importSQLs = StringUtil.split(batchElement.elementText("import-sql"), StringPool.SEMICOLON); runSQL(importSQLs); } }
protected void readExpandoTables(PortletDataContext portletDataContext) throws Exception { String xml = portletDataContext.getZipEntryAsString( ExportImportPathUtil.getSourceRootPath(portletDataContext) + "/expando-tables.xml"); if (xml == null) { return; } Document document = SAXReaderUtil.read(xml); Element rootElement = document.getRootElement(); List<Element> expandoTableElements = rootElement.elements("expando-table"); for (Element expandoTableElement : expandoTableElements) { String className = expandoTableElement.attributeValue("class-name"); ExpandoTable expandoTable = null; try { expandoTable = _expandoTableLocalService.getDefaultTable(portletDataContext.getCompanyId(), className); } catch (NoSuchTableException nste) { expandoTable = _expandoTableLocalService.addDefaultTable(portletDataContext.getCompanyId(), className); } List<Element> expandoColumnElements = expandoTableElement.elements("expando-column"); for (Element expandoColumnElement : expandoColumnElements) { long columnId = GetterUtil.getLong(expandoColumnElement.attributeValue("column-id")); String name = expandoColumnElement.attributeValue("name"); int type = GetterUtil.getInteger(expandoColumnElement.attributeValue("type")); String defaultData = expandoColumnElement.elementText("default-data"); String typeSettings = expandoColumnElement.elementText("type-settings"); Serializable defaultDataObject = ExpandoConverterUtil.getAttributeFromString(type, defaultData); ExpandoColumn expandoColumn = _expandoColumnLocalService.getColumn(expandoTable.getTableId(), name); if (expandoColumn != null) { _expandoColumnLocalService.updateColumn( expandoColumn.getColumnId(), name, type, defaultDataObject); } else { expandoColumn = _expandoColumnLocalService.addColumn( expandoTable.getTableId(), name, type, defaultDataObject); } _expandoColumnLocalService.updateTypeSettings(expandoColumn.getColumnId(), typeSettings); portletDataContext.importPermissions( ExpandoColumn.class, columnId, expandoColumn.getColumnId()); } } }
protected void processSpecialPages( long userId, WikiNode node, Element rootElement, List<String> specialNamespaces) throws PortalException { ProgressTracker progressTracker = ProgressTrackerThreadLocal.getProgressTracker(); List<Element> pageElements = rootElement.elements("page"); for (int i = 0; i < pageElements.size(); i++) { Element pageElement = pageElements.get(i); String title = pageElement.elementText("title"); if (!title.startsWith("Category:")) { if (isSpecialMediaWikiPage(title, specialNamespaces)) { rootElement.remove(pageElement); } continue; } String categoryName = title.substring("Category:".length()); categoryName = normalize(categoryName, 75); Element revisionElement = pageElement.element("revision"); String description = revisionElement.elementText("text"); description = normalizeDescription(description); try { AssetTag assetTag = null; try { assetTag = AssetTagLocalServiceUtil.getTag(node.getCompanyId(), categoryName); } catch (NoSuchTagException nste) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(node.getGroupId()); assetTag = AssetTagLocalServiceUtil.addTag(userId, categoryName, null, serviceContext); } if (Validator.isNotNull(description)) { AssetTagPropertyLocalServiceUtil.addTagProperty( userId, assetTag.getTagId(), "description", description); } } catch (SystemException se) { _log.error(se, se); } if ((i % 5) == 0) { progressTracker.setPercent((i * 10) / pageElements.size()); } } }
protected Definition doParse(InputStream inputStream) throws Exception { Document document = SAXReaderUtil.read(inputStream, _validate); Element rootElement = document.getRootElement(); String name = rootElement.elementText("name"); String description = rootElement.elementText("description"); int version = GetterUtil.getInteger(rootElement.elementText("version")); Definition definition = new Definition(name, description, document.formattedString(), version); List<Element> conditionElements = rootElement.elements("condition"); for (Element conditionElement : conditionElements) { Condition condition = parseCondition(conditionElement); definition.addNode(condition); } List<Element> forkElements = rootElement.elements("fork"); for (Element forkElement : forkElements) { Fork fork = parseFork(forkElement); definition.addNode(fork); } List<Element> joinElements = rootElement.elements("join"); for (Element joinElement : joinElements) { Join join = parseJoin(joinElement); definition.addNode(join); } List<Element> stateElements = rootElement.elements("state"); for (Element stateElement : stateElements) { State state = parseState(stateElement); definition.addNode(state); } List<Element> taskElements = rootElement.elements("task"); for (Element taskElement : taskElements) { Task task = parseTask(taskElement); definition.addNode(task); } parseTransitions( definition, conditionElements, forkElements, joinElements, stateElements, taskElements); return definition; }
protected DelayDuration parseDelay(Element delayElement) { if (delayElement == null) { return null; } double duration = GetterUtil.getDouble(delayElement.elementText("duration")); DurationScale durationScale = DurationScale.parse(delayElement.elementText("scale")); return new DelayDuration(duration, durationScale); }
private void _readColorSchemes( Element themeElement, Map<String, ColorScheme> colorSchemes, ContextReplace themeContextReplace) { List<Element> colorSchemeElements = themeElement.elements("color-scheme"); for (Element colorSchemeElement : colorSchemeElements) { ContextReplace colorSchemeContextReplace = (ContextReplace) themeContextReplace.clone(); String id = colorSchemeElement.attributeValue("id"); colorSchemeContextReplace.addValue("color-scheme-id", id); ColorScheme colorSchemeModel = colorSchemes.get(id); if (colorSchemeModel == null) { colorSchemeModel = new ColorSchemeImpl(id); } String name = GetterUtil.getString( colorSchemeElement.attributeValue("name"), colorSchemeModel.getName()); name = colorSchemeContextReplace.replace(name); boolean defaultCs = GetterUtil.getBoolean( colorSchemeElement.elementText("default-cs"), colorSchemeModel.isDefaultCs()); String cssClass = GetterUtil.getString( colorSchemeElement.elementText("css-class"), colorSchemeModel.getCssClass()); cssClass = colorSchemeContextReplace.replace(cssClass); colorSchemeContextReplace.addValue("css-class", cssClass); String colorSchemeImagesPath = GetterUtil.getString( colorSchemeElement.elementText("color-scheme-images-path"), colorSchemeModel.getColorSchemeImagesPath()); colorSchemeImagesPath = colorSchemeContextReplace.replace(colorSchemeImagesPath); colorSchemeContextReplace.addValue("color-scheme-images-path", colorSchemeImagesPath); colorSchemeModel.setName(name); colorSchemeModel.setDefaultCs(defaultCs); colorSchemeModel.setCssClass(cssClass); colorSchemeModel.setColorSchemeImagesPath(colorSchemeImagesPath); colorSchemes.put(id, colorSchemeModel); } }
public static Tuple getElements(String xml, String className, int inactiveGroupsCount) { List<Element> resultRows = new ArrayList<>(); int totalRows = 0; try { xml = XMLUtil.stripInvalidChars(xml); Document document = SAXReaderUtil.read(xml); Element rootElement = document.getRootElement(); List<Element> elements = rootElement.elements("entry"); totalRows = GetterUtil.getInteger( rootElement.elementText( OpenSearchUtil.getQName("totalResults", OpenSearchUtil.OS_NAMESPACE))); for (Element element : elements) { try { long entryScopeGroupId = GetterUtil.getLong( element.elementText( OpenSearchUtil.getQName("scopeGroupId", OpenSearchUtil.LIFERAY_NAMESPACE))); if ((entryScopeGroupId != 0) && (inactiveGroupsCount > 0)) { Group entryGroup = GroupServiceUtil.getGroup(entryScopeGroupId); if (entryGroup.isLayout()) { entryGroup = GroupLocalServiceUtil.getGroup(entryGroup.getParentGroupId()); } if (!entryGroup.isActive()) { totalRows--; continue; } } resultRows.add(element); } catch (Exception e) { _log.error("Unable to retrieve individual search result for " + className, e); totalRows--; } } } catch (Exception e) { _log.error("Unable to display content for " + className, e); } return new Tuple(resultRows, totalRows); }
protected void addDDMStructures( long userId, long groupId, long classNameId, String fileName, ServiceContext serviceContext) throws DocumentException, PortalException, SystemException { List<Element> structureElements = getDDMStructures(fileName); for (Element structureElement : structureElements) { boolean dynamicStructure = GetterUtil.getBoolean(structureElement.elementText("dynamic-structure")); if (dynamicStructure) { continue; } String name = structureElement.elementText("name"); String description = structureElement.elementText("description"); String ddmStructureKey = name; DDMStructure ddmStructure = DDMStructureLocalServiceUtil.fetchStructure(groupId, ddmStructureKey); if (ddmStructure != null) { continue; } Element structureElementRootElement = structureElement.element("root"); String xsd = structureElementRootElement.asXML(); Map<Locale, String> nameMap = new HashMap<Locale, String>(); nameMap.put(LocaleUtil.getDefault(), name); Map<Locale, String> descriptionMap = new HashMap<Locale, String>(); descriptionMap.put(LocaleUtil.getDefault(), description); DDMStructureLocalServiceUtil.addStructure( userId, groupId, classNameId, ddmStructureKey, nameMap, descriptionMap, xsd, "xml", DDMStructureConstants.TYPE_DEFAULT, serviceContext); } }
@Override public void removeAndStoreSelection( List<String> assetEntryUuids, PortletPreferences portletPreferences) throws Exception { if (assetEntryUuids.size() == 0) { return; } String[] assetEntryXmls = portletPreferences.getValues("assetEntryXml", new String[0]); List<String> assetEntryXmlsList = ListUtil.fromArray(assetEntryXmls); Iterator<String> itr = assetEntryXmlsList.iterator(); while (itr.hasNext()) { String assetEntryXml = itr.next(); Document document = SAXReaderUtil.read(assetEntryXml); Element rootElement = document.getRootElement(); String assetEntryUuid = rootElement.elementText("asset-entry-uuid"); if (assetEntryUuids.contains(assetEntryUuid)) { itr.remove(); } } portletPreferences.setValues( "assetEntryXml", assetEntryXmlsList.toArray(new String[assetEntryXmlsList.size()])); portletPreferences.store(); }
protected String addBasicWebContentStructureAndTemplate(long companyId) throws Exception { initJournalDDMCompositeModelsResourceActions(); Group group = _groupLocalService.getCompanyGroup(companyId); long defaultUserId = _userLocalService.getDefaultUserId(companyId); Class<?> clazz = getClass(); _defaultDDMStructureHelper.addDDMStructures( defaultUserId, group.getGroupId(), PortalUtil.getClassNameId(JournalArticle.class), clazz.getClassLoader(), "com/liferay/journal/internal/upgrade/v1_0_0/dependencies" + "/basic-web-content-structure.xml", new ServiceContext()); String defaultLanguageId = UpgradeProcessUtil.getDefaultLanguageId(companyId); Locale defaultLocale = LocaleUtil.fromLanguageId(defaultLanguageId); List<Element> structureElements = getDDMStructures(defaultLocale); Element structureElement = structureElements.get(0); return StringUtil.toUpperCase(structureElement.elementText("name")); }
private String _getJavaClassComment(Element rootElement, JavaClass javaClass) { StringBundler sb = new StringBundler(); String indent = StringPool.BLANK; sb.append("/**\n"); String comment = rootElement.elementText("comment"); if (Validator.isNotNull(comment)) { sb.append(_wrapText(comment, indent + " * ")); } String docletTags = _addDocletTags( rootElement, new String[] {"author", "version", "see", "since", "serial", "deprecated"}, indent + " * ", _hasPublicModifier(javaClass)); if (Validator.isNotNull(docletTags)) { if (_initializeMissingJavadocs || Validator.isNotNull(comment)) { sb.append(" *\n"); } sb.append(docletTags); } sb.append(" */\n"); return sb.toString(); }
private void _updateLanguageProperties(Document document, String className) throws IOException { if (_languageProperties == null) { return; } int index = className.indexOf("ServiceImpl"); if (index <= 0) { return; } StringBundler sb = new StringBundler(); sb.append(Character.toLowerCase(className.charAt(0))); for (int i = 1; i < index; i++) { char c = className.charAt(i); if (Character.isUpperCase(c)) { if (((i + 1) < index) && Character.isLowerCase(className.charAt(i + 1))) { sb.append(CharPool.DASH); } sb.append(Character.toLowerCase(c)); } else { sb.append(c); } } sb.append("-service-help"); String key = sb.toString(); String value = _languageProperties.getProperty(key); if (value == null) { return; } Element rootElement = document.getRootElement(); String comment = rootElement.elementText("comment"); if ((comment == null) || value.equals(comment)) { return; } index = comment.indexOf("\n\n"); if (index != -1) { value = comment.substring(0, index); } else { value = comment; } _updateLanguageProperties(key, value); }
protected void parseActionElements(List<Element> actionElements, ActionAware actionAware) { if (actionElements.isEmpty()) { return; } Set<Action> actions = new HashSet<Action>(actionElements.size()); for (Element actionElement : actionElements) { String name = actionElement.elementText("name"); String description = actionElement.elementText("description"); String executionType = actionElement.elementText("execution-type"); String script = actionElement.elementText("script"); String scriptLanguage = actionElement.elementText("script-language"); String scriptRequiredContexts = actionElement.elementText("script-required-contexts"); int priority = GetterUtil.getInteger(actionElement.elementText("priority")); Action action = new Action( name, description, executionType, script, scriptLanguage, scriptRequiredContexts, priority); actions.add(action); } actionAware.setActions(actions); }
private String _getJavaMethodComment( String[] lines, Map<String, Element> methodElementsMap, JavaMethod javaMethod) { String methodKey = _getMethodKey(javaMethod); Element methodElement = methodElementsMap.get(methodKey); if (methodElement == null) { return null; } String indent = _getIndent(lines, javaMethod); StringBundler sb = new StringBundler(); sb.append(indent); sb.append("/**\n"); String comment = methodElement.elementText("comment"); if (Validator.isNotNull(comment)) { sb.append(_wrapText(comment, indent + " * ")); } String docletTags = _addDocletTags( methodElement, new String[] {"version", "param", "return", "throws", "see", "since", "deprecated"}, indent + " * ", _hasPublicModifier(javaMethod)); if (Validator.isNotNull(docletTags)) { if (_initializeMissingJavadocs || Validator.isNotNull(comment)) { sb.append(indent); sb.append(" *\n"); } sb.append(docletTags); } sb.append(indent); sb.append(" */\n"); if (!_initializeMissingJavadocs && Validator.isNull(comment) && Validator.isNull(docletTags)) { return null; } if (!_hasPublicModifier(javaMethod) && Validator.isNull(comment) && Validator.isNull(docletTags)) { return null; } return sb.toString(); }
private String _getMethodKey(Element methodElement) { StringBuilder sb = new StringBuilder(); sb.append(methodElement.elementText("name")); sb.append("("); List<Element> paramElements = methodElement.elements("param"); for (Element paramElement : paramElements) { sb.append(paramElement.elementText("name")); sb.append("|"); sb.append(paramElement.elementText("type")); sb.append(","); } sb.append(")"); return sb.toString(); }
private String _getMethodKey(Element methodElement) { StringBundler sb = new StringBundler(); sb.append(methodElement.elementText("name")); sb.append(StringPool.OPEN_PARENTHESIS); List<Element> paramElements = methodElement.elements("param"); for (Element paramElement : paramElements) { sb.append(paramElement.elementText("name")); sb.append("|"); sb.append(paramElement.elementText("type")); sb.append(","); } sb.append(StringPool.CLOSE_PARENTHESIS); return sb.toString(); }
public static void setLanguageIds(Element root) { _languageIds = new HashSet<>(); List<Element> rootElements = root.elements("servlet-mapping"); for (Element element : rootElements) { String servletName = element.elementText("servlet-name"); if (servletName.equals("I18n Servlet")) { String urlPattern = element.elementText("url-pattern"); String languageId = urlPattern.substring(0, urlPattern.lastIndexOf(CharPool.SLASH)); _languageIds.add(languageId); } } _languageIds = Collections.unmodifiableSet(_languageIds); }
protected Fork parseFork(Element forkElement) { String name = forkElement.elementText("name"); String description = forkElement.elementText("description"); Fork fork = new Fork(name, description); String metadata = forkElement.elementText("metadata"); fork.setMetadata(metadata); Element actionsElement = forkElement.element("actions"); parseActionsElement(actionsElement, fork); Element timersElement = forkElement.element("timers"); parseTimerElements(timersElement, fork); return fork; }
protected Join parseJoin(Element joinElement) { String name = joinElement.elementText("name"); String description = joinElement.elementText("description"); Join join = new Join(name, description); String metadata = joinElement.elementText("metadata"); join.setMetadata(metadata); Element actionsElement = joinElement.element("actions"); parseActionsElement(actionsElement, join); Element timersElement = joinElement.element("timers"); parseTimerElements(timersElement, join); return join; }
private void _detachUnnecessaryTypes(Element rootElement) { List<Element> elements = rootElement.elements(); for (Element element : elements) { String type = element.elementText("type"); if (!type.contains(".service.") || !type.endsWith("ServiceImpl")) { element.detach(); } } }
protected State parseState(Element stateElement) { String name = stateElement.elementText("name"); String description = stateElement.elementText("description"); boolean initial = GetterUtil.getBoolean(stateElement.elementText("initial"), false); State state = new State(name, description, initial); String metadata = stateElement.elementText("metadata"); state.setMetadata(metadata); Element actionsElement = stateElement.element("actions"); parseActionsElement(actionsElement, state); Element timersElement = stateElement.element("timers"); parseTimerElements(timersElement, state); return state; }
protected ThemeLoader(String servletContextName, ServletContext servletContext, String[] xmls) { _servletContextName = servletContextName; _servletContext = servletContext; try { Document doc = SAXReaderUtil.read(xmls[0], true); Element root = doc.getRootElement(); _themesPath = GetterUtil.getString(root.elementText("themes-path"), "/themes"); String fileStorageValue = PropsValues.THEME_LOADER_STORAGE_PATH; fileStorageValue = GetterUtil.getString(root.elementText("file-storage"), fileStorageValue); if (Validator.isNotNull(fileStorageValue)) { _fileStorage = new File(fileStorageValue); _loadFromServletContext = false; } else { _fileStorage = new File(servletContext.getRealPath(_themesPath)); _loadFromServletContext = true; } if (!_fileStorage.exists()) { if (_log.isWarnEnabled()) { _log.warn("File storage " + _fileStorage + " does not exist"); } if (!_fileStorage.mkdirs()) { _log.error("Unable to create theme loader file storage at " + _fileStorage); } } } catch (Exception e) { _log.error(e, e); } loadThemes(); }
protected void parseRecipients(Element recipientsElement, Notification notification) { if (recipientsElement == null) { return; } List<Element> addressRecipientElements = recipientsElement.elements("address"); for (Element addressRecipientElement : addressRecipientElements) { AddressRecipient addressRecipient = new AddressRecipient(addressRecipientElement.getText()); notification.addRecipients(addressRecipient); } Element rolesElement = recipientsElement.element("roles"); if (rolesElement != null) { List<Element> roleReceipientElements = rolesElement.elements("role"); for (Element roleReceipientElement : roleReceipientElements) { long roleId = GetterUtil.getLong(roleReceipientElement.elementText("role-id")); String roleType = roleReceipientElement.elementText("role-type"); String name = roleReceipientElement.elementText("name"); RoleRecipient roleRecipient = null; if (roleId > 0) { roleRecipient = new RoleRecipient(roleId, roleType); } else { roleRecipient = new RoleRecipient(name, roleType); boolean autoCreate = GetterUtil.getBoolean(roleReceipientElement.elementText("auto-create"), true); roleRecipient.setAutoCreate(autoCreate); } notification.addRecipients(roleRecipient); } } List<Element> userRecipientElements = recipientsElement.elements("user"); for (Element userRecipientElement : userRecipientElements) { long userId = GetterUtil.getLong(userRecipientElement.elementText("user-id")); String screenName = userRecipientElement.elementText("screen-name"); String emailAddress = userRecipientElement.elementText("email-address"); UserRecipient userRecipient = new UserRecipient(userId, screenName, emailAddress); notification.addRecipients(userRecipient); } }
private void _addDocletTags(Element parentElement, String name, String indent, StringBuilder sb) { List<Element> elements = parentElement.elements(name); for (Element element : elements) { sb.append(indent); sb.append(" * @"); sb.append(name); sb.append(" "); Element commentElement = element.element("comment"); if (commentElement != null) { sb.append(element.elementText("name")); sb.append(" "); sb.append(_getCDATA(element.elementText("comment"))); } else { sb.append(_getCDATA(element.getText())); } sb.append("\n"); } }