001// --------------------------------------------------------------------------------
002// Copyright 2002-2026 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016// Generated File -- DO NOT EDIT BY HAND
017// --------------------------------------------------------------------------------
018
019/**
020 * Language.java
021 */
022
023package com.echothree.model.data.party.server.entity;
024
025import com.echothree.model.data.party.common.pk.LanguagePK;
026
027import com.echothree.model.data.party.common.pk.LanguagePK;
028
029import com.echothree.model.data.party.server.value.LanguageValue;
030
031import com.echothree.model.data.party.server.factory.LanguageFactory;
032
033import com.echothree.util.common.exception.PersistenceException;
034import com.echothree.util.common.exception.PersistenceDatabaseException;
035import com.echothree.util.common.exception.PersistenceNotNullException;
036import com.echothree.util.common.exception.PersistenceReadOnlyException;
037
038import com.echothree.util.common.persistence.BasePK;
039
040import com.echothree.util.common.persistence.type.ByteArray;
041
042import com.echothree.util.server.persistence.BaseEntity;
043import com.echothree.util.server.persistence.EntityPermission;
044import com.echothree.util.server.persistence.Session;
045import com.echothree.util.server.persistence.ThreadSession;
046
047import java.io.Serializable;
048
049import javax.annotation.Nonnull;
050import javax.annotation.Nullable;
051
052public class Language
053        extends BaseEntity
054        implements Serializable {
055    
056    private LanguagePK _pk;
057    private LanguageValue _value;
058    
059    /** Creates a new instance of Language */
060    public Language()
061            throws PersistenceException {
062        super();
063    }
064    
065    /** Creates a new instance of Language */
066    public Language(LanguageValue value, EntityPermission entityPermission) {
067        super(entityPermission);
068        
069        _value = value;
070        _pk = value.getPrimaryKey();
071    }
072    
073    @Override
074    @Nonnull
075    public LanguageFactory getBaseFactoryInstance() {
076        return LanguageFactory.getInstance();
077    }
078    
079    @Override
080    public boolean hasBeenModified() {
081        return _value.hasBeenModified();
082    }
083    
084    @Override
085    public int hashCode() {
086        return _pk.hashCode();
087    }
088    
089    @Override
090    @Nonnull
091    public String toString() {
092        return _pk.toString();
093    }
094    
095    @Override
096    public boolean equals(Object other) {
097        if(this == other)
098            return true;
099        
100        if(other instanceof Language that) {
101            LanguageValue thatValue = that.getLanguageValue();
102            return _value.equals(thatValue);
103        } else {
104            return false;
105        }
106    }
107    
108    @Override
109    public void store()
110            throws PersistenceDatabaseException {
111        getBaseFactoryInstance().store(this);
112    }
113    
114    @Override
115    public void remove()
116            throws PersistenceDatabaseException {
117        getBaseFactoryInstance().remove(this);
118    }
119    
120    @Nonnull
121    public LanguageValue getLanguageValue() {
122        return _value;
123    }
124    
125    public void setLanguageValue(@Nonnull LanguageValue value)
126            throws PersistenceReadOnlyException {
127        checkReadWrite();
128        _value = value;
129    }
130    
131    @Override
132    @Nonnull
133    public LanguagePK getPrimaryKey() {
134        return _pk;
135    }
136    
137    @Nonnull
138    public String getLanguageIsoName() {
139        return _value.getLanguageIsoName();
140    }
141    
142    public void setLanguageIsoName(@Nonnull String languageIsoName)
143            throws PersistenceNotNullException, PersistenceReadOnlyException {
144        checkReadWrite();
145        _value.setLanguageIsoName(languageIsoName);
146    }
147    
148    public boolean getLanguageIsoNameHasBeenModified() {
149        return _value.getLanguageIsoNameHasBeenModified();
150    }
151    
152    @Nonnull
153    public Boolean getIsDefault() {
154        return _value.getIsDefault();
155    }
156    
157    public void setIsDefault(@Nonnull Boolean isDefault)
158            throws PersistenceNotNullException, PersistenceReadOnlyException {
159        checkReadWrite();
160        _value.setIsDefault(isDefault);
161    }
162    
163    public boolean getIsDefaultHasBeenModified() {
164        return _value.getIsDefaultHasBeenModified();
165    }
166    
167    @Nonnull
168    public Integer getSortOrder() {
169        return _value.getSortOrder();
170    }
171    
172    public void setSortOrder(@Nonnull Integer sortOrder)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setSortOrder(sortOrder);
176    }
177    
178    public boolean getSortOrderHasBeenModified() {
179        return _value.getSortOrderHasBeenModified();
180    }
181    
182}