| @@ -0,0 +1,9 @@ | ||
| build.xml.data.CRC32=610a3791 | ||
| build.xml.script.CRC32=cf15c844 | ||
| build.xml.stylesheet.CRC32=651128d4@1.68.1.1 | ||
| # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
| # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
| nbproject/build-impl.xml.data.CRC32=610a3791 | ||
| nbproject/build-impl.xml.script.CRC32=1a1eda14 | ||
| nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 | ||
| nbproject/jaxws-build.xml.stylesheet.CRC32=6608c2cf |
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <jax-ws xmlns="http://www.netbeans.org/ns/jax-ws/1"> | ||
| <services> | ||
| <service name="CustomerWebService"> | ||
| <implementation-class>com.filipferm.soap.webservice.CustomerWebService</implementation-class> | ||
| </service> | ||
| </services> | ||
| <clients/> | ||
| </jax-ws> |
| @@ -0,0 +1,35 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?><!-- | ||
| *** GENERATED FROM jax-ws.xml - DO NOT EDIT ! *** | ||
| *** TO MODIFY wsimport options USE Web Service node -> Edit WS Attributes *** | ||
| *** TO CHANGE TARGETS GENERATED TO jaxws-build.xml COPY THOSE *** | ||
| *** TARGETS TO ../build.xml AND MODIFY THAT FILE INSTEAD *** | ||
| --><project xmlns:xalan="http://xml.apache.org/xslt" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1"> | ||
| <!-- | ||
| =================== | ||
| JAX-WS WSGEN SECTION | ||
| =================== | ||
| --> | ||
| <target name="wsgen-init" depends="init, -do-compile"> | ||
| <mkdir dir="${build.generated.sources.dir}/jax-ws/resources/"/> | ||
| <mkdir dir="${build.classes.dir}"/> | ||
| <mkdir dir="${build.classes.dir}/META-INF"/> | ||
| <property name="j2ee.platform.wsgen.classpath" value="${libs.jaxws21.classpath}"/> | ||
| <taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen"> | ||
| <classpath path="${java.home}/../lib/tools.jar:${build.classes.dir}:${j2ee.platform.wsgen.classpath}:${javac.classpath}"/> | ||
| </taskdef> | ||
| </target> | ||
| <target name="wsgen-CustomerWebService" depends="wsgen-init"> | ||
| <copy todir="${build.classes.dir}/META-INF"> | ||
| <fileset dir="${webinf.dir}" includes="wsit-com.filipferm.soap.webservice.CustomerWebService.xml"/> | ||
| </copy> | ||
| <wsgen sourcedestdir="${build.generated.sources.dir}/jax-ws" resourcedestdir="${build.generated.sources.dir}/jax-ws/resources/" destdir="${build.generated.sources.dir}/jax-ws" verbose="true" keep="true" genwsdl="true" sei="com.filipferm.soap.webservice.CustomerWebService" xendorsed="true"> | ||
| <classpath path="${java.home}/../lib/tools.jar:${build.classes.dir}:${j2ee.platform.wsgen.classpath}:${javac.classpath}"/> | ||
| </wsgen> | ||
| </target> | ||
| <!-- | ||
| =================== | ||
| JAX-WS WSIMPORT SECTION | ||
| =================== | ||
| --> | ||
| </project> |
| @@ -0,0 +1,10 @@ | ||
| deploy.ant.properties.file=C:\\Users\\Filip\\AppData\\Roaming\\NetBeans\\8.0.2\\config\\GlassFishEE6\\Properties\\gfv3-82566820.properties | ||
| j2ee.platform.is.jsr109=true | ||
| j2ee.server.domain=C:/Users/Filip/AppData/Roaming/NetBeans/8.0.2/config/GF_4.1/domain1 | ||
| j2ee.server.home=C:/Program Files/glassfish4.1/glassfish | ||
| j2ee.server.instance=[C:\\Program Files\\glassfish4.1\\glassfish;C:\\Program Files\\glassfish4.1\\glassfish\\domains\\domain1]deployer:gfv3ee6wc:localhost:4848 | ||
| j2ee.server.middleware=C:/Program Files/glassfish4.1 | ||
| javac.debug=true | ||
| javadoc.preview=true | ||
| selected.browser=default | ||
| user.properties.file=C:\\Users\\Filip\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties |
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project-private xmlns="http://www.netbeans.org/ns/project-private/1"> | ||
| <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> | ||
| <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> | ||
| <group/> | ||
| </open-files> | ||
| </project-private> |
| @@ -0,0 +1,91 @@ | ||
| annotation.processing.enabled=true | ||
| annotation.processing.enabled.in.editor=true | ||
| annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false | ||
| annotation.processing.processors.list= | ||
| annotation.processing.run.all.processors=true | ||
| annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output | ||
| build.classes.dir=${build.web.dir}/WEB-INF/classes | ||
| build.classes.excludes=**/*.java,**/*.form | ||
| build.dir=build | ||
| build.generated.dir=${build.dir}/generated | ||
| build.generated.sources.dir=${build.dir}/generated-sources | ||
| build.test.classes.dir=${build.dir}/test/classes | ||
| build.test.results.dir=${build.dir}/test/results | ||
| build.web.dir=${build.dir}/web | ||
| build.web.excludes=${build.classes.excludes} | ||
| client.urlPart= | ||
| compile.jsps=false | ||
| conf.dir=${source.root}/conf | ||
| debug.classpath=${build.classes.dir}:${javac.classpath} | ||
| debug.test.classpath=\ | ||
| ${run.test.classpath} | ||
| display.browser=true | ||
| # Files to be excluded from distribution war | ||
| dist.archive.excludes= | ||
| dist.dir=dist | ||
| dist.ear.war=${dist.dir}/${war.ear.name} | ||
| dist.javadoc.dir=${dist.dir}/javadoc | ||
| dist.war=${dist.dir}/${war.name} | ||
| endorsed.classpath=\ | ||
| ${libs.javaee-endorsed-api-6.0.classpath} | ||
| excludes= | ||
| includes=** | ||
| j2ee.compile.on.save=true | ||
| j2ee.copy.static.files.on.save=true | ||
| j2ee.deploy.on.save=true | ||
| j2ee.platform=1.7-web | ||
| j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar | ||
| j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar | ||
| j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar | ||
| j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar | ||
| j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar | ||
| j2ee.platform.wsit.classpath= | ||
| j2ee.server.type=gfv3ee6 | ||
| jar.compress=false | ||
| javac.classpath= | ||
| # Space-separated list of extra javac options | ||
| javac.compilerargs= | ||
| javac.debug=true | ||
| javac.deprecation=false | ||
| javac.processorpath=\ | ||
| ${javac.classpath}:\ | ||
| ${libs.eclipselink.classpath}:\ | ||
| ${libs.eclipselinkmodelgen.classpath} | ||
| javac.source=1.8 | ||
| javac.target=1.8 | ||
| javac.test.classpath=\ | ||
| ${javac.classpath}:\ | ||
| ${build.classes.dir} | ||
| javac.test.processorpath=\ | ||
| ${javac.test.classpath} | ||
| javadoc.additionalparam= | ||
| javadoc.author=false | ||
| javadoc.encoding=${source.encoding} | ||
| javadoc.noindex=false | ||
| javadoc.nonavbar=false | ||
| javadoc.notree=false | ||
| javadoc.preview=true | ||
| javadoc.private=false | ||
| javadoc.splitindex=true | ||
| javadoc.use=true | ||
| javadoc.version=false | ||
| javadoc.windowtitle= | ||
| lib.dir=${web.docbase.dir}/WEB-INF/lib | ||
| persistence.xml.dir=${conf.dir} | ||
| platform.active=default_platform | ||
| resource.dir=setup | ||
| run.test.classpath=\ | ||
| ${javac.test.classpath}:\ | ||
| ${build.test.classes.dir} | ||
| # Space-separated list of JVM arguments used when running a class with a main method or a unit test | ||
| # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): | ||
| runmain.jvmargs= | ||
| source.encoding=UTF-8 | ||
| source.root=src | ||
| src.dir=${source.root}/java | ||
| test.src.dir=test | ||
| war.content.additional= | ||
| war.ear.name=${war.name} | ||
| war.name=IntegrationSoap.war | ||
| web.docbase.dir=web | ||
| webinf.dir=web/WEB-INF |
| @@ -0,0 +1,21 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://www.netbeans.org/ns/project/1"> | ||
| <type>org.netbeans.modules.web.project</type> | ||
| <configuration> | ||
| <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1"> | ||
| <extension file="jaxws-build.xml" id="jaxws"/> | ||
| </buildExtensions> | ||
| <data xmlns="http://www.netbeans.org/ns/web-project/3"> | ||
| <name>IntegrationSoap</name> | ||
| <minimum-ant-version>1.6.5</minimum-ant-version> | ||
| <web-module-libraries/> | ||
| <web-module-additional-libraries/> | ||
| <source-roots> | ||
| <root id="src.dir"/> | ||
| </source-roots> | ||
| <test-roots> | ||
| <root id="test.src.dir"/> | ||
| </test-roots> | ||
| </data> | ||
| </configuration> | ||
| </project> |
| @@ -0,0 +1,2 @@ | ||
| Manifest-Version: 1.0 | ||
|
|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> | ||
| <persistence-unit name="IntegratioSoapPU" transaction-type="JTA"> | ||
| <jta-data-source>jdbc/integration</jta-data-source> | ||
| <exclude-unlisted-classes>false</exclude-unlisted-classes> | ||
| <properties/> | ||
| </persistence-unit> | ||
| </persistence> |
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.ejb; | ||
|
|
||
| import com.filipferm.soap.model.Customer; | ||
| import java.util.List; | ||
| import javax.ejb.Stateless; | ||
| import javax.persistence.EntityManager; | ||
| import javax.persistence.PersistenceContext; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @Stateless | ||
| public class CustomerManager { | ||
|
|
||
| @PersistenceContext(name = "IntegratioSoapPU") | ||
| EntityManager em; | ||
|
|
||
| public List<Customer> getAllCustomers() { | ||
| return em.createNamedQuery("Customer.findAll", Customer.class).getResultList(); | ||
| } | ||
|
|
||
| public Customer getCustomerByFirstName(int customerId) { | ||
| return em.find(Customer.class, customerId); | ||
| } | ||
|
|
||
| public boolean addCustomer(String firstName, String lastName) { | ||
| if (firstName == null || lastName == null) { | ||
| return false; | ||
| } else { | ||
| Customer customer = new Customer(); | ||
| customer.setFirstName(firstName); | ||
| customer.setLastName(lastName); | ||
| em.merge(customer); | ||
| } | ||
| return true; | ||
| } | ||
| } |
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.model; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Collection; | ||
| import javax.persistence.Basic; | ||
| import javax.persistence.CascadeType; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.NamedQueries; | ||
| import javax.persistence.NamedQuery; | ||
| import javax.persistence.OneToMany; | ||
| import javax.persistence.Table; | ||
| import javax.validation.constraints.Size; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
| import javax.xml.bind.annotation.XmlTransient; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @Entity | ||
| @Table(name = "category") | ||
| @XmlRootElement | ||
| @NamedQueries({ | ||
| @NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c"), | ||
| @NamedQuery(name = "Category.findById", query = "SELECT c FROM Category c WHERE c.id = :id"), | ||
| @NamedQuery(name = "Category.findByCategoryName", query = "SELECT c FROM Category c WHERE c.categoryName = :categoryName"), | ||
| @NamedQuery(name = "Category.findByDescription", query = "SELECT c FROM Category c WHERE c.description = :description")}) | ||
| public class Category implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Basic(optional = false) | ||
| @Column(name = "id") | ||
| private Integer id; | ||
| @Size(max = 45) | ||
| @Column(name = "categoryName") | ||
| private String categoryName; | ||
| @Size(max = 255) | ||
| @Column(name = "description") | ||
| private String description; | ||
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoryid") | ||
| private Collection<Product> productCollection; | ||
|
|
||
| public Category() { | ||
| } | ||
|
|
||
| public Category(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Integer getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public String getCategoryName() { | ||
| return categoryName; | ||
| } | ||
|
|
||
| public void setCategoryName(String categoryName) { | ||
| this.categoryName = categoryName; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public void setDescription(String description) { | ||
| this.description = description; | ||
| } | ||
|
|
||
| @XmlTransient | ||
| public Collection<Product> getProductCollection() { | ||
| return productCollection; | ||
| } | ||
|
|
||
| public void setProductCollection(Collection<Product> productCollection) { | ||
| this.productCollection = productCollection; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 0; | ||
| hash += (id != null ? id.hashCode() : 0); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| // TODO: Warning - this method won't work in the case the id fields are not set | ||
| if (!(object instanceof Category)) { | ||
| return false; | ||
| } | ||
| Category other = (Category) object; | ||
| if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "com.filipferm.soap.model.Category[ id=" + id + " ]"; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.model; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Collection; | ||
| import javax.persistence.Basic; | ||
| import javax.persistence.CascadeType; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.NamedQueries; | ||
| import javax.persistence.NamedQuery; | ||
| import javax.persistence.OneToMany; | ||
| import javax.persistence.Table; | ||
| import javax.validation.constraints.Size; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
| import javax.xml.bind.annotation.XmlTransient; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @Entity | ||
| @Table(name = "customer") | ||
| @XmlRootElement | ||
| @NamedQueries({ | ||
| @NamedQuery(name = "Customer.findAll", query = "SELECT c FROM Customer c"), | ||
| @NamedQuery(name = "Customer.findById", query = "SELECT c FROM Customer c WHERE c.id = :id"), | ||
| @NamedQuery(name = "Customer.findByFirstName", query = "SELECT c FROM Customer c WHERE c.firstName = :firstName"), | ||
| @NamedQuery(name = "Customer.findByLastName", query = "SELECT c FROM Customer c WHERE c.lastName = :lastName")}) | ||
| public class Customer implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Basic(optional = false) | ||
| @Column(name = "id") | ||
| private Integer id; | ||
| @Size(max = 45) | ||
| @Column(name = "firstName") | ||
| private String firstName; | ||
| @Size(max = 45) | ||
| @Column(name = "lastName") | ||
| private String lastName; | ||
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "customerid") | ||
| private Collection<Orders> ordersCollection; | ||
|
|
||
| public Customer() { | ||
| } | ||
|
|
||
| public Customer(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Integer getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public String getFirstName() { | ||
| return firstName; | ||
| } | ||
|
|
||
| public void setFirstName(String firstName) { | ||
| this.firstName = firstName; | ||
| } | ||
|
|
||
| public String getLastName() { | ||
| return lastName; | ||
| } | ||
|
|
||
| public void setLastName(String lastName) { | ||
| this.lastName = lastName; | ||
| } | ||
|
|
||
| @XmlTransient | ||
| public Collection<Orders> getOrdersCollection() { | ||
| return ordersCollection; | ||
| } | ||
|
|
||
| public void setOrdersCollection(Collection<Orders> ordersCollection) { | ||
| this.ordersCollection = ordersCollection; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 0; | ||
| hash += (id != null ? id.hashCode() : 0); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| // TODO: Warning - this method won't work in the case the id fields are not set | ||
| if (!(object instanceof Customer)) { | ||
| return false; | ||
| } | ||
| Customer other = (Customer) object; | ||
| if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "com.filipferm.soap.model.Customer[ id=" + id + " ]"; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,125 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.model; | ||
|
|
||
| import java.io.Serializable; | ||
| import javax.persistence.Basic; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.JoinColumn; | ||
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.NamedQueries; | ||
| import javax.persistence.NamedQuery; | ||
| import javax.persistence.Table; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @Entity | ||
| @Table(name = "orderitems") | ||
| @XmlRootElement | ||
| @NamedQueries({ | ||
| @NamedQuery(name = "Orderitems.findAll", query = "SELECT o FROM Orderitems o"), | ||
| @NamedQuery(name = "Orderitems.findById", query = "SELECT o FROM Orderitems o WHERE o.id = :id"), | ||
| @NamedQuery(name = "Orderitems.findByQuantity", query = "SELECT o FROM Orderitems o WHERE o.quantity = :quantity"), | ||
| @NamedQuery(name = "Orderitems.findByTotalPrice", query = "SELECT o FROM Orderitems o WHERE o.totalPrice = :totalPrice")}) | ||
| public class Orderitems implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Basic(optional = false) | ||
| @Column(name = "id") | ||
| private Integer id; | ||
| @Column(name = "quantity") | ||
| private Integer quantity; | ||
| // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation | ||
| @Column(name = "totalPrice") | ||
| private Double totalPrice; | ||
| @JoinColumn(name = "Orders_id", referencedColumnName = "id") | ||
| @ManyToOne(optional = false) | ||
| private Orders ordersid; | ||
| @JoinColumn(name = "Product_id", referencedColumnName = "id") | ||
| @ManyToOne | ||
| private Product productid; | ||
|
|
||
| public Orderitems() { | ||
| } | ||
|
|
||
| public Orderitems(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Integer getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Integer getQuantity() { | ||
| return quantity; | ||
| } | ||
|
|
||
| public void setQuantity(Integer quantity) { | ||
| this.quantity = quantity; | ||
| } | ||
|
|
||
| public Double getTotalPrice() { | ||
| return totalPrice; | ||
| } | ||
|
|
||
| public void setTotalPrice(Double totalPrice) { | ||
| this.totalPrice = totalPrice; | ||
| } | ||
|
|
||
| public Orders getOrdersid() { | ||
| return ordersid; | ||
| } | ||
|
|
||
| public void setOrdersid(Orders ordersid) { | ||
| this.ordersid = ordersid; | ||
| } | ||
|
|
||
| public Product getProductid() { | ||
| return productid; | ||
| } | ||
|
|
||
| public void setProductid(Product productid) { | ||
| this.productid = productid; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 0; | ||
| hash += (id != null ? id.hashCode() : 0); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| // TODO: Warning - this method won't work in the case the id fields are not set | ||
| if (!(object instanceof Orderitems)) { | ||
| return false; | ||
| } | ||
| Orderitems other = (Orderitems) object; | ||
| if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "com.filipferm.soap.model.Orderitems[ id=" + id + " ]"; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,134 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.model; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Collection; | ||
| import java.util.Date; | ||
| import javax.persistence.Basic; | ||
| import javax.persistence.CascadeType; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.JoinColumn; | ||
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.NamedQueries; | ||
| import javax.persistence.NamedQuery; | ||
| import javax.persistence.OneToMany; | ||
| import javax.persistence.Table; | ||
| import javax.persistence.Temporal; | ||
| import javax.persistence.TemporalType; | ||
| import javax.validation.constraints.Size; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
| import javax.xml.bind.annotation.XmlTransient; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @Entity | ||
| @Table(name = "orders") | ||
| @XmlRootElement | ||
| @NamedQueries({ | ||
| @NamedQuery(name = "Orders.findAll", query = "SELECT o FROM Orders o"), | ||
| @NamedQuery(name = "Orders.findById", query = "SELECT o FROM Orders o WHERE o.id = :id"), | ||
| @NamedQuery(name = "Orders.findByOrderDate", query = "SELECT o FROM Orders o WHERE o.orderDate = :orderDate"), | ||
| @NamedQuery(name = "Orders.findByMessage", query = "SELECT o FROM Orders o WHERE o.message = :message")}) | ||
| public class Orders implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Basic(optional = false) | ||
| @Column(name = "id") | ||
| private Integer id; | ||
| @Column(name = "orderDate") | ||
| @Temporal(TemporalType.DATE) | ||
| private Date orderDate; | ||
| @Size(max = 255) | ||
| @Column(name = "message") | ||
| private String message; | ||
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "ordersid") | ||
| private Collection<Orderitems> orderitemsCollection; | ||
| @JoinColumn(name = "Customer_id", referencedColumnName = "id") | ||
| @ManyToOne(optional = false) | ||
| private Customer customerid; | ||
|
|
||
| public Orders() { | ||
| } | ||
|
|
||
| public Orders(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Integer getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Date getOrderDate() { | ||
| return orderDate; | ||
| } | ||
|
|
||
| public void setOrderDate(Date orderDate) { | ||
| this.orderDate = orderDate; | ||
| } | ||
|
|
||
| public String getMessage() { | ||
| return message; | ||
| } | ||
|
|
||
| public void setMessage(String message) { | ||
| this.message = message; | ||
| } | ||
|
|
||
| @XmlTransient | ||
| public Collection<Orderitems> getOrderitemsCollection() { | ||
| return orderitemsCollection; | ||
| } | ||
|
|
||
| public void setOrderitemsCollection(Collection<Orderitems> orderitemsCollection) { | ||
| this.orderitemsCollection = orderitemsCollection; | ||
| } | ||
|
|
||
| public Customer getCustomerid() { | ||
| return customerid; | ||
| } | ||
|
|
||
| public void setCustomerid(Customer customerid) { | ||
| this.customerid = customerid; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 0; | ||
| hash += (id != null ? id.hashCode() : 0); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| // TODO: Warning - this method won't work in the case the id fields are not set | ||
| if (!(object instanceof Orders)) { | ||
| return false; | ||
| } | ||
| Orders other = (Orders) object; | ||
| if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "com.filipferm.soap.model.Orders[ id=" + id + " ]"; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,153 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.model; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Collection; | ||
| import javax.persistence.Basic; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.JoinColumn; | ||
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.NamedQueries; | ||
| import javax.persistence.NamedQuery; | ||
| import javax.persistence.OneToMany; | ||
| import javax.persistence.Table; | ||
| import javax.validation.constraints.Size; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
| import javax.xml.bind.annotation.XmlTransient; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @Entity | ||
| @Table(name = "product") | ||
| @XmlRootElement | ||
| @NamedQueries({ | ||
| @NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"), | ||
| @NamedQuery(name = "Product.findById", query = "SELECT p FROM Product p WHERE p.id = :id"), | ||
| @NamedQuery(name = "Product.findByProductPrice", query = "SELECT p FROM Product p WHERE p.productPrice = :productPrice"), | ||
| @NamedQuery(name = "Product.findByProductName", query = "SELECT p FROM Product p WHERE p.productName = :productName"), | ||
| @NamedQuery(name = "Product.findByProductSize", query = "SELECT p FROM Product p WHERE p.productSize = :productSize"), | ||
| @NamedQuery(name = "Product.findByDescription", query = "SELECT p FROM Product p WHERE p.description = :description")}) | ||
| public class Product implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Basic(optional = false) | ||
| @Column(name = "id") | ||
| private Integer id; | ||
| // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation | ||
| @Column(name = "productPrice") | ||
| private Double productPrice; | ||
| @Size(max = 45) | ||
| @Column(name = "productName") | ||
| private String productName; | ||
| @Column(name = "productSize") | ||
| private Integer productSize; | ||
| @Size(max = 45) | ||
| @Column(name = "description") | ||
| private String description; | ||
| @OneToMany(mappedBy = "productid") | ||
| private Collection<Orderitems> orderitemsCollection; | ||
| @JoinColumn(name = "Category_id", referencedColumnName = "id") | ||
| @ManyToOne(optional = false) | ||
| private Category categoryid; | ||
|
|
||
| public Product() { | ||
| } | ||
|
|
||
| public Product(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Integer getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Integer id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Double getProductPrice() { | ||
| return productPrice; | ||
| } | ||
|
|
||
| public void setProductPrice(Double productPrice) { | ||
| this.productPrice = productPrice; | ||
| } | ||
|
|
||
| public String getProductName() { | ||
| return productName; | ||
| } | ||
|
|
||
| public void setProductName(String productName) { | ||
| this.productName = productName; | ||
| } | ||
|
|
||
| public Integer getProductSize() { | ||
| return productSize; | ||
| } | ||
|
|
||
| public void setProductSize(Integer productSize) { | ||
| this.productSize = productSize; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public void setDescription(String description) { | ||
| this.description = description; | ||
| } | ||
|
|
||
| @XmlTransient | ||
| public Collection<Orderitems> getOrderitemsCollection() { | ||
| return orderitemsCollection; | ||
| } | ||
|
|
||
| public void setOrderitemsCollection(Collection<Orderitems> orderitemsCollection) { | ||
| this.orderitemsCollection = orderitemsCollection; | ||
| } | ||
|
|
||
| public Category getCategoryid() { | ||
| return categoryid; | ||
| } | ||
|
|
||
| public void setCategoryid(Category categoryid) { | ||
| this.categoryid = categoryid; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 0; | ||
| hash += (id != null ? id.hashCode() : 0); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object object) { | ||
| // TODO: Warning - this method won't work in the case the id fields are not set | ||
| if (!(object instanceof Product)) { | ||
| return false; | ||
| } | ||
| Product other = (Product) object; | ||
| if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "com.filipferm.soap.model.Product[ id=" + id + " ]"; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.webservice; | ||
|
|
||
| import com.filipferm.soap.ejb.CustomerManager; | ||
| import com.filipferm.soap.model.Customer; | ||
| import java.util.List; | ||
| import javax.ejb.EJB; | ||
| import javax.jws.WebService; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @WebService(endpointInterface = "com.filipferm.soap.webservice.CustomerWebServiceInterface", | ||
| serviceName = "CustomerService", | ||
| portName = "CustomerPort") //to change names in wbsl so its easier to see | ||
| public class CustomerWebService implements CustomerWebServiceInterface { | ||
|
|
||
| @EJB | ||
| CustomerManager cm; | ||
|
|
||
| @Override | ||
| public boolean addCustomer(String firstName, String lastName) { | ||
| return cm.addCustomer(firstName, lastName); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Customer> getAllCustomers() { | ||
| return cm.getAllCustomers(); | ||
| } | ||
|
|
||
| @Override | ||
| public Customer getCustomerById(int customerId) { | ||
| return cm.getCustomerByFirstName(customerId); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * To change this license header, choose License Headers in Project Properties. | ||
| * To change this template file, choose Tools | Templates | ||
| * and open the template in the editor. | ||
| */ | ||
| package com.filipferm.soap.webservice; | ||
|
|
||
| import com.filipferm.soap.model.Customer; | ||
| import java.util.List; | ||
| import javax.jws.WebMethod; | ||
| import javax.jws.WebService; | ||
|
|
||
| /** | ||
| * | ||
| * @author Filip | ||
| */ | ||
| @WebService(name = "CustomerWebService", | ||
| targetNamespace = "http://www.integrationSoap.com") | ||
| public interface CustomerWebServiceInterface { | ||
|
|
||
| @WebMethod | ||
| boolean addCustomer(String firstName, String lastName); | ||
|
|
||
| @WebMethod | ||
| List<Customer> getAllCustomers(); | ||
|
|
||
| @WebMethod | ||
| Customer getCustomerById(int customerId); | ||
| } |
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" | ||
| version="3.1"> | ||
| <session-config> | ||
| <session-timeout> | ||
| 30 | ||
| </session-timeout> | ||
| </session-config> | ||
| </web-app> |
| @@ -0,0 +1,16 @@ | ||
| <!DOCTYPE html> | ||
| <!-- | ||
| To change this license header, choose License Headers in Project Properties. | ||
| To change this template file, choose Tools | Templates | ||
| and open the template in the editor. | ||
| --> | ||
| <html> | ||
| <head> | ||
| <title>TODO supply a title</title> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| </head> | ||
| <body> | ||
| <div>TODO write content</div> | ||
| </body> | ||
| </html> |