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 * BaseEncryptionKey.java 021 */ 022 023package com.echothree.model.data.core.server.entity; 024 025import com.echothree.model.data.core.common.pk.BaseEncryptionKeyPK; 026 027import com.echothree.model.data.core.common.pk.BaseEncryptionKeyPK; 028 029import com.echothree.model.data.core.server.value.BaseEncryptionKeyValue; 030 031import com.echothree.model.data.core.server.factory.BaseEncryptionKeyFactory; 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 BaseEncryptionKey 053 extends BaseEntity 054 implements Serializable { 055 056 private BaseEncryptionKeyPK _pk; 057 private BaseEncryptionKeyValue _value; 058 059 /** Creates a new instance of BaseEncryptionKey */ 060 public BaseEncryptionKey() 061 throws PersistenceException { 062 super(); 063 } 064 065 /** Creates a new instance of BaseEncryptionKey */ 066 public BaseEncryptionKey(BaseEncryptionKeyValue value, EntityPermission entityPermission) { 067 super(entityPermission); 068 069 _value = value; 070 _pk = value.getPrimaryKey(); 071 } 072 073 @Override 074 @Nonnull 075 public BaseEncryptionKeyFactory getBaseFactoryInstance() { 076 return BaseEncryptionKeyFactory.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 BaseEncryptionKey that) { 101 BaseEncryptionKeyValue thatValue = that.getBaseEncryptionKeyValue(); 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 BaseEncryptionKeyValue getBaseEncryptionKeyValue() { 122 return _value; 123 } 124 125 public void setBaseEncryptionKeyValue(@Nonnull BaseEncryptionKeyValue value) 126 throws PersistenceReadOnlyException { 127 checkReadWrite(); 128 _value = value; 129 } 130 131 @Override 132 @Nonnull 133 public BaseEncryptionKeyPK getPrimaryKey() { 134 return _pk; 135 } 136 137 @Nonnull 138 public String getBaseEncryptionKeyName() { 139 return _value.getBaseEncryptionKeyName(); 140 } 141 142 public void setBaseEncryptionKeyName(@Nonnull String baseEncryptionKeyName) 143 throws PersistenceNotNullException, PersistenceReadOnlyException { 144 checkReadWrite(); 145 _value.setBaseEncryptionKeyName(baseEncryptionKeyName); 146 } 147 148 public boolean getBaseEncryptionKeyNameHasBeenModified() { 149 return _value.getBaseEncryptionKeyNameHasBeenModified(); 150 } 151 152 @Nonnull 153 public String getSha1Hash() { 154 return _value.getSha1Hash(); 155 } 156 157 public void setSha1Hash(@Nonnull String sha1Hash) 158 throws PersistenceNotNullException, PersistenceReadOnlyException { 159 checkReadWrite(); 160 _value.setSha1Hash(sha1Hash); 161 } 162 163 public boolean getSha1HashHasBeenModified() { 164 return _value.getSha1HashHasBeenModified(); 165 } 166 167}