Example usage for org.springframework.http MediaType APPLICATION_XML_VALUE

List of usage examples for org.springframework.http MediaType APPLICATION_XML_VALUE

Introduction

In this page you can find the example usage for org.springframework.http MediaType APPLICATION_XML_VALUE.

Prototype

String APPLICATION_XML_VALUE

To view the source code for org.springframework.http MediaType APPLICATION_XML_VALUE.

Click Source Link

Document

A String equivalent of MediaType#APPLICATION_XML .

Usage

From source file:com.orange.ngsi.server.NgsiRestBaseController.java

/**
 * Register the host to protocolRegistry if it supports JSON
 * @param httpServletRequest the request
 *//*  ww w .  java 2  s .  c  o m*/
private void registerIntoDispatcher(HttpServletRequest httpServletRequest) {
    String uri = httpServletRequest.getRequestURI();

    // Use Accept or fallback to Content-Type if not defined
    String accept = httpServletRequest.getHeader("Accept");
    if (accept == null) {
        accept = httpServletRequest.getHeader("Content-Type");
    }

    if (accept != null && accept.contains(MediaType.APPLICATION_XML_VALUE)) {
        protocolRegistry.registerHost(uri);
    }
}

From source file:org.messic.server.facade.controllers.rest.AlbumController.java

@ApiMethod(path = "/services/albums", verb = ApiVerb.POST, description = "Create or Update an album.  Before creation you need to upload the resources!.  Return the Sid of the album created/updated", produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE }, consumes = {
                MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"),
        @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access"),
        @ApiError(code = IOMessicRESTException.VALUE, description = "IO internal server error"),
        @ApiError(code = DuplicatedMessicRESTException.VALUE, description = "The album is duplicated, the same album name for the same author name"), })
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody// ww  w  .  j av  a 2 s . c  o m
@ApiResponseObject
public Long createOrUpdateAlbum(@ApiBodyObject @RequestBody Album album)
        throws UnknownMessicRESTException, NotAuthorizedMessicRESTException, NotFoundMessicRESTException,
        IOMessicRESTException, DuplicatedMessicRESTException {

    User user = SecurityUtil.getCurrentUser();
    try {
        Long newSid = albumAPI.createOrUpdateAlbum(user, album);
        return newSid;// new ResponseEntity<HttpStatus>( HttpStatus.OK );
    } catch (IOException e) {
        log.error("failed!", e);
        throw new IOMessicRESTException(e);
    } catch (ExistingMessicException e) {
        log.error("failed!", e);
        throw new DuplicatedMessicRESTException(e);
    } catch (Exception e) {
        log.error("failed!", e);
        throw new UnknownMessicRESTException(e);
    }

}

From source file:com.frequentis.maritime.mcsr.web.rest.InstanceResourceIntTest.java

