class SDNCLcmPayloadBuilder {

    public static UpgradePostCheckPayload buildUpgradePostCheckPayload(DelegateExecution execution) {
        String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));

        UpgradePostCheckPayload upgradePostCheckPayload = new UpgradePostCheckPayload();

        String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam");
        upgradePostCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);

        String oldSwVersion = JsonUtils.getJsonValue(requestPayload, "oldSwVersion");
        upgradePostCheckPayload.setOldSwVersion(oldSwVersion);

        String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION));
        if (targetSwVersion == null) {
            targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion");
        }
        upgradePostCheckPayload.setTargetSwVersion(targetSwVersion);

        String ruleName = JsonUtils.getJsonValue(requestPayload, "postCheckRuleName");
        upgradePostCheckPayload.setRuleName(ruleName);

        String additionalData = JsonUtils.getJsonValue(requestPayload, "postCheckAdditionalData");
        upgradePostCheckPayload.setAdditionalData(additionalData);

        String playbookName = JsonUtils.getJsonValue(requestPayload, "postCheckPlaybook");
        if (playbookName != null) {
            upgradePostCheckPayload.setPlaybookName(playbookName);
        }

        return upgradePostCheckPayload;
    }

}