@Test public void testCreate() { String id = resourceService.postEntity(resource, new EntityBody(createTestEntity())); assertNotNull("ID should not be null", id); }
@Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entityIds = definition.getService().createBasedOnContextualRoles(adapter.migrate(entity, definition.getResourceName(), POST)); } else { entityIds = definition.getService().create(adapter.migrate(entity, definition.getResourceName(), POST)); } return StringUtils.join(entityIds.toArray(), ","); }
DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entityIds = definition.getService().createBasedOnContextualRoles(adapter.migrate(entity, definition.getResourceName(), POST)); } else { entityIds = definition.getService().create(adapter.migrate(entity, definition.getResourceName(), POST)); } return StringUtils.join(entityIds.toArray(), ","); } }
DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entityIds = definition.getService().createBasedOnContextualRoles(adapter.migrate(entity, definition.getResourceName(), POST)); } else { entityIds = definition.getService().create(adapter.migrate(entity, definition.getResourceName(), POST)); } return StringUtils.join(entityIds.toArray(), ","); }  }
DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entityIds = definition.getService().createBasedOnContextualRoles(adapter.migrate(entity, definition.getResourceName(), POST)); } else { entityIds = definition.getService().create(adapter.migrate(entity, definition.getResourceName(), POST)); } return StringUtils.join(entityIds.toArray(), ","); }  @PostConstruct void init(); @Override @MigrateResponse ServiceResponse getEntitiesByIds(final Resource resource, final String idList, final URI requestURI); @Override @MigrateResponse ServiceResponse getEntities(final Resource resource, final URI requestURI,
                                       final boolean getAllEntities); @Override @MigratePostedEntity String postEntity(final Resource resource, EntityBody entity); @Override @MigratePostedEntity void putEntity(Resource resource, String id, EntityBody entity); @Override @MigratePostedEntity void patchEntity(Resource resource, String id, EntityBody entity); @Override void deleteEntity(Resource resource, String id); @Override String getEntityType(Resource resource); @Override CalculatedData<String> getCalculatedData(Resource resource, String id); @Override CalculatedData<Map<String, Integer>> getAggregateData(Resource resource, String id); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @MigrateResponse ServiceResponse getEntities(final Resource base, final String id, final Resource resource, final URI requestURI); @Override ServiceResponse getEntities(Resource base, String id, Resource association, Resource resource, URI requestUri); }
DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entityIds = definition.getService().createBasedOnContextualRoles(adapter.migrate(entity, definition.getResourceName(), POST)); } else { entityIds = definition.getService().create(adapter.migrate(entity, definition.getResourceName(), POST)); } return StringUtils.join(entityIds.toArray(), ","); }  @PostConstruct void init(); @Override @MigrateResponse ServiceResponse getEntitiesByIds(final Resource resource, final String idList, final URI requestURI); @Override @MigrateResponse ServiceResponse getEntities(final Resource resource, final URI requestURI,
                                       final boolean getAllEntities); @Override @MigratePostedEntity String postEntity(final Resource resource, EntityBody entity); @Override @MigratePostedEntity void putEntity(Resource resource, String id, EntityBody entity); @Override @MigratePostedEntity void patchEntity(Resource resource, String id, EntityBody entity); @Override void deleteEntity(Resource resource, String id); @Override String getEntityType(Resource resource); @Override CalculatedData<String> getCalculatedData(Resource resource, String id); @Override CalculatedData<Map<String, Integer>> getAggregateData(Resource resource, String id); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @MigrateResponse ServiceResponse getEntities(final Resource base, final String id, final Resource resource, final URI requestURI); @Override ServiceResponse getEntities(Resource base, String id, Resource association, Resource resource, URI requestUri);  }