本文整理了Java中org.joox.Match.find()
方法的一些代码示例,展示了Match.find()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Match.find()
方法的具体详情如下:
包路径:org.joox.Match
类名称:Match
方法名:find
[英]Find all descendants of each element in the current set of matched elements.
[中]查找当前匹配元素集中每个元素的所有后代。
代码示例来源:origin: windup/windup
private String extractChildTagAndTrim(Element element, String property)
{
String result = $(element).find(property).first().text();
return StringUtils.trimToNull(result);
}
}
代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-ee
private String extractChildTagAndTrim(Element element, String property)
{
String result = $(element).find(property).first().text();
return StringUtils.trimToNull(result);
}
}
代码示例来源:origin: org.jboss.windup.legacy.application/grapher
public void writeGraph(final OutputStream os) throws IOException {
// read in the html template resource.
InputStream is = this.getClass().getClassLoader().getResourceAsStream("dagred3/HtmlTemplate.html");
String result;
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writer.writeGraph(baos);
result = baos.toString();
}
if(LOG.isDebugEnabled()) {
LOG.debug("Graphlib: "+result);
}
// read the document.
Document document;
try {
document = $(is).document();
// append in the gexf.
$(document).find("#graphlib-source").append(result);
writeDocument(document, os);
} catch (SAXException e) {
throw new IOException("Exception loading document.", e);
}
}
代码示例来源:origin: org.jboss.windup/windup-grapher
public void writeGraph(final OutputStream os) throws IOException {
// read in the html template resource.
InputStream is = this.getClass().getClassLoader().getResourceAsStream("dagred3/HtmlTemplate.html");
String result;
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writer.writeGraph(baos);
result = baos.toString();
}
if(LOG.isDebugEnabled()) {
LOG.debug("Graphlib: "+result);
}
// read the document.
Document document;
try {
document = $(is).document();
// append in the gexf.
$(document).find("#graphlib-source").append(result);
writeDocument(document, os);
} catch (SAXException e) {
throw new IOException("Exception loading document.", e);
}
}
代码示例来源:origin: org.jboss.windup/windup-grapher
public void writeGraph(final OutputStream os) throws IOException {
// read in the html template resource.
InputStream is = this.getClass().getClassLoader().getResourceAsStream("sigmajs/HtmlTemplate.html");
String result = null;
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
gexfWriter.writeGraph(baos);
result = baos.toString();
}
if(LOG.isDebugEnabled()) {
LOG.debug("GEXF: "+result);
}
// read the document.
Document document;
try {
document = $(is).document();
// append in the gexf.
$(document).find("#gexf-source").append(result);
writeDocument(document, os);
} catch (SAXException e) {
throw new IOException("Exception loading document.", e);
}
}
代码示例来源:origin: org.jboss.windup.legacy.application/grapher
public void writeGraph(final OutputStream os) throws IOException {
// read in the html template resource.
InputStream is = this.getClass().getClassLoader().getResourceAsStream("sigmajs/HtmlTemplate.html");
String result = null;
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
gexfWriter.writeGraph(baos);
result = baos.toString();
}
if(LOG.isDebugEnabled()) {
LOG.debug("GEXF: "+result);
}
// read the document.
Document document;
try {
document = $(is).document();
// append in the gexf.
$(document).find("#gexf-source").append(result);
writeDocument(document, os);
} catch (SAXException e) {
throw new IOException("Exception loading document.", e);
}
}
代码示例来源:origin: org.jboss.windup.rules.apps/rules-java-ee
private String extractChildTagAndTrim(Element element, String property)
{
String result = $(element).find(property).first().text();
return StringUtils.trimToNull(result);
}
}
代码示例来源:origin: org.jboss.windup.rules/rules-impl
protected String extractChildTagAndTrim(Element element, String property)
{
String result = $(element).find(property).first().text();
return StringUtils.trimToNull(result);
}
}
代码示例来源:origin: org.jboss.windup.rules/rules-impl
protected List<EnvironmentReference> processEnvironmentReference(Element element)
{
List<EnvironmentReference> resources = new LinkedList<EnvironmentReference>();
// find JMS references...
List<Element> queueReferences = $(element).find("resource-env-ref").get();
for (Element e : queueReferences)
{
String type = $(e).child("resource-env-ref-type").text();
String name = $(e).child("resource-env-ref-name").text();
type = StringUtils.trim(type);
name = StringUtils.trim(name);
EnvironmentReference ref = envRefDao.createEnvironmentReference(name, type);
LOG.info("Adding name: " + name + ", type: " + type);
resources.add(ref);
}
return resources;
}
代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-ee
private Map<String, Integer> parseTxTimeout(Element elementRef, String ejbName)
{
Map<String, Integer> transactionTimeouts = new HashMap<>();
for (Element methodRef : $(elementRef).child("method-attributes").find("method").get())
{
String methodName = $(methodRef).child("method-name").content();
String transactionTimeout = $(methodRef).child("transaction-timeout").content();
if(StringUtils.isNotBlank(transactionTimeout)) {
try {
Integer txTimeout = Integer.parseInt(transactionTimeout);
transactionTimeouts.put(methodName, txTimeout);
}
catch(Exception e) {
LOG.info("EJB: "+ejbName+" contains bad reference to TX Timeout on Method: "+methodName);
}
}
}
return transactionTimeouts;
}
代码示例来源:origin: org.jboss.windup.rules/rules-impl
protected String extractChildTagAndTrim(Element element, String property)
{
String result = $(element).find(property).first().text();
return StringUtils.trimToNull(result);
}
}
代码示例来源:origin: windup/windup
private Map<String, Integer> parseTxTimeout(Element elementRef, String ejbName)
{
Map<String, Integer> transactionTimeouts = new HashMap<>();
for (Element methodRef : $(elementRef).child("method-attributes").find("method").get())
{
String methodName = $(methodRef).child("method-name").content();
String transactionTimeout = $(methodRef).child("transaction-timeout").content();
if(StringUtils.isNotBlank(transactionTimeout)) {
try {
Integer txTimeout = Integer.parseInt(transactionTimeout);
transactionTimeouts.put(methodName, txTimeout);
}
catch(Exception e) {
LOG.info("EJB: "+ejbName+" contains bad reference to TX Timeout on Method: "+methodName);
}
}
}
return transactionTimeouts;
}
代码示例来源:origin: org.jboss.windup.rules.apps/rules-java-ee
private void extractMetadata(GraphContext ctx, XmlFileModel xml, Document doc, String versionInformation)
{
EjbDeploymentDescriptorModel facet = GraphService.addTypeToModel(ctx, xml, EjbDeploymentDescriptorModel.class);
if (StringUtils.isNotBlank(versionInformation))
{
facet.setSpecificationVersion(versionInformation);
}
// process all session beans...
for (Element element : $(doc).find("session").get())
{
processSessionBeanElement(ctx, facet, element);
}
// process all message driven beans...
for (Element element : $(doc).find("message-driven").get())
{
processMessageDrivenElement(ctx, facet, element);
}
// process all entity beans...
for (Element element : $(doc).find("entity").get())
{
processEntityElement(ctx, facet, element);
}
}
代码示例来源:origin: org.jboss.windup.rules/rules-impl
public void visitXmlResource(XmlResource xml, Document doc, String versionInformation)
{
// check the root XML node.
EjbConfigurationFacet facet = ejbConfigurationDao.create();
facet.setXmlFacet(xml);
if (StringUtils.isNotBlank(versionInformation))
{
facet.setSpecificationVersion(versionInformation);
}
// process all session beans...
//
for (Element element : $(doc).find("session").get())
{
processSessionBeanElement(facet, element);
}
// process all message driven beans...
for (Element element : $(doc).find("message-driven").get())
{
processMessageDrivenElement(facet, element);
}
// process all entity beans...
for (Element element : $(doc).find("entity").get())
{
processMessageDrivenElement(facet, element);
}
}
代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-ee
private void extractMetadata(GraphRewrite event, EvaluationContext context, XmlFileModel xml, Document doc, String versionInformation)
{
EjbDeploymentDescriptorModel facet = GraphService.addTypeToModel(event.getGraphContext(), xml, EjbDeploymentDescriptorModel.class);
if (StringUtils.isNotBlank(versionInformation))
{
facet.setSpecificationVersion(versionInformation);
}
// process all session beans...
for (Element element : $(doc).find("session").get())
{
processSessionBeanElement(event, context, facet, element);
}
// process all message driven beans...
for (Element element : $(doc).find("message-driven").get())
{
processMessageDrivenElement(event, context, facet, element);
}
// process all entity beans...
for (Element element : $(doc).find("entity").get())
{
processEntityElement(event, context, facet, element);
}
}
代码示例来源:origin: windup/windup
/**
* if this is a maven file, checks to see if "version" tags match the discovered text; if the discovered text does match something in a version
* tag, it is likely a version, not an IP address
*
* @param context
* @param model
* @return
*/
private boolean isMavenVersionTag(GraphContext context, FileLocationModel model)
{
if (isMavenFile(context, model))
{
Document doc = ((XmlFileModel) model.getFile()).asDocument();
for (Element elm : $(doc).find("version"))
{
String text = StringUtils.trim($(elm).text());
if (StringUtils.equals(text, model.getSourceSnippit()))
{
return true;
}
}
}
return false;
}
代码示例来源:origin: org.jboss.windup.rules/rules-impl
protected List<EnvironmentReference> processEnvironmentReference(Element element)
{
List<EnvironmentReference> resources = new LinkedList<EnvironmentReference>();
// find JMS references...
List<Element> queueReferences = $(element).find("resource-ref").get();
for (Element e : queueReferences)
{
String id = $(e).attr("id");
String type = $(e).child("res-type").text();
String name = $(e).child("res-ref-name").text();
type = StringUtils.trim(type);
name = StringUtils.trim(name);
EnvironmentReference ref = envRefDao.createEnvironmentReference(name, type);
ref.setReferenceId(id);
resources.add(ref);
}
return resources;
}
代码示例来源:origin: org.jboss.windup.rules.apps/rules-java-ee
private List<EnvironmentReferenceModel> processEnvironmentReference(GraphContext context, Element element)
{
EnvironmentReferenceService environmentReferenceService = new EnvironmentReferenceService(context);
List<EnvironmentReferenceModel> resources = new LinkedList<EnvironmentReferenceModel>();
// find JMS references...
List<Element> queueReferences = $(element).find("resource-env-ref").get();
for (Element e : queueReferences)
{
String type = $(e).child("resource-env-ref-type").text();
String name = $(e).child("resource-env-ref-name").text();
type = StringUtils.trim(type);
name = StringUtils.trim(name);
EnvironmentReferenceModel ref = environmentReferenceService.findEnvironmentReference(name, type);
if (ref == null)
{
ref = environmentReferenceService.create();
ref.setName(name);
ref.setReferenceType(type);
}
resources.add(ref);
}
return resources;
}
代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-ee
private void createDataSourceModel(GraphRewrite event, EvaluationContext context, XmlFileModel xmlFileModel)
{
GraphContext graphContext = event.getGraphContext();
DataSourceService dataSourceService = new DataSourceService(graphContext);
// check the root XML node.
Set<ProjectModel> applications = ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), xmlFileModel.getProjectModel());
Document doc = new XmlFileService(graphContext).loadDocumentQuiet(event, context, xmlFileModel);
for (String tagName : Arrays.asList(SINGLE_DATASOURCE_TAG, SINGLE_DATASOURCE_XA_TAG))
{
for (Element element : $(doc).find(tagName).get())
{
DataSourceModel dataSourceModel = dataSourceService.create();
boolean isXa = tagName.equals(SINGLE_DATASOURCE_XA_TAG);
dataSourceModel.setName(element.getAttribute("pool-name"));
dataSourceModel.setJndiLocation(element.getAttribute("jndi-name"));
dataSourceModel.setApplications(applications);
dataSourceModel.setXa(isXa);
}
}
}
}
代码示例来源:origin: windup/windup
private void createDataSourceModel(GraphRewrite event, EvaluationContext context, XmlFileModel xmlFileModel)
{
GraphContext graphContext = event.getGraphContext();
DataSourceService dataSourceService = new DataSourceService(graphContext);
// check the root XML node.
Set<ProjectModel> applications = ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), xmlFileModel.getProjectModel());
Document doc = new XmlFileService(graphContext).loadDocumentQuiet(event, context, xmlFileModel);
for (String tagName : Arrays.asList(SINGLE_DATASOURCE_TAG, SINGLE_DATASOURCE_XA_TAG))
{
for (Element element : $(doc).find(tagName).get())
{
DataSourceModel dataSourceModel = dataSourceService.create();
boolean isXa = tagName.equals(SINGLE_DATASOURCE_XA_TAG);
dataSourceModel.setName(element.getAttribute("pool-name"));
dataSourceModel.setJndiLocation(element.getAttribute("jndi-name"));
dataSourceModel.setApplications(applications);
dataSourceModel.setXa(isXa);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!