@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof Scheme)) return false; Scheme that = (Scheme) o; return Objects.equals(identifier, that.getIdentifier()); }
public static ParticipantIdentifier parse(String str) throws PeppolParsingException { String[] parts = str.split("::", 2); if (parts.length != 2) throw new PeppolParsingException(String.format("Unable to parse participant identifier '%s'.", str)); return of(parts[1], Scheme.of(parts[0])); }
public static ProcessIdentifier parse(String str) throws PeppolParsingException { String[] parts = str.split("::", 2); if (parts.length != 2) throw new PeppolParsingException(String.format("Unable to parse process identifier '%s'.", str)); return of(parts[1], Scheme.of(parts[0])); }
@Override public String urlencoded() { return ModelUtils.urlencode("%s::%s", scheme.getIdentifier(), identifier); } }
public static DocumentTypeIdentifier parse(String str) throws PeppolParsingException { String[] parts = str.split("::", 2); if (parts.length != 2) throw new PeppolParsingException(String.format("Unable to parse document type identifier '%s'.", str)); return of(parts[1], Scheme.of(parts[0])); }
public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { // Create digest based on participant identifier. MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); // Create hex of digest. receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } }
public static ParticipantIdentifier readElectronicAddressType(AttributedElectronicAddressType o) { return ParticipantIdentifier.of(o.getValue(), Scheme.of(o.getScheme())); }
static Scope createScope(ProcessIdentifier processIdentifier) { Scope scope = new Scope(); scope.setType("PROCESSID"); scope.setInstanceIdentifier(processIdentifier.getIdentifier()); if (!processIdentifier.getScheme().equals(ProcessIdentifier.DEFAULT_SCHEME)) scope.setIdentifier(processIdentifier.getScheme().getIdentifier()); return scope; }
@SuppressWarnings("all") @Override public List<ServiceReference> parseServiceGroup(FetcherResponse fetcherResponse) throws LookupException { try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); ServiceGroupType serviceGroup = unmarshaller.unmarshal( XmlUtils.streamReader(fetcherResponse.getInputStream()), ServiceGroupType.class).getValue(); List<ServiceReference> serviceReferences = new ArrayList<>(); for (ServiceMetadataReferenceType reference : serviceGroup.getServiceMetadataReferenceCollection().getServiceMetadataReference()) { String hrefDocumentTypeIdentifier = URLDecoder.decode(reference.getHref(), "UTF-8").split("/services/")[1]; String[] parts = hrefDocumentTypeIdentifier.split("::", 2); try { serviceReferences.add(ServiceReference.of(DocumentTypeIdentifierWithUri.of( parts[1], Scheme.of(parts[0]), URI.create(reference.getHref())))); } catch (ArrayIndexOutOfBoundsException e) { LOGGER.warn("Unable to parse '{}'.", hrefDocumentTypeIdentifier); } } return serviceReferences; } catch (JAXBException | XMLStreamException | UnsupportedEncodingException e) { throw new LookupException(e.getMessage(), e); } }
public static AttributedElectronicAddressType createElectronicAddressType(ParticipantIdentifier participant) { AttributedElectronicAddressType o = new AttributedElectronicAddressType(); o.setValue(participant.getIdentifier()); o.setScheme(participant.getScheme().getIdentifier()); return o; }
@SuppressWarnings("all") @Override public List<ServiceReference> parseServiceGroup(FetcherResponse fetcherResponse) throws LookupException { try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); ServiceGroupType serviceGroup = unmarshaller.unmarshal( XmlUtils.streamReader(fetcherResponse.getInputStream()), ServiceGroupType.class).getValue(); List<ServiceReference> serviceReferences = new ArrayList<>(); for (ServiceMetadataReferenceType reference : serviceGroup.getServiceMetadataReferenceCollection().getServiceMetadataReference()) { String hrefDocumentTypeIdentifier = URLDecoder.decode(reference.getHref(), "UTF-8").split("/services/")[1]; String[] parts = hrefDocumentTypeIdentifier.split("::", 2); try { serviceReferences.add(ServiceReference.of(DocumentTypeIdentifierWithUri.of( parts[1], Scheme.of(parts[0]), URI.create(reference.getHref())))); } catch (ArrayIndexOutOfBoundsException e) { LOGGER.warn("Unable to parse '{}'.", hrefDocumentTypeIdentifier); } } return serviceReferences; } catch (JAXBException | XMLStreamException | UnsupportedEncodingException e) { throw new LookupException(e.getMessage(), e); } }
static Scope createScope(DocumentTypeIdentifier documentTypeIdentifier) { Scope scope = new Scope(); scope.setType("DOCUMENTID"); scope.setInstanceIdentifier(documentTypeIdentifier.getIdentifier()); if (!documentTypeIdentifier.getScheme().equals(DocumentTypeIdentifier.DEFAULT_SCHEME)) scope.setIdentifier(documentTypeIdentifier.getScheme().getIdentifier()); return scope; }
@SuppressWarnings("all") @Override public List<ServiceReference> parseServiceGroup(FetcherResponse fetcherResponse) throws LookupException { try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); ServiceGroupType serviceGroup = unmarshaller.unmarshal( XmlUtils.streamReader(fetcherResponse.getInputStream()), ServiceGroupType.class).getValue(); List<ServiceReference> serviceReferences = new ArrayList<>(); for (ServiceMetadataReferenceType reference : serviceGroup.getServiceMetadataReferenceCollection().getServiceMetadataReference()) { String hrefDocumentTypeIdentifier = URLDecoder.decode(reference.getHref(), "UTF-8").split("/services/")[1]; String[] parts = hrefDocumentTypeIdentifier.split("::", 2); try { serviceReferences.add(ServiceReference.of(DocumentTypeIdentifierWithUri.of( parts[1], Scheme.of(parts[0]), URI.create(reference.getHref())))); } catch (ArrayIndexOutOfBoundsException e) { LOGGER.warn("Unable to parse '{}'.", hrefDocumentTypeIdentifier); } } return serviceReferences; } catch (JAXBException | XMLStreamException | UnsupportedEncodingException e) { throw new LookupException(e.getMessage(), e); } }
static Partner createPartner(ParticipantIdentifier participant) { PartnerIdentification partnerIdentification = new PartnerIdentification(); partnerIdentification.setAuthority(participant.getScheme().getIdentifier()); partnerIdentification.setValue(participant.getIdentifier()); Partner partner = new Partner(); partner.setIdentifier(partnerIdentification); return partner; }
ProcessIdentifier.of( processType.getProcessIdentifier().getValue(), Scheme.of(processType.getProcessIdentifier().getScheme()) ), endpoints ParticipantIdentifier.of( serviceInformation.getParticipantIdentifier().getValue(), Scheme.of(serviceInformation.getParticipantIdentifier().getScheme()) ), DocumentTypeIdentifier.of( serviceInformation.getDocumentIdentifier().getValue(), Scheme.of(serviceInformation.getDocumentIdentifier().getScheme()) ), processMetadatas
ProcessIdentifier.of( processType.getProcessIdentifier().getValue(), Scheme.of(processType.getProcessIdentifier().getScheme()) ), endpoints ParticipantIdentifier.of( serviceInformation.getParticipantIdentifier().getValue(), Scheme.of(serviceInformation.getParticipantIdentifier().getScheme()) ), DocumentTypeIdentifier.of( serviceInformation.getDocumentIdentifier().getValue(), Scheme.of(serviceInformation.getDocumentIdentifier().getScheme()) ), processMetadatas
ProcessIdentifier.of( processType.getProcessIdentifier().getValue(), Scheme.of(processType.getProcessIdentifier().getScheme()) ), endpoints ParticipantIdentifier.of( serviceInformation.getParticipantIdentifier().getValue(), Scheme.of(serviceInformation.getParticipantIdentifier().getScheme()) ), DocumentTypeIdentifier.of( serviceInformation.getDocumentIdentifier().getValue(), Scheme.of(serviceInformation.getDocumentIdentifier().getScheme()) ), processMetadatas
ParticipantIdentifier.of(senderIdentifier.getValue(), Scheme.of(senderIdentifier.getAuthority()))); ParticipantIdentifier.of(receiverIdentifier.getValue(), Scheme.of(receiverIdentifier.getAuthority()))); case "DOCUMENTID": { Scheme scheme = scope.getIdentifier() != null ? Scheme.of(scope.getIdentifier()) : DocumentTypeIdentifier.DEFAULT_SCHEME; header = header.documentType(DocumentTypeIdentifier.of(scope.getInstanceIdentifier(), scheme)); break; Scheme.of(scope.getIdentifier()) : ProcessIdentifier.DEFAULT_SCHEME; header = header.process(ProcessIdentifier.of(scope.getInstanceIdentifier(), scheme)); break;