mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
First part of merge from WEB-PROTO-3.0-2 branch - rename of 'web-framework' project to 'webscript-framework' revs 8566:8590
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8757 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<classpathentry kind="lib" path="/3rd Party/lib/chiba-1.3.0.jar"/>
|
<classpathentry kind="lib" path="/3rd Party/lib/chiba-1.3.0.jar"/>
|
||||||
<classpathentry kind="lib" path="/3rd Party/lib/json.jar"/>
|
<classpathentry kind="lib" path="/3rd Party/lib/json.jar"/>
|
||||||
<classpathentry kind="lib" path="/3rd Party/lib/fop/batik-all-1.6.jar"/>
|
<classpathentry kind="lib" path="/3rd Party/lib/fop/batik-all-1.6.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/Web-Framework"/>
|
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/Alfresco JLAN"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/Alfresco JLAN"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/WebScript Framework"/>
|
||||||
<classpathentry kind="output" path="build/classes"/>
|
<classpathentry kind="output" path="build/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@@ -308,7 +308,7 @@ public class RepoStore implements Store, TenantDeployer
|
|||||||
public String[] execute() throws Exception
|
public String[] execute() throws Exception
|
||||||
{
|
{
|
||||||
int baseDirLength = getBaseDir().length() +1;
|
int baseDirLength = getBaseDir().length() +1;
|
||||||
List<String> documentPaths = new ArrayList<String>();
|
List<String> documentPaths = null;
|
||||||
String scriptPath = script.getDescription().getScriptPath();
|
String scriptPath = script.getDescription().getScriptPath();
|
||||||
NodeRef scriptNodeRef = (scriptPath.length() == 0) ? getBaseNodeRef() : findNodeRef(scriptPath);
|
NodeRef scriptNodeRef = (scriptPath.length() == 0) ? getBaseNodeRef() : findNodeRef(scriptPath);
|
||||||
if (scriptNodeRef != null)
|
if (scriptNodeRef != null)
|
||||||
@@ -317,6 +317,7 @@ public class RepoStore implements Store, TenantDeployer
|
|||||||
String id = script.getDescription().getId().substring(scriptPath.length() + (scriptPath.length() > 0 ? 1 : 0));
|
String id = script.getDescription().getId().substring(scriptPath.length() + (scriptPath.length() > 0 ? 1 : 0));
|
||||||
String query = "+PATH:\"" + repoScriptPath.toPrefixString(namespaceService) + "//*\" +QNAME:" + id + "*";
|
String query = "+PATH:\"" + repoScriptPath.toPrefixString(namespaceService) + "//*\" +QNAME:" + id + "*";
|
||||||
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
|
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
|
||||||
|
documentPaths = new ArrayList<String>(resultSet.length());
|
||||||
List<NodeRef> nodes = resultSet.getNodeRefs();
|
List<NodeRef> nodes = resultSet.getNodeRefs();
|
||||||
for (NodeRef nodeRef : nodes)
|
for (NodeRef nodeRef : nodes)
|
||||||
{
|
{
|
||||||
@@ -330,7 +331,7 @@ public class RepoStore implements Store, TenantDeployer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return documentPaths.toArray(new String[documentPaths.size()]);
|
return documentPaths != null ? documentPaths.toArray(new String[documentPaths.size()]) : new String[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -351,10 +352,10 @@ public class RepoStore implements Store, TenantDeployer
|
|||||||
public String[] execute() throws Exception
|
public String[] execute() throws Exception
|
||||||
{
|
{
|
||||||
int baseDirLength = getBaseDir().length() +1;
|
int baseDirLength = getBaseDir().length() +1;
|
||||||
List<String> documentPaths = new ArrayList<String>();
|
|
||||||
|
|
||||||
String query = "+PATH:\"" + repoPath + "//*\" +QNAME:*.desc.xml";
|
String query = "+PATH:\"" + repoPath + "//*\" +QNAME:*.desc.xml";
|
||||||
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
|
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
|
||||||
|
List<String> documentPaths = new ArrayList<String>(resultSet.length());
|
||||||
List<NodeRef> nodes = resultSet.getNodeRefs();
|
List<NodeRef> nodes = resultSet.getNodeRefs();
|
||||||
for (NodeRef nodeRef : nodes)
|
for (NodeRef nodeRef : nodes)
|
||||||
{
|
{
|
||||||
@@ -373,6 +374,38 @@ public class RepoStore implements Store, TenantDeployer
|
|||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.web.scripts.Store#getAllDocumentPaths()
|
||||||
|
*/
|
||||||
|
public String[] getAllDocumentPaths()
|
||||||
|
{
|
||||||
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<String[]>()
|
||||||
|
{
|
||||||
|
public String[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<String[]>()
|
||||||
|
{
|
||||||
|
public String[] execute() throws Exception
|
||||||
|
{
|
||||||
|
int baseDirLength = getBaseDir().length() +1;
|
||||||
|
|
||||||
|
String query = "+PATH:\"" + repoPath + "//*\" +TYPE:\"{http://www.alfresco.org/model/content/1.0}content\"";
|
||||||
|
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
|
||||||
|
List<String> documentPaths = new ArrayList<String>(resultSet.length());
|
||||||
|
List<NodeRef> nodes = resultSet.getNodeRefs();
|
||||||
|
for (NodeRef nodeRef : nodes)
|
||||||
|
{
|
||||||
|
String nodeDir = getPath(nodeRef);
|
||||||
|
documentPaths.add(nodeDir.substring(baseDirLength));
|
||||||
|
}
|
||||||
|
|
||||||
|
return documentPaths.toArray(new String[documentPaths.size()]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.web.scripts.Store#lastModified(java.lang.String)
|
* @see org.alfresco.web.scripts.Store#lastModified(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -479,6 +512,35 @@ public class RepoStore implements Store, TenantDeployer
|
|||||||
writer.putContent(content);
|
writer.putContent(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.web.scripts.Store#updateDocument(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void updateDocument(String documentPath, String content) throws IOException
|
||||||
|
{
|
||||||
|
String[] pathElements = documentPath.split("/");
|
||||||
|
|
||||||
|
// get parent folder
|
||||||
|
NodeRef parentRef;
|
||||||
|
if (pathElements.length == 1)
|
||||||
|
{
|
||||||
|
parentRef = getBaseNodeRef();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parentRef = findNodeRef(documentPath.substring(0, documentPath.lastIndexOf('/')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// update file
|
||||||
|
String fileName = pathElements[pathElements.length -1];
|
||||||
|
if (fileService.searchSimple(parentRef, fileName) == null)
|
||||||
|
{
|
||||||
|
throw new IOException("Document " + documentPath + " does not exists");
|
||||||
|
}
|
||||||
|
FileInfo fileInfo = fileService.create(parentRef, fileName, ContentModel.TYPE_CONTENT);
|
||||||
|
ContentWriter writer = fileService.getWriter(fileInfo.getNodeRef());
|
||||||
|
writer.putContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.web.scripts.Store#getTemplateLoader()
|
* @see org.alfresco.web.scripts.Store#getTemplateLoader()
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user