Hi Minne,

I do this now as I am testing ingest as part of our repo workflow.  I have
to delete 1000's of objects.  Currently I am using findObjects to get a
list of PIDS.  Then I use this list to purge each PID. You can also grab
all the PIDs directly from  mySQL.  Here is a snippet of the code using
findObjects.  This is Java code


*if*(sessionToken==*null*)

fedoraResponse = FedoraClient.*findObjects*().query("pid~*").resultFormat(
"xml").pid(*true*).maxResults(maxResults).execute(fc);

*else
*

fedoraResponse = FedoraClient.*findObjects*().query("pid~*").resultFormat(
"xml").pid(*true*
).maxResults(maxResults).sessionToken(sessionToken).execute(fc);




On Wed, Aug 1, 2012 at 5:06 PM, Rangel, Minnie <mran...@austin.utexas.edu>wrote:

> Hi,
>
> I have been banging my head against my keyboard for the last couple of
> days so I am hoping someone out there has tried this and has a solution.
>
> Background:
>
> I have ingested a whole bunch of test/sample files into Fedora 3.6 but now
> I have hundreds of things in there and need to clean it up.  Earlier I was
> just using the web administrator to purge individual objects but that is
> not an adequate solution when you have hundreds of objects (maybe even
> 1000).
>
> Then I wrote a small php script that would purge objects if I fed it the
> PID...works great if you have a list of PIDs to feed it.
>
> My issue:
>
> I was hoping to use findObjects to generate such a list but haven't been
> able to make it work.
>
> Here is what I have:
>
>         $options = array(
>                 'login' => $usr,
>                 'password' => $pwd
>         ) ;
>
>         $apia = @new SoapClient('http://myserver/fedora/wsdl?api=API-A',
> $options);
>
>         $opts = array(
>                 'resultFields' => array('pid', 'label'),
>                 'maxResults'   => 300,
>                 'query'        => 'label eq SearchTerm',
>         );
>
> (line 26)       $r = $apia->findObjects( $opts );
>
>         foreach ( $r->result->resultList->objectFields as $o ) {
>                 printf("%-36s %-12s %s\n", $o->pid, $o->label);
>         }
>
> I tried the query also as
>                 'query'        => 'SearchTerm',
>                 'label'        => 'SearchTerm',
>
> But all give errors
> 'label' gave a "no query" error so I gave up on that route.
>
> But the other methods give the following error
>
> PHP Fatal error:  Uncaught SoapFault exception: [soap:Client]
> java.lang.NullPointerException Caused by: Uncaught exception from Fedora
> Server in /home/mrangel/fedora-php/findObjects.php:24
> Stack trace:
> #0 /home/mrangel/fedora-php/findObjects.php(24):
> SoapClient->__call('findObjects', Array)
> #1 /home/mrangel/fedora-php/findObjects.php(24):
> SoapClient->findObjects(Array)
> #2 {main}
>   thrown in /home/mrangel/fedora-php/findObjects.php on line 26
>
> adding the Try/Catch loop gives (wasn't very helpful)
>
> PHP Fatal error:  soap:Client, java.lang.NullPointerException Caused by:
> Uncaught exception from Fedora Server in
> /home/mrangel/fedora-php/findObjects.php on line 36
>
> Line 36 is the catch trigger_error part so it wasn't helpful that is why I
> took it out of the loop to see what it would give.
>
> Any ideas???
>
> Thanks for any help,
> Minnie
> mran...@austin.utexas.edu
> Library Systems - Software Developer
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to