macaw.persistenceLayer.demo
Class InMemorySupportingDocumentsManager
java.lang.Object
macaw.persistenceLayer.demo.InMemoryCurationConceptManager
macaw.persistenceLayer.demo.InMemorySupportingDocumentsManager
public class InMemorySupportingDocumentsManager
- extends InMemoryCurationConceptManager
manages instances of SupportingDocument
in memory rather than
managing them in a database. This is a typical example of a manager class used
by delegation classes that implement the main APIs MacawCurationAPI
and MacawRetrievalAPI
.
InMemorySupportingDocumentsManager
supports the following operations:
- get all supporting documents
- add a supporting document
- update a supporting document
- delete a supporting document
- check that a supporting document exists
- check that a supporting document isn't a duplicate
Most of the editing operations have three parts:
- validate parameters
- perform the business operation
- log any changes
The manager supports object persistence by adopting the following policies:
- when a
SupportingDocument
is added, it is treated like
the stored version of a record
- when a
SupportingDocument
is retrieved, the manager
returns a clone copy. The object returned is treated as the working copy.
- when a
SupportingDocument
is updated, the manager uses
the value of an integer identifier field in the working copy to find the original in
a HashMap. The manager replaces the original with the updated copy.
The manager generates unique identifiers for SupportingDocument
in
much the same way as a relational database would use an autonumbered key.
Copyright 2010 Medical Research Council Unit for Lifelong Health and Ageing
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- Version:
- 1.0
- Author:
- Kevin Garwood (kgarwood@users.sourceforge.net)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InMemorySupportingDocumentsManager
public InMemorySupportingDocumentsManager(InMemoryChangeEventManager changeEventManager)
getAllSupportingDocuments
public java.util.ArrayList<SupportingDocument> getAllSupportingDocuments(User user)
throws MacawException
- Throws:
MacawException
addSupportingDocument
public void addSupportingDocument(User user,
SupportingDocument supportingDocument)
throws MacawException
- Throws:
MacawException
updateSupportingDocument
public void updateSupportingDocument(User user,
SupportingDocument revisedSupportingDocument)
throws MacawException
- Throws:
MacawException
deleteSupportingDocuments
public void deleteSupportingDocuments(User user,
java.util.ArrayList<SupportingDocument> supportingDocumentsToDelete)
throws MacawException
- Throws:
MacawException
getOriginalSupportingDocument
public SupportingDocument getOriginalSupportingDocument(SupportingDocument revisedSupportingDocument)
getSupportingDocumentIdentifier
public int getSupportingDocumentIdentifier(SupportingDocument targetSupportingDocument)
clear
public void clear()
checkSupportingDocumentExists
public void checkSupportingDocumentExists(SupportingDocument candidateSupportingDocument)
throws MacawException
- Throws:
MacawException