org.jdom.Element Java Examples

The following examples show how to use org.jdom.Element. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlElementStorage.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
protected final Element getElement(@Nonnull StorageData data, boolean collapsePaths, @Nonnull Map<String, Element> newLiveStates) {
  Element element = data.save(newLiveStates);
  if (element == null || JDOMUtil.isEmpty(element)) {
    return null;
  }

  if (collapsePaths && myPathMacroSubstitutor != null) {
    try {
      myPathMacroSubstitutor.collapsePaths(element);
    }
    finally {
      myPathMacroSubstitutor.reset();
    }
  }

  return element;
}
 
Example #2
Source File: AddressCorrelatorManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public void writeConfigState(SaveState saveState) {
	Element correlatorsRootElement = new Element(ADDRESS_CORRELATORS_ELEMENT_NAME);

	for (AddressCorrelator correlator : correlatorList) {
		Element correlatorSubElement = new Element(ADDRESS_CORRELATOR_SUB_ELEMENT_NAME);
		correlatorSubElement.setAttribute(ADDRESS_CORRELATOR_NAME_KEY,
			correlator.getClass().getName());

		ToolOptions options = correlator.getOptions();
		Element optionsSubElement = new Element(ADDRESS_CORRELATOR_OPTIONS_SUB_ELEMENT);
		Element optionsXMLContent = options.getXmlRoot(true);
		optionsSubElement.addContent(optionsXMLContent);
		correlatorSubElement.addContent(optionsSubElement);
		correlatorsRootElement.addContent(correlatorSubElement);
	}

	saveState.putXmlElement(ADDRESS_CORRELATORS_ELEMENT_NAME, correlatorsRootElement);

}
 
Example #3
Source File: RunnerLayout.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public Element read(@Nonnull Element parentNode) {
  List<Element> tabs = parentNode.getChildren(StringUtil.getShortName(TabImpl.class.getName()));
  for (Element eachTabElement : tabs) {
    TabImpl eachTab = XmlSerializer.deserialize(eachTabElement, TabImpl.class);
    assert eachTab != null;
    XmlSerializer.deserializeInto(getOrCreateTab(eachTab.getIndex()), eachTabElement);
  }

  final List views = parentNode.getChildren(StringUtil.getShortName(ViewImpl.class.getName()));
  for (Object content : views) {
    final ViewImpl state = new ViewImpl(this, (Element)content);
    myViews.put(state.getID(), state);
  }

  XmlSerializer.deserializeInto(myGeneral, parentNode.getChild(StringUtil.getShortName(myGeneral.getClass().getName(), '$')));

  return parentNode;
}
 
Example #4
Source File: CustomActionsSchema.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void readIcons(Element parent) {
  for (Object actionO : parent.getChildren(ELEMENT_ACTION)) {
    Element action = (Element)actionO;
    final String actionId = action.getAttributeValue(ATTRIBUTE_ID);
    final String iconPath = action.getAttributeValue(ATTRIBUTE_ICON);
    if (actionId != null) {
      myIconCustomizations.put(actionId, iconPath);
    }
  }
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      initActionIcons();
    }
  });
}
 
Example #5
Source File: AbstractFileType.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
static List<Pair<FileNameMatcher, String>> readAssociations(@Nonnull Element element) {
  List<Element> children = element.getChildren(ELEMENT_MAPPING);
  if (children.isEmpty()) {
    return Collections.emptyList();
  }

  List<Pair<FileNameMatcher, String>> result = new SmartList<>();
  for (Element mapping : children) {
    String ext = mapping.getAttributeValue(ATTRIBUTE_EXT);
    String pattern = mapping.getAttributeValue(ATTRIBUTE_PATTERN);

    FileNameMatcher matcher = ext != null ? new ExtensionFileNameMatcher(ext) : FileTypeManager.parseFromString(pattern);
    result.add(Pair.create(matcher, mapping.getAttributeValue(ATTRIBUTE_TYPE)));
  }
  return result;
}
 
