use of edu.stanford.bmir.protege.web.shared.form.FormData in project webprotege by protegeproject.
the class CollectionElementDataRepository_IT method shouldFindByCollectionIdAndElementId.
@Test
public void shouldFindByCollectionIdAndElementId() {
Map<FormElementId, FormDataValue> map = new HashMap<>();
map.put(FormElementId.get("theElement"), FormDataPrimitive.get("theValue"));
FormData formData = new FormData(map);
CollectionItemData data = new CollectionItemData(collectionId, elementId, formData);
repository.save(data);
assertThat(repository.find(collectionId, elementId), is(data));
}
use of edu.stanford.bmir.protege.web.shared.form.FormData in project webprotege by protegeproject.
the class SetFormDataActionHandler method execute.
@Nonnull
@Override
public SetFormDataResult execute(@Nonnull SetFormDataAction action, @Nonnull ExecutionContext executionContext) {
FormData formData = action.getFormData();
CollectionItemData data = null;
if (formData.isEmpty()) {
data = new CollectionItemData(action.getCollectionId(), action.getElementId());
} else {
data = new CollectionItemData(action.getCollectionId(), action.getElementId(), formData);
}
repository.save(data);
return new SetFormDataResult();
}
use of edu.stanford.bmir.protege.web.shared.form.FormData in project webprotege by protegeproject.
the class FormDataConverter method decodeObject.
@Override
public FormData decodeObject(DBObject fromDBObject, MappedField optionalExtraInfo) {
Map<FormElementId, FormDataValue> map = new HashMap<>();
fromDBObject.keySet().forEach(key -> {
FormDataValue value = valueConverter.decodeObject(fromDBObject.get(key), optionalExtraInfo);
map.put(FormElementId.get(key), value);
});
return new FormData(map);
}
use of edu.stanford.bmir.protege.web.shared.form.FormData in project webprotege by protegeproject.
the class FormPortletPresenter method setSubject.
private void setSubject(@Nonnull final OWLEntity entity) {
checkNotNull(entity);
FormData formData = formPresenter.getFormData();
// currentSubject.ifPresent(subject -> {
// dispatchServiceManager.execute(new SetFormDataAction(projectId,
// new FormId("MyForm"),
// subject,
// formData),
// result -> {});
// });
currentSubject = Optional.of(entity);
// dispatchServiceManager.execute(new GetFormDescriptorAction(projectId, new FormId("MyForm"), entity),
// result -> formPresenter.displayForm(result.getFormDescriptor(), result.getFormData()));
}
use of edu.stanford.bmir.protege.web.shared.form.FormData in project webprotege by protegeproject.
the class CollectionElementDataRepository_IT method shouldUpdateCollectionElementData.
@Test
public void shouldUpdateCollectionElementData() {
Map<FormElementId, FormDataValue> map = new HashMap<>();
map.put(FormElementId.get("theElement"), FormDataPrimitive.get("theValue"));
FormData formData = new FormData(map);
repository.save(new CollectionItemData(collectionId, elementId, formData));
Map<FormElementId, FormDataValue> map2 = new HashMap<>();
map.put(FormElementId.get("theElement"), FormDataPrimitive.get("theNewValue"));
FormData theNewformData = new FormData(map2);
repository.save(new CollectionItemData(collectionId, elementId, theNewformData));
assertThat(datastore.getCount(CollectionItemData.class), is(1L));
}
Aggregations