user11044402:
私は、Alfrescoはを使用しようとするNodeService
コンテンツノード(QNameを作るためにcm:content
)親プライマリ別のコンテンツノードのを。NodeService
方法を提供し、
public ChildAssociationRef moveNode(
NodeRef nodeToMoveRef,
NodeRef newParentRef,
QName assocTypeQName,
QName assocQName)
throws InvalidNodeRefException;
レッツは、ノードの現在の主な親が言ってtheNodeToMove
いるフォルダとフォルダ内のノードの主要な親連想参照ですprimaryAssocRef
。ましょうtheTargetContentNode
、目標もコンテンツ・ノード。
このように、上記のメッセージを呼び出します
nodeService.moveNode(theNodeToMove,
theTargetContentNode,
primaryAssocRef.getTypeQName(),
primaryAssocRef.getQName());
失敗しました。Alfrescoがreporst 整合性違反を:
The association source type is incorrect:
Source Node: workspace://SpacesStore/27a97736-222c-4bac-8610-f15ce312b074
Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
Actual Source Type: {http://www.alfresco.org/model/content/1.0}content
それは作ることも可能であるノードコンテンツのプライマリ親の既存のコンテンツノードを?
リスト:
はいといいえ。はいコンテンツノードは、子供を持つことはできませんので、何とあなたは「含まれている」の関連付けを使用することはできませんので。
あなたは「親子」関係を作成する場合、基本的に、あなたはそれの関連付けタイプを述べる必要があります。例えば、これらの多くは、のようにして持つことができrm:rendition
、これらのタイプの一つです。
フォルダの下の文書を作成するときに使用される「メイン」の関連タイプがありcm:contains
、かつコンテンツノードが子を持つことができない方法でセットアップです。これは、モデル定義を介して行われ、次のようになりますされています。
<type name="cm:folder">
<title>Folder</title>
<parent>cm:cmobject</parent>
<archive>true</archive>
<associations>
<child-association name="cm:contains">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sys:base</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>