Example #6
Source File: JDOMModelConverter.java    From pom-manipulation-ext with Apache License 2.0 6 votes vote down vote up
/**
 * Method updateContributor.
 *  @param contributor
 * @param counter
 * @param element
 */
protected void updateContributor( final Contributor contributor, final IndentationCounter counter, final Element element )
{
    final IndentationCounter innerCount = new IndentationCounter( counter.getDepth() + 1 );
    Utils.findAndReplaceSimpleElement( innerCount, element,
                                       "name", contributor.getName(),
                                       null );
    Utils.findAndReplaceSimpleElement( innerCount, element,
                                       "email", contributor.getEmail(),
                                       null );
    Utils.findAndReplaceSimpleElement( innerCount, element,
                                       "url", contributor.getUrl(),
                                       null );
    Utils.findAndReplaceSimpleElement( innerCount, element, "organization", contributor.getOrganization(), null );
    Utils.findAndReplaceSimpleElement( innerCount, element,
                                       "organizationUrl", contributor.getOrganizationUrl(),
                                       null );
    Utils.findAndReplaceSimpleLists( innerCount, element, contributor.getRoles(), "roles", "role" );
    Utils.findAndReplaceSimpleElement( innerCount, element, "timezone", contributor.getTimezone(), null );
    Utils.findAndReplaceProperties( innerCount, element, "properties", contributor.getProperties() );
}
 
Example #7
Source File: Parser.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private void 
preProcessResources(Element the_manifest,
  DefaultHandler the_handler) {
 XPath path;
 List<Attribute> results;
 try {
  path = XPath.newInstance(FILE_QUERY);
  path.addNamespace(ns.getNs());
  results = path.selectNodes(the_manifest);
  for (Attribute result : results) {
	  the_handler.preProcessFile(result.getValue()); 
  }
 } catch (JDOMException | ClassCastException e) {
  log.info("Error processing xpath for files", e);
 }
}
 
Example #8
Source File: JDOMUtilTest.java    From geoserver-shell with MIT License 6 votes vote down vote up
@Test
public void toPrettyString() throws Exception {
    Element element = JDOMBuilder.buildElement(getResourceString("workspaces.xml"));
    String actual = JDOMUtil.toPrettyString(element);
    String expected = "<workspaces>\r\n" +
            "  <workspace>\r\n" +
            "    <name>it.geosolutions</name>\r\n" +
            "  </workspace>\r\n" +
            "  <workspace>\r\n" +
            "    <name>cite</name>\r\n" +
            "  </workspace>\r\n" +
            "  <workspace>\r\n" +
            "    <name>topp</name>\r\n" +
            "  </workspace>\r\n" +
            "</workspaces>";
    assertEquals(expected, actual);
}
 
Example #9
Source File: PageModelDOM.java    From entando-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void buildDefaultWidget(Frame frame, Element defaultWidgetElement, int pos, IWidgetTypeManager widgetTypeManager) {
	Widget widget = new Widget();
	String widgetCode = defaultWidgetElement.getAttributeValue(ATTRIBUTE_CODE);
	WidgetType type = widgetTypeManager.getWidgetType(widgetCode);
	if (null == type) {
		_logger.warn("Unknown code of the default widget - '{}'", widgetCode);
		return;
	}
	widget.setType(type);
	Element propertiesElement = defaultWidgetElement.getChild(TAB_PROPERTIES);
	if (null != propertiesElement) {
		ApsProperties prop = this.buildProperties(propertiesElement);
		widget.setConfig(prop);
	}
	frame.setDefaultWidget(widget);
}
 
Example #10
Source File: JDOMModelConverter.java    From pom-manipulation-ext with Apache License 2.0 6 votes vote down vote up
/**
 * Method updateProfile.
 *  @param profile
 * @param counter
 * @param element
 */
