Package org.nentangso.core.web.rest
Class AbstractMetafieldResource
- java.lang.Object
-
- org.nentangso.core.web.rest.AbstractMetafieldResource
-
public abstract class AbstractMetafieldResource extends Object
REST controller for managingNtsMetafieldEntity.
-
-
Field Summary
Fields Modifier and Type Field Description protected NtsJsonHelperjsonHelperprotected NtsMetafieldHelpermetafieldHelperprotected NtsMetafieldMappermetafieldMapper
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMetafieldResource(NtsJsonHelper jsonHelper, NtsMetafieldHelper metafieldHelper, NtsMetafieldMapper metafieldMapper)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract URIbuildCreatedUri(long ownerId, long metafieldId)protected org.springframework.http.ResponseEntity<Long>countMetafields(long ownerId)GET /metafields/count: count all the metafields.protected org.springframework.http.ResponseEntity<NtsMetafieldDTO>createMetafield(long ownerId, MetafieldInput metafield)POST /metafields: Create a new metafieldprotected org.springframework.http.ResponseEntity<Void>deleteMetafield(long ownerId, long id)DELETE /metafields/:id: delete the "id" metafields.protected abstract booleanexistsByOwnerId(long ownerId)protected org.springframework.http.ResponseEntity<List<NtsMetafieldDTO>>getAllMetafields(long ownerId)GET /metafields: get all metafieldsprotected abstract StringgetApplicationName()protected org.springframework.http.ResponseEntity<NtsMetafieldDTO>getMetafield(long ownerId, long id)GET /metafields/:id: get the "id" metafield.protected abstract StringgetOwnerResource()protected org.springframework.http.ResponseEntity<NtsMetafieldDTO>updateMetafield(long ownerId, long id, MetafieldInput metafield, javax.servlet.http.HttpServletRequest request)PUT /metafields/:id: Updates an existing metafield.
-
-
-
Field Detail
-
jsonHelper
protected final NtsJsonHelper jsonHelper
-
metafieldHelper
protected final NtsMetafieldHelper metafieldHelper
-
metafieldMapper
protected final NtsMetafieldMapper metafieldMapper
-
-
Constructor Detail
-
AbstractMetafieldResource
protected AbstractMetafieldResource(NtsJsonHelper jsonHelper, NtsMetafieldHelper metafieldHelper, NtsMetafieldMapper metafieldMapper)
-
-
Method Detail
-
getApplicationName
protected abstract String getApplicationName()
-
getOwnerResource
protected abstract String getOwnerResource()
-
existsByOwnerId
protected abstract boolean existsByOwnerId(long ownerId)
-
buildCreatedUri
protected abstract URI buildCreatedUri(long ownerId, long metafieldId) throws URISyntaxException
- Throws:
URISyntaxException
-
createMetafield
protected org.springframework.http.ResponseEntity<NtsMetafieldDTO> createMetafield(long ownerId, MetafieldInput metafield) throws URISyntaxException
POST /metafields: Create a new metafield- Parameters:
ownerId- the owner id.metafield- the metafield to create.- Returns:
- the
ResponseEntitywith status201 (Created)and with body the new metafieldDTO, or with status400 (Bad Request). - Throws:
URISyntaxException- if the Location URI syntax is incorrect.
-
updateMetafield
protected org.springframework.http.ResponseEntity<NtsMetafieldDTO> updateMetafield(long ownerId, long id, MetafieldInput metafield, javax.servlet.http.HttpServletRequest request) throws IOException
PUT /metafields/:id: Updates an existing metafield.- Parameters:
ownerId- the owner id.id- the id of the metafield to save.metafield- the metafield to update.request- the http servlet request.- Returns:
- the
ResponseEntitywith status200 (OK)and with body the updated metafield, or with status400 (Bad Request)if the customerDTO is not valid, or with status500 (Internal Server Error)if the metafield couldn't be updated. - Throws:
IOException- if the Location URI syntax is incorrect.
-
getAllMetafields
protected org.springframework.http.ResponseEntity<List<NtsMetafieldDTO>> getAllMetafields(long ownerId)
GET /metafields: get all metafields- Parameters:
ownerId- the owner id- Returns:
- the
ResponseEntitywith status200 (OK)and the list of metafields in body.
-
countMetafields
protected org.springframework.http.ResponseEntity<Long> countMetafields(long ownerId)
GET /metafields/count: count all the metafields.- Parameters:
ownerId- the owner id- Returns:
- the
ResponseEntitywith status200 (OK)and the count in body.
-
getMetafield
protected org.springframework.http.ResponseEntity<NtsMetafieldDTO> getMetafield(long ownerId, long id)
GET /metafields/:id: get the "id" metafield.- Parameters:
ownerId- the owner idid- the id of the metafield to retrieve.- Returns:
- the
ResponseEntitywith status200 (OK)and with body the metafield, or with status404 (Not Found).
-
deleteMetafield
protected org.springframework.http.ResponseEntity<Void> deleteMetafield(long ownerId, long id)
DELETE /metafields/:id: delete the "id" metafields.- Parameters:
ownerId- the owner idid- the id of the metafields to delete.- Returns:
- the
ResponseEntitywith status204 (NO_CONTENT).
-
-