<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>I’ve been trying to get OpenCms to publish only a
specific subset of resources in OpenCms. This is a mix of new folders, new
files, modified resources and deleted resources.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>This code is run via the Administration panel through a
newly created Module.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>The code extract looks something like this;<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span style='font-size:
10.0pt;font-family:"Courier New";color:#3F7F5F'>// This list gets populated
before creating the CmsPublishList</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> List<CmsResource> resourcesToPublish = new
ArrayList<CmsResource>();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:#3F7F5F'>// Only publish what we actually
touched</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>boolean</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> publishSiblings
= </span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>false</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>boolean</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>
publishSubResources = </span><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>false</span></b><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>CmsPublishList publishList = OpenCms.<i>getPublishManager</i>().getPublishList(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>cms</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, <span
style='background:silver;mso-highlight:silver'>resourcesToPublish</span>, publishSiblings,</span><span
style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:black'>publishSubResources);</span><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>OpenCms.<i>getPublishManager</i>().publishProject(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>cms</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>report</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, publishList);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>OpenCms.<i>getPublishManager</i>().waitWhileRunning();</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>A short example of the result of this code is attached. All
the resources with status N & U (New and Updated) are added to the
resourcesToPublish List, but the publishProject publishes none of them (see
ImportLog.htm for the result).<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Any idea why OpenCms decides not to publish my resources, or
is there a better way to publish these specific resources programmaticly?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Thanks,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Jasper Roel<o:p></o:p></p>
</div>
</body>
</html>