@Test public void testCreateResource() throws Exception { String resourcePath = "post"; final Name<String> resourceName = name(resourcePath); final DataSet initialData = getInitialData(newReference().toLocalIndividual().named("Miguel"), new Date()); final Container resource = publishResource(Container.class,BookContainerHandler.ID,resourceName,resourcePath); NameProvider nameProvider = NameProvider.create(resourceName); final Name<String> id = NamingScheme.getDefault().name("book1"); nameProvider.addMemberName(id); final BookHandler resourceHandler = getHandler(BookHandler.class); BookContainerHandler containerHandler = getHandler(BookContainerHandler.class); containerHandler.add(resourceName, null); containerHandler.setBookHandler(resourceHandler); containerHandler.addNameProvider(resourceName, nameProvider); final Resource newResource = transactional( new Callable<Resource>() { @Override public Resource call() throws Exception { Resource result=sut.createResource(resource,initialData,getSessionConfiguration(resource)); assertThat(result,notNullValue()); assertThat((Object)result.id().name(),equalTo((Object)id)); assertThat(result.id().templateId(),equalTo(BookHandler.ID)); assertThat(resourceHandler.hasResource(resourceName),equalTo(false)); return result; } } ); transactional( new Callable<Void>() { @Override public Void call() throws Exception { DataSet data = sut.getResource(newResource,getSessionConfiguration(newResource)); assertThat(data,sameInstance(initialData)); return null; } } ); }
public Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { return adapter(container,configuration).create(dataSet); }
ResourceControllerService implements Service { public Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { return adapter(container,configuration).create(dataSet); } }
ResourceControllerService implements Service { public Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { return adapter(container,configuration).create(dataSet); } private  ResourceControllerService(WriteSessionService writeSessionService, TemplateManagementService templateManagementService); }
ResourceControllerService implements Service { public Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { return adapter(container,configuration).create(dataSet); } private  ResourceControllerService(WriteSessionService writeSessionService, TemplateManagementService templateManagementService); DataSet getResource(Resource resource, WriteSessionConfiguration configuration); DataSet queryResource(Resource resource, Query query, WriteSessionConfiguration configuration); void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration); void deleteResource(Resource resource, WriteSessionConfiguration configuration); Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration); static ServiceBuilder<ResourceControllerService> serviceBuilder(); static ResourceControllerService defaultService(); }
ResourceControllerService implements Service { public Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { return adapter(container,configuration).create(dataSet); } private  ResourceControllerService(WriteSessionService writeSessionService, TemplateManagementService templateManagementService); DataSet getResource(Resource resource, WriteSessionConfiguration configuration); DataSet queryResource(Resource resource, Query query, WriteSessionConfiguration configuration); void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration); void deleteResource(Resource resource, WriteSessionConfiguration configuration); Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration); static ServiceBuilder<ResourceControllerService> serviceBuilder(); static ResourceControllerService defaultService();  }