KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > jcr > item > ItemImpl


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.jcr.item;
18
19 import javax.jcr.AccessDeniedException;
20 import javax.jcr.InvalidItemStateException;
21 import javax.jcr.Item;
22 import javax.jcr.ItemExistsException;
23 import javax.jcr.ReferentialIntegrityException;
24 import javax.jcr.RepositoryException;
25 import javax.jcr.Session;
26 import javax.jcr.UnsupportedRepositoryOperationException;
27 import javax.jcr.lock.LockException;
28 import javax.jcr.nodetype.ConstraintViolationException;
29 import javax.jcr.nodetype.NoSuchNodeTypeException;
30 import javax.jcr.version.VersionException;
31
32 import org.alfresco.jcr.session.SessionImpl;
33 import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
34
35
36 /**
37  * Alfresco Implementation of an Item
38  *
39  * @author David Caruana
40  */

41 public abstract class ItemImpl implements Item
42 {
43     protected SessionImpl session;
44     
45
46     /**
47      * Construct
48      *
49      * @param session
50      */

51     public ItemImpl(SessionImpl session)
52     {
53         this.session = session;
54     }
55     
56     /**
57      * Get the Session implementation
58      *
59      * @return session implementation
60      */

61     public SessionImpl getSessionImpl()
62     {
63         return session;
64     }
65     
66     /**
67      * Get the Item Proxy
68      *
69      * @return the proxy
70      */

71     public abstract Item getProxy();
72     
73     /* (non-Javadoc)
74      * @see javax.jcr.Item#getSession()
75      */

76     public Session getSession() throws RepositoryException
77     {
78         return session.getProxy();
79     }
80     
81     /* (non-Javadoc)
82      * @see javax.jcr.Item#isNew()
83      */

84     public boolean isNew()
85     {
86         return false;
87     }
88
89     /* (non-Javadoc)
90      * @see javax.jcr.Item#isModified()
91      */

92     public boolean isModified()
93     {
94         return false;
95     }
96
97     /* (non-Javadoc)
98      * @see javax.jcr.Item#save()
99      */

100     public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException
101     {
102         AlfrescoTransactionSupport.flush();
103     }
104
105     /* (non-Javadoc)
106      * @see javax.jcr.Item#refresh(boolean)
107      */

108     public void refresh(boolean keepChanges) throws InvalidItemStateException, RepositoryException
109     {
110         throw new UnsupportedRepositoryOperationException();
111     }
112
113     
114 }
115
Popular Tags