Web Scripts: Encapsulate concept of mimetype -> object -> mimetype conversions. Allows scripts, templates etc access to request mimetypes (e.g. Atom entry/feed, multipart/form-data) in a natural way (i.e. as objects). Such objects can then be serialized to the appropriate response mimetype (e.g. atom, json). New converters can be configured in. Refactored form post to this mechanism. Fixed script dump/load issue for scripts in root folder.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8412 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2008-03-01 00:09:10 +00:00
parent ba5174613d
commit d076396436
2 changed files with 18 additions and 16 deletions

View File

@@ -103,26 +103,21 @@
<property name="scriptService" ref="scriptService" /> <property name="scriptService" ref="scriptService" />
</bean> </bean>
<bean id="webscripts.container" class="org.alfresco.repo.web.scripts.RepositoryContainer"> <bean id="webscripts.container" class="org.alfresco.repo.web.scripts.RepositoryContainer" parent="webscripts.abstractcontainer">
<property name="name"><value>Repository</value></property> <property name="name"><value>Repository</value></property>
<property name="transactionHelper" ref="retryingTransactionHelper" />
<property name="permissionService" ref="permissionService" />
<property name="authorityService" ref="authorityService" />
<property name="repository" ref="webscripts.repo" />
<property name="repositoryImageResolver" ref="webscripts.repo.imageresolver" />
<property name="registryFactory"> <property name="registryFactory">
<bean class="org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean"> <bean class="org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean">
<property name="targetBeanName"><idref local="webscripts.registry.prototype"/></property> <property name="targetBeanName"><idref local="webscripts.registry.prototype"/></property>
</bean> </bean>
</property> </property>
<property name="transactionHelper" ref="retryingTransactionHelper" />
<property name="formatRegistry" ref="webscripts.formatregistry" /> <property name="permissionService" ref="permissionService" />
<property name="authorityService" ref="authorityService" />
<property name="repository" ref="webscripts.repo" />
<property name="repositoryImageResolver" ref="webscripts.repo.imageresolver" />
<property name="templateProcessor" ref="webscripts.repo.templateprocessor" /> <property name="templateProcessor" ref="webscripts.repo.templateprocessor" />
<property name="scriptProcessor" ref="webscripts.repo.scriptprocessor" /> <property name="scriptProcessor" ref="webscripts.repo.scriptprocessor" />
<property name="descriptorService" ref="DescriptorService" /> <property name="descriptorService" ref="DescriptorService" />
<property name="searchPath" ref="webscripts.searchpath" />
<property name="configService" ref="web.config" />
<property name="tenantDeployerService" ref="tenantAdminService" /> <property name="tenantDeployerService" ref="tenantAdminService" />
<property name="webScriptsRegistryCache" ref="webScriptsRegistryCache"/> <property name="webScriptsRegistryCache" ref="webScriptsRegistryCache"/>
</bean> </bean>

View File

@@ -84,8 +84,7 @@ public class RepoStore implements Store, TenantDeployer
protected FileFolderService fileService; protected FileFolderService fileService;
protected NamespaceService namespaceService; protected NamespaceService namespaceService;
protected PermissionService permissionService; protected PermissionService permissionService;
protected TenantDeployerService tenantDeployerService;
private TenantDeployerService tenantDeployerService;
/** /**
@@ -310,11 +309,11 @@ public class RepoStore implements Store, TenantDeployer
int baseDirLength = getBaseDir().length() +1; int baseDirLength = getBaseDir().length() +1;
List<String> documentPaths = new ArrayList<String>(); List<String> documentPaths = new ArrayList<String>();
String scriptPath = script.getDescription().getScriptPath(); String scriptPath = script.getDescription().getScriptPath();
NodeRef scriptNodeRef = findNodeRef(scriptPath); NodeRef scriptNodeRef = (scriptPath.length() == 0) ? getBaseNodeRef() : findNodeRef(scriptPath);
if (scriptNodeRef != null) if (scriptNodeRef != null)
{ {
org.alfresco.service.cmr.repository.Path repoScriptPath = nodeService.getPath(scriptNodeRef); org.alfresco.service.cmr.repository.Path repoScriptPath = nodeService.getPath(scriptNodeRef);
String id = script.getDescription().getId().substring(script.getDescription().getScriptPath().length() +1); 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);
List<NodeRef> nodes = resultSet.getNodeRefs(); List<NodeRef> nodes = resultSet.getNodeRefs();
@@ -436,7 +435,15 @@ public class RepoStore implements Store, TenantDeployer
List<String> folderElementsList = Arrays.asList(folderElements); List<String> folderElementsList = Arrays.asList(folderElements);
// create folder // create folder
FileInfo pathInfo = fileService.makeFolders(getBaseNodeRef(), folderElementsList, ContentModel.TYPE_FOLDER); FileInfo pathInfo;
if (folderElementsList.size() == 0)
{
pathInfo = fileService.getFileInfo(getBaseNodeRef());
}
else
{
pathInfo = fileService.makeFolders(getBaseNodeRef(), folderElementsList, ContentModel.TYPE_FOLDER);
}
// create file // create file
String fileName = pathElements[pathElements.length -1]; String fileName = pathElements[pathElements.length -1];