1

今天我正在寻找一种使用 dotcmis 在 alfresco 中获取包含特定属性的所有文档的好方法。

我在想:

  • 使用 Ephesoft ( http://www.ephesoft.com/ ) 捕获文档。
  • 使用 cmis 集成将 Ephesoft 与 Alfresco 连接起来。
  • 配置文档属性以匹配露天模型(元数据文档)
  • 在我的 webApplication(asp.net)中开发一个模块来搜索具有特定属性(元数据)的所有文档;使用 dotcmis ( http://chemistry.apache.org/dotnet/dotcmis.html )

我发现:

  • 如何创建会话。
  • 如何列出树文件夹

除了...如果设置了特定属性(元数据),如何验证每个文档?

你知道怎么做吗?


谢谢帕布罗昌!在这一刻,我有:

public ISession Connect(string user, string password, string servicesUrl, string repositoryId)
    {
        IDictionary<string, string> parameter = new Dictionary<string, string>();

        parameter.Add(DotCMIS.SessionParameter.User, user);
        parameter.Add(DotCMIS.SessionParameter.Password, password);
        parameter.Add(DotCMIS.SessionParameter.BindingType, DotCMIS.BindingType.WebServices);
        parameter.Add(DotCMIS.SessionParameter.WebServicesAclService, (servicesUrl + "ACLService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesDiscoveryService, (servicesUrl + "DiscoveryService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesMultifilingService, (servicesUrl + "MultiFilingService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesNavigationService, (servicesUrl + "NavigationService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesObjectService, (servicesUrl + "ObjectService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesPolicyService, (servicesUrl + "PolicyService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesRelationshipService, (servicesUrl + "RelationshipService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesRepositoryService, (servicesUrl + "RepositoryService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.WebServicesVersioningService, (servicesUrl + "VersioningService?wsdl").ToString());
        parameter.Add(DotCMIS.SessionParameter.RepositoryId, (repositoryId));

        ISessionFactory factory = DotCMIS.Client.Impl.SessionFactory.NewInstance();
        return factory.CreateSession(parameter);
    }

    public List<CMISIntegrationResponse> GetFiles(CMISIntegrationRequest request)
    {
        List<CMISIntegrationResponse> cmisIntegrationResponseList = new List<CMISIntegrationResponse>();

        ISession session = Connect(request.UserName, request.Password, request.ServicesUrl, request.RepositoryId);

        IItemEnumerable<IQueryResult> result = session.Query(@"SELECT
                                                               cmis:name, cmis:objectId, cmis:baseTypeId, cmis:objectTypeId, cmis:createdBy,
                                                               cmis:lastModifiedBy, cmis:lastModificationDate,cmis:contentStreamMimeType,
                                                               cmis:contentStreamFileName,cmis:contentStreamId,cmis:contentStreamLength
                                                               FROM cmis:document
                                                               ORDER BY
                                                               cmis:name, cmis:createdBy", false);

        foreach(QueryResult item in result) 
        {
            if (item.AllowableActions.Actions.Contains(DotCMIS.Actions.CanGetContentStream))
            {
                foreach (DotCMIS.Data.IPropertyData property in item.Properties)
                {

                    /*AccountNumber will be a property/metadata of any document
                      In this point i can not see any property/metadata called  "AccountNumber"
                     */

                    if (property.DisplayName.Equals("AccountNumber"))
                    {
                        CMISIntegrationResponse response = new CMISIntegrationResponse();
                        response.Name = item.GetPropertyValueByQueryName("cmis:name").ToString();
                        response.ObjectId = item.GetPropertyValueByQueryName("cmis:objectId").ToString();
                        response.BaseTypeId = item.GetPropertyValueByQueryName("cmis:baseTypeId").ToString();
                        response.ObjectTypeId = item.GetPropertyValueByQueryName("cmis:objectTypeId").ToString();
                        response.CreatedBy = item.GetPropertyValueByQueryName("cmis:createdBy").ToString();
                        response.LastModifiedBy = item.GetPropertyValueByQueryName("cmis:lastModifiedBy").ToString();
                        response.LastModificationDate = item.GetPropertyValueByQueryName("cmis:lastModificationDate").ToString();
                        response.ContentStreamMimeType = item.GetPropertyValueByQueryName("cmis:contentStreamMimeType").ToString();
                        response.ContentStreamFileName = item.GetPropertyValueByQueryName("cmis:contentStreamFileName").ToString();
                        response.ContentStreamId = item.GetPropertyValueByQueryName("cmis:contentStreamId").ToString();
                        response.ContentStreamLength = item.GetPropertyValueByQueryName("cmis:contentStreamLength").ToString();

                        cmisIntegrationResponseList.Add(response);
                    }
                }
            }
        }

        session.Clear();
        return cmisIntegrationResponseList;
    }

我在哪里可以看到 CMIS Alfresco 的虚拟表及其列的列表?

谢谢!

4

2 回答 2

1

我在哪里可以看到 CMIS Alfresco 的虚拟表及其列的列表?

最好的方法是从 Apache Chemistry 下载 OpenCMIS Workbench。启动它,连接到 Alfresco,然后单击 Types。然后,工作台将显示存储库知道的类型的分层列表。

如果您随后单击您感兴趣的特定类型,Workbench 将显示该类型的属性。如果你滚动你会看到一个“可查询”列。如果该列为真,您可以编写查询来测试该属性的值。在查询中使用属性的“查询名称”。

于 2014-01-23T17:52:50.360 回答
1

您可以向 Alfresco 发送 CMIS 查询。我建议先阅读有关 CMIS 查询语言的内容。之后阅读 dotCMIS 指南

假设您的字段定义了一个类型或方面,例如 my:aspect 和 my:field。

查询可能如下所示:

SELECT * FROM my:aspect WHERE my:field = "some value"

代码将是:

session.Query("SELECT * FROM my:aspect WHERE my:field = 'some value'", false);

编辑:

好的,我阅读了您的代码,还有一件事我没有提到。您看不到字段(帐号)的原因是查询结果仅包含为查询类型/方面定义的字段(在本例中为 cmis:object)。如果您想查询“AccountNumber”,您需要知道它定义的类型/方面。

假设“AccountNumber”在类型“custom:myType”中定义。查询将如下所示:

SELECT * from custom:myType

结果将包含“AccountNumber”。

如果字段是在一个方面定义的,您可以使用 JOIN 进行查询:http ://wiki.alfresco.com/wiki/CMIS#Aspect_Query

我希望这有帮助。

于 2014-01-20T23:05:11.107 回答