Hi Mona,<div><br></div><div>What I'm going to tell you applies to Midas 3.2.8 and later, so be sure to check the API documentation of your server to see that the same calls make sense. </div><div><br></div><div>If you want to add a new revision to an existing item, you only need to call midas.upload.generatetoken, passing in the item_id, followed by midas.upload.perform, passing in the upload token.</div>
<div><br></div><div>The uuid is unique for every row in the database. For an item, there is one row in the item table with a uuid, there can be many rows in the itemrevision table that correspond to that same item row. Each of these itemrevision rows will have their own uuid and these will be different from the item's uuid.</div>
<div><br></div><div>You should pass the uuid for the item to the midas.item.create method when you are interested in changing the description or privacy of an existing item, or for adding a metadata tuple to an existing item. For metadata you can also use midas.item.setmetadata or midas.item.setmetadatamultiple, which I think are more straightforward ways of setting metadata than using item.create.</div>
<div><br></div><div><br></div><div>-Mike<br><br><div class="gmail_quote">On Wed, Sep 26, 2012 at 3:56 PM, Mona Wong <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><span style="white-space:pre-wrap"> </span>I have a question about which uuid to use when saving a file.<div>
<br></div><div><span style="white-space:pre-wrap"> </span>I have the following code in my controller:</div><div><br></div><div><span style="white-space:pre-wrap"> </span>$ItemModel = MidasLoader::loadModel('Item'); </div>
<div><span style="white-space:pre-wrap"> </span>$lastRevisionDao = $ItemModel->getLastRevision ( $itemDao ); </div><div><br></div><div><span style="white-space:pre-wrap"> </span>and output of those 2 variables give me:</div>
<div><br></div><div><div>itemDao : ItemDao Object</div><div>(</div><div> [_model] => Item</div><div> [key:protected] =></div><div> [_key] => item_id</div><div> [saved] => 1</div><div> [item_id] => 62884</div>
<div> [name] => rkd2_merged_phase001.nii.axml</div><div> [description] =></div><div> [type] => 0</div><div> [sizebytes] => 3027</div><div> [date_creation] => 2012-09-24 20:58:33</div><div> [date_update] => 2012-09-24 20:58:33</div>
<div> [thumbnail_id] =></div><div> [view] => 0</div><div> [download] => 5</div><div> [privacy_status] => 2</div><div> [uuid] => 506101b9646c4f0e1bea6ba75c3ad5aa7bef3f45eaf71</div><div>)</div>
<div><br></div><div>lastRevisionDao : ItemRevisionDao Object</div><div>(</div><div> [_model] => ItemRevision</div><div> [key:protected] =></div><div> [_key] => itemrevision_id</div><div> [saved] => 1</div>
<div> [itemrevision_id] => 62848</div><div> [item_id] => 62884</div><div> [revision] => 3</div><div> [date] => 2012-09-06 20:53:51</div><div> [changes] =></div><div> [user_id] => 13</div>
<div> [license_id] =></div><div> [uuid] => 506101b996a2811ecc80a82bff73b3b90bdfcaab11d16</div><div>)</div><div><br></div><div><span style="white-space:pre-wrap"> </span>So there is a uuid for the item and a different uuid for the last revision. Is the uuid for the $itemDao for the first revision? If I use the $itemDao's uuid on a call to midas.item.create, what will happen? If I want to save a new revision of the item, should I go through the process similar to creating a new item: midas.item.create -> midas.upload.generatetoken -> midas.upload.perform ?</div>
<div><br></div><div>Mona</div><div><br></div><div>
<div style="word-wrap:break-word"><div style="word-wrap:break-word"><div style="word-wrap:break-word"><span style="text-indent:0px"><div style="word-wrap:break-word"><span style="text-indent:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px"><div style="word-wrap:break-word"><span style="text-indent:0px"><div style="word-wrap:break-word"><span style="text-indent:0px"><div style="word-wrap:break-word"><span style="text-indent:0px"><div style="word-wrap:break-word">
<div>*********************************************</div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
Mona Wong</div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
Web & iPad Application Developer</div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
San Diego Supercomputer Center</div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
<br></div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
Believing we are in control is an</div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
illusion that brings suffering.</div><div style="line-height:normal;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:12px;font-style:normal;white-space:normal;font-family:Helvetica;font-weight:normal;word-spacing:0px">
<div><div>*********************************************</div><div><span style="font-size:medium"><br></span></div></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></div><br></div>
<br><br>
</div>
<br></div></div><br>_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>Michael Grauer<br>R & D Engineer<br>Kitware, Inc.<br>919 969 6990 x322<br><br><br><br>
</div>