protected void updateProfile( final Profile profile, final IndentationCounter counter, final Element element )
{
    final IndentationCounter innerCount = new IndentationCounter( counter.getDepth() + 1 );
    Utils.findAndReplaceSimpleElement( innerCount, element,
                                       "id", profile.getId(),
                                       "default" );
    updateActivation( profile.getActivation(), innerCount, element );
    updateBuildBase( profile.getBuild(), innerCount, element );
    Utils.findAndReplaceSimpleLists( innerCount, element, profile.getModules(), "modules", "module" );
    updateDistributionManagement( profile.getDistributionManagement(), innerCount,
                                  element );
    Utils.findAndReplaceProperties( innerCount, element, "properties", profile.getProperties() );
    updateDependencyManagement( profile.getDependencyManagement(), innerCount, element );
    iterateDependency( innerCount, element, profile.getDependencies() );
    iterateRepository( innerCount, element, profile.getRepositories(), "repositories", "repository" );
    iterateRepository( innerCount, element, profile.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
    Utils.findAndReplaceXpp3DOM( innerCount, element, "reports", (Xpp3Dom) profile.getReports() );
    updateReporting( profile.getReporting(), innerCount, element );
}
 
Example #11
Source File: ThriftPlugin.java    From intellij-thrift with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public Element getState() {
  final Element root = new Element("thrift");

  Element frameWorksList = new Element("compilers");
  if (myConfig != null && StringUtils.isNotBlank(myConfig.getCompilerPath())) {
    Element fw = new Element("compiler");

    fw.setAttribute("url", myConfig.getCompilerPath());
    fw.setAttribute("nowarn", myConfig.isNoWarn() ? "yes" : "no");
    fw.setAttribute("strict", myConfig.isStrict() ? "yes" : "no");
    fw.setAttribute("verbose", myConfig.isVerbose() ? "yes" : "no");
    fw.setAttribute("recurse", myConfig.isRecurse() ? "yes" : "no");
    fw.setAttribute("debug", myConfig.isDebug() ? "yes" : "no");
    fw.setAttribute("allownegkeys", myConfig.isAllowNegKeys() ? "yes" : "no");
    fw.setAttribute("allow64bitconsts", myConfig.isAllow64bitConsts() ? "yes" : "no");

    frameWorksList.addContent(fw);
  }

  root.addContent(frameWorksList);

  return root;
}
 
Example #12
Source File: XmlSerializer.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void serializeInto(@Nonnull Object bean, @Nonnull Element element, @Nullable SerializationFilter filter) {
  if (filter == null) {
    filter = TRUE_FILTER;
  }
  try {
    Binding binding = XmlSerializerImpl.getBinding(bean.getClass());
    assert binding instanceof BeanBinding;
    ((BeanBinding)binding).serializeInto(bean, element, filter);
  }
  catch (XmlSerializationException e) {
    throw e;
  }
  catch (Exception e) {
    throw new XmlSerializationException(e);
  }
}
 
Example #13
Source File: CppHighlightingSettings.java    From CppTools with Apache License 2.0 6 votes vote down vote up
public void readExternal(Element element) throws InvalidDataException {
  String s = element.getAttributeValue(REPORT_IMPLICIT_CAST_TO_BOOL_KEY);
  if (s != null) myReportImplicitCastToBool = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_NAME_NEVER_REFERENCED_KEY);
  if (s != null) myReportNameNeverReferenced = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_NAME_REFERENCED_ONCE_KEY);
  if (s != null) myReportNameUsedOnce = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_REDUNDANT_CAST_KEY);
  if (s != null) myReportRedundantCast = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_REDUNDANT_QUALIFIER_KEY);
  if (s != null) myReportRedundantQualifier = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_STATIC_CALL_FROM_INSTANCE_KEY);
  if (s != null) myReportStaticCallFromInstance = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_UNNEEDED_BRACES_KEY);
  if (s != null) myReportUnneededBraces = Boolean.parseBoolean(s);

  s = element.getAttributeValue(REPORT_DUPLICATED_SYMBOLS_KEY);
  if (s != null) myReportDuplicatedSymbols = Boolean.parseBoolean(s);
}
 
