Search in sources :

Example 6 with IdentifiableObjects

use of org.hisp.dhis.common.IdentifiableObjects in project dhis2-core by dhis2.

the class AbstractCrudController method replaceCollectionItemsJson.

@RequestMapping(value = "/{uid}/{property}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
public void replaceCollectionItemsJson(@PathVariable("uid") String pvUid, @PathVariable("property") String pvProperty, HttpServletRequest request, HttpServletResponse response) throws Exception {
    List<T> objects = getEntity(pvUid);
    IdentifiableObjects identifiableObjects = renderService.fromJson(request.getInputStream(), IdentifiableObjects.class);
    collectionService.clearCollectionItems(objects.get(0), pvProperty);
    collectionService.addCollectionItems(objects.get(0), pvProperty, Lists.newArrayList(identifiableObjects.getIdentifiableObjects()));
}
Also used : IdentifiableObjects(org.hisp.dhis.common.IdentifiableObjects) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

IdentifiableObjects (org.hisp.dhis.common.IdentifiableObjects)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6