Commit 062cf520 by Patryk Czarnik

wersje podstawowe skopiowane do oddzielnych katalogów

parent 81ee59ab
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
/.idea/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.alx.kjava</groupId>
<artifactId>OgloszeniaKlient</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>4.0.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for adres complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="adres">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ulica" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="kod-pocztowy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="miasto" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "adres", propOrder = {
"ulica",
"kodPocztowy",
"miasto"
})
public class Adres {
protected String ulica;
@XmlElement(name = "kod-pocztowy")
protected String kodPocztowy;
protected String miasto;
/**
* Gets the value of the ulica property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUlica() {
return ulica;
}
/**
* Sets the value of the ulica property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUlica(String value) {
this.ulica = value;
}
/**
* Gets the value of the kodPocztowy property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKodPocztowy() {
return kodPocztowy;
}
/**
* Sets the value of the kodPocztowy property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKodPocztowy(String value) {
this.kodPocztowy = value;
}
/**
* Gets the value of the miasto property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMiasto() {
return miasto;
}
/**
* Sets the value of the miasto property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMiasto(String value) {
this.miasto = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for BladBazyDanych complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="BladBazyDanych">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BladBazyDanych", propOrder = {
"message"
})
public class BladBazyDanych {
protected String message;
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
}
package ogloszenia.generated;
import jakarta.xml.ws.WebFault;
/**
* This class was generated by Apache CXF 4.0.0
* 2023-08-03T14:16:35.587+02:00
* Generated source version: 4.0.0
*/
@WebFault(name = "BladBazyDanych", targetNamespace = "http://soap.ogloszenia/")
public class BladBazyDanych_Exception extends Exception {
private ogloszenia.generated.BladBazyDanych faultInfo;
public BladBazyDanych_Exception() {
super();
}
public BladBazyDanych_Exception(String message) {
super(message);
}
public BladBazyDanych_Exception(String message, java.lang.Throwable cause) {
super(message, cause);
}
public BladBazyDanych_Exception(String message, ogloszenia.generated.BladBazyDanych bladBazyDanych) {
super(message);
this.faultInfo = bladBazyDanych;
}
public BladBazyDanych_Exception(String message, ogloszenia.generated.BladBazyDanych bladBazyDanych, java.lang.Throwable cause) {
super(message, cause);
this.faultInfo = bladBazyDanych;
}
public ogloszenia.generated.BladBazyDanych getFaultInfo() {
return this.faultInfo;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for insert complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="insert">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ogloszenie" type="{http://soap.ogloszenia/}ogloszenieSamochodowe" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "insert", propOrder = {
"ogloszenie"
})
public class Insert {
protected OgloszenieSamochodowe ogloszenie;
/**
* Gets the value of the ogloszenie property.
*
* @return
* possible object is
* {@link OgloszenieSamochodowe }
*
*/
public OgloszenieSamochodowe getOgloszenie() {
return ogloszenie;
}
/**
* Sets the value of the ogloszenie property.
*
* @param value
* allowed object is
* {@link OgloszenieSamochodowe }
*
*/
public void setOgloszenie(OgloszenieSamochodowe value) {
this.ogloszenie = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for insertResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="insertResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="new-id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "insertResponse", propOrder = {
"newId"
})
public class InsertResponse {
@XmlElement(name = "new-id")
protected int newId;
/**
* Gets the value of the newId property.
*
*/
public int getNewId() {
return newId;
}
/**
* Sets the value of the newId property.
*
*/
public void setNewId(int value) {
this.newId = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for NieznanyRekord complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="NieznanyRekord">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NieznanyRekord", propOrder = {
"message"
})
public class NieznanyRekord {
protected String message;
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
}
package ogloszenia.generated;
import jakarta.xml.ws.WebFault;
/**
* This class was generated by Apache CXF 4.0.0
* 2023-08-03T14:16:35.635+02:00
* Generated source version: 4.0.0
*/
@WebFault(name = "NieznanyRekord", targetNamespace = "http://soap.ogloszenia/")
public class NieznanyRekord_Exception extends Exception {
private ogloszenia.generated.NieznanyRekord faultInfo;
public NieznanyRekord_Exception() {
super();
}
public NieznanyRekord_Exception(String message) {
super(message);
}
public NieznanyRekord_Exception(String message, java.lang.Throwable cause) {
super(message, cause);
}
public NieznanyRekord_Exception(String message, ogloszenia.generated.NieznanyRekord nieznanyRekord) {
super(message);
this.faultInfo = nieznanyRekord;
}
public NieznanyRekord_Exception(String message, ogloszenia.generated.NieznanyRekord nieznanyRekord, java.lang.Throwable cause) {
super(message, cause);
this.faultInfo = nieznanyRekord;
}
public ogloszenia.generated.NieznanyRekord getFaultInfo() {
return this.faultInfo;
}
}
package ogloszenia.generated;
import javax.xml.namespace.QName;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlElementDecl;
import jakarta.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the ogloszenia.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 _Insert_QNAME = new QName("http://soap.ogloszenia/", "insert");
private final static QName _InsertResponse_QNAME = new QName("http://soap.ogloszenia/", "insertResponse");
private final static QName _Photo_QNAME = new QName("http://soap.ogloszenia/", "photo");
private final static QName _PhotoResponse_QNAME = new QName("http://soap.ogloszenia/", "photoResponse");
private final static QName _ReadAll_QNAME = new QName("http://soap.ogloszenia/", "readAll");
private final static QName _ReadAllResponse_QNAME = new QName("http://soap.ogloszenia/", "readAllResponse");
private final static QName _ReadByPrice_QNAME = new QName("http://soap.ogloszenia/", "readByPrice");
private final static QName _ReadByPriceResponse_QNAME = new QName("http://soap.ogloszenia/", "readByPriceResponse");
private final static QName _ReadOne_QNAME = new QName("http://soap.ogloszenia/", "readOne");
private final static QName _ReadOneResponse_QNAME = new QName("http://soap.ogloszenia/", "readOneResponse");
private final static QName _Update_QNAME = new QName("http://soap.ogloszenia/", "update");
private final static QName _UpdateResponse_QNAME = new QName("http://soap.ogloszenia/", "updateResponse");
private final static QName _BladBazyDanych_QNAME = new QName("http://soap.ogloszenia/", "BladBazyDanych");
private final static QName _NieznanyRekord_QNAME = new QName("http://soap.ogloszenia/", "NieznanyRekord");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ogloszenia.generated
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Insert }
*
* @return
* the new instance of {@link Insert }
*/
public Insert createInsert() {
return new Insert();
}
/**
* Create an instance of {@link InsertResponse }
*
* @return
* the new instance of {@link InsertResponse }
*/
public InsertResponse createInsertResponse() {
return new InsertResponse();
}
/**
* Create an instance of {@link Photo }
*
* @return
* the new instance of {@link Photo }
*/
public Photo createPhoto() {
return new Photo();
}
/**
* Create an instance of {@link PhotoResponse }
*
* @return
* the new instance of {@link PhotoResponse }
*/
public PhotoResponse createPhotoResponse() {
return new PhotoResponse();
}
/**
* Create an instance of {@link ReadAll }
*
* @return
* the new instance of {@link ReadAll }
*/
public ReadAll createReadAll() {
return new ReadAll();
}
/**
* Create an instance of {@link ReadAllResponse }
*
* @return
* the new instance of {@link ReadAllResponse }
*/
public ReadAllResponse createReadAllResponse() {
return new ReadAllResponse();
}
/**
* Create an instance of {@link ReadByPrice }
*
* @return
* the new instance of {@link ReadByPrice }
*/
public ReadByPrice createReadByPrice() {
return new ReadByPrice();
}
/**
* Create an instance of {@link ReadByPriceResponse }
*
* @return
* the new instance of {@link ReadByPriceResponse }
*/
public ReadByPriceResponse createReadByPriceResponse() {
return new ReadByPriceResponse();
}
/**
* Create an instance of {@link ReadOne }
*
* @return
* the new instance of {@link ReadOne }
*/
public ReadOne createReadOne() {
return new ReadOne();
}
/**
* Create an instance of {@link ReadOneResponse }
*
* @return
* the new instance of {@link ReadOneResponse }
*/
public ReadOneResponse createReadOneResponse() {
return new ReadOneResponse();
}
/**
* Create an instance of {@link Update }
*
* @return
* the new instance of {@link Update }
*/
public Update createUpdate() {
return new Update();
}
/**
* Create an instance of {@link UpdateResponse }
*
* @return
* the new instance of {@link UpdateResponse }
*/
public UpdateResponse createUpdateResponse() {
return new UpdateResponse();
}
/**
* Create an instance of {@link BladBazyDanych }
*
* @return
* the new instance of {@link BladBazyDanych }
*/
public BladBazyDanych createBladBazyDanych() {
return new BladBazyDanych();
}
/**
* Create an instance of {@link NieznanyRekord }
*
* @return
* the new instance of {@link NieznanyRekord }
*/
public NieznanyRekord createNieznanyRekord() {
return new NieznanyRekord();
}
/**
* Create an instance of {@link OgloszenieSamochodowe }
*
* @return
* the new instance of {@link OgloszenieSamochodowe }
*/
public OgloszenieSamochodowe createOgloszenieSamochodowe() {
return new OgloszenieSamochodowe();
}
/**
* Create an instance of {@link Ogloszenie }
*
* @return
* the new instance of {@link Ogloszenie }
*/
public Ogloszenie createOgloszenie() {
return new Ogloszenie();
}
/**
* Create an instance of {@link Silnik }
*
* @return
* the new instance of {@link Silnik }
*/
public Silnik createSilnik() {
return new Silnik();
}
/**
* Create an instance of {@link Sprzedawca }
*
* @return
* the new instance of {@link Sprzedawca }
*/
public Sprzedawca createSprzedawca() {
return new Sprzedawca();
}
/**
* Create an instance of {@link Adres }
*
* @return
* the new instance of {@link Adres }
*/
public Adres createAdres() {
return new Adres();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Insert }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link Insert }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "insert")
public JAXBElement<Insert> createInsert(Insert value) {
return new JAXBElement<>(_Insert_QNAME, Insert.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link InsertResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link InsertResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "insertResponse")
public JAXBElement<InsertResponse> createInsertResponse(InsertResponse value) {
return new JAXBElement<>(_InsertResponse_QNAME, InsertResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Photo }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link Photo }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "photo")
public JAXBElement<Photo> createPhoto(Photo value) {
return new JAXBElement<>(_Photo_QNAME, Photo.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link PhotoResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link PhotoResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "photoResponse")
public JAXBElement<PhotoResponse> createPhotoResponse(PhotoResponse value) {
return new JAXBElement<>(_PhotoResponse_QNAME, PhotoResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReadAll }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ReadAll }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "readAll")
public JAXBElement<ReadAll> createReadAll(ReadAll value) {
return new JAXBElement<>(_ReadAll_QNAME, ReadAll.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReadAllResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ReadAllResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "readAllResponse")
public JAXBElement<ReadAllResponse> createReadAllResponse(ReadAllResponse value) {
return new JAXBElement<>(_ReadAllResponse_QNAME, ReadAllResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReadByPrice }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ReadByPrice }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "readByPrice")
public JAXBElement<ReadByPrice> createReadByPrice(ReadByPrice value) {
return new JAXBElement<>(_ReadByPrice_QNAME, ReadByPrice.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReadByPriceResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ReadByPriceResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "readByPriceResponse")
public JAXBElement<ReadByPriceResponse> createReadByPriceResponse(ReadByPriceResponse value) {
return new JAXBElement<>(_ReadByPriceResponse_QNAME, ReadByPriceResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReadOne }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ReadOne }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "readOne")
public JAXBElement<ReadOne> createReadOne(ReadOne value) {
return new JAXBElement<>(_ReadOne_QNAME, ReadOne.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReadOneResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ReadOneResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "readOneResponse")
public JAXBElement<ReadOneResponse> createReadOneResponse(ReadOneResponse value) {
return new JAXBElement<>(_ReadOneResponse_QNAME, ReadOneResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Update }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link Update }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "update")
public JAXBElement<Update> createUpdate(Update value) {
return new JAXBElement<>(_Update_QNAME, Update.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link UpdateResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "updateResponse")
public JAXBElement<UpdateResponse> createUpdateResponse(UpdateResponse value) {
return new JAXBElement<>(_UpdateResponse_QNAME, UpdateResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link BladBazyDanych }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link BladBazyDanych }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "BladBazyDanych")
public JAXBElement<BladBazyDanych> createBladBazyDanych(BladBazyDanych value) {
return new JAXBElement<>(_BladBazyDanych_QNAME, BladBazyDanych.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link NieznanyRekord }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link NieznanyRekord }{@code >}
*/
@XmlElementDecl(namespace = "http://soap.ogloszenia/", name = "NieznanyRekord")
public JAXBElement<NieznanyRekord> createNieznanyRekord(NieznanyRekord value) {
return new JAXBElement<>(_NieznanyRekord_QNAME, NieznanyRekord.class, null, value);
}
}
package ogloszenia.generated;
import jakarta.jws.WebMethod;
import jakarta.jws.WebParam;
import jakarta.jws.WebResult;
import jakarta.jws.WebService;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.ws.RequestWrapper;
import jakarta.xml.ws.ResponseWrapper;
/**
* This class was generated by Apache CXF 4.0.0
* 2023-08-03T14:16:35.644+02:00
* Generated source version: 4.0.0
*
*/
@WebService(targetNamespace = "http://soap.ogloszenia/", name = "Ogloszenia")
@XmlSeeAlso({ObjectFactory.class})
public interface Ogloszenia {
@WebMethod
@RequestWrapper(localName = "readAll", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.ReadAll")
@ResponseWrapper(localName = "readAllResponse", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.ReadAllResponse")
@WebResult(name = "ogloszenie", targetNamespace = "")
public java.util.List<ogloszenia.generated.OgloszenieSamochodowe> readAll()
throws BladBazyDanych_Exception;
@WebMethod
@RequestWrapper(localName = "readByPrice", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.ReadByPrice")
@ResponseWrapper(localName = "readByPriceResponse", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.ReadByPriceResponse")
@WebResult(name = "ogloszenie", targetNamespace = "")
public java.util.List<ogloszenia.generated.OgloszenieSamochodowe> readByPrice(
@WebParam(name = "min", targetNamespace = "")
java.math.BigDecimal min,
@WebParam(name = "max", targetNamespace = "")
java.math.BigDecimal max
) throws BladBazyDanych_Exception;
@WebMethod
@RequestWrapper(localName = "insert", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.Insert")
@ResponseWrapper(localName = "insertResponse", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.InsertResponse")
@WebResult(name = "new-id", targetNamespace = "")
public int insert(
@WebParam(name = "ogloszenie", targetNamespace = "")
ogloszenia.generated.OgloszenieSamochodowe ogloszenie
) throws BladBazyDanych_Exception;
@WebMethod
@RequestWrapper(localName = "photo", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.Photo")
@ResponseWrapper(localName = "photoResponse", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.PhotoResponse")
@WebResult(name = "bytes", targetNamespace = "")
public byte[] photo(
@WebParam(name = "id", targetNamespace = "")
int id
) throws NieznanyRekord_Exception;
@WebMethod
@RequestWrapper(localName = "update", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.Update")
@ResponseWrapper(localName = "updateResponse", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.UpdateResponse")
public void update(
@WebParam(name = "ogloszenie", targetNamespace = "")
ogloszenia.generated.OgloszenieSamochodowe ogloszenie
) throws NieznanyRekord_Exception, BladBazyDanych_Exception;
@WebMethod
@RequestWrapper(localName = "readOne", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.ReadOne")
@ResponseWrapper(localName = "readOneResponse", targetNamespace = "http://soap.ogloszenia/", className = "ogloszenia.generated.ReadOneResponse")
@WebResult(name = "ogloszenie", targetNamespace = "")
public ogloszenia.generated.OgloszenieSamochodowe readOne(
@WebParam(name = "id", targetNamespace = "")
int id
) throws NieznanyRekord_Exception, BladBazyDanych_Exception;
}
package ogloszenia.generated;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import jakarta.xml.ws.WebEndpoint;
import jakarta.xml.ws.WebServiceClient;
import jakarta.xml.ws.WebServiceFeature;
import jakarta.xml.ws.Service;
/**
* This class was generated by Apache CXF 4.0.0
* 2023-08-03T14:16:35.660+02:00
* Generated source version: 4.0.0
*
*/
@WebServiceClient(name = "OgloszeniaService",
wsdlLocation = "http://localhost:8080/OgloszeniaSerwer/Ogloszenia?wsdl",
targetNamespace = "http://soap.ogloszenia/")
public class OgloszeniaService extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://soap.ogloszenia/", "OgloszeniaService");
public final static QName OgloszeniaPort = new QName("http://soap.ogloszenia/", "OgloszeniaPort");
static {
URL url = null;
try {
url = new URL("http://localhost:8080/OgloszeniaSerwer/Ogloszenia?wsdl");
} catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(OgloszeniaService.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "http://localhost:8080/OgloszeniaSerwer/Ogloszenia?wsdl");
}
WSDL_LOCATION = url;
}
public OgloszeniaService(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public OgloszeniaService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public OgloszeniaService() {
super(WSDL_LOCATION, SERVICE);
}
public OgloszeniaService(WebServiceFeature ... features) {
super(WSDL_LOCATION, SERVICE, features);
}
public OgloszeniaService(URL wsdlLocation, WebServiceFeature ... features) {
super(wsdlLocation, SERVICE, features);
}
public OgloszeniaService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns Ogloszenia
*/
@WebEndpoint(name = "OgloszeniaPort")
public Ogloszenia getOgloszeniaPort() {
return super.getPort(OgloszeniaPort, Ogloszenia.class);
}
/**
*
* @param features
* A list of {@link jakarta.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns Ogloszenia
*/
@WebEndpoint(name = "OgloszeniaPort")
public Ogloszenia getOgloszeniaPort(WebServiceFeature... features) {
return super.getPort(OgloszeniaPort, Ogloszenia.class, features);
}
}
package ogloszenia.generated;
import java.math.BigDecimal;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for ogloszenie complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="ogloszenie">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="wystawione" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="cena" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
* <element name="tytul" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="opis" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="sprzedawca" type="{http://soap.ogloszenia/}sprzedawca" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}int" />
* <attribute name="id-sprzedawcy" type="{http://www.w3.org/2001/XMLSchema}int" />
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ogloszenie", propOrder = {
"wystawione",
"cena",
"tytul",
"opis",
"sprzedawca"
})
@XmlSeeAlso({
OgloszenieSamochodowe.class
})
public class Ogloszenie {
protected String wystawione;
protected BigDecimal cena;
protected String tytul;
protected String opis;
protected Sprzedawca sprzedawca;
@XmlAttribute(name = "id")
protected Integer id;
@XmlAttribute(name = "id-sprzedawcy")
protected Integer idSprzedawcy;
/**
* Gets the value of the wystawione property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getWystawione() {
return wystawione;
}
/**
* Sets the value of the wystawione property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setWystawione(String value) {
this.wystawione = value;
}
/**
* Gets the value of the cena property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getCena() {
return cena;
}
/**
* Sets the value of the cena property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setCena(BigDecimal value) {
this.cena = value;
}
/**
* Gets the value of the tytul property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTytul() {
return tytul;
}
/**
* Sets the value of the tytul property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTytul(String value) {
this.tytul = value;
}
/**
* Gets the value of the opis property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOpis() {
return opis;
}
/**
* Sets the value of the opis property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOpis(String value) {
this.opis = value;
}
/**
* Gets the value of the sprzedawca property.
*
* @return
* possible object is
* {@link Sprzedawca }
*
*/
public Sprzedawca getSprzedawca() {
return sprzedawca;
}
/**
* Sets the value of the sprzedawca property.
*
* @param value
* allowed object is
* {@link Sprzedawca }
*
*/
public void setSprzedawca(Sprzedawca value) {
this.sprzedawca = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setId(Integer value) {
this.id = value;
}
/**
* Gets the value of the idSprzedawcy property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getIdSprzedawcy() {
return idSprzedawcy;
}
/**
* Sets the value of the idSprzedawcy property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setIdSprzedawcy(Integer value) {
this.idSprzedawcy = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for ogloszenieSamochodowe complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="ogloszenieSamochodowe">
* <complexContent>
* <extension base="{http://soap.ogloszenia/}ogloszenie">
* <sequence>
* <element name="marka" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="model" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="generacja" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="rok-produkcji" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="stan-licznika" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="kolor" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="silnik" type="{http://soap.ogloszenia/}silnik" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ogloszenieSamochodowe", propOrder = {
"marka",
"model",
"generacja",
"rokProdukcji",
"stanLicznika",
"kolor",
"silnik"
})
public class OgloszenieSamochodowe
extends Ogloszenie
{
protected String marka;
protected String model;
protected String generacja;
@XmlElement(name = "rok-produkcji")
protected int rokProdukcji;
@XmlElement(name = "stan-licznika")
protected int stanLicznika;
protected String kolor;
protected Silnik silnik;
/**
* Gets the value of the marka property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMarka() {
return marka;
}
/**
* Sets the value of the marka property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMarka(String value) {
this.marka = value;
}
/**
* Gets the value of the model property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getModel() {
return model;
}
/**
* Sets the value of the model property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModel(String value) {
this.model = value;
}
/**
* Gets the value of the generacja property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGeneracja() {
return generacja;
}
/**
* Sets the value of the generacja property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGeneracja(String value) {
this.generacja = value;
}
/**
* Gets the value of the rokProdukcji property.
*
*/
public int getRokProdukcji() {
return rokProdukcji;
}
/**
* Sets the value of the rokProdukcji property.
*
*/
public void setRokProdukcji(int value) {
this.rokProdukcji = value;
}
/**
* Gets the value of the stanLicznika property.
*
*/
public int getStanLicznika() {
return stanLicznika;
}
/**
* Sets the value of the stanLicznika property.
*
*/
public void setStanLicznika(int value) {
this.stanLicznika = value;
}
/**
* Gets the value of the kolor property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKolor() {
return kolor;
}
/**
* Sets the value of the kolor property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKolor(String value) {
this.kolor = value;
}
/**
* Gets the value of the silnik property.
*
* @return
* possible object is
* {@link Silnik }
*
*/
public Silnik getSilnik() {
return silnik;
}
/**
* Sets the value of the silnik property.
*
* @param value
* allowed object is
* {@link Silnik }
*
*/
public void setSilnik(Silnik value) {
this.silnik = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlEnum;
import jakarta.xml.bind.annotation.XmlEnumValue;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for paliwo.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>{@code
* <simpleType name="paliwo">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="benzyna"/>
* <enumeration value="diesel"/>
* <enumeration value="lpg"/>
* <enumeration value="hybryda"/>
* <enumeration value="elektryk"/>
* </restriction>
* </simpleType>
* }</pre>
*
*/
@XmlType(name = "paliwo")
@XmlEnum
public enum Paliwo {
@XmlEnumValue("benzyna")
BENZYNA("benzyna"),
@XmlEnumValue("diesel")
DIESEL("diesel"),
@XmlEnumValue("lpg")
LPG("lpg"),
@XmlEnumValue("hybryda")
HYBRYDA("hybryda"),
@XmlEnumValue("elektryk")
ELEKTRYK("elektryk");
private final String value;
Paliwo(String v) {
value = v;
}
public String value() {
return value;
}
public static Paliwo fromValue(String v) {
for (Paliwo c: Paliwo.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for photo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="photo">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "photo", propOrder = {
"id"
})
public class Photo {
protected int id;
/**
* 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;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for photoResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="photoResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="bytes" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "photoResponse", propOrder = {
"bytes"
})
public class PhotoResponse {
protected byte[] bytes;
/**
* Gets the value of the bytes property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getBytes() {
return bytes;
}
/**
* Sets the value of the bytes property.
*
* @param value
* allowed object is
* byte[]
*/
public void setBytes(byte[] value) {
this.bytes = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for readAll complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="readAll">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "readAll")
public class ReadAll {
}
package ogloszenia.generated;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for readAllResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="readAllResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ogloszenie" type="{http://soap.ogloszenia/}ogloszenieSamochodowe" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "readAllResponse", propOrder = {
"ogloszenie"
})
public class ReadAllResponse {
protected List<OgloszenieSamochodowe> ogloszenie;
/**
* Gets the value of the ogloszenie 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 Jakarta XML Binding object.
* This is why there is not a {@code set} method for the ogloszenie property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOgloszenie().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link OgloszenieSamochodowe }
*
*
* @return
* The value of the ogloszenie property.
*/
public List<OgloszenieSamochodowe> getOgloszenie() {
if (ogloszenie == null) {
ogloszenie = new ArrayList<>();
}
return this.ogloszenie;
}
}
package ogloszenia.generated;
import java.math.BigDecimal;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for readByPrice complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="readByPrice">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="min" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
* <element name="max" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "readByPrice", propOrder = {
"min",
"max"
})
public class ReadByPrice {
protected BigDecimal min;
protected BigDecimal max;
/**
* Gets the value of the min property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getMin() {
return min;
}
/**
* Sets the value of the min property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setMin(BigDecimal value) {
this.min = value;
}
/**
* Gets the value of the max property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getMax() {
return max;
}
/**
* Sets the value of the max property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setMax(BigDecimal value) {
this.max = value;
}
}
package ogloszenia.generated;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for readByPriceResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="readByPriceResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ogloszenie" type="{http://soap.ogloszenia/}ogloszenieSamochodowe" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "readByPriceResponse", propOrder = {
"ogloszenie"
})
public class ReadByPriceResponse {
protected List<OgloszenieSamochodowe> ogloszenie;
/**
* Gets the value of the ogloszenie 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 Jakarta XML Binding object.
* This is why there is not a {@code set} method for the ogloszenie property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOgloszenie().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link OgloszenieSamochodowe }
*
*
* @return
* The value of the ogloszenie property.
*/
public List<OgloszenieSamochodowe> getOgloszenie() {
if (ogloszenie == null) {
ogloszenie = new ArrayList<>();
}
return this.ogloszenie;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for readOne complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="readOne">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "readOne", propOrder = {
"id"
})
public class ReadOne {
protected int id;
/**
* 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;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for readOneResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="readOneResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ogloszenie" type="{http://soap.ogloszenia/}ogloszenieSamochodowe" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "readOneResponse", propOrder = {
"ogloszenie"
})
public class ReadOneResponse {
protected OgloszenieSamochodowe ogloszenie;
/**
* Gets the value of the ogloszenie property.
*
* @return
* possible object is
* {@link OgloszenieSamochodowe }
*
*/
public OgloszenieSamochodowe getOgloszenie() {
return ogloszenie;
}
/**
* Sets the value of the ogloszenie property.
*
* @param value
* allowed object is
* {@link OgloszenieSamochodowe }
*
*/
public void setOgloszenie(OgloszenieSamochodowe value) {
this.ogloszenie = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for silnik complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="silnik">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="moc" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
* <element name="pojemnosc" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/>
* <element name="paliwo" type="{http://soap.ogloszenia/}paliwo" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "silnik", propOrder = {
"moc",
"pojemnosc",
"paliwo"
})
public class Silnik {
protected Float moc;
protected Float pojemnosc;
@XmlSchemaType(name = "string")
protected Paliwo paliwo;
/**
* Gets the value of the moc property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getMoc() {
return moc;
}
/**
* Sets the value of the moc property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setMoc(Float value) {
this.moc = value;
}
/**
* Gets the value of the pojemnosc property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getPojemnosc() {
return pojemnosc;
}
/**
* Sets the value of the pojemnosc property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setPojemnosc(Float value) {
this.pojemnosc = value;
}
/**
* Gets the value of the paliwo property.
*
* @return
* possible object is
* {@link Paliwo }
*
*/
public Paliwo getPaliwo() {
return paliwo;
}
/**
* Sets the value of the paliwo property.
*
* @param value
* allowed object is
* {@link Paliwo }
*
*/
public void setPaliwo(Paliwo value) {
this.paliwo = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for sprzedawca complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="sprzedawca">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="nazwa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="adres" type="{http://soap.ogloszenia/}adres" minOccurs="0"/>
* <element name="telefon" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}int" />
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sprzedawca", propOrder = {
"nazwa",
"adres",
"telefon",
"email"
})
public class Sprzedawca {
protected String nazwa;
protected Adres adres;
protected String telefon;
protected String email;
@XmlAttribute(name = "id")
protected Integer id;
/**
* Gets the value of the nazwa property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNazwa() {
return nazwa;
}
/**
* Sets the value of the nazwa property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNazwa(String value) {
this.nazwa = value;
}
/**
* Gets the value of the adres property.
*
* @return
* possible object is
* {@link Adres }
*
*/
public Adres getAdres() {
return adres;
}
/**
* Sets the value of the adres property.
*
* @param value
* allowed object is
* {@link Adres }
*
*/
public void setAdres(Adres value) {
this.adres = value;
}
/**
* Gets the value of the telefon property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTelefon() {
return telefon;
}
/**
* Sets the value of the telefon property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTelefon(String value) {
this.telefon = value;
}
/**
* Gets the value of the email property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEmail() {
return email;
}
/**
* Sets the value of the email property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmail(String value) {
this.email = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setId(Integer value) {
this.id = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for update complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="update">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ogloszenie" type="{http://soap.ogloszenia/}ogloszenieSamochodowe" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "update", propOrder = {
"ogloszenie"
})
public class Update {
protected OgloszenieSamochodowe ogloszenie;
/**
* Gets the value of the ogloszenie property.
*
* @return
* possible object is
* {@link OgloszenieSamochodowe }
*
*/
public OgloszenieSamochodowe getOgloszenie() {
return ogloszenie;
}
/**
* Sets the value of the ogloszenie property.
*
* @param value
* allowed object is
* {@link OgloszenieSamochodowe }
*
*/
public void setOgloszenie(OgloszenieSamochodowe value) {
this.ogloszenie = value;
}
}
package ogloszenia.generated;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for updateResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>{@code
* <complexType name="updateResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* }</pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "updateResponse")
public class UpdateResponse {
}
@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://soap.ogloszenia/")
package ogloszenia.generated;
package ogloszenia.klient;
import ogloszenia.generated.BladBazyDanych_Exception;
import ogloszenia.generated.Ogloszenia;
import ogloszenia.generated.OgloszeniaService;
import ogloszenia.generated.OgloszenieSamochodowe;
import java.util.List;
public class Klient1_OdczytajWszystkie {
public static void main(String[] args) {
try {
System.out.println("Startujemy...");
OgloszeniaService service = new OgloszeniaService();
Ogloszenia proxy = service.getOgloszeniaPort();
System.out.println("Wysyłam zapytanie");
List<OgloszenieSamochodowe> lista = proxy.readAll();
System.out.println("Odczytano " + lista.size() + " ogłoszeń:");
for (OgloszenieSamochodowe ogloszenie : lista) {
System.out.println(ogloszenie.getMarka() + " " + ogloszenie.getModel() + " za " + ogloszenie.getCena());
}
} catch (BladBazyDanych_Exception e) {
System.out.println(e);
} catch (Exception e) {
System.out.println("Inny błąd: " + e);
e.printStackTrace();
}
}
}
package ogloszenia.klient;
import java.util.Scanner;
import ogloszenia.generated.*;
public class Klient2_JednoOgloszenie {
public static void main(String[] args) {
OgloszeniaService service = new OgloszeniaService();
Ogloszenia proxy = service.getOgloszeniaPort();
System.out.println("Ujemne id kończy program");
Scanner sc = new Scanner(System.in);
while(true) {
System.out.print("Podaj id szukanego ogłoszenia: ");
int id = sc.nextInt();
if(id <= 0) break;
try {
OgloszenieSamochodowe ogl = proxy.readOne(id);
System.out.printf("%s %s za %s\n", ogl.getMarka(), ogl.getModel(), ogl.getCena());
System.out.println(ogl.getTytul());
System.out.println(ogl.getOpis());
} catch (NieznanyRekord_Exception e) {
System.out.println(e.getMessage());
} catch (BladBazyDanych_Exception e) {
System.out.println("Inny błąd serwera: " + e);
} catch (Exception e) {
System.out.println("Inny błąd: " + e);
}
}
}
}
// alt+Enter intellij =~= Ctrl+1 w eclipse
package ogloszenia.klient;
import ogloszenia.generated.*;
import java.math.BigDecimal;
import java.util.Scanner;
public class Klient3_Edycja {
public static void main(String[] args) {
OgloszeniaService service = new OgloszeniaService();
Ogloszenia proxy = service.getOgloszeniaPort();
System.out.println("Ujemne id kończy program");
Scanner sc = new Scanner(System.in);
while(true) {
System.out.print("Podaj id szukanego ogłoszenia: ");
int id = sc.nextInt();
if(id <= 0) break;
try {
OgloszenieSamochodowe ogl = proxy.readOne(id);
System.out.printf("%s %s za %s\n", ogl.getMarka(), ogl.getModel(), ogl.getCena());
System.out.println(ogl.getTytul());
System.out.println(ogl.getOpis());
System.out.print("Podaj zmianę ceny: ");
BigDecimal zmiana = sc.nextBigDecimal();
if(zmiana.compareTo(BigDecimal.ZERO) != 0) {
ogl.setCena(ogl.getCena().add(zmiana));
proxy.update(ogl);
System.out.println("Zapisano zmiany");
}
} catch (NieznanyRekord_Exception e) {
System.out.println(e.getMessage());
} catch (BladBazyDanych_Exception e) {
System.out.println("Inny błąd serwera: " + e);
} catch (Exception e) {
System.out.println("Inny błąd: " + e);
}
}
}
}
// alt+Enter intellij =~= Ctrl+1 w eclipse
package ogloszenia.klient;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import ogloszenia.generated.*;
public class OknoSoap {
private Ogloszenia port;
private JFrame frame;
private JTextField txtTytul;
private JTextField txtMarka;
private JTextField txtModel;
private JTextField txtCena;
private JSpinner spinner;
private JLabel lblFoto;
private OgloszenieSamochodowe biezaceOgloszenie;
private ImageIcon ikonaZeZdjeciem;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
OknoSoap window = new OknoSoap();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public OknoSoap() {
OgloszeniaService serwis = new OgloszeniaService();
port = serwis.getOgloszeniaPort();
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 841, 801);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
spinner = new JSpinner();
spinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
wyswietl();
}
});
spinner.setFont(new Font("Dialog", Font.BOLD, 22));
JLabel lblPodajIdOgoszenia = new JLabel("Podaj ID ogłoszenia");
lblPodajIdOgoszenia.setFont(new Font("Dialog", Font.PLAIN, 20));
JButton btnWywietl = new JButton("Wyświetl");
btnWywietl.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
wyswietl();
}
});
btnWywietl.setFont(new Font("Dialog", Font.BOLD, 20));
JPanel panel = new JPanel();
lblFoto = new JLabel("FOTO");
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(lblFoto, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 809, Short.MAX_VALUE)
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addComponent(lblPodajIdOgoszenia)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(spinner, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(btnWywietl))
.addComponent(panel, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 809, Short.MAX_VALUE))
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblPodajIdOgoszenia)
.addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addComponent(btnWywietl))
.addGap(18)
.addComponent(panel, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(lblFoto, GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
.addContainerGap())
);
JLabel lblTytu = new JLabel("Tytuł");
lblTytu.setFont(new Font("Dialog", Font.PLAIN, 18));
txtTytul = new JTextField();
txtTytul.setFont(new Font("Dialog", Font.BOLD, 16));
txtTytul.setText("tytul");
txtTytul.setColumns(10);
JLabel lblMarka = new JLabel("Marka");
lblMarka.setFont(new Font("Dialog", Font.PLAIN, 18));
txtMarka = new JTextField();
txtMarka.setFont(new Font("Dialog", Font.BOLD, 16));
txtMarka.setText("marka");
txtMarka.setColumns(10);
JLabel lblModel = new JLabel("Model");
lblModel.setFont(new Font("Dialog", Font.PLAIN, 18));
txtModel = new JTextField();
txtModel.setFont(new Font("Dialog", Font.BOLD, 16));
txtModel.setText("model");
txtModel.setColumns(10);
JLabel lblCena = new JLabel("Cena");
lblCena.setFont(new Font("Dialog", Font.PLAIN, 18));
txtCena = new JTextField();
txtCena.setFont(new Font("Dialog", Font.BOLD, 16));
txtCena.setText("cena");
txtCena.setColumns(10);
GroupLayout gl_panel = new GroupLayout(panel);
gl_panel.setHorizontalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false)
.addComponent(lblMarka, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblTytu, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(txtMarka, GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)
.addComponent(txtTytul, GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)))
.addGroup(gl_panel.createSequentialGroup()
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(lblModel, GroupLayout.PREFERRED_SIZE, 152, GroupLayout.PREFERRED_SIZE)
.addComponent(lblCena))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(txtCena, GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)
.addComponent(txtModel, GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE))))
.addContainerGap())
);
gl_panel.setVerticalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblTytu)
.addComponent(txtTytul, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblMarka)
.addComponent(txtMarka, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblModel)
.addComponent(txtModel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblCena)
.addComponent(txtCena, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap(15, Short.MAX_VALUE))
);
panel.setLayout(gl_panel);
frame.getContentPane().setLayout(groupLayout);
}
// jest wywoływane przez Swinga po kliknięciu guzika itp.
// ta metoda jest wykonywana w wątku EDT
protected void wyswietl() {
int idOgloszenia = (Integer)spinner.getValue();
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
// to wykona się w oddzielnym wątku,
// nie zablokuj okna, ale tutaj nie powinniśmy korzystać z elementów okna
pobierzDane(idOgloszenia);
return null;
}
@Override
protected void done() {
// tu powinniśmy wpisać polecenia dotyczace okna, które mają być wykonane przez EDT po zakończeniu operacji
uaktualnijWidok();
}
};
worker.execute();
}
private void pobierzDane(int idOgloszenia) {
// ma być wykonane w tle
try {
ikonaZeZdjeciem = null;
biezaceOgloszenie = null;
biezaceOgloszenie = port.readOne(idOgloszenia);
try {
byte[] bajtyZeZdjeciem = port.photo(idOgloszenia);
if(bajtyZeZdjeciem != null) {
ikonaZeZdjeciem = new ImageIcon(bajtyZeZdjeciem);
}
} catch (NieznanyRekord_Exception e) {
// zdjecie zostaje nullem
}
} catch (BladBazyDanych_Exception e) {
e.printStackTrace();
} catch (NieznanyRekord_Exception e) {
}
}
private void uaktualnijWidok() {
// ma być wykonane przez okno (czyli wątek EDT)
if(biezaceOgloszenie != null) {
txtTytul.setText(biezaceOgloszenie.getTytul());
txtMarka.setText(biezaceOgloszenie.getMarka());
txtModel.setText(biezaceOgloszenie.getModel());
txtCena.setText(String.valueOf(biezaceOgloszenie.getCena()));
} else {
txtTytul.setText("");
txtMarka.setText("");
txtModel.setText("");
txtCena.setText("");
}
lblFoto.setIcon(ikonaZeZdjeciem);
}
}
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
/.idea/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
CREATE TABLE sprzedawcy (
id_sprzedawcy INTEGER PRIMARY KEY,
nazwa TEXT NOT NULL,
ulica TEXT,
kod_pocztowy TEXT,
miasto TEXT,
telefon TEXT,
email TEXT
);
CREATE TABLE ogloszenia (
id_ogloszenia INTEGER PRIMARY KEY,
id_sprzedawcy INTEGER REFERENCES sprzedawcy(id_sprzedawcy),
tytul TEXT,
data_wystawienia TEXT, -- w SQLite nie ma DATE / TIMESTAMP
cena REAL, -- w SQLite nie ma NUMBER
opis TEXT,
marka TEXT NOT NULL,
model TEXT NOT NULL,
generacja TEXT,
kolor TEXT,
rocznik INTEGER,
przebieg INTEGER,
pojemnosc REAL,
moc REAL,
paliwo TEXT
);
INSERT INTO sprzedawcy(id_sprzedawcy, nazwa, ulica, kod_pocztowy, miasto, telefon, email)
VALUES (1, 'Komis Bolka', 'Starocmentarna 5', '77-777', 'Wólka', '771231234', NULL);
INSERT INTO sprzedawcy(id_sprzedawcy, nazwa, ulica, kod_pocztowy, miasto, telefon, email)
VALUES (2, 'Auto jak nowe', 'Graniczna 13', '12-345', 'Pruszków', '666444333', 'auto@jaknowe.pl');
INSERT INTO sprzedawcy(id_sprzedawcy, nazwa, ulica, kod_pocztowy, miasto, telefon, email)
VALUES (3, 'Janusz Januszowski', 'Smutna', '56-654', 'Łódź', '987654321', NULL);
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (1, 1, '2017-10-10 20:20:00', 5500, 'Sprzedam Opla', 'Opel Astra V 1.4 jak nowy', 'Opel', 'Astra', 'K', 'brązowy', 2017, 150000, 1.4, 90, 'BENZYNA');
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (2, 2, '2017-10-20 07:21:12', 12000, 'Passat niebity igła', 'Ładny Passat TDI dla chłopaka z polskiej wsi', 'Volkswagen', 'Passat', 'C', 'srebrny', 2003, 179000, 2.0, 125, 'OLEJ');
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (3, 3, '2017-11-03 08:18:00', 3300, 'Złoty Matiz', NULL, 'Dewoo', 'Matiz', NULL, 'złoty', 1999, 123300, 1.0, 75, 'GAZ');
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (4, 1, '2017-10-29 12:12:00', 17000, 'Meganka prosto z Francji', 'Mało jeżdżone, niepalone, opłaca się!', 'Renault', 'Megane', 'II', 'biały', 2009, 130000, 1.9, 130, 'OLEJ');
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (5, 1, '2017-10-27 12:12:00', 99999, 'Mazda szósteczka nówka', 'Prosto z warszawskiej ulicy...', 'Mazda', '6', 'III', 'czerwony', 2015, 8000, 2.0, 150, 'BENZYNA');
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (6, 2, '2017-08-22 08:00:00', 12500, 'Fiacik', NULL, 'Fiat', 'Punto', '2', 'niebieski', 2005, 87000, 1.2, 82, 'GAZ');
INSERT INTO ogloszenia(
id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)
VALUES (7, 3, '2017-09-01 21:21:21', 18200, 'Yaris od kobiety', 'Sprzedam używaną Yariskę', 'Toyota', 'Yaris', 'III', 'srebrny', 2013, 113100, 1.4, 100, 'BENZYNA');
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.alx.kjava</groupId>
<artifactId>OgloszeniaSerwer</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.42.0.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package ogloszenia;
/**
* W tej klasie trzeba wpisać swoje ustawienia ścieżek.
*/
public class Ustawienia {
public static final String SQLITE_PATH = "/home/patryk/ogloszenia/ogloszenia.db";
public static final String PHOTOS_PATH = "/home/patryk/ogloszenia/foto";
}
package ogloszenia.baza.sqlite;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import ogloszenia.Ustawienia;
import ogloszenia.baza.sqlite.OgloszenieDAO;
import ogloszenia.baza.sqlite.SprzedawcaDAO;
import ogloszenia.exn.BladBazyDanych;
public class DostepDoBazySqlite implements AutoCloseable {
private Connection c;
DostepDoBazySqlite(Connection con) {
c = con;
}
public static DostepDoBazySqlite newSQLite(String sqliteFile) throws BladBazyDanych {
try {
Class.forName("org.sqlite.JDBC");
Connection con = DriverManager.getConnection("jdbc:sqlite:" + sqliteFile);
return new DostepDoBazySqlite(con);
} catch (Exception e) {
throw new BladBazyDanych("Błąd podczas otwierania bazy danych (" + e.getMessage() + ")", e);
}
}
public static DostepDoBazySqlite newSQLite() throws BladBazyDanych {
return newSQLite(Ustawienia.SQLITE_PATH);
}
@Override
public void close() {
try {
if (c != null)
c.close();
} catch (SQLException e) {
System.err.println("Błąd podczas close: " + e.getMessage());
}
}
Connection c() {
return c;
}
public void beginTransaction() throws BladBazyDanych {
try {
c.setAutoCommit(false);
//c.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
} catch (SQLException e) {
throw new BladBazyDanych("beginTransaction: " + e.getMessage(), e);
}
}
public void endTransaction(boolean commit) throws BladBazyDanych {
try {
if (commit) {
c.commit();
} else {
c.rollback();
}
c.setAutoCommit(true);
} catch (SQLException e) {
throw new BladBazyDanych("endTransaction: " + e.getMessage(), e);
}
}
public OgloszenieDAO newOgloszenieDAO() {
return new OgloszenieDAO(this);
}
public SprzedawcaDAO newSprzedawcaDAO() {
return new SprzedawcaDAO(this);
}
}
package ogloszenia.baza.sqlite;
import java.time.LocalDateTime;
import ogloszenia.model.Paliwo;
public class Konwersje {
public static LocalDateTime dateFromString(String s) {
return s == null ? null : LocalDateTime.parse(s.replace(' ', 'T'));
}
public static String dateToString(LocalDateTime localDateTime) {
return localDateTime == null ? null : localDateTime.toString().replace('T', ' ');
}
public static Paliwo paliwoFromString(String s) {
return s == null ? null : Paliwo.valueOf(s.trim().toUpperCase());
}
public static String paliwoToString(Paliwo paliwo) {
return paliwo == null ? null : paliwo.toString();
}
}
package ogloszenia.baza.sqlite;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.List;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.exn.NieznanyRekord;
import ogloszenia.model.Ogloszenie;
import ogloszenia.model.OgloszenieSamochodowe;
import ogloszenia.model.Silnik;
import ogloszenia.model.Sprzedawca;
public class OgloszenieDAO {
private DostepDoBazySqlite db;
OgloszenieDAO(DostepDoBazySqlite db) {
this.db = db;
}
public DostepDoBazySqlite getDBHandler() {
return db;
}
public List<Integer> idList() throws BladBazyDanych {
final String sql = "SELECT id_ogloszenia FROM ogloszenia ORDER BY id_ogloszenia";
List<Integer> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
lista.add(rs.getInt(1));
}
}
} catch (SQLException e) {
throw new BladBazyDanych("listaIdOgloszen: " + e.getMessage(), e);
}
return lista;
}
public OgloszenieSamochodowe findById(int idOgloszenia, boolean full) throws BladBazyDanych, NieznanyRekord {
final String sql = "SELECT * FROM ogloszenia WHERE id_ogloszenia = ?";
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, idOgloszenia);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
OgloszenieSamochodowe ogl = ogloszenieZResultSet(rs);
if (full) {
doczytajSprzedawce(ogl);
}
return ogl;
} else {
throw new NieznanyRekord("Nieznane ogloszenie " + idOgloszenia);
}
}
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie byIdFull: " + e.getMessage(), e);
}
}
public OgloszenieSamochodowe findById(int idOgloszenia) throws BladBazyDanych, NieznanyRekord {
return findById(idOgloszenia, false);
}
public OgloszenieSamochodowe findByIdFull(int idOgloszenia) throws BladBazyDanych, NieznanyRekord {
return findById(idOgloszenia, true);
}
public List<OgloszenieSamochodowe> readAll(boolean full) throws BladBazyDanych {
final String sql = "SELECT * FROM ogloszenia";
List<OgloszenieSamochodowe> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
OgloszenieSamochodowe ogl = ogloszenieZResultSet(rs);
if (full) try {
doczytajSprzedawce(ogl);
} catch (NieznanyRekord e) {
System.err.println(e);
}
lista.add(ogl);
}
}
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie readAll: " + e.getMessage(), e);
}
return lista;
}
public List<OgloszenieSamochodowe> readAll() throws BladBazyDanych {
return readAll(false);
}
public List<OgloszenieSamochodowe> readAllFull() throws BladBazyDanych {
return readAll(true);
}
public List<OgloszenieSamochodowe> ogloszeniaWedlugCeny(BigDecimal cenaOd, BigDecimal cenaDo) throws BladBazyDanych {
final String sql = "SELECT * FROM ogloszenia"
+ " WHERE cena BETWEEN ? AND ?"
+ " ORDER BY id_ogloszenia";
if (cenaOd == null)
cenaOd = BigDecimal.ZERO;
if (cenaDo == null)
cenaDo = new BigDecimal(100000000);
List<OgloszenieSamochodowe> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setBigDecimal(1, cenaOd);
stmt.setBigDecimal(2, cenaDo);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
OgloszenieSamochodowe ogl = ogloszenieZResultSet(rs);
try {
doczytajSprzedawce(ogl);
} catch (NieznanyRekord e) {
e.printStackTrace();
}
lista.add(ogl);
}
}
} catch (SQLException e) {
throw new BladBazyDanych("Błąd bazy w metodzie ogloszeniaWedlugCeny: " + e.getMessage(), e);
}
return lista;
}
public List<OgloszenieSamochodowe> ogloszeniaSprzedawcy(int idSprzedawcy) throws BladBazyDanych {
final String sql = "SELECT * FROM ogloszenia WHERE id_sprzedawcy = ?";
List<OgloszenieSamochodowe> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, idSprzedawcy);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
lista.add(ogloszenieZResultSet(rs));
}
}
} catch (SQLException e) {
throw new BladBazyDanych("ogloszeniaSprzedawcy: " + e.getMessage(), e);
}
return lista;
}
public List<Integer> listaIdOgloszenSprzedawcy(int idSprzedawcy) throws BladBazyDanych {
final String sql = "SELECT id_ogloszenia FROM ogloszenia WHERE id_sprzedawcy = ?";
List<Integer> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, idSprzedawcy);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
lista.add(rs.getInt(1));
}
}
} catch (SQLException e) {
throw new BladBazyDanych("listaIdOgloszenSprzedawcy: " + e.getMessage(), e);
}
return lista;
}
public void save(OgloszenieSamochodowe ogl) throws BladBazyDanych {
if (ogl.getIdOgloszenia() == null) {
// wstawiamy nowy rekord korzystajac z autoincrement
insertNew(ogl);
} else if (!update(ogl)) {
insert(ogl);
}
}
public boolean insert(OgloszenieSamochodowe ogl) throws BladBazyDanych {
uzupelnijDate(ogl);
final String sql = "INSERT INTO ogloszenia("
+ " id_ogloszenia, id_sprzedawcy, data_wystawienia, cena, tytul, opis,"
+ " marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, ogl.getIdOgloszenia());
stmt.setInt(2, ogl.getIdSprzedawcy());
stmt.setString(3, Konwersje.dateToString(ogl.getDataWystawienia()));
stmt.setBigDecimal(4, ogl.getCena());
stmt.setString(5, ogl.getTytul());
stmt.setString(6, ogl.getOpis());
stmt.setString(7, ogl.getMarka());
stmt.setString(8, ogl.getModel());
stmt.setString(9, ogl.getGeneracja());
stmt.setString(10, ogl.getKolor());
stmt.setInt(11, ogl.getRocznik());
stmt.setInt(12, ogl.getPrzebieg());
Silnik silnik = ogl.getSilnik();
if (silnik != null) {
stmt.setFloat(13, silnik.getMoc());
stmt.setFloat(14, silnik.getPojemnosc());
stmt.setString(15, Konwersje.paliwoToString(silnik.getPaliwo()));
}
int ile = stmt.executeUpdate();
return (ile > 0);
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie insert: " + e.getMessage(), e);
}
}
public int insertNew(OgloszenieSamochodowe ogl) throws BladBazyDanych {
uzupelnijDate(ogl);
final String sql = "INSERT INTO ogloszenia("
+ " id_sprzedawcy, data_wystawienia, cena, tytul, opis, marka, model, generacja, kolor, rocznik, przebieg, pojemnosc, moc, paliwo)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
try {
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, ogl.getIdSprzedawcy());
stmt.setString(2, Konwersje.dateToString(ogl.getDataWystawienia()));
stmt.setBigDecimal(3, ogl.getCena());
stmt.setString(4, ogl.getTytul());
stmt.setString(5, ogl.getOpis());
stmt.setString(6, ogl.getMarka());
stmt.setString(7, ogl.getModel());
stmt.setString(8, ogl.getGeneracja());
stmt.setString(9, ogl.getKolor());
stmt.setInt(10, ogl.getRocznik());
stmt.setInt(11, ogl.getPrzebieg());
Silnik silnik = ogl.getSilnik();
if (silnik != null) {
stmt.setFloat(12, silnik.getPojemnosc());
stmt.setFloat(13, silnik.getMoc());
stmt.setString(14, Konwersje.paliwoToString(silnik.getPaliwo()));
}
int ile = stmt.executeUpdate();
if (ile == 0) {
throw new SQLException("Nie mogę wstawić nowego rekordu ogloszenie");
}
}
try (Statement stmt = db.c().createStatement();
ResultSet rs = stmt.executeQuery("SELECT last_insert_rowid()")) {
if (rs.next()) {
int noweId = rs.getInt(1);
ogl.setIdOgloszenia(noweId);
return noweId;
} else {
throw new SQLException("Nie mogę pobrać id nowego rekordu ogloszenie");
}
}
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie insertNew: " + e.getMessage(), e);
}
}
public boolean update(OgloszenieSamochodowe ogl) throws BladBazyDanych {
final String sql = "UPDATE ogloszenia SET id_sprzedawcy=?, data_wystawienia=?, cena=?,"
+ " tytul=?, opis=?, marka=?, model=?, generacja=?,"
+ " kolor=?, rocznik=?, przebieg=?, pojemnosc=?, moc=?, paliwo=?"
+ " WHERE id_ogloszenia=?";
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, ogl.getIdSprzedawcy());
stmt.setString(2, Konwersje.dateToString(ogl.getDataWystawienia()));
stmt.setBigDecimal(3, ogl.getCena());
stmt.setString(4, ogl.getTytul());
stmt.setString(5, ogl.getOpis());
stmt.setString(6, ogl.getMarka());
stmt.setString(7, ogl.getModel());
stmt.setString(8, ogl.getGeneracja());
stmt.setString(9, ogl.getKolor());
stmt.setInt(10, ogl.getRocznik());
stmt.setInt(11, ogl.getPrzebieg());
Silnik silnik = ogl.getSilnik();
if (silnik != null) {
stmt.setFloat(12, silnik.getPojemnosc());
stmt.setFloat(13, silnik.getMoc());
stmt.setString(14, Konwersje.paliwoToString(silnik.getPaliwo()));
}
stmt.setInt(15, ogl.getIdOgloszenia());
int ile = stmt.executeUpdate();
return (ile > 0);
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie update: " + e.getMessage(), e);
}
}
public void zmienCene(int idOgloszenia, BigDecimal nowaCena)
throws BladBazyDanych, NieznanyRekord {
final String sql = "UPDATE ogloszenia SET cena=?"
+ " WHERE id_ogloszenia=?";
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setBigDecimal(1, nowaCena);
stmt.setInt(2, idOgloszenia);
int ile = stmt.executeUpdate();
if (ile == 0) {
throw new NieznanyRekord("Nieznane ogloszenie " + idOgloszenia);
}
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie zmienCene: " + e.getMessage(), e);
}
}
public void delete(int idOgloszenia)
throws BladBazyDanych, NieznanyRekord {
final String sql = "DELETE FROM ogloszenia WHERE id_ogloszenia=?";
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, idOgloszenia);
int ile = stmt.executeUpdate();
if (ile == 0) {
throw new NieznanyRekord("Nieznane ogloszenie " + idOgloszenia);
}
} catch (SQLException e) {
throw new BladBazyDanych("Ogloszenie delete: " + e.getMessage(), e);
}
}
private OgloszenieSamochodowe ogloszenieZResultSet(ResultSet rs) throws SQLException {
Silnik silnik = new Silnik(rs.getFloat("moc"),
rs.getFloat("pojemnosc"),
Konwersje.paliwoFromString(rs.getString("paliwo")));
return new OgloszenieSamochodowe(
rs.getInt("id_ogloszenia"),
rs.getInt("id_sprzedawcy"),
Konwersje.dateFromString(rs.getString("data_wystawienia")),
rs.getBigDecimal("cena"),
rs.getString("tytul"),
rs.getString("opis"),
rs.getString("marka"),
rs.getString("model"),
rs.getString("generacja"),
rs.getString("kolor"),
rs.getInt("rocznik"),
rs.getInt("przebieg"),
silnik
);
}
void doczytajSprzedawce(Ogloszenie ogl) throws BladBazyDanych, NieznanyRekord {
SprzedawcaDAO sDao = db.newSprzedawcaDAO();
Sprzedawca sprzedawca = sDao.findById(ogl.getIdSprzedawcy());
ogl.setSprzedawca(sprzedawca);
}
private void uzupelnijDate(OgloszenieSamochodowe ogl) {
if (ogl.getDataWystawienia() == null) {
ogl.setDataWystawienia(LocalDateTime.now());
}
}
}
package ogloszenia.baza.sqlite;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.exn.NieznanyRekord;
import ogloszenia.model.Adres;
import ogloszenia.model.Sprzedawca;
public class SprzedawcaDAO {
private DostepDoBazySqlite db;
SprzedawcaDAO(DostepDoBazySqlite db) {
this.db = db;
}
public DostepDoBazySqlite getDBHandler() {
return db;
}
public List<Integer> idList() throws BladBazyDanych {
final String sql = "SELECT id_sprzedawcy FROM sprzedawcy";
List<Integer> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
lista.add(rs.getInt(1));
}
}
} catch (SQLException e) {
throw new BladBazyDanych("listaIdSprzedawcow: " + e.getMessage(), e);
}
return lista;
}
public Sprzedawca findById(int idSprzedawcy) throws BladBazyDanych, NieznanyRekord {
final String sql = "SELECT * FROM sprzedawcy WHERE id_sprzedawcy = ?";
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
stmt.setInt(1, idSprzedawcy);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return sprzedawcaZResultSet(rs);
} else {
throw new NieznanyRekord("Nieznany sprzedawca " + idSprzedawcy);
}
}
} catch (SQLException e) {
throw new BladBazyDanych("Sprzedawca byId: " + e.getMessage(), e);
}
}
public List<Sprzedawca> readAll() throws BladBazyDanych {
final String sql = "SELECT * FROM sprzedawcy";
List<Sprzedawca> lista = new LinkedList<>();
try (PreparedStatement stmt = db.c().prepareStatement(sql)) {
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
lista.add(sprzedawcaZResultSet(rs));
}
}
} catch (SQLException e) {
throw new BladBazyDanych("Sprzedawca readAll: " + e.getMessage(), e);
}
return lista;
}
private Sprzedawca sprzedawcaZResultSet(ResultSet rs) throws SQLException {
Adres adres = new Adres(rs.getString("ulica"),
rs.getString("kod_pocztowy"), rs.getString("miasto"));
return new Sprzedawca(
rs.getInt("id_sprzedawcy"), rs.getString("nazwa"),
adres, rs.getString("telefon"), rs.getString("email")
);
}
}
package ogloszenia.baza.sqlite;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import ogloszenia.Ustawienia;
public class UtworzBaze {
public static void main(String[] args) {
String skrypt = "";
try {
skrypt = String.join("\n", Files.readAllLines(Paths.get("ogloszenia_sqlite.sql")));
if (Files.deleteIfExists(Paths.get(Ustawienia.SQLITE_PATH))) {
System.out.println("Usunięto plik " + Ustawienia.SQLITE_PATH);
}
} catch (IOException e) {
System.err.println("Błąd podczas przygotowania plików: " + e);
}
String[] poleceniaSkryptu = skrypt.split("\\s*;\\s*");
System.out.println("Otwarcie pliku z bazą...");
try (Connection c = DriverManager.getConnection("jdbc:sqlite:" + Ustawienia.SQLITE_PATH);
Statement stmt = c.createStatement()) {
c.setAutoCommit(false);
System.out.println("Wgrywam dane");
for (String sql : poleceniaSkryptu) {
stmt.addBatch(sql);
System.out.print(".");
System.out.flush();
}
stmt.executeBatch();
c.commit();
System.out.println("\nGotowe");
} catch (SQLException e) {
System.err.println("Błąd podczas wgrywania danych: " + e);
e.printStackTrace();
}
}
}
package ogloszenia.exn;
public class BladAplikacji extends Exception {
public BladAplikacji() {
super();
}
public BladAplikacji(String message, Throwable cause) {
super(message, cause);
}
public BladAplikacji(String message) {
super(message);
}
public BladAplikacji(Throwable cause) {
super(cause);
}
}
package ogloszenia.exn;
public class BladBazyDanych extends BladAplikacji {
public BladBazyDanych() {
super();
}
public BladBazyDanych(String message, Throwable cause) {
super(message, cause);
}
public BladBazyDanych(String message) {
super(message);
}
public BladBazyDanych(Throwable cause) {
super(cause);
}
}
package ogloszenia.exn;
public class NieznanyRekord extends BladAplikacji {
public NieznanyRekord() {
super();
}
public NieznanyRekord(String message) {
super(message);
}
}
package ogloszenia.model;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class AdapterDaty extends XmlAdapter<String, LocalDateTime> {
private static final DateTimeFormatter FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Override
public LocalDateTime unmarshal(String s) {
return LocalDateTime.parse(s, FORMAT);
//return LocalDateTime.parse(s); // domyslny format
}
@Override
public String marshal(LocalDateTime d) {
return FORMAT.format(d);
//return d.toString(); // domyslny format
}
}
package ogloszenia.model;
import jakarta.xml.bind.annotation.XmlElement;
public class Adres {
private String ulica;
@XmlElement(name="kod-pocztowy")
private String kodPocztowy;
private String miasto;
public Adres() {
}
public Adres(String ulica, String kodPocztowy, String miasto) {
this.ulica = ulica;
this.kodPocztowy = kodPocztowy;
this.miasto = miasto;
}
public String getUlica() {
return ulica;
}
public String getKodPocztowy() {
return kodPocztowy;
}
public String getMiasto() {
return miasto;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((kodPocztowy == null) ? 0 : kodPocztowy.hashCode());
result = prime * result + ((miasto == null) ? 0 : miasto.hashCode());
result = prime * result + ((ulica == null) ? 0 : ulica.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Adres other = (Adres) obj;
if (kodPocztowy == null) {
if (other.kodPocztowy != null)
return false;
} else if (!kodPocztowy.equals(other.kodPocztowy))
return false;
if (miasto == null) {
if (other.miasto != null)
return false;
} else if (!miasto.equals(other.miasto))
return false;
if (ulica == null) {
if (other.ulica != null)
return false;
} else if (!ulica.equals(other.ulica))
return false;
return true;
}
@Override
public String toString() {
return String.format("%s, %s %s", ulica, kodPocztowy, miasto);
}
}
package ogloszenia.model;
import java.util.List;
public class ListaOgloszen {
public List<OgloszenieSamochodowe> ogloszenia;
public static ListaOgloszen nowa(List<OgloszenieSamochodowe> ogloszenia) {
ListaOgloszen lista = new ListaOgloszen();
lista.ogloszenia = ogloszenia;
return lista;
}
}
package ogloszenia.model;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlTransient;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
public class Ogloszenie {
@XmlAttribute(name="id")
private Integer idOgloszenia;
@XmlAttribute(name="id-sprzedawcy")
// @XmlTransient
private Integer idSprzedawcy;
@XmlElement(name="wystawione")
@XmlJavaTypeAdapter(AdapterDaty.class)
private LocalDateTime dataWystawienia;
private BigDecimal cena;
private String tytul;
private String opis;
private Sprzedawca sprzedawca;
public Ogloszenie() {
}
public Ogloszenie(Integer idOgloszenia, Integer idSprzedawcy, LocalDateTime dataWystawienia, BigDecimal cena, String tytul, String opis) {
this.idOgloszenia = idOgloszenia;
this.idSprzedawcy = idSprzedawcy;
this.dataWystawienia = dataWystawienia;
this.cena = cena;
this.tytul = tytul;
this.opis = opis;
}
/**
* Pozostawia pole sprzedawca równe null.
*/
public Ogloszenie(Integer idOgloszenia, LocalDateTime dataWystawienia, BigDecimal cena, String tytul, String opis) {
this.idOgloszenia = idOgloszenia;
this.dataWystawienia = dataWystawienia;
this.cena = cena;
this.tytul = tytul;
this.opis = opis;
this.idSprzedawcy = null;
}
/**
* Wartość idSprzedawcy pobiera z obiektu sprzedawca.
*/
public Ogloszenie(Integer idOgloszenia, Sprzedawca sprzedawca, LocalDateTime dataWystawienia, BigDecimal cena, String tytul, String opis) {
this.idOgloszenia = idOgloszenia;
this.dataWystawienia = dataWystawienia;
this.cena = cena;
this.tytul = tytul;
this.opis = opis;
this.sprzedawca = sprzedawca;
if (sprzedawca != null) {
this.idSprzedawcy = sprzedawca.getIdSprzedawcy();
}
}
public Integer getIdOgloszenia() {
return idOgloszenia;
}
public void setIdOgloszenia(Integer noweId) {
this.idOgloszenia = noweId;
}
public String getTytul() {
return tytul;
}
public BigDecimal getCena() {
return cena;
}
public Integer getIdSprzedawcy() {
return idSprzedawcy;
}
public Sprzedawca getSprzedawca() {
return sprzedawca;
}
public void setSprzedawca(Sprzedawca sprzedawca) {
this.sprzedawca = sprzedawca;
}
public String getOpis() {
return opis;
}
public void setOpis(String opis) {
this.opis = opis;
}
public void setCena(BigDecimal cena) {
this.cena = cena;
}
public LocalDateTime getDataWystawienia() {
return dataWystawienia;
}
public void setDataWystawienia(LocalDateTime dataWystawienia) {
this.dataWystawienia = dataWystawienia;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cena == null) ? 0 : cena.hashCode());
result = prime * result + ((dataWystawienia == null) ? 0 : dataWystawienia.hashCode());
result = prime * result + ((idOgloszenia == null) ? 0 : idOgloszenia.hashCode());
result = prime * result + ((idSprzedawcy == null) ? 0 : idSprzedawcy.hashCode());
result = prime * result + ((opis == null) ? 0 : opis.hashCode());
result = prime * result + ((sprzedawca == null) ? 0 : sprzedawca.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Ogloszenie other = (Ogloszenie) obj;
if (cena == null) {
if (other.cena != null)
return false;
} else if (!cena.equals(other.cena))
return false;
if (dataWystawienia == null) {
if (other.dataWystawienia != null)
return false;
} else if (!dataWystawienia.equals(other.dataWystawienia))
return false;
if (idOgloszenia == null) {
if (other.idOgloszenia != null)
return false;
} else if (!idOgloszenia.equals(other.idOgloszenia))
return false;
if (idSprzedawcy == null) {
if (other.idSprzedawcy != null)
return false;
} else if (!idSprzedawcy.equals(other.idSprzedawcy))
return false;
if (opis == null) {
if (other.opis != null)
return false;
} else if (!opis.equals(other.opis))
return false;
if (sprzedawca == null) {
if (other.sprzedawca != null)
return false;
} else if (!sprzedawca.equals(other.sprzedawca))
return false;
return true;
}
@Override
public String toString() {
return String.format("Ogłoszenie #%d: sprzedawca #%s, cena: %.2f\n %s",
idOgloszenia, idSprzedawcy, cena, tytul);
}
}
package ogloszenia.model;
import jakarta.xml.bind.annotation.XmlElement;
import java.math.BigDecimal;
import java.time.LocalDateTime;
public class OgloszenieSamochodowe extends Ogloszenie {
private String marka;
private String model;
private String generacja;
@XmlElement(name="rok-produkcji")
public int rocznik;
@XmlElement(name="stan-licznika")
private int przebieg;
private String kolor;
private Silnik silnik;
public OgloszenieSamochodowe() {
}
public OgloszenieSamochodowe(Integer idOgloszenia, Integer idSprzedawcy,
LocalDateTime dataWystawienia, BigDecimal cena, String tytul, String opis,
String marka, String model, String generacja, String kolor, int rocznik, int przebieg, Silnik silnik) {
super(idOgloszenia, idSprzedawcy, dataWystawienia, cena, tytul, opis);
this.marka = marka;
this.model = model;
this.generacja = generacja;
this.kolor = kolor;
this.rocznik = rocznik;
this.przebieg = przebieg;
this.silnik = silnik;
}
/**
* Pozostawia pole sprzedawca równe null.
*/
public OgloszenieSamochodowe(Integer idOgloszenia, LocalDateTime dataWystawienia, BigDecimal cena, String tytul, String opis,
String marka, String model, String generacja, String kolor, int rocznik, int przebieg, Silnik silnik) {
super(idOgloszenia, dataWystawienia, cena, tytul, opis);
this.marka = marka;
this.model = model;
this.generacja = generacja;
this.kolor = kolor;
this.rocznik = rocznik;
this.przebieg = przebieg;
this.silnik = silnik;
}
/**
* Wartość idSprzedawcy pobiera z obiektu sprzedawca.
*/
public OgloszenieSamochodowe(Integer idOgloszenia, Sprzedawca sprzedawca,
LocalDateTime dataWystawienia, BigDecimal cena, String tytul, String opis,
String marka, String model, String generacja, String kolor, int rocznik, int przebieg, Silnik silnik) {
super(idOgloszenia, sprzedawca, dataWystawienia, cena, tytul, opis);
this.marka = marka;
this.model = model;
this.generacja = generacja;
this.kolor = kolor;
this.rocznik = rocznik;
this.przebieg = przebieg;
this.silnik = silnik;
}
public String getMarka() {
return marka.toUpperCase();
}
public void setMarka(String marka) {
this.marka = marka;
}
public String getModel() {
return model;
}
public String getGeneracja() {
return generacja;
}
public String getKolor() {
return kolor;
}
public int getRocznik() {
return rocznik;
}
public int getPrzebieg() {
return przebieg;
}
public Silnik getSilnik() {
return silnik;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((generacja == null) ? 0 : generacja.hashCode());
result = prime * result + ((kolor == null) ? 0 : kolor.hashCode());
result = prime * result + ((marka == null) ? 0 : marka.hashCode());
result = prime * result + ((model == null) ? 0 : model.hashCode());
result = prime * result + rocznik;
result = prime * result + ((silnik == null) ? 0 : silnik.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
OgloszenieSamochodowe other = (OgloszenieSamochodowe) obj;
if (generacja == null) {
if (other.generacja != null)
return false;
} else if (!generacja.equals(other.generacja))
return false;
if (kolor == null) {
if (other.kolor != null)
return false;
} else if (!kolor.equals(other.kolor))
return false;
if (marka == null) {
if (other.marka != null)
return false;
} else if (!marka.equals(other.marka))
return false;
if (model == null) {
if (other.model != null)
return false;
} else if (!model.equals(other.model))
return false;
if (rocznik != other.rocznik)
return false;
if (silnik == null) {
if (other.silnik != null)
return false;
} else if (!silnik.equals(other.silnik))
return false;
return true;
}
@Override
public String toString() {
return super.toString() + "\n" +
String.format(" Samochód: %s %s %s (%s), rok %d, silnik: %s",
marka, model, generacja, kolor, rocznik, silnik);
}
}
package ogloszenia.model;
import jakarta.xml.bind.annotation.XmlEnumValue;
public enum Paliwo {
@XmlEnumValue("benzyna") BENZYNA,
@XmlEnumValue("diesel") OLEJ,
@XmlEnumValue("lpg") GAZ,
@XmlEnumValue("hybryda") HYBRYDA,
@XmlEnumValue("elektryk") ELEKTRYCZNY;
}
package ogloszenia.model;
public class Silnik {
private Float moc;
private Float pojemnosc;
private Paliwo paliwo;
public Silnik() {
}
public Silnik(Float moc, Float pojemnosc, Paliwo paliwo) {
this.moc = moc;
this.pojemnosc = pojemnosc;
this.paliwo = paliwo;
}
public Float getMoc() {
return moc;
}
public Float getPojemnosc() {
return pojemnosc;
}
public Paliwo getPaliwo() {
return paliwo;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((moc == null) ? 0 : moc.hashCode());
result = prime * result + ((paliwo == null) ? 0 : paliwo.hashCode());
result = prime * result + ((pojemnosc == null) ? 0 : pojemnosc.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Silnik other = (Silnik) obj;
if (moc == null) {
if (other.moc != null)
return false;
} else if (!moc.equals(other.moc))
return false;
if (paliwo != other.paliwo)
return false;
if (pojemnosc == null) {
if (other.pojemnosc != null)
return false;
} else if (!pojemnosc.equals(other.pojemnosc))
return false;
return true;
}
@Override
public String toString() {
return String.format("%.1f %s, %.0f KM", pojemnosc, paliwo, moc);
}
}
package ogloszenia.model;
import jakarta.xml.bind.annotation.XmlAttribute;
public class Sprzedawca {
@XmlAttribute(name="id")
private Integer idSprzedawcy;
private String nazwa;
private Adres adres;
private String telefon;
private String email;
public Sprzedawca() {
}
public Sprzedawca(Integer idSprzedawcy, String nazwa, Adres adres, String telefon, String email) {
this.idSprzedawcy = idSprzedawcy;
this.nazwa = nazwa;
this.adres = adres;
this.telefon = telefon;
this.email = email;
}
public Integer getIdSprzedawcy() {
return idSprzedawcy;
}
public String getNazwa() {
return nazwa;
}
public Adres getAdres() {
return adres;
}
public String getTelefon() {
return telefon;
}
public String getEmail() {
return email;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((adres == null) ? 0 : adres.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((idSprzedawcy == null) ? 0 : idSprzedawcy.hashCode());
result = prime * result + ((nazwa == null) ? 0 : nazwa.hashCode());
result = prime * result + ((telefon == null) ? 0 : telefon.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Sprzedawca other = (Sprzedawca) obj;
if (adres == null) {
if (other.adres != null)
return false;
} else if (!adres.equals(other.adres))
return false;
if (email == null) {
if (other.email != null)
return false;
} else if (!email.equals(other.email))
return false;
if (idSprzedawcy == null) {
if (other.idSprzedawcy != null)
return false;
} else if (!idSprzedawcy.equals(other.idSprzedawcy))
return false;
if (nazwa == null) {
if (other.nazwa != null)
return false;
} else if (!nazwa.equals(other.nazwa))
return false;
if (telefon == null) {
if (other.telefon != null)
return false;
} else if (!telefon.equals(other.telefon))
return false;
return true;
}
@Override
public String toString() {
return String.format("Sprzedawca #%d: %s adres: %s, tel.: %s, email: %s",
idSprzedawcy, nazwa, adres, telefon, email);
}
}
@XmlAccessorType(XmlAccessType.FIELD)
package ogloszenia.model;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
\ No newline at end of file
package ogloszenia.soap;
import jakarta.jws.WebParam;
import jakarta.jws.WebResult;
import jakarta.jws.WebService;
import jakarta.xml.ws.soap.MTOM;
import ogloszenia.Ustawienia;
import ogloszenia.baza.sqlite.DostepDoBazySqlite;
import ogloszenia.baza.sqlite.OgloszenieDAO;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.exn.NieznanyRekord;
import ogloszenia.model.OgloszenieSamochodowe;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
@WebService
@MTOM
public class Ogloszenia {
@WebResult(name="ogloszenie")
public List<OgloszenieSamochodowe> readAll() throws BladBazyDanych {
try (DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite()) {
OgloszenieDAO dao = db.newOgloszenieDAO();
return dao.readAllFull();
}
}
@WebResult(name="ogloszenie")
public OgloszenieSamochodowe readOne(@WebParam(name="id") int idOgloszenia) throws BladBazyDanych, NieznanyRekord {
try (DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite()) {
OgloszenieDAO dao = db.newOgloszenieDAO();
return dao.findByIdFull(idOgloszenia);
}
}
@WebResult(name="ogloszenie")
public List<OgloszenieSamochodowe> readByPrice(
@WebParam(name="min") BigDecimal min,
@WebParam(name="max") BigDecimal max) throws BladBazyDanych {
try(DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite()) {
OgloszenieDAO dao = db.newOgloszenieDAO();
return dao.ogloszeniaWedlugCeny(min, max);
}
}
public void update(
@WebParam(name="ogloszenie") OgloszenieSamochodowe ogloszenie) throws BladBazyDanych, NieznanyRekord {
// W tej wersji zakładamy, że obiekt ma podane id i nadpisujemy istniejące.
// W tym przypadku nie trzeba dawać informacji zwrotnej.
try(DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite()) {
db.beginTransaction();
OgloszenieDAO dao = db.newOgloszenieDAO();
boolean sukces = dao.update(ogloszenie);
if(!sukces) {
throw new NieznanyRekord("Brak ogłoszenia nr " + ogloszenie.getIdOgloszenia());
}
db.endTransaction(true);
}
}
@WebResult(name="new-id")
public int insert(
@WebParam(name="ogloszenie") OgloszenieSamochodowe ogloszenie) throws BladBazyDanych {
// W tej wersji zawsze dodajemy nowy rekord.
// W razie, gdyby klient przysłał ogłoszenie z ustawionym id, to my i tak to id zignorujemy.
// W tej wersji w odpowiedzi wysyłamy id nowego rekordu, aby klient dowiedział się jakie ono jest.
ogloszenie.setIdOgloszenia(null);
try(DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite()) {
db.beginTransaction();
OgloszenieDAO dao = db.newOgloszenieDAO();
dao.insertNew(ogloszenie);
db.endTransaction(true);
return ogloszenie.getIdOgloszenia();
}
}
@WebResult(name="bytes")
public byte[] photo(@WebParam(name="id") int idOgloszenia) throws NieznanyRekord {
try {
Path path = Paths.get(Ustawienia.PHOTOS_PATH, idOgloszenia + ".jpg");
return Files.readAllBytes(path);
} catch (IOException e) {
throw new NieznanyRekord("Brak zdjęcia dla ogłoszenia nr " + idOgloszenia);
}
}
}
package ogloszenia.baza.sqlite;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.exn.NieznanyRekord;
import ogloszenia.model.OgloszenieSamochodowe;
public class TestInsertUpdate {
public static void main(String[] args) {
try(DostepDoBazySqlite baza = DostepDoBazySqlite.newSQLite()) {
OgloszenieDAO dao = baza.newOgloszenieDAO();
OgloszenieSamochodowe auto = dao.findById(2);
auto.setIdOgloszenia(103);
auto.setOpis("Opis złotego Matiza");
dao.save(auto);
System.out.println("Gotowe");
} catch (BladBazyDanych | NieznanyRekord e) {
e.printStackTrace();
}
}
}
package ogloszenia.baza.sqlite;
import java.time.LocalTime;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.exn.NieznanyRekord;
import ogloszenia.model.OgloszenieSamochodowe;
public class TestInsertWstawNowy {
public static void main(String[] args) {
try(DostepDoBazySqlite baza = DostepDoBazySqlite.newSQLite()) {
OgloszenieDAO dao = baza.newOgloszenieDAO();
OgloszenieSamochodowe auto = dao.findById(3);
auto.setIdOgloszenia(null);
auto.setOpis("Nowy z godziny " + LocalTime.now());
dao.save(auto);
} catch (BladBazyDanych e) {
e.printStackTrace();
} catch (NieznanyRekord e) {
e.printStackTrace();
}
}
}
package ogloszenia.baza.sqlite;
import java.util.List;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.model.OgloszenieSamochodowe;
public class TestOdczytOgloszen {
public static void main(String[] args) {
try (DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite()) {
OgloszenieDAO dao = db.newOgloszenieDAO();
List<OgloszenieSamochodowe> lista = dao.readAllFull();
for (OgloszenieSamochodowe ogloszenie : lista) {
System.out.println("\n"+ogloszenie);
}
} catch (BladBazyDanych e) {
e.printStackTrace();
}
}
}
package ogloszenia.baza.sqlite;
import java.util.List;
import ogloszenia.exn.BladBazyDanych;
import ogloszenia.model.Sprzedawca;
public class TestOdczytSprzedawcow {
public static void main(String[] args) {
try (DostepDoBazySqlite db = DostepDoBazySqlite.newSQLite("ogloszenia.db")) {
SprzedawcaDAO dao = db.newSprzedawcaDAO();
List<Sprzedawca> lista = dao.readAll();
for (Sprzedawca sprzedawca : lista) {
System.out.println(sprzedawca);
}
} catch (BladBazyDanych e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment