From 0825eb0cf92571bda5ea858745fbc04c48367343 Mon Sep 17 00:00:00 2001 From: Azon Date: Mon, 5 Feb 2018 20:48:31 +0300 Subject: [PATCH 1/4] add new positions to menu --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 23556c3..8d07b33 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ public class Main { * Menu * submenu + * submenu + * submenu * Menu * submenu * subsubmenu From da841f7276e49595934d1602a788b76eeeb4226f Mon Sep 17 00:00:00 2001 From: Azon Date: Mon, 5 Feb 2018 20:49:45 +0300 Subject: [PATCH 2/4] add new controller method --- .../java/io/khasang/eshop/controller/AppController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/khasang/eshop/controller/AppController.java b/src/main/java/io/khasang/eshop/controller/AppController.java index 6bba66b..5e07fbb 100644 --- a/src/main/java/io/khasang/eshop/controller/AppController.java +++ b/src/main/java/io/khasang/eshop/controller/AppController.java @@ -21,6 +21,12 @@ public String helloPage() { return "OK!"; } + @RequestMapping("/") + @ResponseBody + public String byPage() { + return "Buy!"; + } + @RequestMapping("/create") @ResponseBody public String createTable(){ From e49d952e440d92885a6c7326e545dd7a47f14640 Mon Sep 17 00:00:00 2001 From: Azon Date: Sat, 10 Feb 2018 12:57:26 +0300 Subject: [PATCH 3/4] add associations --- pom.xml | 11 +++++++ .../khasang/eshop/config/HibernateConfig.java | 3 ++ .../eshop/controller/AppController.java | 6 ---- .../khasang/eshop/dao/impl/BasicDaoImpl.java | 14 ++++++++ .../java/io/khasang/eshop/entity/Cat.java | 16 ++++++++++ .../io/khasang/eshop/entity/CatWoman.java | 32 +++++++++++++++++++ src/main/resources/hibernate.properties | 5 +++ .../CatControllerIntegrationTest.java | 19 +++++++++-- 8 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 src/main/java/io/khasang/eshop/entity/CatWoman.java diff --git a/pom.xml b/pom.xml index 3584963..75da30f 100644 --- a/pom.xml +++ b/pom.xml @@ -114,6 +114,17 @@ hibernate-entitymanager ${hibernate.version} + + org.hibernate + hibernate-jcache + ${hibernate.version} + + + + org.ehcache + ehcache + 3.3.1 + diff --git a/src/main/java/io/khasang/eshop/config/HibernateConfig.java b/src/main/java/io/khasang/eshop/config/HibernateConfig.java index 6d35bd8..11bd0a0 100644 --- a/src/main/java/io/khasang/eshop/config/HibernateConfig.java +++ b/src/main/java/io/khasang/eshop/config/HibernateConfig.java @@ -48,6 +48,9 @@ private Properties properties() { properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql")); properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql")); properties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hibernate.hbm2ddl.auto")); + properties.put("hibernate.use_second_level_cache", environment.getRequiredProperty("hibernate.use_second_level_cache")); + properties.put("hibernate.cache.region.factory_class", environment.getRequiredProperty("hibernate.cache.region.factory_class")); + properties.put("hibernate.hibernate.javax.cache.provider", environment.getRequiredProperty("hibernate.hibernate.javax.cache.provider")); properties.put("show_sql", environment.getRequiredProperty("hibernate.format_sql")); return properties; } diff --git a/src/main/java/io/khasang/eshop/controller/AppController.java b/src/main/java/io/khasang/eshop/controller/AppController.java index 5e07fbb..6bba66b 100644 --- a/src/main/java/io/khasang/eshop/controller/AppController.java +++ b/src/main/java/io/khasang/eshop/controller/AppController.java @@ -21,12 +21,6 @@ public String helloPage() { return "OK!"; } - @RequestMapping("/") - @ResponseBody - public String byPage() { - return "Buy!"; - } - @RequestMapping("/create") @ResponseBody public String createTable(){ diff --git a/src/main/java/io/khasang/eshop/dao/impl/BasicDaoImpl.java b/src/main/java/io/khasang/eshop/dao/impl/BasicDaoImpl.java index b9c86bf..e181563 100644 --- a/src/main/java/io/khasang/eshop/dao/impl/BasicDaoImpl.java +++ b/src/main/java/io/khasang/eshop/dao/impl/BasicDaoImpl.java @@ -1,8 +1,10 @@ package io.khasang.eshop.dao.impl; import io.khasang.eshop.dao.BasicDao; +import io.khasang.eshop.entity.Cat; import org.hibernate.Session; import org.hibernate.SessionFactory; +import org.hibernate.stat.Statistics; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -44,7 +46,15 @@ public T getById(long id) { @Override public T add(T entity) { + Statistics statistics = sessionFactory.getStatistics(); + + if (!statistics.isStatisticsEnabled()) { + statistics.setStatisticsEnabled(true); + } + getSession().save(entity); + getSession().get(Cat.class, 1L); + return entity; } @@ -59,4 +69,8 @@ public T delete(T entity) { getSession().delete(entity); return entity; } + + void check(){ + + } } diff --git a/src/main/java/io/khasang/eshop/entity/Cat.java b/src/main/java/io/khasang/eshop/entity/Cat.java index 58f9018..e0cee97 100644 --- a/src/main/java/io/khasang/eshop/entity/Cat.java +++ b/src/main/java/io/khasang/eshop/entity/Cat.java @@ -1,8 +1,14 @@ package io.khasang.eshop.entity; +import org.hibernate.annotations.CacheConcurrencyStrategy; + import javax.persistence.*; +import java.util.ArrayList; +import java.util.List; @Entity +@Cacheable +@org.hibernate.annotations.Cache(region = "catCache", usage = CacheConcurrencyStrategy.READ_WRITE) @Table(name = "cats") public class Cat { @Id @@ -12,6 +18,16 @@ public class Cat { private String name; private String description; + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) + private List catWomanList = new ArrayList<>(); + + public List getCatWomanList() { + return catWomanList; + } + + public void setCatWomanList(List catWomanList) { + this.catWomanList = catWomanList; + } public String getDescription() { return description; diff --git a/src/main/java/io/khasang/eshop/entity/CatWoman.java b/src/main/java/io/khasang/eshop/entity/CatWoman.java new file mode 100644 index 0000000..e917bf8 --- /dev/null +++ b/src/main/java/io/khasang/eshop/entity/CatWoman.java @@ -0,0 +1,32 @@ +package io.khasang.eshop.entity; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class CatWoman { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getId() { + + return id; + } + + public void setId(long id) { + this.id = id; + } +} diff --git a/src/main/resources/hibernate.properties b/src/main/resources/hibernate.properties index 87ebe48..45b7de3 100644 --- a/src/main/resources/hibernate.properties +++ b/src/main/resources/hibernate.properties @@ -6,3 +6,8 @@ hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=true hibernate.format_sql=true hibernate.hbm2ddl.auto=update +hibernate.use_second_level_cache=true +hibernate.cache.region.factory_class=org.hibernate.cache.jcache.JCacheRegionFactory +hibernate.hibernate.javax.cache.provider=org.ehcache.jsr107.EhcacheCachingProvider + + diff --git a/src/test/java/io/khasang/eshop/controller/CatControllerIntegrationTest.java b/src/test/java/io/khasang/eshop/controller/CatControllerIntegrationTest.java index 2302595..9795095 100644 --- a/src/test/java/io/khasang/eshop/controller/CatControllerIntegrationTest.java +++ b/src/test/java/io/khasang/eshop/controller/CatControllerIntegrationTest.java @@ -1,11 +1,13 @@ package io.khasang.eshop.controller; import io.khasang.eshop.entity.Cat; +import io.khasang.eshop.entity.CatWoman; import org.junit.*; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.*; import org.springframework.web.client.RestTemplate; +import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; @@ -123,13 +125,26 @@ private Cat createdCat() { assertNotNull(createdCat); assertEquals(cat.getName(), createdCat.getName()); + assertNotNull(cat.getCatWomanList()); return createdCat; } - private Cat prefillCat(String barsik) { + private Cat prefillCat(String name) { Cat cat = new Cat(); - cat.setName(barsik); + cat.setName(name); cat.setDescription("happy"); + + CatWoman catWoman1 = new CatWoman(); + catWoman1.setName("Riska"); + + CatWoman catWoman2 = new CatWoman(); + catWoman2.setName("Murka"); + + List catWomanList = new ArrayList<>(); + catWomanList.add(catWoman1); + catWomanList.add(catWoman2); + + cat.setCatWomanList(catWomanList); return cat; } From 137d6f8888af0534d2dbcc86d7743d2170a56cb2 Mon Sep 17 00:00:00 2001 From: Azon Date: Wed, 14 Feb 2018 00:07:16 +0300 Subject: [PATCH 4/4] add associations --- .../eshop/controller/AppController.java | 11 + .../java/io/khasang/eshop/util/CheckText.java | 37 ++++ .../spellservice/ArrayOfSpellResult.java | 69 +++++++ .../spellservice/CheckTextRequest.java | 154 ++++++++++++++ .../spellservice/CheckTextResponse.java | 64 ++++++ .../spellservice/CheckTextsRequest.java | 159 +++++++++++++++ .../spellservice/CheckTextsResponse.java | 64 ++++++ .../services/spellservice/ObjectFactory.java | 88 ++++++++ .../services/spellservice/SpellError.java | 192 ++++++++++++++++++ .../services/spellservice/SpellResult.java | 67 ++++++ .../services/spellservice/SpellService.java | 94 +++++++++ .../spellservice/SpellServiceSoap.java | 50 +++++ .../services/spellservice/package-info.java | 2 + 13 files changed, 1051 insertions(+) create mode 100644 src/main/java/io/khasang/eshop/util/CheckText.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/ArrayOfSpellResult.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/CheckTextRequest.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/CheckTextResponse.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/CheckTextsRequest.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/CheckTextsResponse.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/ObjectFactory.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/SpellError.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/SpellResult.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/SpellService.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/SpellServiceSoap.java create mode 100644 src/main/java/net/yandex/speller/services/spellservice/package-info.java diff --git a/src/main/java/io/khasang/eshop/controller/AppController.java b/src/main/java/io/khasang/eshop/controller/AppController.java index 6bba66b..9f58635 100644 --- a/src/main/java/io/khasang/eshop/controller/AppController.java +++ b/src/main/java/io/khasang/eshop/controller/AppController.java @@ -1,6 +1,7 @@ package io.khasang.eshop.controller; import io.khasang.eshop.model.CreateTable; +import io.khasang.eshop.util.CheckText; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Controller; @@ -9,10 +10,14 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import java.net.MalformedURLException; + @Controller public class AppController { @Autowired private CreateTable createTable; + @Autowired + private CheckText checkText; // http://localhost:8080/ @RequestMapping("/") @@ -43,4 +48,10 @@ public String getEncryptedPassword(@PathVariable("password") String password) { return new BCryptPasswordEncoder().encode(password); } + @ResponseBody + @RequestMapping(value = {"/text/{text}"}, method = RequestMethod.GET) + public String checkText(@PathVariable("text") String text) throws MalformedURLException { + return checkText.checkWord(text); + } + } diff --git a/src/main/java/io/khasang/eshop/util/CheckText.java b/src/main/java/io/khasang/eshop/util/CheckText.java new file mode 100644 index 0000000..2fc2c0c --- /dev/null +++ b/src/main/java/io/khasang/eshop/util/CheckText.java @@ -0,0 +1,37 @@ +package io.khasang.eshop.util; + +import net.yandex.speller.services.spellservice.CheckTextRequest; +import net.yandex.speller.services.spellservice.SpellServiceSoap; +import org.springframework.stereotype.Component; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import java.net.MalformedURLException; +import java.net.URL; + +@Component +public class CheckText { + + private final static String ADDRESS = "http://speller.yandex.net/services/spellservice?WSDL"; + + public String checkWord(String text) throws MalformedURLException { + URL url = new URL(ADDRESS); + QName qName = new QName("http://speller.yandex.net/services/spellservice", "SpellService"); + + Service service = Service.create(url, qName); + + SpellServiceSoap serviceSoap = service.getPort(SpellServiceSoap.class); + + CheckTextRequest checkTextRequest = new CheckTextRequest(); + checkTextRequest.setText(text); + checkTextRequest.setFormat("plain"); + checkTextRequest.setLang("en"); + + if (serviceSoap.checkText(checkTextRequest).getSpellResult().getError().size() != 0) { + return serviceSoap.checkText(checkTextRequest).getSpellResult().getError().get(0).getS().toString(); + } else { + return "Word correct!"; + } + + } +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/ArrayOfSpellResult.java b/src/main/java/net/yandex/speller/services/spellservice/ArrayOfSpellResult.java new file mode 100644 index 0000000..410d720 --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/ArrayOfSpellResult.java @@ -0,0 +1,69 @@ + +package net.yandex.speller.services.spellservice; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfSpellResult complex type. + * + *

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

+ * <complexType name="ArrayOfSpellResult">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="SpellResult" type="{http://speller.yandex.net/services/spellservice}SpellResult" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfSpellResult", propOrder = { + "spellResult" +}) +public class ArrayOfSpellResult { + + @XmlElement(name = "SpellResult") + protected List spellResult; + + /** + * Gets the value of the spellResult property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the spellResult property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link SpellResult } + * + * + */ + public List getSpellResult() { + if (spellResult == null) { + spellResult = new ArrayList(); + } + return this.spellResult; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/CheckTextRequest.java b/src/main/java/net/yandex/speller/services/spellservice/CheckTextRequest.java new file mode 100644 index 0000000..bc7c02f --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/CheckTextRequest.java @@ -0,0 +1,154 @@ + +package net.yandex.speller.services.spellservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *       <attribute name="lang" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="options" type="{http://www.w3.org/2001/XMLSchema}int" default="0" />
+ *       <attribute name="format" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "text" +}) +@XmlRootElement(name = "CheckTextRequest") +public class CheckTextRequest { + + @XmlElement(required = true) + protected String text; + @XmlAttribute(name = "lang") + protected String lang; + @XmlAttribute(name = "options") + protected Integer options; + @XmlAttribute(name = "format") + protected String format; + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets the value of the options property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public int getOptions() { + if (options == null) { + return 0; + } else { + return options; + } + } + + /** + * Sets the value of the options property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setOptions(Integer value) { + this.options = value; + } + + /** + * Gets the value of the format property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormat() { + if (format == null) { + return ""; + } else { + return format; + } + } + + /** + * Sets the value of the format property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormat(String value) { + this.format = value; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/CheckTextResponse.java b/src/main/java/net/yandex/speller/services/spellservice/CheckTextResponse.java new file mode 100644 index 0000000..e9893ff --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/CheckTextResponse.java @@ -0,0 +1,64 @@ + +package net.yandex.speller.services.spellservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="SpellResult" type="{http://speller.yandex.net/services/spellservice}SpellResult"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "spellResult" +}) +@XmlRootElement(name = "CheckTextResponse") +public class CheckTextResponse { + + @XmlElement(name = "SpellResult", required = true) + protected SpellResult spellResult; + + /** + * Gets the value of the spellResult property. + * + * @return + * possible object is + * {@link SpellResult } + * + */ + public SpellResult getSpellResult() { + return spellResult; + } + + /** + * Sets the value of the spellResult property. + * + * @param value + * allowed object is + * {@link SpellResult } + * + */ + public void setSpellResult(SpellResult value) { + this.spellResult = value; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/CheckTextsRequest.java b/src/main/java/net/yandex/speller/services/spellservice/CheckTextsRequest.java new file mode 100644 index 0000000..8547d6e --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/CheckTextsRequest.java @@ -0,0 +1,159 @@ + +package net.yandex.speller.services.spellservice; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="text" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="lang" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="options" type="{http://www.w3.org/2001/XMLSchema}int" default="0" />
+ *       <attribute name="format" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "text" +}) +@XmlRootElement(name = "CheckTextsRequest") +public class CheckTextsRequest { + + protected List text; + @XmlAttribute(name = "lang") + protected String lang; + @XmlAttribute(name = "options") + protected Integer options; + @XmlAttribute(name = "format") + protected String format; + + /** + * Gets the value of the text property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the text property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getText() { + if (text == null) { + text = new ArrayList(); + } + return this.text; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets the value of the options property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public int getOptions() { + if (options == null) { + return 0; + } else { + return options; + } + } + + /** + * Sets the value of the options property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setOptions(Integer value) { + this.options = value; + } + + /** + * Gets the value of the format property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormat() { + if (format == null) { + return ""; + } else { + return format; + } + } + + /** + * Sets the value of the format property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormat(String value) { + this.format = value; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/CheckTextsResponse.java b/src/main/java/net/yandex/speller/services/spellservice/CheckTextsResponse.java new file mode 100644 index 0000000..8946f39 --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/CheckTextsResponse.java @@ -0,0 +1,64 @@ + +package net.yandex.speller.services.spellservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ArrayOfSpellResult" type="{http://speller.yandex.net/services/spellservice}ArrayOfSpellResult"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "arrayOfSpellResult" +}) +@XmlRootElement(name = "CheckTextsResponse") +public class CheckTextsResponse { + + @XmlElement(name = "ArrayOfSpellResult", required = true) + protected ArrayOfSpellResult arrayOfSpellResult; + + /** + * Gets the value of the arrayOfSpellResult property. + * + * @return + * possible object is + * {@link ArrayOfSpellResult } + * + */ + public ArrayOfSpellResult getArrayOfSpellResult() { + return arrayOfSpellResult; + } + + /** + * Sets the value of the arrayOfSpellResult property. + * + * @param value + * allowed object is + * {@link ArrayOfSpellResult } + * + */ + public void setArrayOfSpellResult(ArrayOfSpellResult value) { + this.arrayOfSpellResult = value; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/ObjectFactory.java b/src/main/java/net/yandex/speller/services/spellservice/ObjectFactory.java new file mode 100644 index 0000000..603b94a --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/ObjectFactory.java @@ -0,0 +1,88 @@ + +package net.yandex.speller.services.spellservice; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the net.yandex.speller.services.spellservice package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: net.yandex.speller.services.spellservice + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link CheckTextResponse } + * + */ + public CheckTextResponse createCheckTextResponse() { + return new CheckTextResponse(); + } + + /** + * Create an instance of {@link SpellResult } + * + */ + public SpellResult createSpellResult() { + return new SpellResult(); + } + + /** + * Create an instance of {@link CheckTextsRequest } + * + */ + public CheckTextsRequest createCheckTextsRequest() { + return new CheckTextsRequest(); + } + + /** + * Create an instance of {@link CheckTextsResponse } + * + */ + public CheckTextsResponse createCheckTextsResponse() { + return new CheckTextsResponse(); + } + + /** + * Create an instance of {@link ArrayOfSpellResult } + * + */ + public ArrayOfSpellResult createArrayOfSpellResult() { + return new ArrayOfSpellResult(); + } + + /** + * Create an instance of {@link CheckTextRequest } + * + */ + public CheckTextRequest createCheckTextRequest() { + return new CheckTextRequest(); + } + + /** + * Create an instance of {@link SpellError } + * + */ + public SpellError createSpellError() { + return new SpellError(); + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/SpellError.java b/src/main/java/net/yandex/speller/services/spellservice/SpellError.java new file mode 100644 index 0000000..ad6e430 --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/SpellError.java @@ -0,0 +1,192 @@ + +package net.yandex.speller.services.spellservice; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for SpellError complex type. + * + *

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

+ * <complexType name="SpellError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="word" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="s" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="code" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       <attribute name="pos" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       <attribute name="row" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       <attribute name="col" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       <attribute name="len" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SpellError", propOrder = { + "word", + "s" +}) +public class SpellError { + + @XmlElement(required = true) + protected String word; + protected List s; + @XmlAttribute(name = "code", required = true) + protected int code; + @XmlAttribute(name = "pos", required = true) + protected int pos; + @XmlAttribute(name = "row", required = true) + protected int row; + @XmlAttribute(name = "col", required = true) + protected int col; + @XmlAttribute(name = "len", required = true) + protected int len; + + /** + * Gets the value of the word property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWord() { + return word; + } + + /** + * Sets the value of the word property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWord(String value) { + this.word = value; + } + + /** + * Gets the value of the s property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the s property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getS() { + if (s == null) { + s = new ArrayList(); + } + return this.s; + } + + /** + * Gets the value of the code property. + * + */ + public int getCode() { + return code; + } + + /** + * Sets the value of the code property. + * + */ + public void setCode(int value) { + this.code = value; + } + + /** + * Gets the value of the pos property. + * + */ + public int getPos() { + return pos; + } + + /** + * Sets the value of the pos property. + * + */ + public void setPos(int value) { + this.pos = value; + } + + /** + * Gets the value of the row property. + * + */ + public int getRow() { + return row; + } + + /** + * Sets the value of the row property. + * + */ + public void setRow(int value) { + this.row = value; + } + + /** + * Gets the value of the col property. + * + */ + public int getCol() { + return col; + } + + /** + * Sets the value of the col property. + * + */ + public void setCol(int value) { + this.col = value; + } + + /** + * Gets the value of the len property. + * + */ + public int getLen() { + return len; + } + + /** + * Sets the value of the len property. + * + */ + public void setLen(int value) { + this.len = value; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/SpellResult.java b/src/main/java/net/yandex/speller/services/spellservice/SpellResult.java new file mode 100644 index 0000000..679cf72 --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/SpellResult.java @@ -0,0 +1,67 @@ + +package net.yandex.speller.services.spellservice; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for SpellResult complex type. + * + *

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

+ * <complexType name="SpellResult">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="error" type="{http://speller.yandex.net/services/spellservice}SpellError" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SpellResult", propOrder = { + "error" +}) +public class SpellResult { + + protected List error; + + /** + * Gets the value of the error property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the error property. + * + *

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link SpellError } + * + * + */ + public List getError() { + if (error == null) { + error = new ArrayList(); + } + return this.error; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/SpellService.java b/src/main/java/net/yandex/speller/services/spellservice/SpellService.java new file mode 100644 index 0000000..b3f1ec8 --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/SpellService.java @@ -0,0 +1,94 @@ + +package net.yandex.speller.services.spellservice; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "SpellService", targetNamespace = "http://speller.yandex.net/services/spellservice", wsdlLocation = "http://speller.yandex.net/services/spellservice?WSDL") +public class SpellService + extends Service +{ + + private final static URL SPELLSERVICE_WSDL_LOCATION; + private final static WebServiceException SPELLSERVICE_EXCEPTION; + private final static QName SPELLSERVICE_QNAME = new QName("http://speller.yandex.net/services/spellservice", "SpellService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL("http://speller.yandex.net/services/spellservice?WSDL"); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + SPELLSERVICE_WSDL_LOCATION = url; + SPELLSERVICE_EXCEPTION = e; + } + + public SpellService() { + super(__getWsdlLocation(), SPELLSERVICE_QNAME); + } + + public SpellService(WebServiceFeature... features) { + super(__getWsdlLocation(), SPELLSERVICE_QNAME, features); + } + + public SpellService(URL wsdlLocation) { + super(wsdlLocation, SPELLSERVICE_QNAME); + } + + public SpellService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, SPELLSERVICE_QNAME, features); + } + + public SpellService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public SpellService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns SpellServiceSoap + */ + @WebEndpoint(name = "SpellServiceSoap") + public SpellServiceSoap getSpellServiceSoap() { + return super.getPort(new QName("http://speller.yandex.net/services/spellservice", "SpellServiceSoap"), SpellServiceSoap.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns SpellServiceSoap + */ + @WebEndpoint(name = "SpellServiceSoap") + public SpellServiceSoap getSpellServiceSoap(WebServiceFeature... features) { + return super.getPort(new QName("http://speller.yandex.net/services/spellservice", "SpellServiceSoap"), SpellServiceSoap.class, features); + } + + private static URL __getWsdlLocation() { + if (SPELLSERVICE_EXCEPTION!= null) { + throw SPELLSERVICE_EXCEPTION; + } + return SPELLSERVICE_WSDL_LOCATION; + } + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/SpellServiceSoap.java b/src/main/java/net/yandex/speller/services/spellservice/SpellServiceSoap.java new file mode 100644 index 0000000..fd0880c --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/SpellServiceSoap.java @@ -0,0 +1,50 @@ + +package net.yandex.speller.services.spellservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.xml.bind.annotation.XmlSeeAlso; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebService(name = "SpellServiceSoap", targetNamespace = "http://speller.yandex.net/services/spellservice") +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface SpellServiceSoap { + + + /** + * + * @param parameters + * @return + * returns net.yandex.speller.services.spellservice.CheckTextResponse + */ + @WebMethod(action = "http://speller.yandex.net/services/spellservice/checkText") + @WebResult(name = "CheckTextResponse", targetNamespace = "http://speller.yandex.net/services/spellservice", partName = "parameters") + public CheckTextResponse checkText( + @WebParam(name = "CheckTextRequest", targetNamespace = "http://speller.yandex.net/services/spellservice", partName = "parameters") + CheckTextRequest parameters); + + /** + * + * @param parameters + * @return + * returns net.yandex.speller.services.spellservice.CheckTextsResponse + */ + @WebMethod(action = "http://speller.yandex.net/services/spellservice/checkTexts") + @WebResult(name = "CheckTextsResponse", targetNamespace = "http://speller.yandex.net/services/spellservice", partName = "parameters") + public CheckTextsResponse checkTexts( + @WebParam(name = "CheckTextsRequest", targetNamespace = "http://speller.yandex.net/services/spellservice", partName = "parameters") + CheckTextsRequest parameters); + +} diff --git a/src/main/java/net/yandex/speller/services/spellservice/package-info.java b/src/main/java/net/yandex/speller/services/spellservice/package-info.java new file mode 100644 index 0000000..b58aade --- /dev/null +++ b/src/main/java/net/yandex/speller/services/spellservice/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://speller.yandex.net/services/spellservice", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package net.yandex.speller.services.spellservice;