Метод writeOrder (SubmitOrder.java)
Листинг 5.25. Метод writeOrder (SubmitOrder.java)
private void writeOrder( Order order ) {
try
{
Calendar calendar = new GregorianCalendar();
int day = calendar.get( Calendar.DAY_OF_MONTH );
int month = calendar.get( Calendar.MONTH ) + 1;
int year = calendar.get( Calendar.YEAR );
String dir = "Orders_" + year + "-" + month + "-" + day;
String filename = "Order_" + order.getId() + ".xml";
File file = new File( dir );
file.mkdir();
FileWriter writer = new FileWriter( dir + File.separator + filename );
order.writeXML(writer);
writer.close();
}
catch( IOException e ) {
}
}
}
Содержание раздела