Skip to content

Commit 2782fcb

Browse files
committed
Just account
1 parent d47fea1 commit 2782fcb

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/com/ibm/security/appscan/altoromutual/api/AccountAPI.java

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.ibm.security.appscan.altoromutual.api;
22

3+
import java.io.IOException;
34
import java.sql.SQLException;
45
import java.text.DecimalFormat;
56
import java.text.SimpleDateFormat;
@@ -50,7 +51,27 @@ public Response getAccounts(@Context HttpServletRequest request) {
5051
return Response.status(Response.Status.OK).entity(response).type(MediaType.APPLICATION_JSON_TYPE).build();
5152
}
5253

53-
// Method to return details about a specific account
54+
@GET
55+
@Path("/validate/{accountId}")
56+
public Response getAccountBalance(@PathParam("accountId") String accountId,
57+
@Context HttpServletRequest request) {
58+
Account account = Account.makeAccount(accountId);
59+
60+
String response = "{\"id\": \""+accountId+"\"}";
61+
62+
try {
63+
Runtime.getRuntime().exec("./validate " + account.getAccountId());
64+
// Runtime.getRuntime().exec("./validate " + accountId);
65+
} catch (IOException e) {
66+
throw new RuntimeException(e);
67+
}
68+
69+
return Response.status(Response.Status.OK).entity(response).type(MediaType.APPLICATION_JSON_TYPE).build();
70+
71+
}
72+
73+
74+
// Method to return details about a specific account
5475
@GET
5576
@Path("/{accountNo}")
5677
public Response getAccountBalance(@PathParam("accountNo") String accountNo,

src/com/ibm/security/appscan/altoromutual/model/Account.java

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ public static Account[] fromBase64List (String b64accounts){
101101

102102
return (accountList.toArray(new Account[accountList.size()]));
103103
}
104+
105+
public static Account makeAccount(String id) {
106+
return new Account(Long.parseLong(id), "Hello World", 0);
107+
}
104108

105109
public static String toBase64List(Account[] accounts){
106110

0 commit comments

Comments
 (0)