From a32e5e5070b5a211aca3e57b0ed60c35e2426f48 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Tue, 8 Dec 2009 01:08:22 +0000 Subject: [PATCH] CSPACE-644: Sample code to delete collection objects now guarded by a flag. --- .../client/sample/Sample.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java b/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java index 268b9af4f..a143cc20e 100644 --- a/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java +++ b/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java @@ -6,7 +6,7 @@ * http://www.collectionspace.org * http://wiki.collectionspace.org * - * Copyright (c)) 2009 Regents of the University of California + * Copyright © 2009 Regents of the University of California * * Licensed under the Educational Community License (ECL), Version 2.0. * You may not use this file except in compliance with this License. @@ -105,7 +105,7 @@ public class Sample { } // Submit the read ("get") request to the service and store the response. - // The resourceIdentifier is a unique identifier for the CollectionObject + // The resourceId is a unique identifier for the CollectionObject // record we're reading. ClientResponse res = client.read(resourceId); @@ -398,9 +398,14 @@ public class Sample { Sample sample = new Sample(); - if (logger.isInfoEnabled()){ - logger.info("Creating a new CollectionObject record ..."); + // Optionally first delete all existing collection object records. + boolean ENABLE_DELETE_ALL = false; + if (ENABLE_DELETE_ALL) { + logger.info("Deleting all CollectionObject records ..."); + sample.deleteAllCollectionObjects(); } + + logger.info("Creating a new CollectionObject record ..."); String newRecordId = sample.createCollectionObject(); if (newRecordId == null || newRecordId.trim().isEmpty()) { @@ -408,21 +413,12 @@ public class Sample { return; } - if (logger.isInfoEnabled()){ - logger.info("Reading the new CollectionObject record ..."); - } + logger.info("Reading the new CollectionObject record ..."); MultipartInput corecord = sample.readCollectionObject(newRecordId); sample.displayCollectionObject(corecord); - if (logger.isInfoEnabled()){ - logger.info("Deleting the new CollectionObject record ..."); - } + logger.info("Deleting the new CollectionObject record ..."); sample.deleteCollectionObject(newRecordId); - - if (logger.isInfoEnabled()){ - logger.info("Deleting all CollectionObject records ..."); - } - sample.deleteAllCollectionObjects(); } -- 2.47.3