@Test @RunWithCustomExecutor public void createAccessionRegister() throws Exception { VitamThreadUtils.getVitamSession().setTenantId(TENANT_ID); VitamThreadUtils.getVitamSession().setRequestId(newOperationLogbookGUID(TENANT_ID)); stream = PropertiesUtils.getResourceAsStream("accession-register.json"); final AccessionRegisterDetailModel register = JsonHandler.getFromInputStream(stream, AccessionRegisterDetailModel.class); GUID guid = GUIDFactory.newAccessionRegisterDetailGUID(TENANT_ID); register.setId(guid.toString()); given().contentType(ContentType.JSON).body(register) .header(GlobalDataRest.X_TENANT_ID, TENANT_ID) .when().post(CREATE_FUND_REGISTER_URI) .then().statusCode(Status.CREATED.getStatusCode()); given().contentType(ContentType.JSON).body(register) .header(GlobalDataRest.X_TENANT_ID, TENANT_ID) .when().post(CREATE_FUND_REGISTER_URI) .then().statusCode(Status.CREATED.getStatusCode()); register.setTotalObjects(null); given().contentType(ContentType.JSON).body(register) .header(GlobalDataRest.X_TENANT_ID, TENANT_ID) .when().post(CREATE_FUND_REGISTER_URI) .then().statusCode(Status.BAD_REQUEST.getStatusCode()); }
@Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("register ID / Originating Agency: " + accessionRegister.getId() + " / " + accessionRegister.getOriginatingAgency()); } ParametersChecker.checkParameter("Accession Register is a mandatory parameter", accessionRegister); try (ReferentialAccessionRegisterImpl accessionRegisterManagement = new ReferentialAccessionRegisterImpl(mongoAccess, vitamCounterService)) { accessionRegisterManagement.createOrUpdateAccessionRegister(accessionRegister); return Response.status(Status.CREATED).build(); } catch (final BadRequestException e) { LOGGER.error(e); return Response.status(Status.BAD_REQUEST) .entity(getErrorEntity(Status.BAD_REQUEST, e.getMessage())).build(); } catch (final ReferentialException e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } catch (final Exception e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } }
AdminManagementResource extends ApplicationStatusResource { @Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("register ID / Originating Agency: " + accessionRegister.getId() + " / " + accessionRegister.getOriginatingAgency()); } ParametersChecker.checkParameter("Accession Register is a mandatory parameter", accessionRegister); try (ReferentialAccessionRegisterImpl accessionRegisterManagement = new ReferentialAccessionRegisterImpl(mongoAccess, vitamCounterService)) { accessionRegisterManagement.createOrUpdateAccessionRegister(accessionRegister); return Response.status(Status.CREATED).build(); } catch (final BadRequestException e) { LOGGER.error(e); return Response.status(Status.BAD_REQUEST) .entity(getErrorEntity(Status.BAD_REQUEST, e.getMessage())).build(); } catch (final ReferentialException e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } catch (final Exception e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } } }
AdminManagementResource extends ApplicationStatusResource { @Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("register ID / Originating Agency: " + accessionRegister.getId() + " / " + accessionRegister.getOriginatingAgency()); } ParametersChecker.checkParameter("Accession Register is a mandatory parameter", accessionRegister); try (ReferentialAccessionRegisterImpl accessionRegisterManagement = new ReferentialAccessionRegisterImpl(mongoAccess, vitamCounterService)) { accessionRegisterManagement.createOrUpdateAccessionRegister(accessionRegister); return Response.status(Status.CREATED).build(); } catch (final BadRequestException e) { LOGGER.error(e); return Response.status(Status.BAD_REQUEST) .entity(getErrorEntity(Status.BAD_REQUEST, e.getMessage())).build(); } catch (final ReferentialException e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } catch (final Exception e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } } AdminManagementResource(AdminManagementConfiguration configuration, OntologyLoader ontologyLoader,
        OntologyLoader rulesOntologyLoader); }
