diff --git a/WebService/.idea/misc.xml b/WebService/.idea/misc.xml index cb0f292cab4d8456cfef480a525a5da502bf3f92..6453144a3a94f18ab73702d40a1c3f54dbd4f9c2 100644 --- a/WebService/.idea/misc.xml +++ b/WebService/.idea/misc.xml @@ -6,4 +6,5 @@ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/out" /> </component> + <component name="WebServicesPlugin" addRequiredLibraries="true" /> </project> \ No newline at end of file diff --git a/WebService/src/com/informatika/ojek/webservice/History.java b/WebService/src/com/informatika/ojek/webservice/History.java new file mode 100644 index 0000000000000000000000000000000000000000..8c8d5181f59b94c66e187effa75be047d68fbc32 --- /dev/null +++ b/WebService/src/com/informatika/ojek/webservice/History.java @@ -0,0 +1,64 @@ +package com.informatika.ojek.webservice; + +import javax.jws.WebService; +import java.util.Date; + +@WebService(endpointInterface = "com.informatika.ojek.webservice.IHistory") +public class History implements IHistory { + @Override + public Transaction[] getDriverHistory(String accessToken) { + boolean isTokenValid = true; //request identity service + int id = 1; //request identity service + if (isTokenValid) { + //QUERY getTransaction idDriver = id + int idTransaction = 1; + int idPenumpang = 1; + String lokasiAwal = "a"; + String lokasiTujuan = "b"; + int rating = 5; + String comment = "no comment"; + boolean isHide = true; + Date datePosted = new Date(2017, 7, 10); + boolean isDriver = true; + Transaction trx = new Transaction(idTransaction, id, idPenumpang, lokasiAwal, lokasiTujuan, rating, comment, isHide, datePosted); + return new Transaction[]{trx}; + } else { + return null; + } + } + + @Override + public Transaction[] getPenumpangHistory(String accessToken) { + boolean isTokenValid = true; //request identity service + int id = 1; //request identity service + if (isTokenValid) { + //QUERY getTransaction idPenumpang = id + int idTransaction = 1; + int idDriver = 1; + String lokasiAwal = "a"; + String lokasiTujuan = "b"; + int rating = 5; + String comment = "no comment"; + boolean isHide = true; + Date datePosted = new Date(2017, 7, 10); + boolean isDriver = true; + Transaction trx = new Transaction(idTransaction, idDriver, id, lokasiAwal, lokasiTujuan, rating, comment, isHide, datePosted); + return new Transaction[]{trx}; + } else { + return null; + } + } + + @Override + public boolean hideHistory(String accessToken, int idTransaction) { + boolean isTokenValid = true; //request identity service + int id = 1; //request identity service + if (isTokenValid) { + //QUERY hideTransaction + return true; + } else { + return false; + } + } + +} diff --git a/WebService/src/com/informatika/ojek/webservice/IHistory.java b/WebService/src/com/informatika/ojek/webservice/IHistory.java new file mode 100644 index 0000000000000000000000000000000000000000..054fdb9143245f57c9954f58b17b894cb7337334 --- /dev/null +++ b/WebService/src/com/informatika/ojek/webservice/IHistory.java @@ -0,0 +1,15 @@ +package com.informatika.ojek.webservice; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.jws.soap.SOAPBinding.Style; + +//Service Endpoint Interface +@WebService +@SOAPBinding(style = Style.RPC) +public interface IHistory { + @WebMethod public Transaction[] getDriverHistory(String accessToken); + @WebMethod public Transaction[] getPenumpangHistory(String accessToken); + @WebMethod public boolean hideHistory(String accessToken, int idTransaction); +} \ No newline at end of file diff --git a/WebService/src/com/informatika/ojek/webservice/IProfile.java b/WebService/src/com/informatika/ojek/webservice/IProfile.java index 9720857f8de92b5dc8d64280bbf2493a8e33fdd7..810429441b63c674cef6ff13ef55250d84704697 100644 --- a/WebService/src/com/informatika/ojek/webservice/IProfile.java +++ b/WebService/src/com/informatika/ojek/webservice/IProfile.java @@ -9,10 +9,10 @@ import javax.jws.soap.SOAPBinding.Style; @WebService @SOAPBinding(style = Style.RPC) public interface IProfile { - @WebMethod public Account getActiveUser(String access_token); - @WebMethod public String[] getLocation(String access_token); - @WebMethod public boolean addPreferredLocation(String access_token, String location); - @WebMethod public boolean delPreferredLocation(String access_token, String location); - @WebMethod public boolean updatePreferredLocation(String access_token, String old_location, String new_location); - @WebMethod public boolean updateProfile(String access_token, String name, String phone, Boolean is_driver, String photo); + @WebMethod public Account getActiveUser(String accessToken); + @WebMethod public String[] getLocation(String accessToken); + @WebMethod public boolean addPreferredLocation(String accessToken, String location); + @WebMethod public boolean delPreferredLocation(String accessToken, String location); + @WebMethod public boolean updatePreferredLocation(String accessToken, String old_location, String new_location); + @WebMethod public boolean updateProfile(String accessToken, String name, String phone, Boolean is_driver, String photo); } \ No newline at end of file diff --git a/WebService/src/com/informatika/ojek/webservice/Main.java b/WebService/src/com/informatika/ojek/webservice/Main.java index 4fb270237ebd0e7372032e807643af275cd8de12..b766ae062421cbf72787c2c647909fc2d8c4be32 100644 --- a/WebService/src/com/informatika/ojek/webservice/Main.java +++ b/WebService/src/com/informatika/ojek/webservice/Main.java @@ -8,7 +8,7 @@ public class Main{ public static void main(String[] args) { Endpoint.publish("http://localhost:9999/ws/profile", new Profile()); Endpoint.publish("http://localhost:9999/ws/order", new Order()); - + Endpoint.publish("http://localhost:9999/ws/history", new History()); } } \ No newline at end of file diff --git a/WebService/src/com/informatika/ojek/webservice/Profile.java b/WebService/src/com/informatika/ojek/webservice/Profile.java index dd0662bd43590b5dc3e4502a870b64dd82a6ad7b..ed60e10e1a520ca28047938c23bd9141bbb02af5 100644 --- a/WebService/src/com/informatika/ojek/webservice/Profile.java +++ b/WebService/src/com/informatika/ojek/webservice/Profile.java @@ -9,6 +9,7 @@ public class Profile implements IProfile { boolean isTokenValid = true; //request identity service int id = 1; //request identity service if (isTokenValid) { + //QUERY getAccount String name = "Diki Ardian"; String username = "dikiardian"; String email = "diki@gmail.com";