use of com.helger.json.JsonObject in project phive by phax.
the class PhiveJsonHelperTest method testValidationResults.
@Test
public void testValidationResults() {
final IJsonObject aObj = new JsonObject();
final Locale aDisplayLocale = Locale.US;
final VESID aVESID = new VESID("group", "art", "1.0");
final IValidationExecutorSet<?> aVES = new ValidationExecutorSet<>(aVESID, "name", false);
PhiveJsonHelper.applyValidationResultList(aObj, aVES, new CommonsArrayList<>(), aDisplayLocale, 123, null, null);
final String sJson = aObj.getAsJsonString();
assertEquals("{\"ves\":{\"vesid\":\"group:art:1.0\",\"name\":\"name\",\"deprecated\":false}," + "\"success\":true," + "\"interrupted\":false," + "\"mostSevereErrorLevel\":\"SUCCESS\"," + "\"results\":[]," + "\"durationMS\":123}", sJson);
}
use of com.helger.json.JsonObject in project phase4 by phax.
the class PModePropertyJsonConverter method convertToJson.
@Nonnull
public static IJsonObject convertToJson(@Nonnull final PModeProperty aValue) {
final IJsonObject ret = new JsonObject();
ret.add(NAME, aValue.getName());
if (aValue.hasDescription())
ret.add(DESCRIPTION, aValue.getDescription());
ret.add(DATA_TYPE, aValue.getDataType());
ret.add(MANDATORY, aValue.isMandatory());
return ret;
}
use of com.helger.json.JsonObject 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.JsonObject 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.JsonObject 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;
}
Aggregations