Skip to content

Instantly share code, notes, and snippets.

@Manuri
Created June 28, 2015 11:50
Show Gist options
  • Save Manuri/e74c0c6a6bb9548da149 to your computer and use it in GitHub Desktop.
Save Manuri/e74c0c6a6bb9548da149 to your computer and use it in GitHub Desktop.
package orderprocessing.service;
import orderprocessing.data.Order;
/**
* Created by manurip on 6/28/15.
*/
public class OrderProcessingService {
/*
* This is a test method
*/
public String sayHello() {
return "Hello";
}
public String addOrder(String index,Double price) {
Order newOrder = new Order(index,price);
XMLWriterDOM.getInstance().saveOrder(newOrder);
Order retrieved = XMLReaderDOM.getInstance().retrieveOrder(index);
if(retrieved!= null){
return "Added Order. Index:"+retrieved.getIndex()+" Price:"+retrieved.getPrice();
}
else{
return "Unable to add order";
}
}
public String getPrice(String index) {
String result = "NONE";
Order order = XMLReaderDOM.getInstance().retrieveOrder(index);
if(order!=null){
result = Double.toString(order.getPrice());
}
System.out.println("Price Retrived. Index=" + index
+ ", Price=" + result);
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment