use of com.icthh.xm.commons.permission.annotation.PrivilegeDescription in project xm-ms-entity by xm-online.
the class XmEntitySpecResource method generateXmEntity.
/**
* POST /xm-entity-specs/generate-xm-entity : Generate a new xmEntity.
*
* @return the ResponseEntity with status 201 (Created) and with body the new xmEntity
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/xm-entity-specs/generate-xm-entity")
@Timed
@PreAuthorize("hasPermission({'rootTypeKey': #rootTypeKey}, 'XMENTITY_SPEC.GENERATE')")
@PrivilegeDescription("Privilege to generate a new random xmEntity with passed type. Used for demo")
public ResponseEntity<XmEntity> generateXmEntity(@ApiParam String rootTypeKey) throws URISyntaxException {
log.debug("REST request to generate XmEntity");
XmEntity result = xmEntityGeneratorService.generateXmEntity(rootTypeKey != null ? rootTypeKey : "");
return ResponseEntity.created(new URI("/api/xm-entities/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Aggregations