mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Web Scripts:
- addition of extension paths for web script customisations - updated "delete ticket" web script to return appropriate response on success git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5867 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -63,6 +63,7 @@ import freemarker.cache.TemplateLoader;
|
||||
public class RepoStore implements WebScriptStore, ApplicationContextAware, ApplicationListener
|
||||
{
|
||||
private ProcessorLifecycle lifecycle = new ProcessorLifecycle();
|
||||
protected boolean mustExist = false;
|
||||
protected StoreRef repoStore;
|
||||
protected String repoPath;
|
||||
protected NodeRef baseNodeRef;
|
||||
@@ -116,6 +117,16 @@ public class RepoStore implements WebScriptStore, ApplicationContextAware, Appli
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the repo store must exist
|
||||
*
|
||||
* @param mustExist
|
||||
*/
|
||||
public void setMustExist(boolean mustExist)
|
||||
{
|
||||
this.mustExist = mustExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the repo store
|
||||
*/
|
||||
@@ -182,23 +193,30 @@ public class RepoStore implements WebScriptStore, ApplicationContextAware, Appli
|
||||
{
|
||||
String query = "PATH:\"" + repoPath + "\"";
|
||||
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
|
||||
if (resultSet.length() == 0)
|
||||
if (resultSet.length() == 1)
|
||||
{
|
||||
throw new WebScriptException("Unable to locate repository path " + repoStore.toString() + repoPath);
|
||||
baseNodeRef = resultSet.getNodeRef(0);
|
||||
baseDir = getPath(baseNodeRef);
|
||||
}
|
||||
if (resultSet.length() > 1)
|
||||
else if (mustExist)
|
||||
{
|
||||
throw new WebScriptException("Multiple repository paths found for " + repoStore.toString() + repoPath);
|
||||
throw new WebScriptException("Web Script Store " + repoStore.toString() + repoPath + " must exist; it was not found");
|
||||
}
|
||||
baseNodeRef = resultSet.getNodeRef(0);
|
||||
baseDir = getPath(baseNodeRef);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.scripts.WebScriptStore#exists()
|
||||
*/
|
||||
public boolean exists()
|
||||
{
|
||||
return (baseNodeRef != null);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.web.scripts.WebScriptStore#getBasePath()
|
||||
*/
|
||||
|
Reference in New Issue
Block a user