View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   
6   package com.hack23.cia.model.application.impl.common;
7   
8   import java.util.ArrayList;
9   import java.util.List;
10  
11  import javax.persistence.CascadeType;
12  import javax.persistence.DiscriminatorValue;
13  import javax.persistence.Entity;
14  import javax.persistence.FetchType;
15  import javax.persistence.OneToMany;
16  
17  import org.hibernate.annotations.Cache;
18  import org.hibernate.annotations.CacheConcurrencyStrategy;
19  
20  /***
21   * The Class Language.
22   */
23  @Entity
24  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
25  @DiscriminatorValue("Language")
26  public class Language extends AbstractAgencyConfiguration {
27  
28      /*** The Constant serialVersionUID. */
29      private static final long serialVersionUID = 1L;
30  
31      /*** The Constant SWEDISH_LANGUAGE_CODE. */
32      public static final String SWEDISH_LANGUAGE_CODE = "sv";
33  
34      /*** The language contents. */
35      private List<LanguageContent> languageContents = new ArrayList<LanguageContent>();
36  
37      /*** The short code. */
38      private String shortCode;
39      
40      /***
41       * Instantiates a new language.
42       */
43      public Language() {
44          super();
45          setResourceType(ResourceType.Language);
46      }
47  
48      /***
49       * Gets the language contents.
50       *
51       * @return the language contents
52       */
53      @OneToMany(mappedBy = "language", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
54      @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
55      public List<LanguageContent> getLanguageContents() {
56          return languageContents;
57      }
58  
59      /***
60       * Gets the short code.
61       *
62       * @return the short code
63       */
64      public String getShortCode() {
65          return shortCode;
66      }
67  
68      /***
69       * Sets the language contents.
70       *
71       * @param languageContents the new language contents
72       */
73      public void setLanguageContents(final List<LanguageContent> languageContents) {
74          this.languageContents = languageContents;
75      }
76  
77      /***
78       * Sets the short code.
79       *
80       * @param shortCode the new short code
81       */
82      public void setShortCode(final String shortCode) {
83          this.shortCode = shortCode;
84      }
85  
86  }