use of com.helger.photon.security.object.StubObject in project phase4 by phax.
the class PModeJsonConverter method getStubObject.
@Nonnull
public static StubObject getStubObject(@Nonnull final IJsonObject aElement) {
// ID
final String sID = aElement.getAsString(ATTR_ID);
// Creation
final LocalDateTime aCreationLDT = PDTWebDateHelper.getLocalDateTimeFromXSD(aElement.getAsString(ATTR_CREATIONLDT));
final String sCreationUserID = aElement.getAsString(ATTR_CREATIONUSERID);
// Last modification
final LocalDateTime aLastModificationLDT = PDTWebDateHelper.getLocalDateTimeFromXSD(aElement.getAsString(ATTR_LASTMODLDT));
final String sLastModificationUserID = aElement.getAsString(ATTR_LASTMODUSERID);
// Deletion
final LocalDateTime aDeletionLDT = PDTWebDateHelper.getLocalDateTimeFromXSD(aElement.getAsString(ATTR_DELETIONLDT));
final String sDeletionUserID = aElement.getAsString(ATTR_DELETIONUSERID);
final ICommonsOrderedMap<String, String> aCustomAttrs = new CommonsLinkedHashMap<>();
final IJsonArray aCustom = aElement.getAsArray(ELEMENT_CUSTOM);
if (aCustom != null)
for (final IJsonObject eCustom : aCustom.iteratorObjects()) aCustomAttrs.put(eCustom.getAsString(ATTR_ID), eCustom.getAsString(VALUE));
return new StubObject(sID, aCreationLDT, sCreationUserID, aLastModificationLDT, sLastModificationUserID, aDeletionLDT, sDeletionUserID, aCustomAttrs);
}
use of com.helger.photon.security.object.StubObject in project peppol-practical by phax.
the class TestEndpointMicroTypeConverter method convertToNative.
@Nonnull
public TestEndpoint convertToNative(@Nonnull final IMicroElement eValue) {
final StubObject aStubObject = getStubObject(eValue);
final String sCompanyName = eValue.getAttributeValue(ATTR_COMPANY_NAME);
final String sContactPerson = eValue.getAttributeValue(ATTR_CONTACT_PERSON);
final String sParticipantIDScheme = eValue.getAttributeValue(ATTR_PARTICIPANT_ID_ISSUER);
final String sParticipantIDValue = eValue.getAttributeValue(ATTR_PARTICIPANT_ID_VALUE);
final String sTransportProfile = eValue.getAttributeValue(ATTR_TRANSPORT_PROFILE);
final ESMPTransportProfile eTransportProfile = ESMPTransportProfile.getFromIDOrNull(sTransportProfile);
final String sSMLID = eValue.getAttributeValue(ATTR_SML);
final ISMLConfiguration aSMLInfo = PPMetaManager.getSMLConfigurationMgr().getSMLInfoOfID(sSMLID);
if (aSMLInfo == null)
throw new IllegalStateException("Failed to resolve SML with ID '" + sSMLID + "'");
// Create object
return new TestEndpoint(aStubObject, sCompanyName, sContactPerson, sParticipantIDScheme, sParticipantIDValue, eTransportProfile, aSMLInfo);
}
Aggregations