diff --git a/pom.xml b/pom.xml index e27c38b..a9d7c74 100644 --- a/pom.xml +++ b/pom.xml @@ -108,16 +108,8 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 17 - 17 - - - \ No newline at end of file + diff --git a/src/main/java/com/release11/DAO.java b/src/main/java/com/release11/DAO.java index b0abf50..da807bd 100644 --- a/src/main/java/com/release11/DAO.java +++ b/src/main/java/com/release11/DAO.java @@ -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")); diff --git a/src/main/java/com/release11/Main.java b/src/main/java/com/release11/Main.java index 4e995f6..1977c81 100644 --- a/src/main/java/com/release11/Main.java +++ b/src/main/java/com/release11/Main.java @@ -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("" + "\n" + @@ -117,6 +128,7 @@ public class Main { "\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"); diff --git a/target/classes/META-INF/JAXB/episode_default-cli.xjb b/target/classes/META-INF/JAXB/episode_default-cli.xjb new file mode 100644 index 0000000..524a264 --- /dev/null +++ b/target/classes/META-INF/JAXB/episode_default-cli.xjb @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/target/classes/com/release11/DAO.class b/target/classes/com/release11/DAO.class index bbe88b6..4ffb0cd 100644 Binary files a/target/classes/com/release11/DAO.class and b/target/classes/com/release11/DAO.class differ diff --git a/target/classes/com/release11/Main$1.class b/target/classes/com/release11/Main$1.class index d2bd461..3d786d5 100644 Binary files a/target/classes/com/release11/Main$1.class and b/target/classes/com/release11/Main$1.class differ diff --git a/target/classes/com/release11/Main.class b/target/classes/com/release11/Main.class index 1942bd6..a5ecd53 100644 Binary files a/target/classes/com/release11/Main.class and b/target/classes/com/release11/Main.class differ diff --git a/target/classes/generated/MaterialType.class b/target/classes/generated/MaterialType.class new file mode 100644 index 0000000..06732de Binary files /dev/null and b/target/classes/generated/MaterialType.class differ diff --git a/target/classes/generated/MaterialTypeType.class b/target/classes/generated/MaterialTypeType.class new file mode 100644 index 0000000..f239fbe Binary files /dev/null and b/target/classes/generated/MaterialTypeType.class differ diff --git a/target/classes/generated/ObjectFactory.class b/target/classes/generated/ObjectFactory.class new file mode 100644 index 0000000..2abb3b1 Binary files /dev/null and b/target/classes/generated/ObjectFactory.class differ diff --git a/target/classes/generated/Package.class b/target/classes/generated/Package.class new file mode 100644 index 0000000..d8a5673 Binary files /dev/null and b/target/classes/generated/Package.class differ diff --git a/target/generated-sources/jaxb/META-INF/JAXB/episode_default-cli.xjb b/target/generated-sources/jaxb/META-INF/JAXB/episode_default-cli.xjb new file mode 100644 index 0000000..524a264 --- /dev/null +++ b/target/generated-sources/jaxb/META-INF/JAXB/episode_default-cli.xjb @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/target/generated-sources/jaxb/generated/MaterialType.java b/target/generated-sources/jaxb/generated/MaterialType.java new file mode 100644 index 0000000..0ff980a --- /dev/null +++ b/target/generated-sources/jaxb/generated/MaterialType.java @@ -0,0 +1,221 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 +// See https://javaee.github.io/jaxb-v2/ +// 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; + + +/** + *

Java class for materialType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="materialType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="material_number" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="material_type" type="{}material_typeType"/>
+ *         <element name="material_name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="is_deleted" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="packages" type="{}package" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@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 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. + * + *

+ * 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 set method for the packages property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getPackages().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Package } + * + * + */ + public List getPackages() { + if (packages == null) { + packages = new ArrayList(); + } + return this.packages; + } + +} diff --git a/target/generated-sources/jaxb/generated/MaterialTypeType.java b/target/generated-sources/jaxb/generated/MaterialTypeType.java new file mode 100644 index 0000000..0213265 --- /dev/null +++ b/target/generated-sources/jaxb/generated/MaterialTypeType.java @@ -0,0 +1,79 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 +// See https://javaee.github.io/jaxb-v2/ +// 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; + + +/** + *

Java class for material_typeType. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="material_typeType">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="A1"/>
+ *     <enumeration value="A2"/>
+ *     <enumeration value="A3"/>
+ *     <enumeration value="B1"/>
+ *     <enumeration value="B2"/>
+ *     <enumeration value="B3"/>
+ *     <enumeration value="Z1"/>
+ *     <enumeration value="Z2"/>
+ *     <enumeration value="Z3"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@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); + } + +} diff --git a/target/generated-sources/jaxb/generated/ObjectFactory.java b/target/generated-sources/jaxb/generated/ObjectFactory.java new file mode 100644 index 0000000..a84e500 --- /dev/null +++ b/target/generated-sources/jaxb/generated/ObjectFactory.java @@ -0,0 +1,72 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 +// See https://javaee.github.io/jaxb-v2/ +// 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. + *

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 createMaterial(MaterialType value) { + return new JAXBElement(_Material_QNAME, MaterialType.class, null, value); + } + +} diff --git a/target/generated-sources/jaxb/generated/Package.java b/target/generated-sources/jaxb/generated/Package.java new file mode 100644 index 0000000..af5a883 --- /dev/null +++ b/target/generated-sources/jaxb/generated/Package.java @@ -0,0 +1,211 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 +// See https://javaee.github.io/jaxb-v2/ +// 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; + + +/** + *

Java class for package complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="package">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="material_id" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="package_number" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="ean" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="unit_of_measure" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="dimension" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@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; + } + +} diff --git a/target/jaxb2/.default-cli-xjcStaleFlag b/target/jaxb2/.default-cli-xjcStaleFlag new file mode 100644 index 0000000..e69de29