Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve lookup for StepItem #20

Open
hvge opened this issue Apr 2, 2020 · 0 comments
Open

Improve lookup for StepItem #20

hvge opened this issue Apr 2, 2020 · 0 comments

Comments

@hvge
Copy link
Member

hvge commented Apr 2, 2020

We should change way how we get a result from ObjectStepLogger. Currently, there are many enumeration loops over the items array, just to get the right object. We can simplify this with using the brand new lookup by item-id. For example:

        // Verify decrypted activationId
        String activationId = null;
        ActivationRecovery activationRecovery = null;
        for (StepItem item: stepLoggerPrepare.getItems()) {
            if (item.getName().equals("Activation Done")) {
                Map<String, Object> responseMap = (Map<String, Object>) item.getObject();
                activationId = (String) responseMap.get("activationId");
                break;
            }
            if (item.getName().equals("Decrypted Layer 2 Response")) {
                activationRecovery = ((ActivationLayer2Response)item.getObject()).getActivationRecovery();
            }
        }

could be replaced with a much simpler code:

       // Verify decrypted activationId
        String activationId = (String)((Map<String, Object>)stepLoggerPrepare.getFirstItem("activation-create-activation-done").getObject()).get("activationId");
        ActivationRecovery activationRecovery = ((ActivationLayer2Response)stepLoggerPrepare.getFirstItem("activation-create-response-decrypt-inner").getObject()).getActivationRecovery();

This is a quite dull task, so it has a low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant