Skip to content
Snippets Groups Projects
Commit 7967de8e authored by Diki Ardian Wirasandi's avatar Diki Ardian Wirasandi
Browse files

add history service

parent 207ddf98
No related merge requests found
......@@ -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
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;
}
}
}
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
......@@ -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
......@@ -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
......@@ -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";
......
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