@Test
@Transactional/*from   www. j  a  v  a 2s  .co m*/
public void updateInstance() throws Exception {
    // Initialize the database
    instanceService.save(instance);

    int databaseSizeBeforeUpdate = instanceRepository.findAll().size();

    // Update the instance
    Instance updatedInstance = new Instance();
    updatedInstance.setId(instance.getId());
    updatedInstance.setGeometryContentType(UPDATED_GEOMETRY_CONTENT_TYPE);
    updatedInstance.setOrganizationId(UPDATED_ORGANIZATION_ID);
    updatedInstance.setEndpointType(UPDATED_ENDPOINT_TYPE);

    // Required by validation in controller
    updatedInstance.setName(DEFAULT_NAME);
    updatedInstance.setVersion(DEFAULT_VERSION);
    updatedInstance.setComment(DEFAULT_COMMENT);
    updatedInstance.setInstanceId(DEFAULT_INSTANCE_ID);
    updatedInstance.setKeywords(DEFAULT_KEYWORDS);
    updatedInstance.setStatus(DEFAULT_STATUS);
    updatedInstance.setUnlocode(DEFAULT_UNLOCODE);
    updatedInstance.setEndpointUri(DEFAULT_ENDPOINT_URI);

    Xml xml = new Xml();
    xml.setName(DEFAULT_NAME);
    xml.setComment(DEFAULT_COMMENT);
    xml.setContentContentType(MediaType.APPLICATION_XML_VALUE);

    XMLInstanceBuilder xmlBuilder = new XMLInstanceBuilder();
    InstanceXML x = xmlBuilder.getBuilderXml();
    x.setName(UPDATED_VERSION);
    x.setDescription(UPDATED_COMMENT);
    x.setURL(UPDATED_ENDPOINT_URI);
    x.setKeywords(UPDATED_KEYWORDS);
    x.setId(UPDATED_INSTANCE_ID);
    x.setStatus(Status.valueOf(UPDATED_STATUS));
    x.setServiceType(UPDATED_ENDPOINT_TYPE);
    x.setIMO(UPDATED_IMO);
    x.setVersion(UPDATED_VERSION);
    x.setMMSI(RandomStringUtils.randomAlphabetic(5));
    x.setRequiresAuthorization("false");

    VendorInfo producedBy = x.getProducedBy();
    producedBy.setContactInfo(RandomStringUtils.randomAlphabetic(15));
    producedBy.setName(UPDATED_NAME);
    producedBy.setId(RandomStringUtils.randomAlphabetic(15));
    producedBy.setOrganizationId(RandomStringUtils.randomAlphabetic(15));
    producedBy.setDescription(RandomStringUtils.randomAlphabetic(15));

    VendorInfo providedBy = x.getProvidedBy();
    providedBy.setContactInfo(RandomStringUtils.randomAlphabetic(15));
    providedBy.setName(RandomStringUtils.randomAlphabetic(15));
    providedBy.setId(RandomStringUtils.randomAlphabetic(15));
    providedBy.setOrganizationId(RandomStringUtils.randomAlphabetic(15));
    providedBy.setDescription(RandomStringUtils.randomAlphabetic(15));

    ServiceLevel offersServiceLevel = x.getOffersServiceLevel();
    offersServiceLevel.setName(RandomStringUtils.randomAlphabetic(15));
    offersServiceLevel.setAvailability(1);
    offersServiceLevel.setDescription(RandomStringUtils.randomAlphabetic(15));

    CoversAreaType conversAreas = x.getCoversAreas();
    // Requires plenty of heap (parsing JSON with unls)
    // conversAreas.setUnLoCode(DEFAULT_UNLOCODE);

    List<CoverageArea> coversArea = new ArrayList<>();
    CoverageArea ca = new CoverageArea();
    ca.setName("Bermuda Triangle");
    ca.setDescription("Loosely defined region in the western part of the North Atlantic Ocean.");
    ca.setGeometryAsWKT("POLYGON((-80.190 25.774, -66.118 18.466, -64.757 32.321, -80.190 25.774))");
    coversArea.add(ca);
    conversAreas.setCoversArea(coversArea);

    ServiceDesignReference implementsServiceDesign = x.getImplementsServiceDesign();
    implementsServiceDesign.setId("awdwad");
    implementsServiceDesign.setVersion("dwadwdwad");

    xml.setContent(xmlBuilder.buildXmlString());
    xmlService.save(xml);

    updatedInstance.setInstanceAsXml(xml);

    restInstanceMockMvc.perform(put("/api/instances").contentType(TestUtil.APPLICATION_JSON_UTF8)
            .content(TestUtil.convertObjectToJsonBytes(updatedInstance))).andExpect(status().isOk());

    // Validate the Instance in the database
    List<Instance> instances = instanceRepository.findAll();
    assertThat(instances).hasSize(databaseSizeBeforeUpdate);
    Instance testInstance = instances.get(instances.size() - 1);
    assertThat(testInstance.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testInstance.getVersion()).isEqualTo(UPDATED_VERSION);
    assertThat(testInstance.getComment()).isEqualTo(UPDATED_COMMENT);
    assertThat(testInstance.getGeometryContentType()).isEqualTo(UPDATED_GEOMETRY_CONTENT_TYPE);
    assertThat(testInstance.getInstanceId()).isEqualTo(UPDATED_INSTANCE_ID);
    assertThat(testInstance.getKeywords()).isEqualTo(UPDATED_KEYWORDS);
    assertThat(testInstance.getStatus()).isEqualTo(UPDATED_STATUS);
    assertThat(testInstance.getOrganizationId()).isEqualTo(UPDATED_ORGANIZATION_ID);
    //        assertThat(testInstance.getUnlocode()).isEqualTo(UPDATED_UNLOCODE);
    assertThat(testInstance.getEndpointUri()).isEqualTo(UPDATED_ENDPOINT_URI);
    assertThat(testInstance.getEndpointType()).isEqualTo(UPDATED_ENDPOINT_TYPE);

    // Validate the Instance in ElasticSearch
    Instance instanceEs = instanceSearchRepository.findById(testInstance.getId()).get();
    assertThat(instanceEs.getName()).isEqualTo(UPDATED_NAME);
    assertThat(instanceEs.getVersion()).isEqualTo(UPDATED_VERSION);
    assertThat(instanceEs.getComment()).isEqualTo(UPDATED_COMMENT);
    assertThat(instanceEs.getGeometryContentType()).isEqualTo(UPDATED_GEOMETRY_CONTENT_TYPE);
    assertThat(instanceEs.getInstanceId()).isEqualTo(UPDATED_INSTANCE_ID);
    assertThat(instanceEs.getKeywords()).isEqualTo(UPDATED_KEYWORDS);
    assertThat(instanceEs.getStatus()).isEqualTo(UPDATED_STATUS);
    assertThat(instanceEs.getOrganizationId()).isEqualTo(UPDATED_ORGANIZATION_ID);
    //        assertThat(instanceEs.getUnlocode()).isEqualTo(UPDATED_UNLOCODE);
    assertThat(instanceEs.getEndpointUri()).isEqualTo(UPDATED_ENDPOINT_URI);
    assertThat(instanceEs.getEndpointType()).isEqualTo(UPDATED_ENDPOINT_TYPE);
}

