Skip to content
Browse files
Fixed: Decrypt a field on embedded entity-view failed

When you tried to decrypt a field present on embedded entity-view, key use is the view name and not the final entity who contains this field.

You currently have the problem on PartyContactMechDetail where if you want to displaying the ftpPassword for a FtpAddress, the view failed and tried to use ContactMechDetail to decrypt instead of FtpAddress

To solve it, we iterate on the entity contains the field in the view while is an entity-view :

         -> ContactMechDetail.ftpPassword
              -> FtpAddress.ftpPassword
                   -> key found FtpAddress

git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed May 29, 2019
1 parent 5d2b8b9 commit 69d4c767ea6bebdb02f9528c614e299a9414a6c0
Showing with 6 additions and 3 deletions.
  1. +6 −3 framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/
@@ -569,11 +569,14 @@ public static void getValue(ResultSet rs, int ind, ModelField curField, GenericE

ModelEntity model = entity.getModelEntity();
String encryptionKeyName = entity.getEntityName();
if (curField.getEncryptMethod().isEncrypted() && model instanceof ModelViewEntity) {
while (curField.getEncryptMethod().isEncrypted() && model instanceof ModelViewEntity) {
ModelViewEntity modelView = (ModelViewEntity) model;
encryptionKeyName = modelView.getAliasedEntity(modelView.getAlias(curField.getName()).getEntityAlias(), entity.getDelegator().getModelReader()).getEntityName();
String entityName = modelView.getAliasedEntity(
modelView.getAlias(curField.getName()).getEntityAlias(), entity.getDelegator().getModelReader()
model = entity.getDelegator().getModelEntity(entityName);
String encryptionKeyName = model.getEntityName();

// ----- Try out the new handler code -----

0 comments on commit 69d4c76

Please sign in to comment.