public Single<Content> createContent(final Content content) {
BackendACL acl = new BackendACL();
acl.setPublicRead(false);
acl.setPublicWrite(false);
content.setAcl(acl);
return content.create().flatMap(backendEntity -> {
Content newContent = (Content) backendEntity;
newContent.setEntityId(backendEntity.getEntityId());
newContent.setSchema(content.getSchema());
return Single.just(newContent);
}).flatMap(content1 -> {
return content1.setLink("schema", content1.getSchema().getEntityId());
}).flatMap(isLinked -> {
// Code section 1
//return content1.setLink("user", getLoggedInUser().getEntityId());
return Single.just(true); // just a dummy to illustrate
}).flatMap(isLinked -> {
return Single.just(content);
// Code section 2
// should be: return Single.jus(content1);
});
}
In the code above, what is the solution to use the content1
variable in Code section 1 and Code section 2?