class UnitDipServiceImpl implements DipService {

    @Override
    public Response jsonToXml(JsonNode object, String id) {
        Status status;
        StringWriter writer = new StringWriter();
        try {
            if (object != null) {
                ArchiveUnitModel archiveUnitModel = objectMapper.treeToValue(object, ArchiveUnitModel.class);
                Marshaller marshaller = jaxbContext.createMarshaller();
                final ArchiveUnitType xmlUnit = archiveUnitMapper.map(archiveUnitModel);
                marshaller.marshal(xmlUnit, writer);
                LOGGER.debug(END_OF_EXECUTION_OF_DSL_VITAM_FROM_ACCESS);
                return Response.status(Status.OK).entity(writer.toString()).build();
            } else {
                return Response.status(Status.BAD_REQUEST.getStatusCode())
                    .entity(JsonHandler.unprettyPrint(
                        new VitamError(VitamCode.ACCESS_EXTERNAL_SELECT_UNIT_BY_ID_ERROR.getItem())
                            .setHttpCode(Status.BAD_REQUEST.getStatusCode())
                            .setMessage(VitamCode.ACCESS_EXTERNAL_SELECT_UNIT_BY_ID_ERROR.getMessage())
                            .setState(StatusCode.KO.name())
                            .setContext(ACCESS_EXTERNAL_MODULE)
                            .setDescription(VitamCode.ACCESS_EXTERNAL_SELECT_UNIT_BY_ID_ERROR.getMessage())))
                    .build();
            }
        } catch (JsonProcessingException e) {
            LOGGER.error(BAD_REQUEST_EXCEPTION, e);
            status = Status.BAD_REQUEST;
            return Response.status(status).entity(JsonHandler.unprettyPrint(getErrorEntity(status, e.getMessage())))
                .build();
        } catch (JAXBException e) {
            LOGGER.error(BAD_REQUEST_EXCEPTION, e);
            status = Status.BAD_REQUEST;
            return Response.status(status).entity(JsonHandler.unprettyPrint(getErrorEntity(status, e.getMessage())))
                .build();
        } catch (DatatypeConfigurationException e) {
            LOGGER.error(BAD_REQUEST_EXCEPTION, e);
            status = Status.BAD_REQUEST;
            return Response.status(status).entity(JsonHandler.unprettyPrint(getErrorEntity(status, e.getMessage())))
                .build();
        } catch (NullPointerException e) {
            LOGGER.error(BAD_REQUEST_EXCEPTION, e);
            status = Status.BAD_REQUEST;
            return Response.status(status).entity(JsonHandler.unprettyPrint(getErrorEntity(status, e.getMessage())))
                .build();
        } catch (Exception e) {
            status = Status.BAD_REQUEST;
            return Response.status(status)
                .entity(JsonHandler.unprettyPrint(getErrorEntity(status, e.getMessage())))
                .build();
        }
    }

    public  UnitDipServiceImpl(ArchiveUnitMapper archiveUnitMapper, ObjectMapper objectMapper);

}