本文整理汇总了Java中com.icthh.xm.commons.errors.ErrorConstants.ERR_BUSINESS_IDEXISTS属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorConstants.ERR_BUSINESS_IDEXISTS属性的具体用法?Java ErrorConstants.ERR_BUSINESS_IDEXISTS怎么用?Java ErrorConstants.ERR_BUSINESS_IDEXISTS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.icthh.xm.commons.errors.ErrorConstants
的用法示例。
在下文中一共展示了ErrorConstants.ERR_BUSINESS_IDEXISTS属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createXmEntity
/**
* POST /xm-entities : Create a new xmEntity.
* @param xmEntity the xmEntity to create
* @return the ResponseEntity with status 201 (Created) and with body the new xmEntity, or with
* status 400 (Bad Request) if the xmEntity has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/xm-entities")
@Timed
public ResponseEntity<XmEntity> createXmEntity(@Valid @RequestBody XmEntity xmEntity) throws URISyntaxException {
log.debug("REST request to save XmEntity : {}", xmEntity);
if (xmEntity.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new XmEntity cannot already have an ID");
}
if (Constants.TENANT_TYPE_KEY.equals(xmEntity.getTypeKey()) && xmEntity.getName().trim().contains(" ")) {
throw new BusinessException(ErrorConstants.ERR_VALIDATION,
"Entity name can not contain whitespaces");
}
XmEntity result = xmEntityService.save(xmEntity);
return ResponseEntity.created(new URI("/api/xm-entities/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, String.valueOf(result.getId())))
.body(result);
}
示例2: createLocation
/**
* POST /locations : Create a new location.
*
* @param location the location to create
* @return the ResponseEntity with status 201 (Created) and with body the new location, or with status 400 (Bad Request) if the location has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/locations")
@Timed
public ResponseEntity<Location> createLocation(@Valid @RequestBody Location location) throws URISyntaxException {
log.debug("REST request to save Location : {}", location);
if (location.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new location cannot already have an ID");
}
Location result = locationRepository.save(location);
locationSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/locations/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例3: createRating
/**
* POST /ratings : Create a new rating.
*
* @param rating the rating to create
* @return the ResponseEntity with status 201 (Created) and with body the new rating, or with status 400 (Bad Request) if the rating has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/ratings")
@Timed
public ResponseEntity<Rating> createRating(@Valid @RequestBody Rating rating) throws URISyntaxException {
log.debug("REST request to save Rating : {}", rating);
if (rating.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new rating cannot already have an ID");
}
Rating result = ratingService.save(rating);
return ResponseEntity.created(new URI("/api/ratings/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例4: createTag
/**
* POST /tags : Create a new tag.
*
* @param tag the tag to create
* @return the ResponseEntity with status 201 (Created) and with body the new tag, or with status 400 (Bad Request) if the tag has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/tags")
@Timed
public ResponseEntity<Tag> createTag(@Valid @RequestBody Tag tag) throws URISyntaxException {
log.debug("REST request to save Tag : {}", tag);
if (tag.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new tag cannot already have an ID");
}
Tag result = tagRepository.save(tag);
tagSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/tags/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例5: createComment
/**
* POST /comments : Create a new comment.
*
* @param comment the comment to create
* @return the ResponseEntity with status 201 (Created) and with body the new comment, or with status 400 (Bad Request) if the comment has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/comments")
@Timed
public ResponseEntity<Comment> createComment(@Valid @RequestBody Comment comment) throws URISyntaxException {
log.debug("REST request to save Comment : {}", comment);
if (comment.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new comment cannot already have an ID");
}
Comment result = commentService.save(comment);
return ResponseEntity.created(new URI("/api/comments/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例6: createLink
/**
* POST /links : Create a new link.
*
* @param link the link to create
* @return the ResponseEntity with status 201 (Created) and with body the new link, or with status 400 (Bad Request) if the link has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/links")
@Timed
public ResponseEntity<Link> createLink(@Valid @RequestBody Link link) throws URISyntaxException {
log.debug("REST request to save Link : {}", link);
if (link.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new link cannot already have an ID");
}
Link result = linkService.save(link);
return ResponseEntity.created(new URI("/api/links/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例7: createEvent
/**
* POST /events : Create a new event.
*
* @param event the event to create
* @return the ResponseEntity with status 201 (Created) and with body the new event, or with status 400 (Bad Request) if the event has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/events")
@Timed
public ResponseEntity<Event> createEvent(@Valid @RequestBody Event event) throws URISyntaxException {
log.debug("REST request to save Event : {}", event);
if (event.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new event cannot already have an ID");
}
Event result = eventService.save(event);
return ResponseEntity.created(new URI("/api/events/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例8: createCalendar
/**
* POST /calendars : Create a new calendar.
*
* @param calendar the calendar to create
* @return the ResponseEntity with status 201 (Created) and with body the new calendar, or with status 400 (Bad Request) if the calendar has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/calendars")
@Timed
public ResponseEntity<Calendar> createCalendar(@Valid @RequestBody Calendar calendar) throws URISyntaxException {
log.debug("REST request to save Calendar : {}", calendar);
if (calendar.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new calendar cannot already have an ID");
}
Calendar result = calendarService.save(calendar);
return ResponseEntity.created(new URI("/api/calendars/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例9: createVote
/**
* POST /votes : Create a new vote.
*
* @param vote the vote to create
* @return the ResponseEntity with status 201 (Created) and with body the new vote, or with status 400 (Bad Request) if the vote has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/votes")
@Timed
public ResponseEntity<Vote> createVote(@Valid @RequestBody Vote vote) throws URISyntaxException {
log.debug("REST request to save Vote : {}", vote);
if (vote.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new vote cannot already have an ID");
}
Vote result = voteRepository.save(vote);
voteSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/votes/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例10: createContent
/**
* POST /contents : Create a new content.
*
* @param content the content to create
* @return the ResponseEntity with status 201 (Created) and with body the new content, or with status 400 (Bad Request) if the content has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/contents")
@Timed
public ResponseEntity<Content> createContent(@Valid @RequestBody Content content) throws URISyntaxException {
log.debug("REST request to save Content : {}", content);
if (content.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new content cannot already have an ID");
}
Content result = contentRepository.save(content);
contentSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/contents/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
示例11: createAttachment
/**
* POST /attachments : Create a new attachment.
*
* @param attachment the attachment to create
* @return the ResponseEntity with status 201 (Created) and with body the new attachment, or with status 400 (Bad Request) if the attachment has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/attachments")
@Timed
public ResponseEntity<Attachment> createAttachment(@Valid @RequestBody Attachment attachment) throws URISyntaxException {
log.debug("REST request to save Attachment : {}", attachment);
if (attachment.getId() != null) {
throw new BusinessException(ErrorConstants.ERR_BUSINESS_IDEXISTS,
"A new attachment cannot already have an ID");
}
Attachment result = attachmentService.save(attachment);
return ResponseEntity.created(new URI("/api/attachments/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}