如何将方面及其属性与C#DotCmis Alfresco中的文档相关联

如何将方面及其属性与C#DotCmis Alfresco中的文档相关联,c#,alfresco,bitnami,dotcmis,C#,Alfresco,Bitnami,Dotcmis,我在一个.net web应用程序中工作,需要能够在Alfresco中创建文档,然后将特定方面及其特性与这些文档相关联 我在/opt/bitnami/apache tomcat/shared/classes/alfresco/path中创建了我的方面(nameModel.xml、name-model-context.xml所有这些文件在扩展文件夹中,name.properties在messages文件夹中,custom-slingshot-application-context.xml共享配置-c

我在一个.net web应用程序中工作,需要能够在Alfresco中创建文档,然后将特定方面及其特性与这些文档相关联

我在/opt/bitnami/apache tomcat/shared/classes/alfresco/path中创建了我的方面(nameModel.xml、name-model-context.xml所有这些文件在扩展文件夹中,name.properties在messages文件夹中,custom-slingshot-application-context.xml共享配置-custom.xml在web扩展文件夹中)

在我的C#代码中,我有两种方法:

        public void PutFile(CMISDocument document)
    {
        IObjectId cmisObjectFolder = (IObjectId)session.GetObject(document.FolderId);

        IDictionary<string, object> properties = new Dictionary<string, object>();
        properties[PropertyIds.Name] = document.ContentStreamFileName;
        properties[PropertyIds.ObjectTypeId] = "cmis:document";
        properties[PropertyIds.CreationDate] = DateTime.Now;

        ContentStream contentStream = new ContentStream();
        contentStream.FileName = document.ContentStreamFileName;
        contentStream.MimeType = document.ContentStreamMimeType;
        contentStream.Length = document.Stream.Length;
        contentStream.Stream = document.Stream;

        IObjectId objectId = session.CreateDocument(properties, cmisObjectFolder, contentStream, DotCMIS.Enums.VersioningState.None);

        PutFileDetail(objectId,document.Owner);
    }

        internal void PutFileDetail(IObjectId objectId,string actorIdCard)
    {
        ICmisObject cmisObject = session.GetObject(objectId);

        IDictionary<string, object> properties = new Dictionary<string, object>();
        properties[PropertyIds.ObjectTypeId] = "adm:aridoctypBase";
        properties["adm:actidcard"] = actorIdCard;

        IObjectId newId = cmisObject.UpdateProperties(properties);

        if (newId.Id == cmisObject.Id) 
        {
            // the repository updated this object - refresh the object
            cmisObject.Refresh();
        }
        else
        {
            // the repository created a new version - fetch the new version
            cmisObject = session.GetObject(newId);
        }
    }
公共作废文件(CMISDocument文档)
{
IObjectId cmisObjectFolder=(IObjectId)session.GetObject(document.FolderId);
IDictionary properties=新字典();
properties[PropertyId.Name]=document.ContentStreamFileName;
properties[PropertyId.ObjectTypeId]=“cmis:document”;
properties[PropertyId.CreationDate]=DateTime.Now;
ContentStream ContentStream=新ContentStream();
contentStream.FileName=document.ContentStreamFileName;
contentStream.MimeType=document.ContentStreamMimeType;
contentStream.Length=document.Stream.Length;
contentStream.Stream=document.Stream;
IOObjectId objectId=session.CreateDocument(属性、cmisObjectFolder、contentStream、DotCMIS.Enums.VersioningState.None);
PutFileDetail(objectId、document.Owner);
}
内部void PutFileDetail(IObjectId objectId,string actorIdCard)
{
icmisbject-cmisbject=session.GetObject(objectId);
IDictionary properties=新字典();
properties[PropertyId.ObjectTypeId]=“adm:aridoctypBase”;
属性[“adm:actidcard”]=actorIdCard;
IOObjectId newId=cmisObject.UpdateProperties(属性);
if(newId.Id==cmisObject.Id)
{
//存储库更新了此对象-刷新对象
cmisObject.Refresh();
}
其他的
{
//存储库创建了一个新版本-获取新版本
cmisObject=session.GetObject(newId);
}
}
使用此代码,我产生了一个错误:

第一个用于创建文档,第二个用于添加方面及其属性

我在寻找答案,我发现:

但是一个真的不知道如何安装AlfrescoOpenCMIS扩展;他们说我需要把jar文件放在我的类路径中。但我不知道我在bitnami虚拟机中的类路径是什么

另一件事是如果我在我相位的创造中忘记了什么

pd:如果有一天需要将Alfresco更改为Sharepoint或其他企业内容管理,这一点对我来说很重要,但也不紧急

我将感激任何帮助


谢谢!你知道我在哪里可以看到一个好的例子吗?我认为第一点:我需要改变我的模式。在这一刻,我有了aspect标记中的属性。我需要创建类型和属性。。。你能告诉我我走得好吗

这是我的模型xml文件(aridocsModel.xml)简历:


...
AriDocs基地
d:日期
d:日期
d:文本
d:文本
d:文本
现在,我怎么也不能用方面来工作;我需要类型

<?xml version="1.0" encoding="UTF-8"?>
<model name="adm:aridocsModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

        ...

        <types>
                <type name="adm:aridoctypBase">
                        <title>Ari Docs Type Base</title>
                        <parent>cm:content</parent>
                           <properties>
                                  <property name="adm:createdate">
                                          <type>d:date</type>
                                  </property>
                                  <property name="adm:disabledate">
                                          <type>d:date</type>
                                  </property>
                                  <property name="adm:artiddoc">
                                          <type>d:text</type>
                                  </property>
                                  <property name="adm:accnumber">
                                          <type>d:text</type>
                                  </property>
                                  <property name="adm:actidcard">
                                          <type>d:text</type>
                                  </property>
                                </properties>
                </type>
        </types>

        ...
        <!-- i need put the aspect here... Even if i will work with types... -->
        ...

</model>

...
Ari文档类型库
cm:内容
d:日期
d:日期
d:文本
d:文本
d:文本
...
...

如果有任何建议,我将不胜感激。

在创建文档时,您不需要扩展。扩展仅用于管理方面

据我所知,扩展并不是在所有语言中都可用,所以我不确定是否有一个.dll供您包含在项目中

您是否阅读了以下主题:


和:

谢谢你的回答,但我想管理方面;出于这个原因,有人提到了我的扩展。我创建了文档“xyz.txt”,现在我想将特定方面的一些属性添加到此文档中。我该怎么做?如果没有可用的扩展,那么就没有其他方法了。您将需要使用中具有属性的类型。我做了一个有相同问题的实现(不可能有扩展),所以我用不同的内容类型创建了多个嵌套类型,这使得一些事情变得复杂,但提供了相同的结果
<?xml version="1.0" encoding="UTF-8"?>
<model name="adm:aridocsModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

        ...

        <types>
                <type name="adm:aridoctypBase">
                        <title>Ari Docs Type Base</title>
                        <parent>cm:content</parent>
                           <properties>
                                  <property name="adm:createdate">
                                          <type>d:date</type>
                                  </property>
                                  <property name="adm:disabledate">
                                          <type>d:date</type>
                                  </property>
                                  <property name="adm:artiddoc">
                                          <type>d:text</type>
                                  </property>
                                  <property name="adm:accnumber">
                                          <type>d:text</type>
                                  </property>
                                  <property name="adm:actidcard">
                                          <type>d:text</type>
                                  </property>
                                </properties>
                </type>
        </types>

        ...
        <!-- i need put the aspect here... Even if i will work with types... -->
        ...

</model>