use of com.helger.json.IJsonObject in project phase4 by phax.
the class PModeLegJsonConverter method convertToNative.
@Nonnull
public static PModeLeg convertToNative(@Nonnull final IJsonObject aElement) {
final IJsonObject aProt = aElement.getAsObject(PROTOCOL);
final PModeLegProtocol aProtocol = aProt == null ? null : PModeLegProtocolJsonConverter.convertToNative(aProt);
final IJsonObject aBI = aElement.getAsObject(BUSINESS_INFORMATION);
final PModeLegBusinessInformation aBusinessInformation = aBI == null ? null : PModeLegBusinessInformationJsonConverter.convertToNative(aBI);
final IJsonObject aEH = aElement.getAsObject(ERROR_HANDLING);
final PModeLegErrorHandling aErrorHandling = aEH == null ? null : PModeLegErrorHandlingJsonConverter.convertToNative(aEH);
final IJsonObject aR = aElement.getAsObject(RELIABILITY);
final PModeLegReliability aReliability = aR == null ? null : PModeLegReliabilityJsonConverter.convertToNative(aR);
final IJsonObject aS = aElement.getAsObject(SECURITY);
final PModeLegSecurity aSecurity = aS == null ? null : PModeLegSecurityJsonConverter.convertToNative(aS);
return new PModeLeg(aProtocol, aBusinessInformation, aErrorHandling, aReliability, aSecurity);
}
use of com.helger.json.IJsonObject in project phase4 by phax.
the class PModePartyJsonConverter method convertToJson.
@Nonnull
public static IJsonObject convertToJson(@Nonnull final PModeParty aValue) {
final IJsonObject ret = new JsonObject();
if (aValue.hasIDType())
ret.add(ID_TYPE, aValue.getIDType());
ret.add(ID_VALUE, aValue.getIDValue());
ret.add(ROLE, aValue.getRole());
if (aValue.hasUserName())
ret.add(USER_NAME, aValue.getUserName());
if (aValue.hasPassword())
ret.add(PASSWORD, aValue.getPassword());
return ret;
}
use of com.helger.json.IJsonObject in project phase4 by phax.
the class PModeReceptionAwarenessJsonConverter method convertToJson.
@Nonnull
public static IJsonObject convertToJson(@Nonnull final PModeReceptionAwareness aValue) {
final IJsonObject ret = new JsonObject();
if (aValue.isReceptionAwarenessDefined())
ret.add(RECEPTION_AWARENESS, aValue.isReceptionAwareness());
if (aValue.isRetryDefined())
ret.add(RETRY, aValue.isRetry());
ret.add(MAX_RETRIES, aValue.getMaxRetries());
ret.add(RETRY_INTERVAL_MS, aValue.getRetryIntervalMS());
if (aValue.isDuplicateDetectionDefined())
ret.add(DUPLICATE_DETECTION, aValue.isDuplicateDetection());
return ret;
}
use of com.helger.json.IJsonObject in project phase4 by phax.
the class PModeJsonConverter method convertToJson.
@Nonnull
public static IJsonObject convertToJson(@Nonnull final IPMode aValue) {
final IJsonObject ret = new JsonObject();
setObjectFields(aValue, ret);
if (aValue.hasInitiator())
ret.addJson(ELEMENT_INITIATOR, PModePartyJsonConverter.convertToJson(aValue.getInitiator()));
if (aValue.hasResponder())
ret.addJson(ELEMENT_RESPONDER, PModePartyJsonConverter.convertToJson(aValue.getResponder()));
if (aValue.hasAgreement())
ret.add(ATTR_AGREEMENT, aValue.getAgreement());
ret.add(ATTR_MEP, aValue.getMEPID());
ret.add(ATTR_MEP_BINDING, aValue.getMEPBindingID());
if (aValue.hasLeg1())
ret.addJson(ELEMENT_LEG1, PModeLegJsonConverter.convertToJson(aValue.getLeg1()));
if (aValue.hasLeg2())
ret.addJson(ELEMENT_LEG2, PModeLegJsonConverter.convertToJson(aValue.getLeg2()));
if (aValue.hasPayloadService())
ret.addJson(ELEMENT_PAYLOADSERVICE, PModePayloadServiceJsonConverter.convertToJson(aValue.getPayloadService()));
if (aValue.hasReceptionAwareness())
ret.addJson(ELEMENT_RECEPETIONAWARENESS, PModeReceptionAwarenessJsonConverter.convertToJson(aValue.getReceptionAwareness()));
return ret;
}
use of com.helger.json.IJsonObject in project phase4 by phax.
the class PModeLegBusinessInformationJsonConverter method convertToNative.
@Nonnull
public static PModeLegBusinessInformation convertToNative(@Nonnull final IJsonObject aElement) {
final String sService = aElement.getAsString(SERVICE);
final String sServiceType = aElement.getAsString(SERVICE_TYPE);
final String sAction = aElement.getAsString(ACTION);
final ICommonsOrderedMap<String, PModeProperty> aProperties = new CommonsLinkedHashMap<>();
final IJsonArray aProps = aElement.getAsArray(PROPERTIES);
if (aProps != null)
for (final IJsonObject aPropertyElement : aProps.iteratorObjects()) {
final PModeProperty aProperty = PModePropertyJsonConverter.convertToNative(aPropertyElement);
aProperties.put(aProperty.getName(), aProperty);
}
final ICommonsOrderedMap<String, PModePayloadProfile> aPayloadProfiles = new CommonsLinkedHashMap<>();
final IJsonArray aPayloadProfs = aElement.getAsArray(PAYLOAD_PROFILE);
if (aPayloadProfs != null)
for (final IJsonObject aPayloadElement : aPayloadProfs.iteratorObjects()) {
final PModePayloadProfile aPayloadProfile = PModePayloadProfileJsonConverter.convertToNative(aPayloadElement);
aPayloadProfiles.put(aPayloadProfile.getName(), aPayloadProfile);
}
final Long aPayloadProfileMaxKB = aElement.getAsLongObj(PAYLOAD_PROFILE_MAX_KB);
final String sMPCID = aElement.getAsString(MPCID);
return new PModeLegBusinessInformation(sService, sServiceType, sAction, aProperties, aPayloadProfiles, aPayloadProfileMaxKB, sMPCID);
}
Aggregations