I have a java agent that pulls information from a hail website. I know I can hard code the dates in, but I want to be able to run this with the current days date. How would I do this?
Here’s my agent:
import lotus.domino.*;
import java.net.*;
import java.io.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
//public void NotesMain() {
try {
//Create variables
Session session = getSession();
AgentContext ac = session.getAgentContext();
Database db = ac.getCurrentDatabase();
Document doc = db.createDocument();
RichTextItem xml = doc.createRichTextItem(“XMLData”);
//RichTextItem xml = doc.createRichTextItem(“XMLDataHTML”);
DateTime dt = session.createDateTime(“Today”);
//Set the value of the document fields
doc.appendItemValue(“Form”, “RawEXRData”);
dt.setNow();
doc.appendItemValue(“Date”, dt);
//importing html instead of xml
//HERE IS AN EXAMPLE OF THE URL WITH DATES INCLUDED:
URL EXRates = new URL(“http://hailreports.net/advanced_search.php?start_date=06%2F27%2F2012&end_date=06%2F30%2F2012&address=&radius=&size=&adv-srch=Search”);
//I JUST WANT TO RUN IT DAILY WITH CURRENT DATE
BufferedReader in = new BufferedReader (new InputStreamReader(EXRates.openStream()));
String inputLine;
//Loop through every line of the URL and write it out to a RichText Field
while ((inputLine = in.readLine()) != null) {
xml.appendText(inputLine.toString());
xml.addNewLine();
} //try
//Save the document and close the reader
doc.save(true, true);
in.close();
}catch(Exception e) { e.printStackTrace(); } //catch
} //NotesMain
} //public class
Thank you in advance.