Java Code Examples for org.jdom.Element#getValue()

The following examples show how to use org.jdom.Element#getValue() . 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: NATO4676Decoder.java    From geowave with Apache License 2.0 6 votes vote down vote up
private TrackIdentity readTrackIdentity(final Element element, final Namespace xmlns) {
  final TrackIdentity trackIdentity = new TrackIdentity();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("identity".equals(childName)) {
      try {
        trackIdentity.identity = Identity.valueOf(childValue);
      } catch (final IllegalArgumentException iae) {
        LOGGER.warn("Unable to set identity", iae);
        trackIdentity.identity = null;
      }
    }
    // TODO: Track Identity
  }
  return trackIdentity;
}
 
Example 2
Source File: DAOLunaticConfiguration.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
private ScriptPartialOrder loadScriptPartialOrder(Element scriptPartialOrderElement, String fileScenario) {
    if (scriptPartialOrderElement == null || scriptPartialOrderElement.getChildren().isEmpty()) {
        return null;
    }
    Element xmlElement = scriptPartialOrderElement.getChild("script");
    if (xmlElement == null) {
        throw new it.unibas.lunatic.exceptions.DAOException("Unable to load scenario from file " + fileScenario + ". Missing tag <script>");
    }
    String scriptRelativeFile = xmlElement.getValue();
    String scriptAbsoluteFile = filePathTransformator.expand(fileScenario, scriptRelativeFile);
    try {
        return new ScriptPartialOrder(scriptAbsoluteFile);
    } catch (ScriptException ex) {
        throw new it.unibas.lunatic.exceptions.DAOException("Unable to load partial-order script " + scriptAbsoluteFile + ". " + ex.getLocalizedMessage());
    }
}
 
Example 3
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 6 votes vote down vote up
private IDdata readIDdata(final Element element, final Namespace xmlns) {
  final IDdata id = new IDdata();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("stationID".equals(childName)) {
      id.setStationId(childValue);
    } else if ("nationality".equals(childName)) {
      id.setNationality(childValue);
    }
  }
  return id;
}
 
Example 4
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 6 votes vote down vote up
private TrackMessage readTrackMessage(final Element element, final Namespace xmlns) {
  final TrackMessage msg = new TrackMessage();
  msg.setUuid(UUID.randomUUID());
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("stanagVersion".equals(childName)) {
      msg.setFormatVersion(childValue);
    } else if ("messageSecurity".equals(childName)) {
      msg.setSecurity(readSecurity(child, xmlns));
    } else if ("msgCreatedTime".equals(childName)) {
      msg.setMessageTime(DateStringToLong(childValue));
    } else if ("senderId".equals(childName)) {
      msg.setSenderID(readIDdata(child, xmlns));
    } else if ("tracks".equals(childName)) {
      msg.addTrackEvent(readTrackEvent(child, xmlns));
    }
  }
  return msg;
}
 
Example 5
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 6 votes vote down vote up
private MissionFrame readFrame(final Element element, final Namespace xmlns) {
  final MissionFrame frame = new MissionFrame();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("frameNumber".equals(childName)) {
      frame.setFrameNumber(Integer.parseInt(childValue));
    } else if ("frameTimestamp".equals(childName)) {
      frame.setFrameTime(DateStringToLong(childValue));
    } else if ("frameCoverageArea".equals(childName)) {
      frame.setCoverageArea(readCoverageArea(child, xmlns));
    }
  }
  return frame;
}
 
Example 6
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 6 votes vote down vote up
private List<ObjectClassification> readObjectClassifications(
    final Element element,
    final Namespace xmlns) {
  final List<ObjectClassification> objClassList = new ArrayList<>();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();

    if ("classification".equals(childName)) {
      final ObjectClassification classification = ObjectClassification.fromString(childValue);
      if (classification != null) {
        objClassList.add(classification);
      }
    }
  }

  return objClassList;
}
 
Example 7
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 5 votes vote down vote up
private MissionSummaryMessage readMissionSummaryMessage(
    final Element element,
    final Namespace xmlns) {
  final MissionSummaryMessage msg = new MissionSummaryMessage();
  final MissionSummary missionSummary = msg.getMissionSummary();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("missionID".equals(childName)) {
      missionSummary.setMissionId(childValue);
    } else if ("Name".equals(childName)) {
      missionSummary.setName(childValue);
    } else if ("Security".equals(childName)) {
      msg.setSecurity(readSecurity(child, xmlns));
      missionSummary.setSecurity(msg.getSecurity().getClassification().toString());
    } else if ("msgCreatedTime".equals(childName)) {
      msg.setMessageTime(DateStringToLong(childValue));
    } else if ("senderId".equals(childName)) {
      msg.setSenderID(readIDdata(child, xmlns));
    } else if ("StartTime".equals(childName)) {
      missionSummary.setStartTime(DateStringToLong(childValue));
    } else if ("EndTime".equals(childName)) {
      missionSummary.setEndTime(DateStringToLong(childValue));
    } else if ("FrameInformation".equals(childName)) {
      missionSummary.addFrame(readFrame(child, xmlns));
    } else if ("CoverageArea".equals(childName)) {
      missionSummary.setCoverageArea(readCoverageArea(child, xmlns));
    } else if ("ActiveObjectClassifications".equals(childName)) {
      missionSummary.setClassifications(readObjectClassifications(child, xmlns));
    }
  }
  return msg;
}
 
Example 8
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 5 votes vote down vote up
private Area readArea(final Element element, final Namespace xmlns) {
  final Area area = new Area();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("xxx".equals(childName)) {
      // area.setXXX(childValue);
      // TODO: Area , CircularArea, PolygonArea, etc...
    }
  }
  return area;
}
 
Example 9
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 5 votes vote down vote up
private LineageRelation readLineageRelation(final Element element, final Namespace xmlns) {
  final LineageRelation relation = new LineageRelation();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("relations".equals(childName)) {
      // TODO: TrackLineageInformation / LineageRelation
    }
  }
  return relation;
}
 
Example 10
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 5 votes vote down vote up
private TrackClassification readTrackClassification(
    final Element element,
    final Namespace xmlns) {
  final TrackClassification trackClassification = new TrackClassification();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("trackItemUUID".equals(childName)) {
      try {
        trackClassification.setUuid(UUID.fromString(childValue));
      } catch (final IllegalArgumentException iae) {
        LOGGER.warn("Unable to set uuid", iae);
        trackClassification.setUuid(null);
      }
    } else if ("trackItemSecurity".equals(childName)) {
      trackClassification.setSecurity(readSecurity(child, xmlns));
    } else if ("trackItemTime".equals(childName)) {
      trackClassification.setTime(DateStringToLong(childValue));
    } else if ("trackItemSource".equals(childName)) {
      trackClassification.setSource(childValue);
    } else if ("classification".equals(childName)) {
      trackClassification.classification = ObjectClassification.fromString(childValue);
    } else if ("classificationCredibility".equals(childName)) {
      trackClassification.credibility = readClassificationCredibility(child, xmlns);
    } else if ("numObjects".equals(childName)) {
      trackClassification.setNumObjects(Integer.parseInt(child.getText()));
    }
  }
  return trackClassification;
}
 
Example 11
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 5 votes vote down vote up
private Security readSecurity(final Element element, final Namespace xmlns) {
  final Security security = new Security();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("securityClassification".equals(childName)) {
      try {
        security.setClassification(ClassificationLevel.valueOf(childValue));
      } catch (final IllegalArgumentException iae) {
        LOGGER.warn("Unable to set classification level", iae);
        security.setClassification(null);
      }
    }
    if ("securityPolicyName".equals(childName)) {
      security.setPolicyName(childValue);
    }
    if ("securityControlSystem".equals(childName)) {
      security.setControlSystem(childValue);
    }
    if ("securityDissemination".equals(childName)) {
      security.setDissemination(childValue);
    }
    if ("securityReleasability".equals(childName)) {
      security.setReleasability(childValue);
    }
  }
  return security;
}
 
