Search in sources :

Example 6 with RelationshipsUpdate

use of org.motechproject.mds.web.domain.RelationshipsUpdate in project motech by motech.

the class InstanceController method getRelatedValues.

@RequestMapping(value = "/instances/{entityId}/instance/new/{fieldName}", method = RequestMethod.POST)
@ResponseBody
public Records<BasicEntityRecord> getRelatedValues(@PathVariable Long entityId, @PathVariable String fieldName, String filters, GridSettings settings) {
    RelationshipsUpdate filter = parseRelatedInstancesFilter(filters);
    QueryParams queryParams = QueryParamsBuilder.buildQueryParams(settings);
    Records<BasicEntityRecord> records = instanceService.getRelatedFieldValue(entityId, null, fieldName, filter, queryParams);
    processFieldsForUI(records);
    return records;
}
Also used : RelationshipsUpdate(org.motechproject.mds.web.domain.RelationshipsUpdate) QueryParams(org.motechproject.mds.query.QueryParams) BasicEntityRecord(org.motechproject.mds.web.domain.BasicEntityRecord) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

RelationshipsUpdate (org.motechproject.mds.web.domain.RelationshipsUpdate)6 BasicEntityRecord (org.motechproject.mds.web.domain.BasicEntityRecord)5 Test (org.junit.Test)3 EntityDto (org.motechproject.mds.dto.EntityDto)3 EntityRecord (org.motechproject.mds.web.domain.EntityRecord)3 Matchers.anyString (org.mockito.Matchers.anyString)2 QueryParams (org.motechproject.mds.query.QueryParams)2 DefaultMotechDataService (org.motechproject.mds.service.DefaultMotechDataService)2 MotechDataService (org.motechproject.mds.service.MotechDataService)2 Collection (java.util.Collection)1 FieldDto (org.motechproject.mds.dto.FieldDto)1 Order (org.motechproject.mds.util.Order)1 BasicFieldRecord (org.motechproject.mds.web.domain.BasicFieldRecord)1 FieldRecord (org.motechproject.mds.web.domain.FieldRecord)1 ServiceReference (org.osgi.framework.ServiceReference)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1