Hi all.
I am working on an agent in Java that would calculate the amount of space we would regain if we forced automated archiving over a specified period. I have been trying to compile the script and it is giving me an error “can not resolve symbol.” According to my Java guru it SHOULD work, and I can’t figure out why it won’t.
Could someone take a look and tell me what I am doing wrong? thanks.
import lotus.domino.*;
public class HDCalcAgent extends AgentBase {
public void NotesMain(){
try {
Session s = getSession();
AgentContext ac = s.getAgentContext();
long keepCount = 0;
long removeCount = 0;
DateTime dt = s.createDateTime("Today");
dt.adjustDay(-549);
DbDirectory dbDir = s.getDbDirectory(null);
Database db = dbDir.getFirstDatabase(dbDir.DATABASE);
while (db != null) {
String filePath = db.getFilePath();
int findString = filePath.lastIndexOf(Consts.MAIL);
if (findString != -1) {
db.open();
if (db.isOpen()){
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
while (doc != null){
DateTime cdt = doc.getCreated();
int timeDiff = cdt.timeDifference(dt);
if (timeDiff < 0){
removeCount = removeCount + doc.getSize();
} else {
keepCount = keepCount + doc.getSize();
}
doc = dc.getNextDocument();
}
}
}
db = dbDir.getNextDatabase();
}
db = ac.getCurrentDatabase();
double keepCalc = keepCount/Consts.MB;
double remCalc = removeCount/Consts.MB;
String keepSpace = "" + keepCalc;
String remSpace = "" + remCalc;
Document memo = db.createDocument();
memo.replaceItemValue(Fields.FORM,FValues.MEMO);
memo.replaceItemValue(Fields.PRINCIPAL,s.getServerName());
memo.replaceItemValue(Fields.RECIPIENTS,FValues.RECIPIENTS);
memo.replaceItemValue(Fields.SUBJECT,FValues.SUBJECT);
RichTextItem rtItem = memo.createRichTextItem(Fields.BODY);
rtItem.appendText(Body.TEXT1);
rtItem.appendText(dt.getDateOnly());
rtItem.appendText(Body.TEXT2);
rtItem.addNewLine(2);
rtItem.appendText(Body.TEXT3);
rtitem.appendText(keepSpace.toString);<--can not resolve symbol issue here
rtItem.addNewLine(2);
rtItem.appendText(Body.TEXT4);
rtitem.appendText(remSpace.toString);<--can not resolve symbol issue here
memo.send();
} catch (Exception e) {}
}
}
final class Consts {
public static final String MAIL = "mail\\";
public static final int MB = 1048576;
}
final class Fields {
public static final String FORM = "Form";
public static final String PRINCIPAL = "Principal";
public static final String RECIPIENTS = "Recipients";
public static final String SUBJECT = "Subject";
public static final String BODY = "Body";
}
final class FValues {
public static final String MEMO = "Memo";
public static final String SUBJECT = "Notes Archiving Hard Drive Calculations";
public static final String RECIPIENTS = "Brandt Fundak/Cleveland-Corporate/Olympic";
}
final class Body {
public static final String TEXT1 = "The following calculations have been made to determine the amount of space needed if automated archiving was institued to archive all documents received prior to ";
public static final String TEXT2 = ". All values are in megabytes.";
public static final String TEXT3 = "Amount of space still necessary for non-archived documents: ";
public static final String TEXT4 = "Amount of space recovered by potential archive process: ";
}