use of com.helger.pd.businesscard.v3.PD3BusinessCardMarshaller in project phoss-smp by phax.
the class APIExecutorBusinessCardGet method invokeAPI.
public void invokeAPI(@Nonnull final IAPIDescriptor aAPIDescriptor, @Nonnull @Nonempty final String sPath, @Nonnull final Map<String, String> aPathVariables, @Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception {
final String sServiceGroupID = aPathVariables.get(SMPRestFilter.PARAM_SERVICE_GROUP_ID);
final ISMPServerAPIDataProvider aDataProvider = new SMPRestDataProvider(aRequestScope, sServiceGroupID);
if (!SMPMetaManager.getSettings().isDirectoryIntegrationEnabled()) {
// PD integration is disabled
throw new SMPPreconditionFailedException("The " + SMPWebAppConfiguration.getDirectoryName() + " integration is disabled. getBusinessCard will not be executed", aDataProvider.getCurrentURI());
}
// getBusinessCard throws an exception if non is found
final PD3BusinessCardType ret = new BusinessCardServerAPI(aDataProvider).getBusinessCard(sServiceGroupID);
final byte[] aBytes = new PD3BusinessCardMarshaller().getAsBytes(ret);
aUnifiedResponse.setContent(aBytes).setMimeType(CMimeType.TEXT_XML).setCharset(XMLWriterSettings.DEFAULT_XML_CHARSET_OBJ);
}
Aggregations