View Javadoc

1   package org.jcr_blog.domain;
2   
3   import org.jcr_blog.jcrmapping.PropertyConfiguration;
4   import static org.jcr_blog.persistence.JcrBlogNamespace.JCRBLOG_NAMESPACE_URI;
5   
6   /**
7    * Read-only short version of content used in all forms of listings, such as archive or search results.
8    * 
9    * @author Sebastian Prehn <sebastian.prehn@planetswebdesign.de>
10   */
11  public class ContentReference {
12  
13      @PropertyConfiguration(special= PropertyConfiguration.SpecialProperty.name)
14      private String name;
15      @PropertyConfiguration(special= PropertyConfiguration.SpecialProperty.path)
16      private String path;    
17      @PropertyConfiguration(namespace = JCRBLOG_NAMESPACE_URI)
18      private String title;
19      @PropertyConfiguration(namespace = JCRBLOG_NAMESPACE_URI)
20      private String teaser;
21  
22      //@PropertyConfiguration(name="jcr:score")
23      //private Integer score;
24  
25      public String getTeaser() {
26          return teaser;
27      }
28  
29      public String getTitle() {
30          return title;
31      }
32  
33      
34      /*public Integer getScore() {
35          return score;
36      }*/
37  
38      public String getName() {
39          return name;
40      }
41  
42      public String getPath() {
43          return path;
44      }
45      public boolean isPage() {
46          return "pages".equals(getPostsOrPages());
47      }
48      public boolean isPost() {
49          return "posts".equals(getPostsOrPages());
50      }
51      
52      private String getPostsOrPages() {
53          int end = path.lastIndexOf("/");
54          int start = path.lastIndexOf("/", end - 1);
55          return path.substring(start+1, end);
56      }
57      
58      
59  }