Merged DEV\EXTENSIONS to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/DEV/EXTENSIONS@4865 svn://svn.alfresco.com:3691/alfresco/BRANCHES/DEV/EXTENSIONS@4866 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/DEV/EXTENSIONS@4872 svn://svn.alfresco.com:3691/alfresco/BRANCHES/DEV/EXTENSIONS@4884 .
   Dave and Gavin's search work


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4899 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-01-23 12:09:27 +00:00
parent 2d184a6b13
commit 9c17a38488
51 changed files with 9993 additions and 6442 deletions

View File

@@ -16,7 +16,6 @@
*/
package org.alfresco.web.api.services;
import java.io.IOException;
import java.util.Map;
import org.alfresco.web.api.APIRequest;
@@ -30,7 +29,7 @@ import org.alfresco.web.api.APIRequest.RequiredAuthentication;
*
* @author davidc
*/
public class TextSearchDescription extends APIServiceImpl
public class TextSearchDescription extends APIServiceTemplateImpl
{
/* (non-Javadoc)
@@ -50,27 +49,38 @@ public class TextSearchDescription extends APIServiceImpl
}
/* (non-Javadoc)
* @see org.alfresco.web.api.APIService#execute(org.alfresco.web.api.APIRequest, org.alfresco.web.api.APIResponse)
* @see org.alfresco.web.api.APIService#getDefaultFormat()
*/
public void execute(APIRequest req, APIResponse res)
throws IOException
public String getDefaultFormat()
{
Map<String, Object> model = createTemplateModel(req, res);
res.setContentType(APIResponse.OPEN_SEARCH_DESCRIPTION_TYPE + ";charset=UTF-8");
renderTemplate(OPEN_SEARCH_DESCRIPTION, model, res);
return APIResponse.OPENSEARCH_DESCRIPTION_FORMAT;
}
// TODO: place into accessible file
private final static String OPEN_SEARCH_DESCRIPTION =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" xmlns:alf=\"http://www.alfresco.org\">\n" +
" <ShortName>Alfresco Text Search</ShortName>\n" +
" <LongName>Alfresco ${agent.edition} Text Search ${agent.version}</LongName>\n" +
" <Description>Search Alfresco \"company home\" using text keywords</Description>\n" +
" <Url type=\"application/atom+xml\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}&amp;format=atom\"/>\n" +
" <Url type=\"text/xml\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}&amp;format=xml\"/>\n" +
" <Url type=\"text/html\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}\"/>\n" +
" <Image height=\"16\" width=\"16\" type=\"image/x-icon\">${request.path}/images/logo/AlfrescoLogo16.ico</Image>\n" +
"</OpenSearchDescription>";
/* (non-Javadoc)
* @see org.alfresco.web.api.services.APIServiceTemplateImpl#createModel(org.alfresco.web.api.APIRequest, org.alfresco.web.api.APIResponse, java.util.Map)
*/
@Override
protected Map<String, Object> createModel(APIRequest req, APIResponse res, Map<String, Object> model)
{
return model;
}
/* (non-Javadoc)
* @see org.alfresco.web.api.APIService#getDescription()
*/
public String getDescription()
{
return "Retrieve the OpenSearch Description for the Alfresco Web Client keyword search";
}
/**
* Simple test that can be executed outside of web context
*/
public static void main(String[] args)
throws Exception
{
TextSearchDescription service = (TextSearchDescription)APIServiceImpl.getMethod("web.api.TextSearchDescription");
service.test(APIResponse.OPENSEARCH_DESCRIPTION_FORMAT);
}
}