KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > jcr > item > property > JCRMixinTypesProperty


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.property;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21 import java.util.Set JavaDoc;
22
23 import javax.jcr.RepositoryException;
24
25 import org.alfresco.jcr.dictionary.JCRNamespace;
26 import org.alfresco.jcr.dictionary.NodeTypeImpl;
27 import org.alfresco.jcr.item.NodeImpl;
28 import org.alfresco.jcr.item.PropertyImpl;
29 import org.alfresco.service.cmr.repository.NodeService;
30 import org.alfresco.service.namespace.QName;
31
32 /**
33  * Implementation for nt:base primaryType property
34  *
35  * @author David Caruana
36  */

37 public class JCRMixinTypesProperty extends PropertyImpl
38 {
39     public static QName PROPERTY_NAME = QName.createQName(JCRNamespace.JCR_URI, "mixinTypes");
40     
41
42     /**
43      * Construct
44      *
45      * @param node
46      */

47     public JCRMixinTypesProperty(NodeImpl node)
48     {
49         super(node, PROPERTY_NAME);
50     }
51
52     @Override JavaDoc
53     protected Object JavaDoc getPropertyValue() throws RepositoryException
54     {
55         // get aspects from node
56
NodeImpl nodeImpl = getNodeImpl();
57         NodeService nodeService = nodeImpl.getSessionImpl().getRepositoryImpl().getServiceRegistry().getNodeService();
58         Set JavaDoc<QName> aspects = nodeService.getAspects(nodeImpl.getNodeRef());
59
60         // resolve against session namespace prefix resolver
61
List JavaDoc<String JavaDoc> aspectNames = new ArrayList JavaDoc<String JavaDoc>(aspects.size() + 1);
62         for (QName aspect : aspects)
63         {
64             aspectNames.add(aspect.toPrefixString(nodeImpl.getSessionImpl().getNamespaceResolver()));
65         }
66         
67         // add JCR referenceable
68
aspectNames.add(NodeTypeImpl.MIX_REFERENCEABLE.toPrefixString(nodeImpl.getSessionImpl().getNamespaceResolver()));
69         
70         return aspectNames;
71     }
72     
73 }
74
Popular Tags