]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
5e4a677f5d409ecfb65e34c294e7e0462f6bad32
[tmp/jakarta-migration.git] /
1 /**
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:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
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.
23  */
24 package org.collectionspace.services.account.storage;
25
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;
31
32 /**
33  *
34  * @author 
35  */
36 public class AccountDocumentHandler
37         extends AbstractDocumentHandler<AccountsCommon, AccountsCommonList, AccountsCommon, AccountsCommonList> {
38
39     private AccountsCommon account;
40     private AccountsCommonList accountList;
41
42     @Override
43     public void handleCreate(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
44         String id = UUID.randomUUID().toString();
45         AccountsCommon account = wrapDoc.getWrappedObject();
46         account.setCsid(id);
47     }
48
49     @Override
50     public void handleUpdate(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
51     }
52
53     @Override
54     public void handleGet(DocumentWrapper<AccountsCommon> wrapDoc) throws Exception {
55         setCommonPart(wrapDoc.getWrappedObject());
56     }
57
58     @Override
59     public void handleGetAll(DocumentWrapper<AccountsCommonList> wrapDoc) throws Exception {
60         setCommonPartList(wrapDoc.getWrappedObject());
61     }
62
63     @Override
64     public AccountsCommon extractCommonPart(DocumentWrapper<AccountsCommon> wrapDoc)
65             throws Exception {
66         throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
67     }
68
69     @Override
70     public void fillCommonPart(AccountsCommon obj, DocumentWrapper<AccountsCommon> wrapDoc)
71             throws Exception {
72         throw new UnsupportedOperationException("operation not relevant for AccountDocumentHandler");
73     }
74
75     @Override
76     public AccountsCommonList extractCommonPartList(DocumentWrapper<AccountsCommonList> wrapDoc)
77             throws Exception {
78         return wrapDoc.getWrappedObject();
79     }
80
81     @Override
82     public AccountsCommon getCommonPart() {
83         return account;
84     }
85
86     @Override
87     public void setCommonPart(AccountsCommon account) {
88         this.account = account;
89     }
90
91     @Override
92     public AccountsCommonList getCommonPartList() {
93         return accountList;
94     }
95
96     @Override
97     public void setCommonPartList(AccountsCommonList accountList) {
98         this.accountList = accountList;
99     }
100
101     @Override
102     public String getQProperty(String prop) {
103         return null;
104     }
105 }