[Midas] uuid
Michael Grauer
michael.grauer at kitware.com
Wed Sep 26 17:09:10 EDT 2012
Hi Mona,
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.
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.
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.
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.
-Mike
On Wed, Sep 26, 2012 at 3:56 PM, Mona Wong <mona at sdsc.edu> wrote:
>
> I have a question about which uuid to use when saving a file.
>
> I have the following code in my controller:
>
> $ItemModel = MidasLoader::loadModel('Item');
> $lastRevisionDao = $ItemModel->getLastRevision ( $itemDao );
>
> and output of those 2 variables give me:
>
> itemDao : ItemDao Object
> (
> [_model] => Item
> [key:protected] =>
> [_key] => item_id
> [saved] => 1
> [item_id] => 62884
> [name] => rkd2_merged_phase001.nii.axml
> [description] =>
> [type] => 0
> [sizebytes] => 3027
> [date_creation] => 2012-09-24 20:58:33
> [date_update] => 2012-09-24 20:58:33
> [thumbnail_id] =>
> [view] => 0
> [download] => 5
> [privacy_status] => 2
> [uuid] => 506101b9646c4f0e1bea6ba75c3ad5aa7bef3f45eaf71
> )
>
> lastRevisionDao : ItemRevisionDao Object
> (
> [_model] => ItemRevision
> [key:protected] =>
> [_key] => itemrevision_id
> [saved] => 1
> [itemrevision_id] => 62848
> [item_id] => 62884
> [revision] => 3
> [date] => 2012-09-06 20:53:51
> [changes] =>
> [user_id] => 13
> [license_id] =>
> [uuid] => 506101b996a2811ecc80a82bff73b3b90bdfcaab11d16
> )
>
> 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 ?
>
> Mona
>
> *********************************************
> Mona Wong
> Web & iPad Application Developer
> San Diego Supercomputer Center
>
> Believing we are in control is an
> illusion that brings suffering.
> *********************************************
>
>
>
>
>
>
> _______________________________________________
> Midas mailing list
> Midas at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/midas
>
>
--
Thanks,
Michael Grauer
R & D Engineer
Kitware, Inc.
919 969 6990 x322
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20120926/a05e5f96/attachment.html>
More information about the Midas
mailing list