Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Useful Alfresco JavaScript console scripts
var ctxt,hazelcastInstanceFactory, hzInstance, hzLifecycleService;
ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
hazelcastInstanceFactory = ctxt.getBean('hazelcastInstanceFactory', Packages.org.alfresco.enterprise.repo.cluster.core.HazelcastInstanceFactory);
hzInstance = hazelcastInstanceFactory.getInstance();
hzLifecycleService = hzInstance.getLifecycleService();
// this should reinitialize the local cluster node Hazelcast layer without invalidating any beans
// this can be useful if cluster node may be stuck / not discovering any other members after a split
hzLifecycleService.restart();
var ctxt, scheduler;
// get Spring context and Quartz scheduler
ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
scheduler = ctxt.getBean('schedulerFactory', Packages.org.quartz.Scheduler);
// fire (unless explicitly defined in Job detail Spring bean, scheduler group is always DEFAULT)
scheduler.triggerJob('<insertJobName>', 'DEFAULT');
var ctxt, synchronizer;
ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
synchronizer = ctxt.getBean('userRegistrySynchronizer', Packages.org.alfresco.repo.security.sync.UserRegistrySynchronizer);
// forceUpdate = false, isFullSync = false - change for full update / with deletions
synchronizer.synchronize(false, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment