Skip to content

Commit

Permalink
Merge pull request #1026 from SarafrazAhamad/main
Browse files Browse the repository at this point in the history
[HAL-1952] Adding String constants in ExpressionEncryptor class.
  • Loading branch information
hpehl authored Dec 4, 2023
2 parents 397d5ee + 106ed8a commit f5064a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@
import com.google.web.bindery.event.shared.EventBus;

import static org.jboss.hal.dmr.ModelDescriptionConstants.CHILD_TYPE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.CREATE_EXPRESSION;
import static org.jboss.hal.dmr.ModelDescriptionConstants.DEFAULT_RESOLVER;
import static org.jboss.hal.dmr.ModelDescriptionConstants.ENCRYPTION;
import static org.jboss.hal.dmr.ModelDescriptionConstants.EXPRESSION;
import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
import static org.jboss.hal.dmr.ModelDescriptionConstants.READ_CHILDREN_RESOURCES_OPERATION;
import static org.jboss.hal.dmr.ModelDescriptionConstants.RESOLVERS;



public class ExpressionEncryptor implements EncryptExpressionEvent.EncryptExpressionHandler {

private static final ResourceAddress ELYTRON_ADDRESS = ResourceAddress.from("subsystem=elytron");

private static final ResourceAddress EXPRESSION_ADDRESS = ResourceAddress.from("subsystem=elytron/expression=encryption");

private final EventBus eventBus;
Expand Down Expand Up @@ -86,7 +89,7 @@ public void onEncryptExpression(final EncryptExpressionEvent event) {
List<String> resolverNames = result.get(ENCRYPTION).get(RESOLVERS)
.asList().stream().map(r -> r.get(NAME).asString())
.collect(Collectors.toList());
boolean hasDefaultResolver = result.hasDefined("default-resolver");
boolean hasDefaultResolver = result.hasDefined(DEFAULT_RESOLVER);
showDialog(resolverNames, hasDefaultResolver);
},
(op1, error) -> showEmptyDialog());
Expand All @@ -102,7 +105,7 @@ private void showEmptyDialog() {

void saveEncryption(ModelNode payload) {

Operation operation = new Operation.Builder(EXPRESSION_ADDRESS, "create-expression")
Operation operation = new Operation.Builder(EXPRESSION_ADDRESS, CREATE_EXPRESSION)
.payload(payload)
.build();
dispatcher.execute(operation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public interface ModelDescriptionConstants {
String CREATE_ACCOUNT = "create-account";
String CREATE_ADDRESS = "createAddress"; // no typo!
String CREATE_DURABLE_QUEUE = "create-durable-queue";
String CREATE_EXPRESSION = "create-expression";
String CREATE_NON_DURABLE_QUEUE = "create-non-durable-queue";
String CREATE_TIME = "create-time";
String CREATION_TIME = "creation-time";
Expand Down Expand Up @@ -251,6 +252,7 @@ public interface ModelDescriptionConstants {
String DEFAULT_JOB_REPOSITORY = "default-job-repository";
String DEFAULT_REALM = "default-realm";
String DEFAULT_REMOTE_CLUSTER = "default-remote-cluster";
String DEFAULT_RESOLVER = "default-resolver";
String DEFAULT_SECURITY_DOMAIN = "default-security-domain";
String DEFAULT_SFSB_CACHE = "default-sfsb-cache";
String DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE = "default-sfsb-passivation-disabled-cache";
Expand Down

0 comments on commit f5064a5

Please sign in to comment.