package org.expeditee.encryption.items.surrogates; public class EncryptionDetail { private Type type; private String undecipheredValue; public EncryptionDetail(Type type) { this.type = type; } public EncryptionDetail setUndecipheredValue(String undecipheredValue) { this.undecipheredValue = undecipheredValue; return this; } public String getUndecipheredValue() { return undecipheredValue; } public Type getEncryptionDetailType() { return type; } @Override public EncryptionDetail clone() { EncryptionDetail copy = new EncryptionDetail(this.type); copy.setUndecipheredValue(this.undecipheredValue); return copy; } public enum Type { // If the property needs to be unencrypted due to inheritance then do not try to encrypt it. UnencryptedOnSave, // If the property is not inherited by any surrogates then we can try to encrypt it. // If we do not have key then default to UnencryptedOnSave. ReencryptOnSave, // If the property is no longer inherited by at least one surrogate then this value is present. // If it turns out there is no longer any surrogates who inherit the value then this value can be replaced with ReencryptOnSave. // Otherwise, this value must be replaced with UnencryptedOnSave. InheritanceCheckOnSave, // If we could not decrypt the value on load then EncryptionDetail.getUndecipheredValue() can be used to get the value for saving. UseUndecipheredValueOnSave; } }