AdminManagementResource extends ApplicationStatusResource { @Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("register ID / Originating Agency: " + accessionRegister.getId() + " / " + accessionRegister.getOriginatingAgency()); } ParametersChecker.checkParameter("Accession Register is a mandatory parameter", accessionRegister); try (ReferentialAccessionRegisterImpl accessionRegisterManagement = new ReferentialAccessionRegisterImpl(mongoAccess, vitamCounterService)) { accessionRegisterManagement.createOrUpdateAccessionRegister(accessionRegister); return Response.status(Status.CREATED).build(); } catch (final BadRequestException e) { LOGGER.error(e); return Response.status(Status.BAD_REQUEST) .entity(getErrorEntity(Status.BAD_REQUEST, e.getMessage())).build(); } catch (final ReferentialException e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } catch (final Exception e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } } AdminManagementResource(AdminManagementConfiguration configuration, OntologyLoader ontologyLoader,
        OntologyLoader rulesOntologyLoader); @Path("format/check") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_JSON) Response checkFormat(InputStream xmlPronom); @Path("format/import") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_JSON) Response importFormat(@Context HttpHeaders headers, InputStream xmlPronom); @GET @Path("format/{id_format:.+}") @Produces(APPLICATION_JSON) Response findFileFormatByID(@PathParam("id_format") String formatId, @Context Request request); @Path("format/document") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findFormats(JsonNode select); @Path("rules/check") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_OCTET_STREAM) Response checkRulesFile(InputStream rulesStream); @Path("rules/import") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_JSON) Response importRulesFile(@Context HttpHeaders headers, InputStream rulesStream); @GET @Path("rules/{id_rule}") @Produces(APPLICATION_JSON) Response findRuleByID(@PathParam("id_rule") String ruleId, @Context Request request); @Path("rules/document") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDocumentRules(JsonNode select); @Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister); @Path("accession-register/document") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDocumentFundsRegister(JsonNode select); @Path("accession-register/detail/{id}") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDetailAccessionRegister(@PathParam("id") String originatingAgency, JsonNode select); @Path("accession-register/detail") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDetailAccessionRegister(JsonNode select); @Path(AUDIT_RULE_URI) @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response launchRuleAudit(); @Path(AUDIT_URI) @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response launchAudit(AuditOptions options); @POST @Path("accession-register/symbolic") @Produces(APPLICATION_JSON) Response createAccessionRegisterSymbolic(); @GET @Path("accession-register/symbolic") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response getAccessionRegisterSymbolic(JsonNode queryDsl); @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response forcePause(ProcessPause info); @Path("/removeforcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response removeForcePause(ProcessPause info); void setVitamCounterService(VitamCounterService vitamCounterService); @POST @Path(OPERATIONS_PATH) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response addExternalOperation(LogbookOperationParameters operation); }
AdminManagementResource extends ApplicationStatusResource { @Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("register ID / Originating Agency: " + accessionRegister.getId() + " / " + accessionRegister.getOriginatingAgency()); } ParametersChecker.checkParameter("Accession Register is a mandatory parameter", accessionRegister); try (ReferentialAccessionRegisterImpl accessionRegisterManagement = new ReferentialAccessionRegisterImpl(mongoAccess, vitamCounterService)) { accessionRegisterManagement.createOrUpdateAccessionRegister(accessionRegister); return Response.status(Status.CREATED).build(); } catch (final BadRequestException e) { LOGGER.error(e); return Response.status(Status.BAD_REQUEST) .entity(getErrorEntity(Status.BAD_REQUEST, e.getMessage())).build(); } catch (final ReferentialException e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } catch (final Exception e) { LOGGER.error(e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(getErrorEntity(Status.INTERNAL_SERVER_ERROR, e.getMessage())).build(); } } AdminManagementResource(AdminManagementConfiguration configuration, OntologyLoader ontologyLoader,
        OntologyLoader rulesOntologyLoader); @Path("format/check") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_JSON) Response checkFormat(InputStream xmlPronom); @Path("format/import") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_JSON) Response importFormat(@Context HttpHeaders headers, InputStream xmlPronom); @GET @Path("format/{id_format:.+}") @Produces(APPLICATION_JSON) Response findFileFormatByID(@PathParam("id_format") String formatId, @Context Request request); @Path("format/document") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findFormats(JsonNode select); @Path("rules/check") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_OCTET_STREAM) Response checkRulesFile(InputStream rulesStream); @Path("rules/import") @POST @Consumes(APPLICATION_OCTET_STREAM) @Produces(APPLICATION_JSON) Response importRulesFile(@Context HttpHeaders headers, InputStream rulesStream); @GET @Path("rules/{id_rule}") @Produces(APPLICATION_JSON) Response findRuleByID(@PathParam("id_rule") String ruleId, @Context Request request); @Path("rules/document") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDocumentRules(JsonNode select); @Path("accession-register") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response createAccessionRegister(AccessionRegisterDetailModel accessionRegister); @Path("accession-register/document") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDocumentFundsRegister(JsonNode select); @Path("accession-register/detail/{id}") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDetailAccessionRegister(@PathParam("id") String originatingAgency, JsonNode select); @Path("accession-register/detail") @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response findDetailAccessionRegister(JsonNode select); @Path(AUDIT_RULE_URI) @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response launchRuleAudit(); @Path(AUDIT_URI) @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response launchAudit(AuditOptions options); @POST @Path("accession-register/symbolic") @Produces(APPLICATION_JSON) Response createAccessionRegisterSymbolic(); @GET @Path("accession-register/symbolic") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response getAccessionRegisterSymbolic(JsonNode queryDsl); @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response forcePause(ProcessPause info); @Path("/removeforcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response removeForcePause(ProcessPause info); void setVitamCounterService(VitamCounterService vitamCounterService); @POST @Path(OPERATIONS_PATH) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response addExternalOperation(LogbookOperationParameters operation);  }