All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.mt.subscription.json.SubscriptionPayload Maven / Gradle / Ivy

There is a newer version: 3.3.1
Show newest version
/*******************************************************************************
 *   © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved.
 ******************************************************************************/
package com.sap.cloud.mt.subscription.json;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.HashMap;
import java.util.Map;

@JsonIgnoreProperties(ignoreUnknown = true)

public class SubscriptionPayload extends AbstractTenantLcmPayload {
	public static final String SUBSCRIPTION_PARAMS = "subscriptionParams";
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	public Map subscriptionParams = new HashMap<>(); //NOSONAR
	public String subscribedLicenseType; //NOSONAR
	public String eventType;//NOSONAR
	public SubscriptionPayloadAddInfo additionalInformation;//NOSONAR

	public SubscriptionPayload() {
		super();
	}

	public SubscriptionPayload(Map map) {
		super(map);
	}

	@Override
	protected void fillAttributesFromMap() {
		super.fillAttributesFromMap();
		subscribedLicenseType = (String) map.get("subscribedLicenseType");
		eventType = (String) map.get("eventType");
		if (map.get("additionalInformation") != null) {
			var addInfoMap = (Map) map.get("additionalInformation");
			additionalInformation = new SubscriptionPayloadAddInfo();
			additionalInformation.clientid = (String) addInfoMap.get("clientid");
			additionalInformation.clientsecret = (String) addInfoMap.get("clientsecret");
			additionalInformation.tokenurl = (String) addInfoMap.get("tokenurl");
		}
		if (map.get(SUBSCRIPTION_PARAMS) != null && !((Map) map.get(SUBSCRIPTION_PARAMS)).isEmpty()) {
			if (subscriptionParams == null) {
				subscriptionParams = new HashMap<>();
			}
			subscriptionParams.putAll((Map) map.get(SUBSCRIPTION_PARAMS));
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy