use of de.trustable.ca3s.core.web.rest.errors.BadRequestAlertException in project ca3sCore by kuehne-trustable-de.
the class PipelineAttributeResource method createPipelineAttribute.
/**
* {@code POST /pipeline-attributes} : Create a new pipelineAttribute.
*
* @param pipelineAttribute the pipelineAttribute to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new pipelineAttribute, or with status {@code 400 (Bad Request)} if the pipelineAttribute has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/pipeline-attributes")
public ResponseEntity<PipelineAttribute> createPipelineAttribute(@Valid @RequestBody PipelineAttribute pipelineAttribute) throws URISyntaxException {
log.debug("REST request to save PipelineAttribute : {}", pipelineAttribute);
if (pipelineAttribute.getId() != null) {
throw new BadRequestAlertException("A new pipelineAttribute cannot already have an ID", ENTITY_NAME, "idexists");
}
PipelineAttribute result = pipelineAttributeService.save(pipelineAttribute);
return ResponseEntity.created(new URI("/api/pipeline-attributes/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result);
}
use of de.trustable.ca3s.core.web.rest.errors.BadRequestAlertException in project ca3sCore by kuehne-trustable-de.
the class PipelineAttributeResource method updatePipelineAttribute.
/**
* {@code PUT /pipeline-attributes} : Updates an existing pipelineAttribute.
*
* @param pipelineAttribute the pipelineAttribute to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated pipelineAttribute,
* or with status {@code 400 (Bad Request)} if the pipelineAttribute is not valid,
* or with status {@code 500 (Internal Server Error)} if the pipelineAttribute couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/pipeline-attributes")
public ResponseEntity<PipelineAttribute> updatePipelineAttribute(@Valid @RequestBody PipelineAttribute pipelineAttribute) throws URISyntaxException {
log.debug("REST request to update PipelineAttribute : {}", pipelineAttribute);
if (pipelineAttribute.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
PipelineAttribute result = pipelineAttributeService.save(pipelineAttribute);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, pipelineAttribute.getId().toString())).body(result);
}
use of de.trustable.ca3s.core.web.rest.errors.BadRequestAlertException in project ca3sCore by kuehne-trustable-de.
the class PipelineResource method createPipeline.
/**
* {@code POST /pipelines} : Create a new pipeline.
*
* @param pipeline the pipeline to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new pipeline, or with status {@code 400 (Bad Request)} if the pipeline has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/pipelines")
public ResponseEntity<Pipeline> createPipeline(@Valid @RequestBody Pipeline pipeline) throws URISyntaxException {
log.debug("REST request to save Pipeline : {}", pipeline);
if (pipeline.getId() != null) {
throw new BadRequestAlertException("A new pipeline cannot already have an ID", ENTITY_NAME, "idexists");
}
Pipeline result = pipelineService.save(pipeline);
return ResponseEntity.created(new URI("/api/pipelines/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result);
}
use of de.trustable.ca3s.core.web.rest.errors.BadRequestAlertException in project ca3sCore by kuehne-trustable-de.
the class PipelineViewResource method createPipeline.
/**
* {@code POST /pipelineViews} : Create a new pipeline.
*
* @param pipelineView the pipeline to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new pipeline, or with status {@code 400 (Bad Request)} if the pipeline has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/pipelineViews")
public ResponseEntity<PipelineView> createPipeline(@Valid @RequestBody PipelineView pipelineView) throws URISyntaxException {
log.debug("REST request to save PipelineView : {}", pipelineView);
if (pipelineView.getId() != null) {
throw new BadRequestAlertException("A new pipeline request cannot have an ID", ENTITY_NAME, "idexists");
}
if (pipelineUtil.getPipelineByRealm(pipelineView.getType(), pipelineView.getUrlPart()) != null) {
throw new BadRequestAlertException("Realm '" + pipelineView.getUrlPart() + "' already exists", ENTITY_NAME, "realmexists");
}
Pipeline p = pipelineUtil.toPipeline(pipelineView);
return ResponseEntity.created(new URI("/api/pipelineViews/" + p.getId())).headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, p.getId().toString())).body(pipelineView);
}
use of de.trustable.ca3s.core.web.rest.errors.BadRequestAlertException in project ca3sCore by kuehne-trustable-de.
the class ProtectedContentResource method createProtectedContent.
/**
* {@code POST /protected-contents} : Create a new protectedContent.
*
* @param protectedContent the protectedContent to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new protectedContent, or with status {@code 400 (Bad Request)} if the protectedContent has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/protected-contents")
public ResponseEntity<ProtectedContent> createProtectedContent(@Valid @RequestBody ProtectedContent protectedContent) throws URISyntaxException {
log.debug("REST request to save ProtectedContent : {}", protectedContent);
if (protectedContent.getId() != null) {
throw new BadRequestAlertException("A new protectedContent cannot already have an ID", ENTITY_NAME, "idexists");
}
ProtectedContent result = protectedContentService.save(protectedContent);
return ResponseEntity.created(new URI("/api/protected-contents/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result);
}
Aggregations