modified pom

This commit is contained in:
2021-11-18 12:33:34 +01:00
parent e0aa057fc0
commit 7c3916a6ce
17 changed files with 681 additions and 12 deletions

10
pom.xml
View File

@@ -108,16 +108,8 @@
</sources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -1,5 +1,6 @@
package com.release11;
import generated.MaterialType;
import org.apache.camel.Exchange;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -26,13 +27,42 @@ public class DAO {
return xml;
}
public void getId(Exchange exchange) throws InterruptedException {
String tmp = exchange.getIn().getBody().toString();
System.out.println(tmp);
MaterialType tmp = (MaterialType) exchange.getIn().getBody();
System.out.println(tmp.getDescription()+tmp.getMaterialName());
Thread.sleep(10000);
exchange.getIn().setBody("SELECT * FROM package WHERE material_id = 1");
}
public void test2(Exchange exchange) throws InterruptedException {
HashMap map = (HashMap) exchange.getIn().getBody();
MaterialType materialType = new MaterialType();
materialType.setMaterialType(map.get(""));
System.out.println(tmp.getDescription()+tmp.getMaterialName());
Thread.sleep(10000);
exchange.getIn().setBody("SELECT * FROM package WHERE material_id = 1");
}
public void splitPackage(LinkedHashMap packageMap) {
Package pack = new Package();
pack.setId((Integer) packageMap.get("id"));

View File

@@ -88,11 +88,22 @@ public class Main {
.to("activemq:queue:materialTest");
from("activemq:queue:materialTest")
.bean(new DAO(), "test2")
.marshal(XMLDataFormat)
.to("activemq:queue:test");
from("direct:pretty")
.setBody(constant("<?xml version='1.0'?>" +
"<material>\n" +
@@ -117,6 +128,7 @@ public class Main {
"</material>\n"))
.unmarshal()
.jaxb("generated")
.bean(new DAO(), "getId")
.to("activemq:queue:test")
.to("log:?level=INFO&showBody=true");
@@ -126,7 +138,7 @@ public class Main {
context.start();
ProducerTemplate template = context.createProducerTemplate();
template.sendBody("direct:pretty", null);
template.sendBody("direct:test", null);
Thread.sleep(1000);
//template.setDefaultEndpointUri("activemq:queue:material");

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<!--
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2021.11.17 at 01:26:11 PM CET
-->
<jaxb:bindings scd="x-schema::">
<jaxb:schemaBindings map="false">
<jaxb:package name="generated"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="~materialType">
<jaxb:class ref="generated.MaterialType"/>
</jaxb:bindings>
<jaxb:bindings scd="~package">
<jaxb:class ref="generated.Package"/>
</jaxb:bindings>
<jaxb:bindings scd="~material_typeType">
<jaxb:typesafeEnumClass ref="generated.MaterialTypeType"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<!--
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2021.11.17 at 01:26:11 PM CET
-->
<jaxb:bindings scd="x-schema::">
<jaxb:schemaBindings map="false">
<jaxb:package name="generated"/>
</jaxb:schemaBindings>
<jaxb:bindings scd="~materialType">
<jaxb:class ref="generated.MaterialType"/>
</jaxb:bindings>
<jaxb:bindings scd="~package">
<jaxb:class ref="generated.Package"/>
</jaxb:bindings>
<jaxb:bindings scd="~material_typeType">
<jaxb:typesafeEnumClass ref="generated.MaterialTypeType"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@@ -0,0 +1,221 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2021.11.17 at 01:26:11 PM CET
//
package generated;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for materialType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="materialType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
* &lt;element name="material_number" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
* &lt;element name="material_type" type="{}material_typeType"/&gt;
* &lt;element name="material_name" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="is_deleted" type="{http://www.w3.org/2001/XMLSchema}boolean"/&gt;
* &lt;element name="packages" type="{}package" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "materialType", propOrder = {
"id",
"materialNumber",
"materialType",
"materialName",
"description",
"isDeleted",
"packages"
})
public class MaterialType {
protected int id;
@XmlElement(name = "material_number")
protected int materialNumber;
@XmlElement(name = "material_type", required = true)
@XmlSchemaType(name = "string")
protected MaterialTypeType materialType;
@XmlElement(name = "material_name", required = true)
protected String materialName;
@XmlElement(required = true)
protected String description;
@XmlElement(name = "is_deleted")
protected boolean isDeleted;
@XmlElement(required = true)
protected List<Package> packages;
/**
* Gets the value of the id property.
*
*/
public int getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(int value) {
this.id = value;
}
/**
* Gets the value of the materialNumber property.
*
*/
public int getMaterialNumber() {
return materialNumber;
}
/**
* Sets the value of the materialNumber property.
*
*/
public void setMaterialNumber(int value) {
this.materialNumber = value;
}
/**
* Gets the value of the materialType property.
*
* @return
* possible object is
* {@link MaterialTypeType }
*
*/
public MaterialTypeType getMaterialType() {
return materialType;
}
/**
* Sets the value of the materialType property.
*
* @param value
* allowed object is
* {@link MaterialTypeType }
*
*/
public void setMaterialType(MaterialTypeType value) {
this.materialType = value;
}
/**
* Gets the value of the materialName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMaterialName() {
return materialName;
}
/**
* Sets the value of the materialName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMaterialName(String value) {
this.materialName = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the isDeleted property.
*
*/
public boolean isIsDeleted() {
return isDeleted;
}
/**
* Sets the value of the isDeleted property.
*
*/
public void setIsDeleted(boolean value) {
this.isDeleted = value;
}
/**
* Gets the value of the packages property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the packages property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPackages().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Package }
*
*
*/
public List<Package> getPackages() {
if (packages == null) {
packages = new ArrayList<Package>();
}
return this.packages;
}
}

View File

@@ -0,0 +1,79 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2021.11.17 at 01:26:11 PM CET
//
package generated;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for material_typeType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* &lt;simpleType name="material_typeType"&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
* &lt;enumeration value="A1"/&gt;
* &lt;enumeration value="A2"/&gt;
* &lt;enumeration value="A3"/&gt;
* &lt;enumeration value="B1"/&gt;
* &lt;enumeration value="B2"/&gt;
* &lt;enumeration value="B3"/&gt;
* &lt;enumeration value="Z1"/&gt;
* &lt;enumeration value="Z2"/&gt;
* &lt;enumeration value="Z3"/&gt;
* &lt;/restriction&gt;
* &lt;/simpleType&gt;
* </pre>
*
*/
@XmlType(name = "material_typeType")
@XmlEnum
public enum MaterialTypeType {
@XmlEnumValue("A1")
A_1("A1"),
@XmlEnumValue("A2")
A_2("A2"),
@XmlEnumValue("A3")
A_3("A3"),
@XmlEnumValue("B1")
B_1("B1"),
@XmlEnumValue("B2")
B_2("B2"),
@XmlEnumValue("B3")
B_3("B3"),
@XmlEnumValue("Z1")
Z_1("Z1"),
@XmlEnumValue("Z2")
Z_2("Z2"),
@XmlEnumValue("Z3")
Z_3("Z3");
private final String value;
MaterialTypeType(String v) {
value = v;
}
public String value() {
return value;
}
public static MaterialTypeType fromValue(String v) {
for (MaterialTypeType c: MaterialTypeType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}

View File

@@ -0,0 +1,72 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2021.11.17 at 01:26:11 PM CET
//
package generated;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the generated package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _Material_QNAME = new QName("", "material");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link MaterialType }
*
*/
public MaterialType createMaterialType() {
return new MaterialType();
}
/**
* Create an instance of {@link Package }
*
*/
public Package createPackage() {
return new Package();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link MaterialType }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link MaterialType }{@code >}
*/
@XmlElementDecl(namespace = "", name = "material")
public JAXBElement<MaterialType> createMaterial(MaterialType value) {
return new JAXBElement<MaterialType>(_Material_QNAME, MaterialType.class, null, value);
}
}

View File

@@ -0,0 +1,211 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2021.11.17 at 01:26:11 PM CET
//
package generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for package complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="package"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
* &lt;element name="material_id" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
* &lt;element name="package_number" type="{http://www.w3.org/2001/XMLSchema}int"/&gt;
* &lt;element name="ean" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="unit_of_measure" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="dimension" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "package", propOrder = {
"id",
"materialId",
"packageNumber",
"ean",
"unitOfMeasure",
"dimension",
"description"
})
public class Package {
protected int id;
@XmlElement(name = "material_id")
protected int materialId;
@XmlElement(name = "package_number")
protected int packageNumber;
@XmlElement(required = true)
protected String ean;
@XmlElement(name = "unit_of_measure", required = true)
protected String unitOfMeasure;
@XmlElement(required = true)
protected String dimension;
protected String description;
/**
* Gets the value of the id property.
*
*/
public int getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(int value) {
this.id = value;
}
/**
* Gets the value of the materialId property.
*
*/
public int getMaterialId() {
return materialId;
}
/**
* Sets the value of the materialId property.
*
*/
public void setMaterialId(int value) {
this.materialId = value;
}
/**
* Gets the value of the packageNumber property.
*
*/
public int getPackageNumber() {
return packageNumber;
}
/**
* Sets the value of the packageNumber property.
*
*/
public void setPackageNumber(int value) {
this.packageNumber = value;
}
/**
* Gets the value of the ean property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEan() {
return ean;
}
/**
* Sets the value of the ean property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEan(String value) {
this.ean = value;
}
/**
* Gets the value of the unitOfMeasure property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUnitOfMeasure() {
return unitOfMeasure;
}
/**
* Sets the value of the unitOfMeasure property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnitOfMeasure(String value) {
this.unitOfMeasure = value;
}
/**
* Gets the value of the dimension property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDimension() {
return dimension;
}
/**
* Sets the value of the dimension property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDimension(String value) {
this.dimension = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
}

View File