View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.surf.types;
20  
21  import org.dom4j.Document;
22  import org.springframework.extensions.surf.ModelPersisterInfo;
23  import org.springframework.extensions.surf.RequestContext;
24  
25  /**
26   * Default page association implementation
27   * 
28   * @author muzquiano
29   */
30  public class PageAssociationImpl extends AbstractModelObject implements PageAssociation
31  {
32      /**
33       * Instantiates a new page association for a given XML document
34       * 
35       * @param document the document
36       */
37      public PageAssociationImpl(String id, ModelPersisterInfo key, Document document)
38      {
39          super(id, key, document);
40      }
41      
42      /* (non-Javadoc)
43       * @see org.alfresco.web.site.model.AbstractModelObject#getTypeName()
44       */
45      public String getTypeId() 
46      {
47          return TYPE_ID;
48      }
49      
50      /* (non-Javadoc)
51       * @see org.alfresco.web.framework.types.PageAssociation#getSourceId()
52       */
53      public String getSourceId()
54      {
55          return getProperty(PROP_SOURCE_ID);
56      }
57  
58      /* (non-Javadoc)
59       * @see org.alfresco.web.framework.types.PageAssociation#setSourceId(java.lang.String)
60       */
61      public void setSourceId(String sourceId)
62      {
63          setProperty(PROP_SOURCE_ID, sourceId);
64      }
65  
66      /* (non-Javadoc)
67       * @see org.alfresco.web.framework.types.PageAssociation#getDestId()
68       */
69      public String getDestId()
70      {
71          return getProperty(PROP_DEST_ID);
72      }
73  
74      /* (non-Javadoc)
75       * @see org.alfresco.web.framework.types.PageAssociation#setDestId(java.lang.String)
76       */
77      public void setDestId(String destId)
78      {
79          setProperty(PROP_DEST_ID, destId);
80      }
81  
82      /* (non-Javadoc)
83       * @see org.alfresco.web.framework.types.PageAssociation#getAssociationType()
84       */
85      public String getAssociationType()
86      {
87          return getProperty(PROP_ASSOC_TYPE);
88      }
89  
90      /* (non-Javadoc)
91       * @see org.alfresco.web.framework.types.PageAssociation#setAssociationType(java.lang.String)
92       */
93      public void setAssociationType(String associationType)
94      {
95          setProperty(PROP_ASSOC_TYPE, associationType);
96      }
97  
98      /* (non-Javadoc)
99       * @see org.alfresco.web.framework.types.PageAssociation#getOrderId()
100      */
101     public String getOrderId()
102     {
103         return getProperty(PROP_ORDER_ID);
104     }
105 
106     /* (non-Javadoc)
107      * @see org.alfresco.web.framework.types.PageAssociation#setOrderId(java.lang.String)
108      */
109     public void setOrderId(String orderId)
110     {
111         setProperty(PROP_ORDER_ID, orderId);
112     }
113 
114     // Helpers
115 
116     /* (non-Javadoc)
117      * @see org.alfresco.web.framework.types.PageAssociation#getSourcePage(org.alfresco.web.framework.RequestContext)
118      */
119     public Page getSourcePage(RequestContext context)
120     {
121         return context.getModel().getPage(getSourceId());
122     }
123 
124     /* (non-Javadoc)
125      * @see org.alfresco.web.framework.types.PageAssociation#getDestPage(org.alfresco.web.framework.RequestContext)
126      */
127     public Page getDestPage(RequestContext context)
128     {
129         return context.getModel().getPage(getDestId());
130     }
131 }