Example #14
Source File: MapBinding.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void serializeKeyOrValue(@Nonnull Element entry, @Nonnull String attributeName, @Nullable Object value, @Nullable Binding binding, @Nonnull SerializationFilter filter) {
  if (value == null) {
    return;
  }

  if (binding == null) {
    entry.setAttribute(attributeName, XmlSerializerImpl.convertToString(value));
  }
  else {
    Object serialized = binding.serialize(value, entry, filter);
    if (serialized != null) {
      if (myMapAnnotation != null && !myMapAnnotation.surroundKeyWithTag()) {
        entry.addContent((Content)serialized);
      }
      else {
        Element container = new Element(attributeName);
        container.addContent((Content)serialized);
        entry.addContent(container);
      }
    }
  }
}
 
Example #15
Source File: CustomActionsSchema.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException {
  DefaultJDOMExternalizer.readExternal(this, element);
  Element schElement = element;
  final String activeName = element.getAttributeValue(ACTIVE);
  if (activeName != null) {
    for (Element toolbarElement : (Iterable<Element>)element.getChildren(ACTIONS_SCHEMA)) {
      for (Object o : toolbarElement.getChildren("option")) {
        if (Comparing.strEqual(((Element)o).getAttributeValue("name"), "myName") && Comparing.strEqual(((Element)o).getAttributeValue("value"), activeName)) {
          schElement = toolbarElement;
          break;
        }
      }
    }
  }
  for (Object groupElement : schElement.getChildren(GROUP)) {
    ActionUrl url = new ActionUrl();
    url.readExternal((Element)groupElement);
    myActions.add(url);
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    System.err.println("read custom actions: " + myActions.toString());
  }
  readIcons(element);
}
 
Example #16
Source File: BackgroundTaskByVfsChangeManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public Element getState() {
  Element element = new Element("state");
  for (BackgroundTaskByVfsChangeTaskImpl task : myTasks) {
    Element taskElement = new Element("task");
    element.addContent(taskElement);

    taskElement.setAttribute("url", task.getVirtualFilePointer().getUrl());
    taskElement.setAttribute("provider-name", task.getProviderName());
    taskElement.setAttribute("name", task.getName());
    taskElement.setAttribute("enabled", String.valueOf(task.isEnabled()));

    Element serialize = XmlSerializer.serialize(task.getParameters());

    taskElement.addContent(serialize);

    ExpandMacroToPathMap expandMacroToPathMap = task.createExpandMacroToPathMap();

    expandMacroToPathMap.substitute(serialize, false, true);
  }
  return element;
}
 
Example #17
Source File: ModuleManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Method expand or collapse element children.  This is need because PathMacroManager affected to attributes to.
 * If dirurl equals file://$PROJECT_DIR$ it ill replace to  file://$MODULE_DIR$, and after restart it ill throw error directory not found
 */
private static void collapseOrExpandMacros(Module module, Element element, boolean collapse) {
  final PathMacroManager pathMacroManager = PathMacroManager.getInstance(module);
  for (Element child : element.getChildren()) {
    if (collapse) {
      pathMacroManager.collapsePaths(child);
    }
    else {
      pathMacroManager.expandPaths(child);
    }
  }
}
 
Example #18
Source File: SamlHelper.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
protected void validateFormatAndCertificate(Signature signature, org.w3c.dom.Element element, String issuer) {
    validateSignatureFormat(signature);

    try {
        if (!validator.isDocumentTrusted(element, issuer)) {
            throw new APIAccessDeniedException("Invalid SAML message: Certificate is not trusted");
        }
    } catch (Exception e) {
        // chg Jan 2014, rc - passing exception into error-handling allows it to make a better error message.
        handleSignatureValidationErrors(e);
    }
}
 
Example #19
Source File: VarnodeTpl.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public void restoreXml(Element el, Translate trans) {
	List<?> list = el.getChildren();

	space.restoreXml((Element) list.get(0), trans);
	offset.restoreXml((Element) list.get(1), trans);
	size.restoreXml((Element) list.get(2), trans);
}
 
