Skip to content
Snippets Groups Projects
Commit c2c7e651 authored by Louis Leslie's avatar Louis Leslie
Browse files

Merge branch 'SOAP' of https://github.com/louispy/LuckyJS into web

parents 213b2aba d721dd8b
No related merge requests found
Pipeline #5590 failed with stages
in 20 seconds
Showing
with 169 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>wbd</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.5
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
...@@ -7,6 +7,12 @@ public class Book implements Serializable { ...@@ -7,6 +7,12 @@ public class Book implements Serializable {
private String title; private String title;
private String id; private String id;
private int price; private int price;
private int votes;
private String description;
private String[] author;
private String image;
private float rating;
private String[] categories;
public String getTitle() { public String getTitle() {
return title; return title;
...@@ -31,6 +37,54 @@ public class Book implements Serializable { ...@@ -31,6 +37,54 @@ public class Book implements Serializable {
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
public int getVotes() {
return votes;
}
public void setVotes(int votes) {
this.votes = votes;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String[] getAuthor() {
return author;
}
public void setAuthor(String[] author) {
this.author = author;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public float getRating() {
return rating;
}
public void setRating(float rating) {
this.rating = rating;
}
public String[] getCategories() {
return categories;
}
public void setCategories(String[] categories) {
this.categories = categories;
}
@Override @Override
public String toString(){ public String toString(){
......
File added
...@@ -17,7 +17,10 @@ public interface WebServiceBook { ...@@ -17,7 +17,10 @@ public interface WebServiceBook {
public Book[] getAllBooks(); public Book[] getAllBooks();
<<<<<<< HEAD
@WebMethod @WebMethod
=======
>>>>>>> d721dd8bf8f4220b5b36b4d3ebd973f2dd90cf46
public void removeAllBooks(); public void removeAllBooks();
@WebMethod @WebMethod
......
...@@ -68,6 +68,7 @@ public class WebServiceBookImpl implements WebServiceBook { ...@@ -68,6 +68,7 @@ public class WebServiceBookImpl implements WebServiceBook {
public Book[] search(String title) { public Book[] search(String title) {
MySQLAccess test = new MySQLAccess(); MySQLAccess test = new MySQLAccess();
removeAllBooks();
String a = ""; String a = "";
try { try {
String b = sendGETSearchBuku(title); String b = sendGETSearchBuku(title);
...@@ -80,14 +81,35 @@ public class WebServiceBookImpl implements WebServiceBook { ...@@ -80,14 +81,35 @@ public class WebServiceBookImpl implements WebServiceBook {
for (Integer counter = 0; counter < items.size(); counter++) { for (Integer counter = 0; counter < items.size(); counter++) {
JSONObject volume = (JSONObject) items.get(counter); JSONObject volume = (JSONObject) items.get(counter);
System.out.println(volume.get("id")); System.out.println(volume.get("id"));
// System.out.println(volume);
JSONObject books = (JSONObject) volume.get("volumeInfo"); JSONObject books = (JSONObject) volume.get("volumeInfo");
JSONObject image = (JSONObject) books.get("imageLinks");
JSONObject saleInfo = (JSONObject) volume.get("saleInfo"); JSONObject saleInfo = (JSONObject) volume.get("saleInfo");
JSONObject retailPrice = (JSONObject) saleInfo.get("retailPrice"); JSONObject retailPrice = (JSONObject) saleInfo.get("retailPrice");
JSONArray categories = (JSONArray) books.get("categories");
JSONArray authors = (JSONArray) books.get("authors");
Double dbl = (Double) (retailPrice.get("amount")); Double dbl = (Double) (retailPrice.get("amount"));
double dble = dbl.doubleValue(); double dble = dbl.doubleValue();
int intgr = (int) dble; int intgr = (int) dble;
Integer val = Integer.valueOf(intgr); Integer val = Integer.valueOf(intgr);
Book book = new Book(); book.setTitle((String) books.get("title")); book.setId((String) volume.get("id")); Book book = new Book(); book.setTitle((String) books.get("title")); book.setId((String) volume.get("id"));
book.setDescription((String) books.get("description")); book.setImage((String) image.get("thumbnail"));
if (categories != null) {
String[] cat = new String[10];
for (Integer x = 0; x < categories.size(); x++) {
cat[x] = (String) categories.get(x);
}
book.setCategories(cat);
}
if (authors != null) {
String[] author = new String[10];
for (Integer x = 0; x < authors.size(); x++) {
author[x] = (String) authors.get(x);
}
book.setAuthor(author);
}
int price = test.findBookPrice(book); int price = test.findBookPrice(book);
if (price != 0) { if (price != 0) {
book.setPrice(price); book.setPrice(price);
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
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