<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Just to make sure I understand...</div><div><br></div><span class="Apple-tab-span" style="white-space:pre"> </span>I just did a test where I uploaded a new revision for a text file and in the web interface, under "HISTORY", it lists revision 2 (latest copy) on top and then revision (earlier copy) at the bottom. I assume this always the order, latest on top?<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>So from what I can see:</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre"> </span>$lastRevisionDao->getBitstreams();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>will always return an array of 1 item which is the latest copy (revision #2 from my test above). </div><div><br></div><div>Mona</div><div><br></div><div><div><br><div><div>On Aug 15, 2012, at 5:33 PM, Patrick Reynolds wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div style="font-family: Helvetica; font-size: 13px; ">It should be in order by id, that is to say the same order as in the web interface.<br></div>
<div><div><br></div><div><span style="background-color: transparent;">Thanks,</span></div><div><span style="background-color: transparent;">Patrick Reynolds</span></div><div><span style="background-color: transparent;">Technical Leader</span></div><div><span style="background-color: transparent;">Kitware, Inc.</span></div><div><span style="background-color: transparent;">919 869 8848</span></div><div><span style="background-color: transparent;"><br></span></div></div><p style="color: #A0A0A8;">On Wednesday, August 15, 2012 at 8:27 PM, Mona Wong wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div>Hi Patrick:<div><br></div><div><span style="white-space:pre"> </span>Thanks for the code!</div><div><br></div><div><span style="white-space:pre"> </span>So the most recent bitstream for an item id is the last bitstream or the first bitstream in the foreach loop below?</div><div><br></div><div>Mona</div><div><br></div><div><br><div><div>On Aug 11, 2012, at 1:14 PM, Patrick Reynolds wrote:</div><br><blockquote type="cite"><div>
<div style="font-family: Helvetica; font-size: 13px; ">Mona,<div><br></div><div>First, a bit about how items correspond to files. Items are made up of revisions. Most items contain one revision (the head or latest revision). Within each revision are bitstreams. These bitstreams are analogous to the files on the file system. With all that in mind, the following code should get you what you want (I'm going to assume the item ID is in a variable called, appropriately, $itemId.):</div><div><br></div><div>// Load our models</div><div>$ItemModel = MidasLoader::loadModel('Item');</div><div>$ItemRevisionModel = MidasLoader::loadModel('ItemRevision');</div><div>$BitstreamModel = MidasLoader::loadModel('Bitstream');</div><div><br></div><div>// Get the item and its last revision from the time id</div><div>$itemDao = $ItemModel->load($itemId);</div><div>$lastRevisionDao = $ItemModel->getLastRevision($itemDao);</div><div><br></div><div>// loop through the bitstreams and print their paths</div><div>foreach($lastRevisionDao->getBitstreams() as $bitstreamDao)</div><div> {</div><div> print($bitstreamDao->getPath());</div><div> }</div><div><br></div><div>Hope that helps!</div></div>
<div><div><br></div><div><span style="background-color: transparent;">Thanks,</span></div><div><span style="background-color: transparent;">Patrick Reynolds</span></div><div><span style="background-color: transparent;">Technical Leader</span></div><div><span style="background-color: transparent;">Kitware, Inc.</span></div><div><span style="background-color: transparent;">919 869 8848</span></div></div></div></blockquote></div></div></div></div></span></blockquote></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>*********************************************</div><div> Mona Wong</div><div> Web & iPad Application Developer</div><div> San Diego Supercomputer Center</div><div><br></div><div> Believing we are in control is an</div><div> illusion that brings suffering.</div><div><div><div>*********************************************</div><div><span class="Apple-style-span" style="font-size: medium; "><br></span></div></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></div></div></div></body></html>