Example #20
Source File: EntityTypeDOM.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public List<SmallEntityType> extractSmallEntityTypes(String xml) throws ApsSystemException {
	List<SmallEntityType> list = new ArrayList<>();
	Document document = this.decodeDOM(xml);
	List<Element> entityElements = document.getRootElement().getChildren();
	for (int i = 0; i < entityElements.size(); i++) {
		Element entityElem = entityElements.get(i);
		String typeCode = this.extractXmlAttribute(entityElem, "typecode", true);
		String typeDescr = this.extractXmlAttribute(entityElem, "typedescr", true);
		list.add(new SmallEntityType(typeCode, typeDescr));
	}
	return list;
}
 
Example #21
Source File: ResourceDOM.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void buildDOM() {
    this._doc = new Document();
    this._root = new Element(ROOT);
    for (int i = 0; i < TAGS.length; i++) {
        Element tag = new Element(TAGS[i]);
        this._root.addContent(tag);
    }
    this._doc.setRootElement(this._root);
}
 
Example #22
Source File: FileColorConfiguration.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public static FileColorConfiguration load(@Nonnull final Element e) {
  final String path = e.getAttributeValue(SCOPE_NAME);
  if (path == null) {
    return null;
  }

  final String colorName = e.getAttributeValue(COLOR);
  if (colorName == null) {
    return null;
  }

  return new FileColorConfiguration(path, colorName);
}
 
Example #23
Source File: MessageNotifierConfigDOM.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Create an xml containing the notifier configuration.
 * @param config The jpmail configuration.
 * @return The xml containing the configuration.
 * @throws ApsSystemException In case of errors.
 */
public String createConfigXml(Map<String, MessageTypeNotifierConfig> config) throws ApsSystemException {
	Element root = new Element(ROOT);
	for (MessageTypeNotifierConfig messageTypeConfig : config.values()) {
		Element configElement = this.createConfigElement(messageTypeConfig);
		root.addContent(configElement);
	}
	Document doc = new Document(root);
	String xml = new XMLOutputter().outputString(doc);
	return xml;
}
 
Example #24
Source File: WmsStoreCommands.java    From geoserver-shell with MIT License 5 votes vote down vote up
@CliCommand(value = "wmsstore get", help = "Get a WMS Stores.")
public String getStore(
        @CliOption(key = "workspace", mandatory = true, help = "The workspace") String workspace,
        @CliOption(key = "store", mandatory = true, help = "The WMSStore") String store
) throws Exception {
    String url = geoserver.getUrl() + "/rest/workspaces/" + URLUtil.encode(workspace) + "/wmsstores/" + URLUtil.encode(store) + ".xml";
    String xml = HTTPUtils.get(url, geoserver.getUser(), geoserver.getPassword());
    StringBuilder builder = new StringBuilder();
    String TAB = "   ";
    Element element = JDOMBuilder.buildElement(xml);
    builder.append(element.getChildText("name")).append(OsUtils.LINE_SEPARATOR);
    builder.append(TAB).append("Type: ").append(element.getChildText("type")).append(OsUtils.LINE_SEPARATOR);
    builder.append(TAB).append("Enabled: ").append(element.getChildText("enabled")).append(OsUtils.LINE_SEPARATOR);
    Element wsElement = element.getChild("workspace");
    if (wsElement != null) {
        builder.append(TAB).append("Workspace: ").append(wsElement.getChildText("name")).append(OsUtils.LINE_SEPARATOR);
    }
    builder.append(TAB).append("Capabilities URL: ").append(element.getChildText("capabilitiesURL")).append(OsUtils.LINE_SEPARATOR);
    builder.append(TAB).append("Max Connections: ").append(element.getChildText("maxConnections")).append(OsUtils.LINE_SEPARATOR);
    builder.append(TAB).append("Read Timeout: ").append(element.getChildText("readTimeout")).append(OsUtils.LINE_SEPARATOR);
    builder.append(TAB).append("Connect Timeout: ").append(element.getChildText("connectTimeout")).append(OsUtils.LINE_SEPARATOR);
    Element metadataElement = element.getChild("metadata");
    if (metadataElement != null) {
        List<Element> entryElements = metadataElement.getChildren("entry");
        if (entryElements.size() > 0) {
            builder.append(TAB).append("Metadata: ").append(OsUtils.LINE_SEPARATOR);
            for (Element entryElement : entryElements) {
                builder.append(TAB).append(TAB).append(entryElement.getAttributeValue("key")).append(": ").append(entryElement.getTextTrim()).append(OsUtils.LINE_SEPARATOR);
            }
        }
    }
    return builder.toString();
}
 
