Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Alfresco创建专用工作副本_Alfresco_Checkout_Working Copy_Opencmis - Fatal编程技术网

Alfresco创建专用工作副本

Alfresco创建专用工作副本,alfresco,checkout,working-copy,opencmis,Alfresco,Checkout,Working Copy,Opencmis,我使用Alfresco Community4.0.e、chemistry opencmis client 0.7.0和primefaces 3.4.1 我想在web应用程序的附件文件中添加“脱机编辑”功能 为此,我尝试使用Web脚本“checkedout”,但找不到调用此Web脚本的正确方法 我通过“CMIS工作台”运行这个Web脚本,并尝试阅读日志 我发现alfresco像这样调用这个Web脚本 DEBUG ent.bindings.spi.http.DefaultHttpInvoker:PO

我使用Alfresco Community4.0.e、chemistry opencmis client 0.7.0和primefaces 3.4.1 我想在web应用程序的附件文件中添加“脱机编辑”功能 为此,我尝试使用Web脚本“checkedout”,但找不到调用此Web脚本的正确方法 我通过“CMIS工作台”运行这个Web脚本,并尝试阅读日志 我发现alfresco像这样调用这个Web脚本

DEBUG ent.bindings.spi.http.DefaultHttpInvoker:POSThttp://fateh:8080/alfresco/service/cmis/checkedout

TRACE ent.bindings.spi.http.DefaultHttpInvoker:POSThttp://fateh:8080/alfresco/service/cmis/checkedout >标题:{null=[HTTP/1.1201已创建],日期=[Tue,2013年7月16日10:38:53 GMT],传输编码=[chunked],位置=[http://fateh:8080/alfresco/service/cmis/pwc/s/workspace:SpacesStore/...,内容类型=[application/atom+xml;type=entry;charset=UTF-8],Server=[apachecoyote/1.1],Pragma=[no cache],cache Control=[no cache]}

我试图编写代码来匹配我从日志中了解到的内容,但它不起作用-_-

 public String cancelCheckOut(String objID) throws JSONException{
     try{
         HttpPost httpPost = new HttpPost("http://"+Constant.getAlfrescoIpConcatPort()+"/alfresco/service/cmis/checkedout");
         //StringEntity requestEntity  =new StringEntity(json);
         //httpPost.setEntity(requestEntity);
         httpPost.setHeader("Transfer-Encoding", "chunked");
         httpPost.setHeader("Content-type", "application/atom+xml");
         httpPost.setHeader("Location", "http://50.17.228.246:80/alfresco/service/cmis/pwc/s/workspace:SpacesStore/i/5b4772c9-8d8d-4fab-a7b9-5fe5d25b45f1");
         httpPost.setHeader("Content-Type", "application/atom+xml;type=entry;charset=UTF-8");
         httpPost.setHeader("Pragma", "no-cache");
         httpPost.setHeader("Cache-Control", "no-cache");

         System.out.println("Http post "+ httpPost.toString());

         HttpResponse response = client.execute(httpPost);
         System.out.println("response "+ response.toString());

         HttpEntity entity = response.getEntity();
         if (entity != null) {
                 return "done";
         }
    }catch (Exception ex) {         
        System.out.println(ex.getLocalizedMessage());
    } finally {
        client.getConnectionManager().shutdown();
    }
    return "failed";    
} 

有什么帮助吗?

您必须在帖子中添加有效负载,以指定要签出的文档,例如:

<?xml version="1.0" encoding="utf-8"?>
  <entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/"
    xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">
    <cmisra:object>
    <cmis:properties>
    <cmis:propertyId propertyDefinitionId="cmis:objectId">
    <cmis:value>workspace:/SpacesStore/5b4772c9-8d8d-4fab-a7b9-5fe5d25b45f1</cmis:value>
    </cmis:propertyId>
    </cmis:properties>
    </cmisra:object>
 </entry>

工作空间:/SpacesStore/5b4772c9-8d8d-4fab-a7b9-5fe5d25b45f1

为了明确Alfrecian的回答,以下是您在client.execute之前必须编写的内容:

String data = "what alfrescian wrote";
httpPost.setEntity(new StringEntity(data));

我找到了创建私有工作副本的更简单的方法,因为我在curl查询之前没有使用过它

Session session = CMISUtils.getSession();
Document doc = (Document) session.getObject(session.createObjectId(attachment.getIdAttachment()));
Document pwc = (Document) session.getObject(doc.checkOut());

谢谢大家的回答,但我找到了创建私有工作副本的更简单的方法,因为我在curl查询会话=CMISUtils.getSession();文档文档=(文档)会话.getObject(会话.createObjectId(附件.getIdAttachment());文档pwc=(文档)会话.getObject(文档签出());