From source file:org.messic.server.facade.controllers.rest.AlbumController.java

@ApiMethod(path = "/services/albums/{albumCode}?fileName=xxxxx", verb = ApiVerb.PUT, description = "Upload a resource for an album. This resources are stored at the temporal folder, waiting until save Album process. The client must post the binary content of the resource.", produces = {
        MediaType.APPLICATION_JSON_VALUE,
        MediaType.APPLICATION_XML_VALUE }, consumes = { MediaType.APPLICATION_OCTET_STREAM_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"),
        @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access"),
        @ApiError(code = IOMessicRESTException.VALUE, description = "IO internal server error"), })
@RequestMapping(value = "/{albumCode}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)/*from   w w  w  .  j  a v  a2  s .  c  o  m*/
@ResponseBody
@ApiResponseObject
public HttpEntity<HttpStatus> uploadResource(@ApiBodyObject HttpEntity<byte[]> requestEntity,
        HttpServletResponse response, HttpSession session,
        @ApiParam(name = "albumCode", description = "code for the album owner of the resource.. This code is the reference for others resources that could be uploaded, and so on", paramType = ApiParamType.PATH, required = true) @PathVariable String albumCode,
        @ApiParam(name = "fileName", description = "file name of the resource", paramType = ApiParamType.QUERY, required = true) @RequestParam("fileName") String fileName)
        throws IOMessicRESTException, UnknownMessicRESTException, NotAuthorizedMessicRESTException {

    User user = SecurityUtil.getCurrentUser();
    try {
        byte[] payload = requestEntity.getBody();
        albumAPI.uploadResource(user, albumCode, HtmlUtils.htmlUnescape(fileName), payload);
    } catch (IOException ioe) {
        log.error("failed!", ioe);
        throw new IOMessicRESTException(ioe);
    } catch (Exception e) {
        log.error("failed!", e);
        throw new UnknownMessicRESTException(e);
    }

    return new HttpEntity<HttpStatus>(HttpStatus.OK);
}

From source file:org.messic.server.facade.controllers.rest.SongController.java

@ApiMethod(path = "/services/songs", verb = ApiVerb.POST, description = "Update a song.", produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE }, consumes = {
                MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"),
        @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access"),
        @ApiError(code = IOMessicRESTException.VALUE, description = "IO internal server error"), })
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)/*  ww  w  .  j a v a 2s  .c  o  m*/
@ResponseBody
@ApiResponseObject
public ResponseEntity<HttpStatus> updateSong(@ApiBodyObject @RequestBody Song song)
        throws UnknownMessicRESTException, NotAuthorizedMessicRESTException, NotFoundMessicRESTException,
        IOMessicRESTException {

    User user = SecurityUtil.getCurrentUser();
    try {
        songAPI.updateSong(user, song);
        return new ResponseEntity<HttpStatus>(HttpStatus.OK);
    } catch (IOException e) {
        log.error("failed!", e);
        throw new IOMessicRESTException(e);
    } catch (SidNotFoundMessicException sm) {
        log.error("failed!", sm);
        throw new NotFoundMessicRESTException(sm);
    } catch (Exception e) {
        log.error("failed!", e);
        throw new UnknownMessicRESTException(e);
    }
}

