/* * * Copyright (C) 2007-2015 Licensed to the Comunes Association (CA) under * one or more contributor license agreements (see COPYRIGHT for details). * The CA licenses this file to you under the GNU Affero General Public * License version 3, (the "License"); you may not use this file except in * compliance with the License. This file is part of kune. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package cc.kune.domain; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Pattern; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.search.annotations.DocumentId; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Index; import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.Store; import org.hibernate.validator.constraints.Length; import cc.kune.domain.utils.HasId; // TODO: Auto-generated Javadoc /** * GlobalizeLanguages generated by hbm2java from original rails globalize schema * * http://en.wikipedia.org/wiki/Calendar_date * http://en.wikipedia.org/wiki/Date_and_time_notation_by_country * * @author vjrj@ourproject.org (Vicente J. Ruiz Jurado) */ @Entity @Indexed @Table(name = "globalize_languages") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class I18nLanguage implements HasId { /** The code. */ @org.hibernate.annotations.Index(name = "code") @Field(index = Index.YES, store = Store.NO) @Column(name = "code", unique = true) private String code; /** The date format. */ @Column(name = "date_format") private String dateFormat; /** The date format short. */ @Column(name = "date_format_short") private String dateFormatShort; /** The direction. */ @Column(name = "direction") private String direction; /** The english name. */ @org.hibernate.annotations.Index(name = "english_name") @Field(index = Index.YES, store = Store.NO) @Column(name = "english_name") private String englishName; /** The english name locale. */ @Column(name = "english_name_locale") private String englishNameLocale; /** The english name modifier. */ @Column(name = "english_name_modifier") private String englishNameModifier; /** The id. */ @Id // Is not GeneratedValue @DocumentId @Column(name = "id", unique = true, nullable = false) private Long id; /** The iso6391. */ @Column(name = "iso_639_1", length = 2) private String iso6391; /** The iso6392. */ @Column(name = "iso_639_2", length = 3, unique = true) private String iso6392; /** The iso6393. */ @Column(name = "iso_639_3", length = 3, unique = true) private String iso6393; /** The macro language. */ @Basic @Column(name = "macro_language", columnDefinition = "BIT", length = 1) private Boolean macroLanguage; /** The native name. */ @Field(index = Index.YES, store = Store.NO) @Column(name = "native_name") private String nativeName; /** The native name locale. */ @Column(name = "native_name_locale") private String nativeNameLocale; /** The native name modifier. */ @Column(name = "native_name_modifier") private String nativeNameModifier; /** The pluralization. */ @Pattern(regexp = "^[c=\\d?:%!<>&|() ]+$") @Column(name = "pluralization") @Length(max = 200) private String pluralization; /** The rfc3066. */ @Column(name = "rfc_3066", unique = true) private String rfc3066; /** The scope. */ @Column(name = "scope", length = 1) private String scope; /** * Instantiates a new i18n language. */ public I18nLanguage() { this(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); } // Only for tests /** * Instantiates a new i18n language. * * @param id * the id * @param englishName * the english name * @param nativeName * the native name * @param code * the code */ public I18nLanguage(final Long id, final String englishName, final String nativeName, final String code) { this.id = id; this.englishName = englishName; this.nativeName = nativeName; this.code = code; } // code is iso6391 || iso6392 || rfc3306 (see DatabaseInicializer) /** * Instantiates a new i18n language. * * @param id * the id * @param code * the code * @param direction * the direction * @param englishName * the english name * @param englishNameLocale * the english name locale * @param englishNameModifier * the english name modifier * @param iso6391 * the iso6391 * @param iso6392 * the iso6392 * @param iso6393 * the iso6393 * @param macroLanguage * the macro language * @param nativeName * the native name * @param nativeNameLocale * the native name locale * @param nativeNameModifier * the native name modifier * @param pluralization * the pluralization * @param rfc3066 * the rfc3066 * @param scope * the scope * @param dateFormat * the date format */ public I18nLanguage(final Long id, final String code, final String direction, final String englishName, final String englishNameLocale, final String englishNameModifier, final String iso6391, final String iso6392, final String iso6393, final Boolean macroLanguage, final String nativeName, final String nativeNameLocale, final String nativeNameModifier, final String pluralization, final String rfc3066, final String scope, final String dateFormat) { this.id = id; this.iso6391 = iso6391; this.iso6392 = iso6392; this.iso6393 = iso6393; this.rfc3066 = rfc3066; this.englishName = englishName; this.englishNameLocale = englishNameLocale; this.englishNameModifier = englishNameModifier; this.nativeName = nativeName; this.nativeNameLocale = nativeNameLocale; this.nativeNameModifier = nativeNameModifier; this.macroLanguage = macroLanguage; this.direction = direction; this.pluralization = pluralization; this.scope = scope; this.code = code; this.dateFormat = dateFormat; } /** * Gets the code. * * @return the code */ public String getCode() { return code; } /** * Gets the date format. * * @return the date format */ public String getDateFormat() { return dateFormat; } /** * Gets the date format short. * * @return the date format short */ public String getDateFormatShort() { return dateFormatShort; } /** * Gets the direction. * * @return the direction */ public String getDirection() { return this.direction; } /** * Gets the english name. * * @return the english name */ public String getEnglishName() { return this.englishName; } /** * Gets the english name locale. * * @return the english name locale */ public String getEnglishNameLocale() { return this.englishNameLocale; } /** * Gets the english name modifier. * * @return the english name modifier */ public String getEnglishNameModifier() { return this.englishNameModifier; } /* * (non-Javadoc) * * @see cc.kune.domain.utils.HasId#getId() */ @Override public Long getId() { return this.id; } /** * Gets the iso6391. * * @return the iso6391 */ public String getIso6391() { return this.iso6391; } /** * Gets the iso6392. * * @return the iso6392 */ public String getIso6392() { return this.iso6392; } /** * Gets the iso6393. * * @return the iso6393 */ public String getIso6393() { return this.iso6393; } /** * Gets the macro language. * * @return the macro language */ public Boolean getMacroLanguage() { return this.macroLanguage; } /** * Gets the native name. * * @return the native name */ public String getNativeName() { return this.nativeName; } /** * Gets the native name locale. * * @return the native name locale */ public String getNativeNameLocale() { return this.nativeNameLocale; } /** * Gets the native name modifier. * * @return the native name modifier */ public String getNativeNameModifier() { return this.nativeNameModifier; } /** * Gets the pluralization. * * @return the pluralization */ public String getPluralization() { return this.pluralization; } /** * Gets the rfc3066. * * @return the rfc3066 */ public String getRfc3066() { return this.rfc3066; } /** * Gets the scope. * * @return the scope */ public String getScope() { return this.scope; } /** * Sets the code. * * @param code * the new code */ @Column(unique = true) public void setCode(final String code) { this.code = code; } /** * Sets the date format. * * @param dateFormat * the new date format */ public void setDateFormat(final String dateFormat) { this.dateFormat = dateFormat; } /** * Sets the date format short. * * @param dateFormatShort * the new date format short */ public void setDateFormatShort(final String dateFormatShort) { this.dateFormatShort = dateFormatShort; } /** * Sets the direction. * * @param direction * the new direction */ public void setDirection(final String direction) { this.direction = direction; } /** * Sets the english name. * * @param englishName * the new english name */ public void setEnglishName(final String englishName) { this.englishName = englishName; } /** * Sets the english name locale. * * @param englishNameLocale * the new english name locale */ public void setEnglishNameLocale(final String englishNameLocale) { this.englishNameLocale = englishNameLocale; } /** * Sets the english name modifier. * * @param englishNameModifier * the new english name modifier */ public void setEnglishNameModifier(final String englishNameModifier) { this.englishNameModifier = englishNameModifier; } /* * (non-Javadoc) * * @see cc.kune.domain.utils.HasId#setId(java.lang.Long) */ @Override public void setId(final Long id) { this.id = id; } /** * Sets the iso6391. * * @param iso6391 * the new iso6391 */ public void setIso6391(final String iso6391) { this.iso6391 = iso6391; } /** * Sets the iso6392. * * @param iso6392 * the new iso6392 */ public void setIso6392(final String iso6392) { this.iso6392 = iso6392; } /** * Sets the iso6393. * * @param iso6393 * the new iso6393 */ public void setIso6393(final String iso6393) { this.iso6393 = iso6393; } /** * Sets the macro language. * * @param macroLanguage * the new macro language */ public void setMacroLanguage(final Boolean macroLanguage) { this.macroLanguage = macroLanguage; } /** * Sets the native name. * * @param nativeName * the new native name */ public void setNativeName(final String nativeName) { this.nativeName = nativeName; } /** * Sets the native name locale. * * @param nativeNameLocale * the new native name locale */ public void setNativeNameLocale(final String nativeNameLocale) { this.nativeNameLocale = nativeNameLocale; } /** * Sets the native name modifier. * * @param nativeNameModifier * the new native name modifier */ public void setNativeNameModifier(final String nativeNameModifier) { this.nativeNameModifier = nativeNameModifier; } /** * Sets the pluralization. * * @param pluralization * the new pluralization */ public void setPluralization(final String pluralization) { this.pluralization = pluralization; } /** * Sets the rfc3066. * * @param rfc3066 * the new rfc3066 */ public void setRfc3066(final String rfc3066) { this.rfc3066 = rfc3066; } /** * Sets the scope. * * @param scope * the new scope */ public void setScope(final String scope) { this.scope = scope; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "I18nLanguage[" + englishName + "]"; } }