com.sap.cloud.mt.subscription.SubscriptionPayloadAccessForSMS Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-tenant-subscription Show documentation
Show all versions of multi-tenant-subscription Show documentation
Spring Boot Enablement Parent
/*******************************************************************************
* © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved.
******************************************************************************/
package com.sap.cloud.mt.subscription;
import java.util.Map;
public class SubscriptionPayloadAccessForSMS implements SubscriptionPayloadAccess {
public static final String SUBSCRIBER = "subscriber";
public static final String GLOBAL_ACCOUNT_ID = "globalAccountId";
public static final String SUBACCOUNT_ID = "subaccountId";
public static final String ROOT_APPLICATION = "rootApplication";
public static final String APP_NAME = "appName";
public static final String EVENT_TYPE = "eventType";
public static final String SUBACCOUNT_SUBDOMAIN = "subaccountSubdomain";
private final Map payload;
public SubscriptionPayloadAccessForSMS(Map payload) {
this.payload = payload;
}
@Override
public String getGlobalAccountId() {
Map subscriber;
if (payload.containsKey(SUBSCRIBER)) {
subscriber = (Map) payload.get(SUBSCRIBER);
} else {
return "";
}
return subscriber.containsKey(GLOBAL_ACCOUNT_ID) ? (String) subscriber.get(GLOBAL_ACCOUNT_ID) : "";
}
@Override
public String getSubAccountId() {
Map subscriber;
if (payload.containsKey(SUBSCRIBER)) {
subscriber = (Map) payload.get(SUBSCRIBER);
} else {
return "";
}
return subscriber.containsKey(SUBACCOUNT_ID) ? (String) subscriber.get(SUBACCOUNT_ID) : "";
}
@Override
public String getApplicationName() {
Map rootApplication;
if (payload.containsKey(ROOT_APPLICATION)) {
rootApplication = (Map) payload.get(ROOT_APPLICATION);
} else {
return "";
}
return rootApplication.containsKey(APP_NAME) ? (String) rootApplication.get(APP_NAME) : "";
}
@Override
public String getSubDomain() {
Map subscriber;
if (payload.containsKey(SUBSCRIBER)) {
subscriber = (Map) payload.get(SUBSCRIBER);
} else {
return "";
}
return subscriber.containsKey(SUBACCOUNT_SUBDOMAIN) ? (String) subscriber.get(SUBACCOUNT_SUBDOMAIN) : "";
}
@Override
public String getEventType() {
return payload.containsKey(EVENT_TYPE) ? (String) payload.get(EVENT_TYPE) : "";
}
}