use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class AttributeValueTableUpdater method add.
public void add(FieldValue value) {
EnumValue enumValue = (EnumValue) value;
if (enumValue != null) {
for (ResourceId resourceId : enumValue.getResourceIds()) {
Preconditions.checkArgument(resourceId.getDomain() == CuidAdapter.ATTRIBUTE_DOMAIN);
int attributeId = CuidAdapter.getLegacyIdFromCuid(resourceId);
attributesToSet.add(attributeId);
attributesToClear.remove(attributeId);
}
}
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class MySqlUpdateTest method updateGeometry.
@Test
public void updateGeometry() throws SQLException {
userId = 3;
ResourceId formId = CuidAdapter.adminLevelFormClass(1);
ResourceId recordId = entity(1);
ResourceId fieldId = CuidAdapter.field(formId, CuidAdapter.GEOMETRY_FIELD);
Optional<FormStorage> storage = catalog.getForm(formId);
GeometryFactory factory = new GeometryFactory();
Polygon polygon = new Polygon(new LinearRing(new CoordinateArraySequence(new Coordinate[] { new Coordinate(100, 0), new Coordinate(101, 0), new Coordinate(101, 1), new Coordinate(100, 1), new Coordinate(100, 0) }), factory), new LinearRing[0], factory);
storage.get().updateGeometry(recordId, fieldId, polygon);
query(formId, "_id", "ST_XMIN(boundary)", "ST_XMAX(boundary)");
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class ColumnSetBuilder method enqueue.
public Slot<ColumnSet> enqueue(QueryModel queryModel, FormScanBatch batch) {
ResourceId formId = queryModel.getRowSources().get(0).getRootFormId();
FormTree tree = formTreeBuilder.queryTree(formId);
if (tree.getRootState() == FormTree.State.VALID) {
return enqueue(tree, queryModel, batch);
} else {
return emptySet(queryModel);
}
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class AttributeConverter method toParameters.
@Override
public Collection<?> toParameters(FieldValue value) {
EnumValue enumValue = (EnumValue) value;
ResourceId enumItemId = enumValue.getValueId();
Preconditions.checkArgument(enumItemId.getDomain() == CuidAdapter.ATTRIBUTE_DOMAIN);
return Collections.singleton(CuidAdapter.getLegacyIdFromCuid(enumItemId));
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class TableViewModel method getEffectiveSubTable.
public Observable<EffectiveTableModel> getEffectiveSubTable(final ResourceId subFormId) {
Observable<EffectiveTableModel> effectiveSubTable = effectiveSubTables.get(subFormId);
if (effectiveSubTable == null) {
final TableModel subModel = ImmutableTableModel.builder().formId(subFormId).build();
effectiveSubTable = formTree.transform(tree -> tree.subTree(subFormId)).transform(subTree -> new EffectiveTableModel(formStore, subTree, subModel, Optional.of(getSelectedRecordRef())));
effectiveSubTables.put(subFormId, effectiveSubTable);
}
return effectiveSubTable;
}
Aggregations