Example 12
Source File: DAOLunaticConfiguration.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private IUserManager loadUserManager(Element userManagerElement, Scenario scenario) {
    if (userManagerElement == null || userManagerElement.getChildren().isEmpty()) {
        return new StandardUserManager();
    }
    Element typeElement = userManagerElement.getChild("type");
    if (typeElement == null) {
        throw new it.unibas.lunatic.exceptions.DAOException("Unable to load scenario from file " + scenario.getAbsolutePath() + ". Missing tag <type>");
    }
    IUserManager userManager = null;
    String userManagerType = typeElement.getValue();
    if (USER_MANAGER_STANDARD.equals(userManagerType)) {
        userManager = new StandardUserManager();
    }
    if (USER_MANAGER_INTERACTIVE.equals(userManagerType)) {
        userManager = new InteractiveUserManager();
    }
    if (USER_MANAGER_AFTER_FORK.equals(userManagerType)) {
        userManager = new AfterForkUserManager();
    }
    if (USER_MANAGER_AFTER_LLUN.equals(userManagerType)) {
        userManager = new AfterLLUNUserManager(OperatorFactory.getInstance().getOccurrenceHandlerMC(scenario));
    }
    if (USER_MANAGER_AFTER_LLUN_FORK.equals(userManagerType)) {
        userManager = new AfterLLUNForkUserManager(OperatorFactory.getInstance().getOccurrenceHandlerMC(scenario));
    }
    return userManager;
}
 
Example 13
Source File: NATO4676Decoder.java    From geowave with Apache License 2.0 5 votes vote down vote up
private Area readCoverageArea(final Element element, final Namespace xmlns) {
  final Area area = new Area();
  final List<Element> children = element.getChildren();
  final Iterator<Element> childIter = children.iterator();
  while (childIter.hasNext()) {
    final Element child = childIter.next();
    final String childName = child.getName();
    final String childValue = child.getValue();
    if ("areaBoundaryPoints".equals(childName)) {
      final GeodeticPosition pos = readGeodeticPosition(child, xmlns);
      area.getPoints().add(pos);
    }
  }
  return area;
}
 
Example 14
Source File: JPlistBuilder.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private static DictionaryElement parseDictionary(Element edict) {
List<Element> children = edict.getChildren();
    DictionaryElement dict = new DictionaryElement();
    for (Iterator iter = children.iterator(); iter.hasNext(); ) {
      Element keyElement = (Element)iter.next();
      PElementType keyType = PElementType.getType(keyElement.getName());
      if (keyType != PElementType.KEY)
        throw new IllegalArgumentException("Missing KEY!");
      String key = keyElement.getValue();
      Element pelement = (Element)iter.next();
      PElement value = parseGeneric(pelement);
      dict.put(key, value);
    }
    return dict;
  }
 
Example 15
Source File: JPlistBuilder.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private static PElement parseGeneric(Element pelement) {
  PElementType vType = PElementType.getType(pelement.getName());
  PElement value;
  switch (vType) {
  case ARRAY:
    value = parseArray(pelement);
    break;
  case BOOLEAN:
    value = new BooleanElement(pelement.getName().equalsIgnoreCase("true"));
    break;
  case STRING:
    value = new StringElement(pelement.getValue());
    break;
  case INTEGER:
    value = new IntegerElement(pelement.getValue());
    break;
  case DATA:
    value = new DataElement(pelement.getValue());
    break;
  case DICTIONARY:
    value = parseDictionary(pelement);
    break;
  case REAL:
    value = new RealElement(Double.parseDouble(pelement.getValue()));
    break;
  case DATE:
    value = new DateElement(pelement.getValue());
    break;
  default:
    throw new IllegalArgumentException("Unknown Value:" + pelement);
  }
  return value;
}
 
