mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ETHREEOH-100, cleanup to some webscripts as ETHREEOH-100 now fixed.
Basic "people" API for FreeMarker - just getPerson() and getGroup() currently. Template cache size and delay now configurable in RepositoryTemplateProcessor (like they already are in PresentationTemplateProcessor) - related default cache size tweaks. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13788 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,4 +38,3 @@ function main()
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -15,17 +15,17 @@ var peopleList = Array(memberships.length);
|
||||
for (userName in memberships)
|
||||
{
|
||||
var person = people.getPerson(userName);
|
||||
peopleList["_" + userName] = person; // make sure the keys are strings
|
||||
// make sure the keys are strings - as usernames may be all numbers!
|
||||
peopleList['_' + userName] = person;
|
||||
}
|
||||
|
||||
// also copy over the memberships.
|
||||
var mems = {};
|
||||
var pos = 0; // memberships[userName] won't return the correct value if userName is a digit-only value
|
||||
for (userName in memberships)
|
||||
{
|
||||
var membershipType = memberships[pos];
|
||||
mems["_" + userName] = membershipType; // make sure the keys are strings
|
||||
pos++;
|
||||
var membershipType = memberships[userName];
|
||||
// make sure the keys are strings - as usernames may be all numbers!
|
||||
mems['_' + userName] = membershipType;
|
||||
}
|
||||
|
||||
// Pass the information to the template
|
||||
|
@@ -64,11 +64,14 @@ public class RepositoryTemplateProcessor extends FreeMarkerProcessor
|
||||
protected String defaultEncoding;
|
||||
protected Configuration templateConfig;
|
||||
protected FreeMarkerProcessor freeMarkerProcessor;
|
||||
private int updateDelay = 0;
|
||||
private int cacheSize = 512;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.template.FreeMarkerProcessor#setDefaultEncoding(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setDefaultEncoding(String defaultEncoding)
|
||||
{
|
||||
this.defaultEncoding = defaultEncoding;
|
||||
@@ -82,6 +85,25 @@ public class RepositoryTemplateProcessor extends FreeMarkerProcessor
|
||||
return this.defaultEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param updateDelay the time in seconds between checks on the modified date for cached templates
|
||||
*/
|
||||
public void setUpdateDelay(int updateDelay)
|
||||
{
|
||||
this.updateDelay = updateDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacheSize the size of the MRU template cache, default is 256
|
||||
*/
|
||||
public void setCacheSize(int cacheSize)
|
||||
{
|
||||
if (cacheSize >= 0)
|
||||
{
|
||||
this.cacheSize = cacheSize;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchPath
|
||||
*/
|
||||
@@ -151,8 +173,8 @@ public class RepositoryTemplateProcessor extends FreeMarkerProcessor
|
||||
Configuration config = new Configuration();
|
||||
|
||||
// setup template cache
|
||||
config.setCacheStorage(new MruCacheStorage(20, 100));
|
||||
config.setTemplateUpdateDelay(0);
|
||||
config.setCacheStorage(new MruCacheStorage(this.cacheSize, this.cacheSize << 1));
|
||||
config.setTemplateUpdateDelay(updateDelay);
|
||||
|
||||
// setup template loaders
|
||||
List<TemplateLoader> loaders = new ArrayList<TemplateLoader>();
|
||||
|
Reference in New Issue
Block a user