<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" 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 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hi,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to get a list of all archived packages from the
Drools repository but I can&#8217;t seem to get packages that have been
archived.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Below is the query I am using to get a list of archived
packages:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>RulesRepository repo = <i><span style='font-style:italic'>createRepository</span></i>();&nbsp;&nbsp;
</span></font><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>PackageItem item = repo.createPackage( </span></font><font size=2
color="#2a00ff" face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:#2A00FF'>&quot;testPackage&quot;</span></font><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>, </span></font><font size=2 color="#2a00ff" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;A
test&quot;</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> );</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>item.archiveItem( </span></font><b><font size=2 color="#7f0055"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055;font-weight:bold'>true</span></font></b><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> );</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>item.checkin( </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;Archive test&quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> );</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black;background:silver'>System</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>.</span></font><i><font size=2 color="#0000c0" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0;font-style:
italic'>out</span></font></i><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>.println( </span></font><font
size=2 color="#2a00ff" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#2A00FF'>&quot;Archived=&quot;</span></font><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> + repo.loadPackageByUUID( item.getUUID()
).isArchived());</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>String sql = </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;SELECT &quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + PackageItem.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>TITLE_PROPERTY_NAME</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> + </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;, &quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + PackageItem.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>DESCRIPTION_PROPERTY_NAME</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> + </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;, &quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + PackageItem.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>CONTENT_PROPERTY_ARCHIVE_FLAG</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>; </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>sql += </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot; FROM &quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> + PackageItem.</span></font><i><font size=2 color="#0000c0"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000C0;font-style:italic'>RULE_PACKAGE_TYPE_NAME</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>;</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>sql += </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot; WHERE &quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>;</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>sql += </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot; jcr:path LIKE '/&quot;</span></font><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + RulesRepository.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>RULES_REPOSITORY_NAME</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> + </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;/&quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + RulesRepository.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>RULE_PACKAGE_AREA</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> + </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;/%'&quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>;</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color="#3f7f5f"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>//sql += &quot; AND &quot; +
PackageItem.CONTENT_PROPERTY_ARCHIVE_FLAG + &quot; = 'true'&quot;;</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>Query q =
repo.getSession().getWorkspace().getQueryManager().createQuery( sql, Query.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>SQL</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> );</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>QueryResult res = q.execute();</span></font><font size=2
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>Iterator&lt;PackageItem&gt; it = </span></font><b><font size=2
color="#7f0055" face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055;font-weight:bold'>new</span></font></b><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> PackageIterator( repo, res.getNodes() );</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><b><font size=2 color="#7f0055"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055;font-weight:bold'>while</span></font></b><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>( it.hasNext() )</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>{</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PackageItem pi = it.next();</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='background:silver'>System</span>.</span></font><i><font
size=2 color="#0000c0" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0;font-style:italic'>out</span></font></i><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>.println( </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;*****&nbsp; item=&quot;</span></font><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> +pi.getUUID() + </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;, name=&quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> +pi.getName() + </span></font><font size=2 color="#2a00ff"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>&quot;, isArchived=&quot;</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> + pi.isArchived() );</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>}</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>If I don&#8217;t archive a package then the code returns my
package. I know that the package is archived because if I do<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color="#0000c0"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000C0'>&#8220;</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>loadPackageByUUID(
uuid ).isArchived()&#8221; </span></font><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>it return true.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Does anyone know what I am doing wrong here?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Len<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>