Example #25
Source File: PrintHandler.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void addFile(Element elem) {
 //These are processed as standard text
 String href = elem.getAttributeValue(HREF);
 String sakaiId = baseName + elem.getAttributeValue(HREF);
 String extension = Validator.getFileExtension(sakaiId);
 String mime = ContentTypeImageService.getContentType(extension);
 if (mime != null && mime.startsWith("text/"))
  return;
 addFile(href);
}
 
Example #26
Source File: XmlSerializerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
static String getTextValue(@Nonnull Element element, @Nonnull String defaultText) {
  List<Content> content = element.getContent();
  String value = defaultText;
  if (!content.isEmpty()) {
    Content child = content.get(0);
    if (child instanceof Text) {
      value = child.getValue();
    }
  }
  return value;
}
 
Example #27
Source File: ExternalizablePropertyTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testWriteList() throws WriteExternalException {
  myContainer.registerProperty(PROPERTY, "item", EXTERNALIZER);
  PROPERTY.getModifiableList(myContainer).add(new MockJDOMExternalizable());
  Element containerElement = new Element("xxx");
  myContainer.writeExternal(containerElement);

  List children = containerElement.getChildren();
  assertEquals(1, children.size());
  Element listElement = (Element)children.get(0);
  assertEquals("list", listElement.getName());
  children = listElement.getChildren();
  assertEquals(1, children.size());
  Element itemElement = (Element)children.get(0);
  assertEquals("item", itemElement.getName());
}
 
Example #28
Source File: SenBotDocumenter.java    From senbot with MIT License 5 votes vote down vote up
private Document generateHtml() {
	Document document = new Document();
	Element html = new Element("html");
	document.setRootElement(html);
	Element head = new Element("head");
	Element body = new Element("body");
	html.addContent(head);
	html.addContent(body);
	
	head.addContent(new Element("title").setText("Step definition documentation"));
	
	body.addContent(new Element("h1").setText("All steps on the classpath"));
	Element list = new Element("ol");
	body.addContent(list);
	
	for(String key : availableStepDefs.keySet()) {
		StepDef stepDef = availableStepDefs.get(key);
		Element listItem = new Element("li");
		list.addContent(listItem);
		
		listItem.addContent(new Element("h3").setText(key));
		listItem.addContent(new Element("br"));
		listItem.addContent("found at: " + stepDef.getFullMethodName());
	}
	
	return document;
}
 
Example #29
Source File: InspectionTestUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
static boolean compareProblemWithExpected(Element reportedProblem, Element expectedProblem, boolean checkRange) throws Exception {
  if (!compareFiles(reportedProblem, expectedProblem)) return false;
  if (!compareLines(reportedProblem, expectedProblem)) return false;
  if (!compareDescriptions(reportedProblem, expectedProblem)) return false;
  if (checkRange && !compareTextRange(reportedProblem, expectedProblem)) return false;
  return true;
}
 
Example #30
Source File: BaseAttributeValidationRules.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void fillJDOMConfigElement(Element configElement) {
    if (this.isRequired()) {
        Element element = new Element("required");
        element.setText("true");
        configElement.addContent(element);
    }
    if (null != this.getOgnlValidationRule()) {
        Element exprElement = this.getOgnlValidationRule().getConfigElement();
        if (null != exprElement) {
            configElement.addContent(exprElement);
        }
    }
}