use of com.helger.pd.businesscard.generic.PDIdentifier in project phoss-directory by phax.
the class ExportHelper method getAsXML.
@Nonnull
public static IMicroDocument getAsXML(@Nonnull final ICommonsOrderedMap<IParticipantIdentifier, ICommonsList<PDStoredBusinessEntity>> aMap, final boolean bIncludeDocTypes) {
// XML root
final IMicroDocument aDoc = new MicroDocument();
final IMicroElement aRoot = aDoc.appendElement(XML_EXPORT_NS_URI, "root");
aRoot.setAttribute("version", "2");
aRoot.setAttribute("creationdt", PDTWebDateHelper.getAsStringXSD(PDTFactory.getCurrentZonedDateTimeUTC()));
// For all BCs
for (final Map.Entry<IParticipantIdentifier, ICommonsList<PDStoredBusinessEntity>> aEntry : aMap.entrySet()) {
final IParticipantIdentifier aParticipantID = aEntry.getKey();
final PDBusinessCard aBC = new PDBusinessCard();
aBC.setParticipantIdentifier(new PDIdentifier(aParticipantID.getScheme(), aParticipantID.getValue()));
for (final PDStoredBusinessEntity aSBE : aEntry.getValue()) aBC.businessEntities().add(aSBE.getAsBusinessEntity());
final IMicroElement eBC = aBC.getAsMicroXML(XML_EXPORT_NS_URI, "businesscard");
// New in v2 - add all Document types
if (bIncludeDocTypes && aEntry.getValue().isNotEmpty())
for (final IDocumentTypeIdentifier aDocTypeID : aEntry.getValue().getFirst().documentTypeIDs()) eBC.appendChild(_createMicroElement(aDocTypeID));
aRoot.appendChild(eBC);
}
return aDoc;
}
use of com.helger.pd.businesscard.generic.PDIdentifier in project phoss-directory by phax.
the class PDStoredBusinessEntity method getAsBusinessCard.
/**
* @return This {@link PDStoredBusinessEntity} as a {@link PDBusinessCard}.
*/
@Nonnull
@ReturnsMutableCopy
public PDBusinessCard getAsBusinessCard() {
final PDBusinessCard ret = new PDBusinessCard();
ret.setParticipantIdentifier(new PDIdentifier(m_aParticipantID.getScheme(), m_aParticipantID.getValue()));
// We have a single entity
ret.businessEntities().add(getAsBusinessEntity());
return ret;
}
use of com.helger.pd.businesscard.generic.PDIdentifier in project phoss-directory by phax.
the class IndexerResourceTest method _createMockBC.
@Nonnull
private static PDExtendedBusinessCard _createMockBC(@Nonnull final IParticipantIdentifier aParticipantID) {
final PDBusinessCard aBI = new PDBusinessCard();
aBI.setParticipantIdentifier(new PDIdentifier(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME, "9915:mock"));
{
final PDBusinessEntity aEntity = new PDBusinessEntity();
aEntity.names().add(new PDName("Philip's mock Peppol receiver"));
aEntity.setCountryCode("AT");
aEntity.identifiers().add(new PDIdentifier("mock", "12345678"));
aEntity.identifiers().add(new PDIdentifier(aParticipantID.getScheme(), aParticipantID.getValue()));
aEntity.setAdditionalInfo("This is a mock entry for testing purposes only");
aBI.businessEntities().add(aEntity);
}
{
final PDBusinessEntity aEntity = new PDBusinessEntity();
aEntity.names().add(new PDName("Philip's mock Peppol receiver 2"));
aEntity.setCountryCode("NO");
aEntity.identifiers().add(new PDIdentifier("mock", "abcdefgh"));
aEntity.setAdditionalInfo("This is another mock entry for testing purposes only");
aBI.businessEntities().add(aEntity);
}
return new PDExtendedBusinessCard(aBI, new CommonsArrayList<>(EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30.getAsDocumentTypeIdentifier()));
}
use of com.helger.pd.businesscard.generic.PDIdentifier in project phoss-directory by phax.
the class LocalHost8080FuncTest method _createMockBC.
@Nonnull
private static PDExtendedBusinessCard _createMockBC(@Nonnull final IParticipantIdentifier aParticipantID) {
final PDBusinessCard aBI = new PDBusinessCard();
aBI.setParticipantIdentifier(new PDIdentifier(PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME, "9915:mock"));
{
final PDBusinessEntity aEntity = new PDBusinessEntity();
aEntity.names().add(new PDName("Philip's mock Peppol receiver"));
aEntity.setCountryCode("AT");
aEntity.identifiers().add(new PDIdentifier("mock", "12345678"));
aEntity.identifiers().add(new PDIdentifier(aParticipantID.getScheme(), aParticipantID.getValue()));
aEntity.setAdditionalInfo("This is a mock entry for testing purposes only");
aBI.businessEntities().add(aEntity);
}
{
final PDBusinessEntity aEntity = new PDBusinessEntity();
aEntity.names().add(new PDName("Philip's mock Peppol receiver 2"));
aEntity.setCountryCode("NO");
aEntity.identifiers().add(new PDIdentifier("mock", "abcdefgh"));
aEntity.setAdditionalInfo("This is another mock entry for testing purposes only");
aBI.businessEntities().add(aEntity);
}
return new PDExtendedBusinessCard(aBI, new CommonsArrayList<>(EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30.getAsDocumentTypeIdentifier()));
}
use of com.helger.pd.businesscard.generic.PDIdentifier in project phoss-directory by phax.
the class PDStorageManagerTest method _createMockBI.
@Nonnull
private static PDExtendedBusinessCard _createMockBI(@Nonnull final IParticipantIdentifier aParticipantID) {
final PDBusinessCard aBI = new PDBusinessCard();
aBI.setParticipantIdentifier(new PDIdentifier(aParticipantID.getScheme(), aParticipantID.getValue()));
{
final PDBusinessEntity aEntity = new PDBusinessEntity();
aEntity.setCountryCode("AT");
aEntity.setRegistrationDate(PDTFactory.createLocalDate(2015, Month.JULY, 6));
aEntity.names().add(new PDName("Philip's mock Peppol receiver"));
aEntity.setGeoInfo("Vienna");
for (int i = 0; i < 10; ++i) aEntity.identifiers().add(new PDIdentifier("scheme" + i, "value" + i));
aEntity.websiteURIs().add("http://www.peppol.eu");
aEntity.contacts().add(new PDContact("support", "BC name", "12345", "test@example.org"));
aEntity.setAdditionalInfo("This is a mock entry for testing purposes only");
aBI.businessEntities().add(aEntity);
}
{
final PDBusinessEntity aEntity = new PDBusinessEntity();
aEntity.setCountryCode("NO");
aEntity.names().add(new PDName("Entity2a", "no"));
aEntity.names().add(new PDName("Entity2b", "de"));
aEntity.names().add(new PDName("Entity2c", "en"));
aEntity.setAdditionalInfo("Mock");
aBI.businessEntities().add(aEntity);
}
return new PDExtendedBusinessCard(aBI, new CommonsArrayList<>(EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30));
}
Aggregations