From source file:org.messic.server.facade.controllers.rest.AlbumController.java

@ApiMethod(path = "/services/albums/clear?albumCode=xxxx", verb = ApiVerb.POST, description = "Clear all the temporal files that have been uploaded previously. You can pass a json object with all the files you don't want to delate (the algorithm will erase all files that aren't in the list)", produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"),
        @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access"),
        @ApiError(code = IOMessicRESTException.VALUE, description = "IO internal server error"), })
@RequestMapping(value = "/clear", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)/*from   w w  w.j a va  2s  . c  o  m*/
@ResponseBody
@ApiResponseObject
public List<org.messic.server.api.datamodel.File> clear(
        @ApiParam(name = "albumCode", description = "temporal code of the album we want to clear.  This code is the same the client give to the server when upload a resource for an album.  If not give this code, messic will remove all the temporal files uploaded until now.", paramType = ApiParamType.QUERY, required = false) @RequestParam(value = "albumCode", required = false) String albumCode,
        @ApiBodyObject @RequestBody(required = false) List<org.messic.server.api.datamodel.File> exceptFiles)
        throws NotAuthorizedMessicRESTException, IOMessicRESTException, UnknownMessicRESTException {

    User user = SecurityUtil.getCurrentUser();
    try {
        List<org.messic.server.api.datamodel.File> existingFiles = albumAPI.clearTemporal(user, albumCode,
                exceptFiles);
        return existingFiles;
    } catch (IOException e) {
        log.error("failed!", e);
        throw new IOMessicRESTException(e);
    } catch (Exception e) {
        log.error("failed!", e);
        throw new UnknownMessicRESTException(e);
    }

}

From source file:org.messic.server.facade.controllers.rest.SongController.java

