class SDNCLcmPayloadBuilder {

    public static UpgradePreCheckPayload buildUpgradePreCheckPayload(DelegateExecution execution) {
        String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));

        UpgradePreCheckPayload upgradePreCheckPayload = new UpgradePreCheckPayload();

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

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

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

        String ruleName = JsonUtils.getJsonValue(requestPayload, "preCheckRuleName");
        upgradePreCheckPayload.setRuleName(ruleName);

        String additionalData = JsonUtils.getJsonValue(requestPayload, "preCheckAdditionalData");
        upgradePreCheckPayload.setAdditionalData(additionalData);

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

        return upgradePreCheckPayload;
    }

}