<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16890" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>I've gotten no answers on this question, so I'm just
posting an update.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>I don't get how the CRE is supposed to work. Seems to me
that it actually doesn't work like it's supposed to(?). I've
got a structured content type, which is a just a type of general page. It
nests paragraphs which in turn nests image containers (where you
can VfsFile-link to the image). Pretty straightforward, nothing
special.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>If I add a picture to the page, save, and then look at
the relations using the context menu's "Link relations to/from", I can see
the relation between the page and the image just fine. So a relation
has definitively been established.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>But when I try to publish the page "with related
resources", the system apparently fails to recognize the relation, as no
image file appears in the publish list, only the page itself... WHY? The
relation clearly exists! </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN><SPAN class=612450012-20082009><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>I've tried other approaches to try to force the behaviour I
want:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009> </SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>Tried to manually add a relation using a simple
.jsp that calls addRelationToResource. However, I was only able to add the types
CATEGORY and OU_RESOURCE. All the other types caused IllegalArgumentExceptions.
And still, "publish with related resources" did not include the image when
trying to publish the general page.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>Tried to Add the relation in the XSD, but that didn't
work either (some elements are optional, which caused this approach to produce
mostly errors when trying to create new general pages).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>Can anybody shed some light on why the "publish with
related resources" behaves like this? Is it a configuration
issue?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>Also, I would still like to see an example on how
to programatically add a new relation between two resources (and how to define a
new type of relation).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>Anyone? (Michael Moossen..? :) )</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>All the best,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=612450012-20082009><FONT face=Arial
color=#0000ff size=2>Paul</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> opencms-dev-bounces@opencms.org
[mailto:opencms-dev-bounces@opencms.org] <B>On Behalf Of </B>Paul-Inge
Flakstad<BR><B>Sent:</B> 13. august 2009 20:40<BR><B>To:</B>
opencms-dev@opencms.org<BR><B>Subject:</B> [opencms-dev] How to add a
relation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial size=2>Hi
everyone</FONT></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial size=2>I'm trying to
programatically add a relation between two resources, and things are not going
so well.</FONT></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial size=2>What I want to do
is establish a relation between an xmlcontents type resource (structured
content) and an image resource, so that the image
gets published when the xmlcontents file is published with related
resources. This is actually quite important, because
many editors forget to publish images, resulting in an error message
for any user who's not logged in... </FONT></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial size=2>I'm putting my
code inside a Java class method that creates the image (thumbnail)
resource. </FONT></SPAN><SPAN class=082262518-13082009><FONT face=Arial
size=2>When using the call like this (tried other CmsRelationTypes as well,
same result):</FONT></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><FONT face="Courier New"
size=2>cmso.addRelationToResource("/en/index.html",
"/images/thumbs/image.jpg",
CmsRelationType.JSP_WEAK.getName());</FONT></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=082262518-13082009><FONT face=Arial size=2>I get the
following error:</FONT></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN
class=Apple-style-span style="FONT-SIZE: 11px; FONT-FAMILY: Verdana"><FONT
face="Courier New" size=2>Error while adding a relation from resource
"/en/index.html" to resource "/images/thumbs/image.jpg" with type
"JSP_WEAK".</FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN
class=Apple-style-span style="FONT-SIZE: 11px; FONT-FAMILY: Verdana"><FONT
face="Courier New" size=2></FONT></SPAN></SPAN></SPAN> </DIV>
<DIV><SPAN class=082262518-13082009><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN
class=Apple-style-span style="FONT-SIZE: 11px; FONT-FAMILY: Verdana"><FONT
face=Arial size=2>Can anyone tell me what I'm doing
wrong - and/or show me how it's
done?</FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN
class=Apple-style-span style="FONT-SIZE: 11px; FONT-FAMILY: Verdana"><FONT
face=Arial size=2></FONT></SPAN></SPAN></SPAN> </DIV>
<DIV><SPAN class=082262518-13082009><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN
class=Apple-style-span style="FONT-SIZE: 11px; FONT-FAMILY: Verdana"><FONT
face=Arial size=2>Cheers,</FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=082262518-13082009><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 16px 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><SPAN
class=Apple-style-span style="FONT-SIZE: 11px; FONT-FAMILY: Verdana"><FONT
face=Arial
size=2>Paul</FONT></SPAN></SPAN></SPAN></DIV></BLOCKQUOTE></BODY></HTML>