01-29-2009 02:50 PM
<import resource="/Company Home/Data Dictionary/Scripts/burris-common.js">
<import resource="/Company Home/Data Dictionary/Scripts/exclusion-set.js">
function transportation_dailyTasks() {
checkExpires();
checkRetention();
checkDocumentSets();
}
///////////////////////////////////////////////////
function checkExpires() {
// records that are burris, are expireable, aren't superceded, aren't terminated
var results = search.luceneSearch("TYPE:\""+BURRIS_DOC_TYPE+"\" +ASPECT:\""+EXPIREABLE_ASPECT+"\" -ASPECT:\""+SUPERCEDED_ASPECT+"\" -ASPECT:\""+TERMINATED_ASPECT+"\"");
var expireds = findExpiredRecords(results);
sendExpiredNotifications(expireds);
}
function findExpiredRecords(results) {
var found = new Array();
// find the docs that are expired and store according to group responsible so that they get one email with all the expirations
for each(var result in results) {
// files that are sitting at the facility-level are unfiled and not approve yet, ignore them
if(result.parent.parent.name == "Transportation") continue;
var properties = result.properties;
var expirationDate = properties[EXPIRATION_DATE];
var now = new Date();
var groupEntry = found[result.properties[GROUP_RESPONSIBLE]];
if(!groupEntry) {
groupEntry = new Array();
groupEntry["group"] = result.properties[GROUP_RESPONSIBLE];
found[result.properties[GROUP_RESPONSIBLE]] = groupEntry;
}
var entry = new Array();
entry["file"] = result.name;
var difference = getDayDifference(expirationDate, now);
if(difference <= 0) {
result.properties[EXPIRED] = true;
result.save();
entry["isExpired"] = true;
groupEntry.push(entry);
} else if(difference <= 30) {
entry["isExpired"] = false;
groupEntry.push(entry);
}
}
return found;
}
function sendExpiredNotifications(results) {
for each(var group in results) {
// the only reason a file won't have a group is if it hasn't been approved yet
if(group["group"] && !group["group"].match(/_x0020_/)) {
var users = people.getMembers(people.getGroup(group["group"]));
for each(var p in users) {
if (!p.properties.email || p.properties.email == " ") {
continue;
}
var mail = actions.create("mail");
mail.parameters.to = p.properties.email;
mail.parameters.from = "Burris Alfresco <noreply@burrislogistics.com>";
mail.parameters.subject = "Results from Alfresco Expiration Check";
mail.parameters.text = "Hello " + p.properties.firstName + ",\r\n\r\n";
mail.parameters.text += "This is an automated email, the result of an ";
mail.parameters.text += "Alfresco Expiring Record check. The results are ";
mail.parameters.text += "listed below.\r\n\r\n";
var hasFiles = false;
for each(var item in group) {
if (!item["file"]) continue;
hasFiles = true;
mail.parameters.text += " * " + item["file"] + ": ";
mail.parameters.text += item["isExpired"] ? "expired" : "expiring in less than 30 days";
mail.parameters.text += "\r\n";
}
mail.parameters.text += "\r\n";
mail.parameters.text += "Please login to Alfresco (" + ALFRESCO_URL + ") ";
mail.parameters.text += "to update these documents.\r\n\r\n";
mail.parameters.text += "Thank you.";
if(hasFiles) {
mail.execute(roothome);
}
appendLog( mail.parameters.text );
}
sendLog();
}
else {
appendLog("These items have a Group Name that does not behave:");
for each(var item in group) {
if(item["file"] == undefined) continue;
appendLog(" * " + item["file"]);
}
sendLog();
}
}
}
02-09-2009 05:37 PM
Not in a cluster environment. Some transactions might be missing in the local lucene index of an Alfresco instance.Yes, and indexes might also get corrupted, but these are not not normal behaviors, I am referring to situation when indexes are not corrupted and are properly synchronized between cluster nodes. In that case Lucene query will always return a correct number of results, cutting will occur later during acl evaluation.
05-04-2009 11:17 AM
05-06-2009 03:34 PM
search.luceneSearch("TYPE:\""+BURRIS_DOC_TYPE+"\" +ASPECT:\""+EXPIREABLE_ASPECT+"\" -ASPECT:\""+SUPERCEDED_ASPECT+"\" -ASPECT:\""+TERMINATED_ASPECT+"\"");
to search.xpathSearch("TYPE:\""+BURRIS_DOC_TYPE+"\" +ASPECT:\""+EXPIREABLE_ASPECT+"\" -ASPECT:\""+SUPERCEDED_ASPECT+"\" -ASPECT:\""+TERMINATED_ASPECT+"\"");
etc. in all instances in the javascript code. Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.