See the orignal question for context.
Additional Context:
- Objectify-Appengine is used for persistence.
FormProxy
andQuestionProxy
are of type EntityProxyQuestionDataProxy
and its subtypes are of typeValueProxy
- All Editors implement
HasRequestContext
, and in the case ofQuestionData
subtype Editors,HasRequestContext.setContext()
is called explicitly from the parent.
The first problem has to do with Collections, and the second has to do with Polymorphic types. I'm not sure if the problem is with the way I'm using Editors or RequestFactory. Since the data isn't present in the RPC payload we can rule out the persistence setup.
Problem
Values for QuestionProxy are all null in RPC request (if QuestionProxy is newly created, ok otherwise)
Question
What is the correct way to add / remove Questions
from the form. What is the sequence of calling create, edit, update methods for Question
, Form
, and QuestionData
while using Editors.
Current Solutions
The add question functionality (in the activity):
@Override
public void addQuestion(final QuestionEditor questionEditor) {
final QuestionProxy proxy = theOneAndOnlyOneContextForEditing.create(QuestionProxy.class);
final QuestionRequest dpr = theOneAndOnlyOneContextForEditing.append(clientFactory.getRequestFactory()
.qestionRequest());
dpr.updateQuestion(proxy);
questionListEditor.asEditor().getList().add(proxy);
}
To remove a question I mark a flag in the question, which will remove it from the list on the server, and delete it. (hack) This only works for questions which have already been saved.
Form
andQuestion
? – Tempa