@ApiMethod(path = "/services/songs?filterSongSid=xxxx&filterAlbumSid=xxxx&filterAuthorSid=xxxx&albumInfo=true|false&authorInfo=true|false", verb = ApiVerb.GET, description = "Get all songs. They can be filtered by songSid, albumSid or authorSid (not combined). You can also espcify what information should be returned (with album information or not, for exmaple)", produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"),
        @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access") })
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)//from   ww  w  . j  av a  2s  .  co  m
@ResponseBody
@ApiResponseObject
public List<Song> getAll(
        @RequestParam(value = "filterSongSid", required = false) @ApiParam(name = "filterSongSid", description = "SID of the song to get", paramType = ApiParamType.QUERY, required = false) Integer filterSongSid,
        @RequestParam(value = "filterAlbumSid", required = false) @ApiParam(name = "filterAlbumSid", description = "SID of the album to filter songs", paramType = ApiParamType.QUERY, required = false) Integer filterAlbumSid,
        @RequestParam(value = "filterAuthorSid", required = false) @ApiParam(name = "filterAuthorSid", description = "SID of the author to filter songs", paramType = ApiParamType.QUERY, required = false) Integer filterAuthorSid,
        @RequestParam(value = "albumInfo", required = false) @ApiParam(name = "albumInfo", description = "flag to return also the album info of the songs or not. By default, false", paramType = ApiParamType.QUERY, required = false, allowedvalues = {
                "true", "false" }, format = "Boolean") Boolean albumInfo,
        @RequestParam(value = "authorInfo", required = false) @ApiParam(name = "authorInfo", description = "flag to return also the author info of the album of each song or not. By default, false", paramType = ApiParamType.QUERY, required = false, allowedvalues = {
                "true", "false" }, format = "Boolean") Boolean authorInfo)
        throws UnknownMessicRESTException, NotAuthorizedMessicRESTException {
    User user = SecurityUtil.getCurrentUser();

    try {
        List<Song> songs = null;
        boolean albumi = (albumInfo != null ? albumInfo : false);
        boolean authori = (authorInfo != null ? authorInfo : false);

        if (filterSongSid != null) {
            songs = new ArrayList<Song>();
            Song song = songAPI.getSong(user, filterSongSid, albumi, authori);
            songs.add(song);
        } else if (filterAlbumSid != null) {
            songs = songAPI.getSongsOfAlbum(user, filterAlbumSid, albumi, authori);
        } else if (filterAuthorSid != null) {
            songs = songAPI.getSongsOfAuthor(user, filterAuthorSid, albumi, authori);
        }

        return songs;
    } catch (Exception e) {
        log.error("failed!", e);
        throw new UnknownMessicRESTException(e);
    }
}

From source file:org.messic.server.facade.controllers.rest.AlbumController.java

@ApiMethod(path = "/services/albums/{albumCode}/wizard", verb = ApiVerb.GET, description = "Get 'magic' info from the resources that have been uploaded previously.  This resources are suposed to be of the same album, messic try to get the album info from them using several mechanisms. If the {pluginName} param is not present it returns only the basic info with all the available plugins. ALSO SUPPORT POST TO SUBMIT THE PARAMETER ALBUMHELPINFO!.", produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"),
        @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access"),
        @ApiError(code = IOMessicRESTException.VALUE, description = "IO internal server error"),
        @ApiError(code = MusicTagsMessicRESTException.VALUE, description = "Song Tags error"), })
@RequestMapping(value = "/{albumCode}/wizard", method = { RequestMethod.GET, RequestMethod.POST })
@ResponseStatus(HttpStatus.OK)//from www.  j ava  2 s  .co  m
@ResponseBody
@ApiResponseObject
public List<TAGWizardPlugin> getWizardAlbum(
        @ApiParam(name = "albumCode", description = "temporal code of the album we want to analyze. This code have been set previously while uploading resources. Messic will use the resources linked with these album code", paramType = ApiParamType.PATH, required = true) @PathVariable String albumCode,
        @ApiParam(name = "pluginName", description = "Name of the plugin we want to use.. It's not required. If this paremeter is not present the function will return only the basic informartion with all the available plugins names to query", paramType = ApiParamType.PATH, required = false) @RequestParam(value = "pluginName", required = false) String pluginName,
        @ApiBodyObject @RequestBody(required = false) Album albumHelpInfo)
        throws NotAuthorizedMessicRESTException, UnknownMessicRESTException, IOMessicRESTException,
        MusicTagsMessicRESTException {
    User user = SecurityUtil.getCurrentUser();

    try {
        List<TAGWizardPlugin> result = new ArrayList<TAGWizardPlugin>();
        if (pluginName != null && pluginName.length() > 0) {
            TAGWizardPlugin album = wizardAPI.getWizardAlbum(user, pluginName, albumHelpInfo, albumCode);
            result.add(album);
        } else {
            result = wizardAPI.getWizards(user, albumCode);
        }
        return result;
    } catch (IOException e) {
        throw new MusicTagsMessicRESTException(e);
    } catch (Exception e) {
        log.error("failed!", e);
        throw new UnknownMessicRESTException(e);
    }
}

