2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 package org.collectionspace.services.account.storage;
26 import java.util.UUID;
27 import org.collectionspace.services.account.AccountsCommon;
28 import org.collectionspace.services.account.AccountsCommonList;
29 import org.collectionspace.services.common.document.AbstractDocumentHandler;
30 import org.collectionspace.services.common.document.DocumentWrapper;
36 public class AccountDocumentHandler
37 extends AbstractDocumentHandler<AccountsCommon, AccountsCommonList, AccountsCommon, AccountsCommonList> {
39 private AccountsCommon account;
40 private AccountsCommonList accountList;
43 public void handleCreate(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
44 String id = UUID.randomUUID().toString();
45 AccountsCommon account = wrapDoc.getWrappedObject();
50 public void handleUpdate(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
54 public void handleGet(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
55 setCommonPart(wrapDoc.getWrappedObject());
59 public void handleGetAll(DocumentWrapper<AccountsCommonList> wrapDoc) throws Exception {
60 setCommonPartList(wrapDoc.getWrappedObject());
64 public AccountsCommon extractCommonPart(DocumentWrapper<AccountsCommon> wrapDoc)
66 throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
70 public void fillCommonPart(AccountsCommon obj, DocumentWrapper<AccountsCommon> wrapDoc)
72 throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
76 public AccountsCommonList extractCommonPartList(DocumentWrapper<AccountsCommonList> wrapDoc)
78 return wrapDoc.getWrappedObject();
82 public AccountsCommon getCommonPart() {
87 public void setCommonPart(AccountsCommon account) {
88 this.account = account;
92 public AccountsCommonList getCommonPartList() {
97 public void setCommonPartList(AccountsCommonList accountList) {
98 this.accountList = accountList;
102 public String getQProperty(String prop) {