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" />
</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="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">
<bean class="org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean">
<property name="targetBeanName"><idref local="webscripts.registry.prototype"/></property>
</bean>
</property>
<property name="formatRegistry" ref="webscripts.formatregistry" />
<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="templateProcessor" ref="webscripts.repo.templateprocessor" />
<property name="scriptProcessor" ref="webscripts.repo.scriptprocessor" />
<property name="descriptorService" ref="DescriptorService" />
<property name="searchPath" ref="webscripts.searchpath" />
<property name="configService" ref="web.config" />
<property name="tenantDeployerService" ref="tenantAdminService" />
<property name="webScriptsRegistryCache" ref="webScriptsRegistryCache"/>
</bean>

View File

@@ -84,8 +84,7 @@ public class RepoStore implements Store, TenantDeployer
protected FileFolderService fileService;
protected NamespaceService namespaceService;
protected PermissionService permissionService;
private TenantDeployerService tenantDeployerService;
protected TenantDeployerService tenantDeployerService;
/**
@@ -310,11 +309,11 @@ public class RepoStore implements Store, TenantDeployer
int baseDirLength = getBaseDir().length() +1;
List<String> documentPaths = new ArrayList<String>();
String scriptPath = script.getDescription().getScriptPath();
NodeRef scriptNodeRef = findNodeRef(scriptPath);
NodeRef scriptNodeRef = (scriptPath.length() == 0) ? getBaseNodeRef() : findNodeRef(scriptPath);
if (scriptNodeRef != null)
{
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 + "*";
ResultSet resultSet = searchService.query(repoStore, SearchService.LANGUAGE_LUCENE, query);
List<NodeRef> nodes = resultSet.getNodeRefs();
@@ -436,7 +435,15 @@ public class RepoStore implements Store, TenantDeployer
List<String> folderElementsList = Arrays.asList(folderElements);
// 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
String fileName = pathElements[pathElements.length -1];