From source file:com.nagarro.core.v2.controller.CartsController.java

/**
 * Adds a product to the cart.//from   w  w w.  ja  va 2  s . c om
 *
 * @param entry
 *           Request body parameter (DTO in xml or json format) which contains details like : product code
 *           (product.code), quantity of product (quantity), pickup store name (deliveryPointOfService.name)
 * @queryparam fields Response configuration (list of fields, which should be returned in response)
 * @bodyparams entry,quantity,deliveryPointOfService.name,product.code
 * @return Information about cart modification.
 * @throws CommerceCartModificationException
 *            When there are some problems with cart modification
 * @throws WebserviceValidationException
 *            When there is no product code value When store given in pickupStore parameter doesn't exist
 * @throws ProductLowStockException
 *            When product is out of stock in store (when pickupStore parameter is filled)
 * @throws StockSystemException
 *            When there is no information about stock for stores (when pickupStore parameter is filled).
 */
@RequestMapping(value = "/{cartId}/entries", method = RequestMethod.POST, consumes = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ResponseBody
public CartModificationWsDTO addCartEntry(@PathVariable final String baseSiteId,
        @RequestBody final OrderEntryWsDTO entry,
        @RequestParam(required = false, defaultValue = DEFAULT_FIELD_SET) final String fields)
        throws CommerceCartModificationException, WebserviceValidationException, ProductLowStockException,
        StockSystemException {
    if (entry.getQuantity() == null) {
        entry.setQuantity(Long.valueOf(DEFAULT_PRODUCT_QUANTITY));
    }

    validate(entry, "entry", orderEntryCreateValidator);

    final String pickupStore = entry.getDeliveryPointOfService() == null ? null
            : entry.getDeliveryPointOfService().getName();
    return addCartEntryInternal(baseSiteId, entry.getProduct().getCode(), entry.getQuantity().longValue(),
            pickupStore, fields);
}

From source file:com.nagarro.core.v2.controller.CartsController.java

/**
 * Updates the quantity of a single cart entry and details of the store where the cart entry will be picked.
 * Attributes not provided in request will be defined again (set to null or default)
 *
 * @param entry/*w  w  w  . j a  v a  2 s  . c  o  m*/
 *           Request body parameter (DTO in xml or json format) which contains details like : quantity of product
 *           (quantity), pickup store name (deliveryPointOfService.name)
 * @queryparam fields Response configuration (list of fields, which should be returned in response)
 * @bodyparams entry,quantity,deliveryPointOfService.name,product.code
 * @return Information about cart modification
 * @throws CartEntryException
 *            When entry with given number doesn't exist or in case of ambiguity of cart entries
 * @throws WebserviceValidationException
 *            When store given in pickupStore parameter doesn't exist
 * @throws CommerceCartModificationException
 *            When there are some problems with cart modification
 * @throws ProductLowStockException
 *            When product is out of stock in store (when pickupStore parameter is filled)
 * @throws StockSystemException
 *            When there is no information about stock for stores (when pickupStore parameter is filled).
 */
@RequestMapping(value = "/{cartId}/entries/{entryNumber}", method = RequestMethod.PUT, consumes = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ResponseBody
public CartModificationWsDTO setCartEntry(@PathVariable final String baseSiteId,
        @PathVariable final long entryNumber, @RequestBody final OrderEntryWsDTO entry,
        @RequestParam(required = false, defaultValue = DEFAULT_FIELD_SET) final String fields)
        throws CommerceCartModificationException {
    final CartData cart = getSessionCart();
    final OrderEntryData orderEntry = getCartEntryForNumber(cart, entryNumber);
    final String pickupStore = entry.getDeliveryPointOfService() == null ? null
            : entry.getDeliveryPointOfService().getName();

    validateCartEntryForReplace(orderEntry, entry);

    return updateCartEntryInternal(baseSiteId, cart, orderEntry, entry.getQuantity(), pickupStore, fields,
            true);
}