@Test public void participantTypesForObjectTypeName() throws Exception { String objectTypeName = "objectTypeName"; AcmParticipantType participantType = new AcmParticipantType(); participantType.setType(AcmParticipantTypes.SINGLE_USER); participantType.setName("Object Type Agent"); participantType.setDescription("The Agent for this Object Type"); participantType.setRequiredOnACL(true); AcmObjectType objectType = new AcmObjectType(); objectType.setName(objectTypeName); objectType.setParticipantTypes(Arrays.asList(participantType)); AcmApplication app = new AcmApplication(); app.setBusinessObjects(Arrays.asList(objectType)); unit.setAcmApplication(app); MvcResult result = mockMvc.perform(get("/api/latest/users/participantTypesForObjectTypeName/{objectTypeName}", objectTypeName) .accept(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8")) .andReturn(); String jsonString = result.getResponse().getContentAsString(); log.debug("Got JSON: " + jsonString); ObjectMapper om = new ObjectMapper(); JavaType javaType = om.getTypeFactory().constructParametricType(List.class, AcmParticipantType.class); List<AcmParticipantType> found = om.readValue(jsonString, javaType); assertEquals(objectType.getParticipantTypes().size(), found.size()); AcmParticipantType foundParticipantType = found.get(0); assertEquals(participantType.getName(), foundParticipantType.getName()); }
@RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName( @PathVariable(value = "objectTypeName") String objectTypeName) { if (log.isDebugEnabled()) { log.debug("Looking for participant types for '" + objectTypeName + "'"); } AcmObjectType objectType = getAcmApplication().getBusinessObjectByName(objectTypeName); List<AcmParticipantType> retval = objectType.getParticipantTypes(); return retval; }
FindParticipantTypesForObjectTypeNameAPIController { @RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName( @PathVariable(value = "objectTypeName") String objectTypeName) { if (log.isDebugEnabled()) { log.debug("Looking for participant types for '" + objectTypeName + "'"); } AcmObjectType objectType = getAcmApplication().getBusinessObjectByName(objectTypeName); List<AcmParticipantType> retval = objectType.getParticipantTypes(); return retval; } }
FindParticipantTypesForObjectTypeNameAPIController { @RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName( @PathVariable(value = "objectTypeName") String objectTypeName) { if (log.isDebugEnabled()) { log.debug("Looking for participant types for '" + objectTypeName + "'"); } AcmObjectType objectType = getAcmApplication().getBusinessObjectByName(objectTypeName); List<AcmParticipantType> retval = objectType.getParticipantTypes(); return retval; }  }
FindParticipantTypesForObjectTypeNameAPIController { @RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName( @PathVariable(value = "objectTypeName") String objectTypeName) { if (log.isDebugEnabled()) { log.debug("Looking for participant types for '" + objectTypeName + "'"); } AcmObjectType objectType = getAcmApplication().getBusinessObjectByName(objectTypeName); List<AcmParticipantType> retval = objectType.getParticipantTypes(); return retval; }  @RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName(
            @PathVariable(value = "objectTypeName") String objectTypeName); AcmApplication getAcmApplication(); void setAcmApplication(AcmApplication acmApplication); }
FindParticipantTypesForObjectTypeNameAPIController { @RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName( @PathVariable(value = "objectTypeName") String objectTypeName) { if (log.isDebugEnabled()) { log.debug("Looking for participant types for '" + objectTypeName + "'"); } AcmObjectType objectType = getAcmApplication().getBusinessObjectByName(objectTypeName); List<AcmParticipantType> retval = objectType.getParticipantTypes(); return retval; }  @RequestMapping(method = RequestMethod.GET, value = "/participantTypesForObjectTypeName/{objectTypeName}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List<AcmParticipantType> participantTypesForObjectTypeName(
            @PathVariable(value = "objectTypeName") String objectTypeName); AcmApplication getAcmApplication(); void setAcmApplication(AcmApplication acmApplication);  }