Example 16
Source File: LoadEGTask.java    From BART with MIT License 5 votes vote down vote up
private void loadForKeyMainMem(Element keyElement, String path) {
    Element typeElement = keyElement.getChild("type");
    if (typeElement.getValue().equals("XML")) {
        Element xmlElement = keyElement.getChild("xml");
        String schemaRelativeFile = xmlElement.getChild("xml-schema").getValue();
        String schemaAbsoluteFile = filePathTransformator.expand(path, schemaRelativeFile);
        String instanceRelativeFile = xmlElement.getChild("xml-instance").getValue();
        String instanceAbsoluteFile = null; //Optional field
        if (instanceRelativeFile != null && !instanceRelativeFile.trim().isEmpty()) {
            instanceAbsoluteFile = filePathTransformator.expand(path, instanceRelativeFile);
        }
        if (keyElement.getValue().equals("source")) {
            ((EGTaskDataObjectDataObject) egtDO).setXmlInstanceFilePathSourceDB(instanceAbsoluteFile);
            ((EGTaskDataObjectDataObject) egtDO).setXmlSchemaFilePathSourceDB(schemaAbsoluteFile);
            ((EGTaskDataObjectDataObject) egtDO).setMainMemoryGenerateSource(false);
        }
        if (keyElement.getValue().equals("target")) {
            ((EGTaskDataObjectDataObject) egtDO).setXmlInstanceFilePathTargetDB(instanceAbsoluteFile);
            ((EGTaskDataObjectDataObject) egtDO).setXmlSchemaFilePathTargetDB(schemaAbsoluteFile);
            ((EGTaskDataObjectDataObject) egtDO).setMainMemoryGenerateTager(false);
        }
    }
    if (typeElement.getValue().equals("GENERATE")) {
        Element plainInstanceElement = keyElement.getChild("generate");
        String plainInstance = plainInstanceElement.getValue();
        if (keyElement.getName().equals("source")) {
            ((EGTaskDataObjectDataObject) egtDO).setPlainInstanceGenerateSourceDB(plainInstance.trim());
            ((EGTaskDataObjectDataObject) egtDO).setMainMemoryGenerateSource(true);
        }
        if (keyElement.getName().equals("target")) {
            ((EGTaskDataObjectDataObject) egtDO).setPlainInstanceGenerateTargetDB(plainInstance.trim());
            ((EGTaskDataObjectDataObject) egtDO).setMainMemoryGenerateTager(true);
        }
    }
}
 
Example 17
Source File: UnifiedModuleImpl.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
@Override
public String getSymbolicName() {
    // This is a verify central function as the Symbolic Name is the key to find the
    // bundle on the target server.
    //
    // - If this is a Maven Plugin then we check the maven-bundle-plugin and
    //   check if hte Symbolic Name is set there and use this one
    // - Otherwise Check if there is a Symbolic Name specified in the Sling
    //   Facet
    // - Otherwise check if a Manifest.mf can be found and look for the 'Bundle-SymbolicName'
    // - Otherwise take the groupId.artifactId

    String answer = null;
    if(mavenProject != null) {
        // Check if there is an Maven Bundle Plugin with an Symbolic Name override
        List<MavenPlugin> mavenPlugins = mavenProject.getPlugins();
        for(MavenPlugin mavenPlugin : mavenPlugins) {
            if(FELIX_GROUP_ID.equals(mavenPlugin.getGroupId()) && BUNDLE_PLUGIN_ARTIFACT_ID.equals(mavenPlugin.getArtifactId())) {
                Element configuration = mavenPlugin.getConfigurationElement();
                if(configuration != null) {
                    Element instructions = configuration.getChild(INSTRUCTIONS_SECTION);
                    if(instructions != null) {
                        Element bundleSymbolicName = instructions.getChild(BUNDLE_SYMBOLIC_NAME_FIELD);
                        if(bundleSymbolicName != null) {
                            answer = bundleSymbolicName.getValue();
                            answer = answer != null && answer.trim().isEmpty() ? null : answer.trim();
                        }
                    }
                }
            }
        }
    }
    if(answer == null && slingConfiguration != null) {
        answer = slingConfiguration.getOsgiSymbolicName();
    }
    if(answer == null) {
        VirtualFile baseDir = module.getProject().getBaseDir();
        VirtualFile buildDir = baseDir.getFileSystem().findFileByPath(getBuildDirectoryPath());
        if(buildDir != null) {
            // Find a Metainf.mf file
            VirtualFile manifest = Util.findFileOrFolder(buildDir, MANIFEST_MF_FILE_NAME, false);
            if(manifest != null) {
                try {
                    String content = new String(manifest.contentsToByteArray());
                    int index = content.indexOf(BUNDLE_SYMBOLIC_NAME_FIELD);
                    if(index >= 0) {
                        int index2 = content.indexOf("\n", index);
                        if(index2 >= 0) {
                            answer = content.substring(index + BUNDLE_SYMBOLIC_NAME_FIELD.length() + 2, index2);
                            answer = answer.trim().isEmpty() ? null : answer.trim();
                        }
                    }
                } catch(IOException e) {
                    //AS TODO: Report the issues
                    e.printStackTrace();
                }
            }
        }
    }
    if(answer == null && mavenProject != null) {
        answer = mavenProject.getMavenId().getGroupId() + "." + mavenProject.getMavenId().getArtifactId();
    }
    return answer == null ? NO_OSGI_BUNDLE : answer;
}
 
Example 18
Source File: DAOLunaticConfiguration.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
private CostManagerConfiguration loadCostManagerConfiguration(Element costManagerElement, String fileScenario) throws it.unibas.lunatic.exceptions.DAOException {
    if (costManagerElement == null || costManagerElement.getChildren().isEmpty()) {
        return null;
    }
    Element typeElement = costManagerElement.getChild("type");
    if (typeElement == null) {
        throw new it.unibas.lunatic.exceptions.DAOException("Unable to load scenario from file " + fileScenario + ". Missing tag <type>");
    }
    CostManagerConfiguration costManagerConfiguration = new CostManagerConfiguration();
    String costManagerType = typeElement.getValue();
    if (LunaticConstants.COST_MANAGER_STANDARD.equalsIgnoreCase(costManagerType)) {
        costManagerConfiguration.setType(LunaticConstants.COST_MANAGER_STANDARD);
    }
    if (LunaticConstants.COST_MANAGER_GREEDY.equalsIgnoreCase(costManagerType)) {
        costManagerConfiguration.setType(LunaticConstants.COST_MANAGER_GREEDY);
    }
    if (LunaticConstants.COST_MANAGER_SIMILARITY.equalsIgnoreCase(costManagerType)) {
        costManagerConfiguration.setType(LunaticConstants.COST_MANAGER_SIMILARITY);
        Element similarityStrategyElement = costManagerElement.getChild("similarityStrategy");
        if (similarityStrategyElement != null) {
            costManagerConfiguration.getDefaultSimilarityConfiguration().setStrategy(similarityStrategyElement.getValue().trim());
        }
        Element similarityThresholdElement = costManagerElement.getChild("similarityThreshold");
        if (similarityThresholdElement != null) {
            costManagerConfiguration.getDefaultSimilarityConfiguration().setThreshold(Double.parseDouble(similarityThresholdElement.getValue()));
        }
        loadExtraParams(costManagerConfiguration.getDefaultSimilarityConfiguration().getParams(), costManagerElement);
        Element requestMajority = costManagerElement.getChild("requestMajority");
        if (requestMajority != null) {
            costManagerConfiguration.setRequestMajorityInSimilarityCostManager(Boolean.parseBoolean(requestMajority.getValue()));
        }
    }
    if (costManagerConfiguration == null) {
        throw new it.unibas.lunatic.exceptions.DAOException("Unable to load scenario from file " + fileScenario + ". Unknown cost-manager type " + costManagerType);
    }
    Element doBackwardElement = costManagerElement.getChild("doBackward");
    if (doBackwardElement != null) {
        costManagerConfiguration.setDoBackward(Boolean.parseBoolean(doBackwardElement.getValue()));
    }
    Element doPermutationsElement = costManagerElement.getChild("doPermutations");
    if (doPermutationsElement != null) {
        costManagerConfiguration.setDoPermutations(Boolean.parseBoolean(doPermutationsElement.getValue()));
    }
    Element chaseTreeSizeThresholdElement = costManagerElement.getChild("chaseTreeSizeThreshold");
    if (chaseTreeSizeThresholdElement != null) {
        throw new IllegalArgumentException("Replace chase tree size with chaseBranchingThreshold and potentialSolutionsThreshold");
    }
    Element chaseBranchingThresholdElement = costManagerElement.getChild("chaseBranchingThreshold");
    if (chaseBranchingThresholdElement != null) {
        costManagerConfiguration.setChaseBranchingThreshold(Integer.parseInt(chaseBranchingThresholdElement.getValue()));
    }
    Element dependencyLimitElement = costManagerElement.getChild("dependencyLimit");
    if (dependencyLimitElement != null) {
        costManagerConfiguration.setDependencyLimit(Integer.parseInt(dependencyLimitElement.getValue()));
    }
    Element potentialSolutionsThresholdElement = costManagerElement.getChild("potentialSolutionsThreshold");
    if (potentialSolutionsThresholdElement != null) {
        costManagerConfiguration.setPotentialSolutionsThreshold(Integer.parseInt(potentialSolutionsThresholdElement.getValue()));
    }
    for (Object noBackwardEl : costManagerElement.getChildren("noBackwardOnDependency")) {
        Element noBackwardElement = (Element) noBackwardEl;
        costManagerConfiguration.addNoBackwardDependency(noBackwardElement.getValue().trim());
    }
    for (Object similarityAttributeEl : costManagerElement.getChildren("similarityForAttribute")) {
        Element similarityAttributeElement = (Element) similarityAttributeEl;
        String tableName = similarityAttributeElement.getAttribute("tableName").getValue().trim();
        String attributeName = similarityAttributeElement.getAttribute("attributeName").getValue().trim();
        AttributeRef attribute = new AttributeRef(tableName, attributeName);
        String similarityStrategy = similarityAttributeElement.getChild("similarityStrategy").getValue().trim();
        double similarityThreshold = Double.parseDouble(similarityAttributeElement.getChild("similarityThreshold").getValue().trim());
        SimilarityConfiguration similarityConfiguration = new SimilarityConfiguration(similarityStrategy, similarityThreshold);
        costManagerConfiguration.setSimilarityConfigurationForAttribute(attribute, similarityConfiguration);
        loadExtraParams(similarityConfiguration.getParams(), similarityAttributeElement);
    }
    return costManagerConfiguration;
}
 
Example 19
Source File: ConfigParameterUtils.java    From ankush with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * Gets the tag content.
 * 
 * @param element
 *            the element
 * @param tagName
 *            the tag name
 * @return the tag content
 */
private static String getTagContent(Element element, String tagName) {
	String content = "";
	Element e = element.getChild(tagName);
	if (e != null) {
		content = e.getValue();
	}
	return content;
}
 
Example 20
Source File: XmlUtil.java    From ankush with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * Gets the tag content.
 * 
 * @param element
 *            the element
 * @param tagName
 *            the tag name
 * @return the tag content
 */
public static String getTagContent(Element element, String tagName) {
	String content = "";
	Element e = element.getChild(tagName);
	if (e != null) {
		content = e.getValue();
	}
	return content;
}