use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class RelevancePanelPresenter method fieldList.
private List<FormField> fieldList(FieldWidgetContainer container) {
ResourceId thisFieldId = container.getFormField().getId();
FormClass formClass = container.getFormDesigner().getModel().getFormClassByElementId(thisFieldId);
List<FormField> formFields = new ArrayList<>();
for (FormField formField : formClass.getFields()) {
if (!formField.getId().equals(thisFieldId)) {
formFields.add(formField);
}
}
return formFields;
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class SingleClassTargetBuilder method newImporter.
public SingleClassImporter newImporter(Map<TargetSiteId, ColumnAccessor> mappings) {
List<ColumnAccessor> sourceColumns = Lists.newArrayList();
Map<FieldPath, Integer> referenceValues = targetCollector.getPathMap(mappings, sourceColumns);
List<FieldImporterColumn> fieldImporterColumns = targetCollector.fieldImporterColumns(mappings);
ResourceId rangeClassId = Iterables.getOnlyElement(rootField.getRange());
return new SingleClassImporter(rangeClassId, rootField.getField().isRequired(), sourceColumns, referenceValues, fieldImporterColumns, rootField.getFieldId());
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class TargetCollector method getPathMap.
public Map<FieldPath, Integer> getPathMap(Map<TargetSiteId, ColumnAccessor> mappings, List<ColumnAccessor> sourceColumns) {
Map<FieldPath, Integer> referenceValues = new HashMap<>();
List<FieldImporterColumn> importerColumns = Lists.newArrayList();
int columnIndex = 0;
for (Map.Entry<TargetSiteId, ColumnAccessor> entry : mappings.entrySet()) {
ImportTarget target = getTargetBySiteId(entry.getKey());
ColumnAccessor source = entry.getValue();
importerColumns.add(new FieldImporterColumn(target, source));
sourceColumns.add(entry.getValue());
ResourceId fieldId = ResourceId.valueOf(entry.getKey().asString());
for (FieldPath path : getFieldPathMap().get(fieldId)) {
referenceValues.put(path, columnIndex);
}
columnIndex++;
}
return referenceValues;
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class DbEditor method onUIAction.
private void onUIAction(String actionId) {
if (UIActions.SAVE.equals(actionId)) {
save();
} else if (UIActions.DELETE.equals(actionId)) {
promptDeleteSelection();
} else if (UIActions.IMPORT.equals(actionId)) {
SchemaImportDialog dialog = new SchemaImportDialog(new SchemaImporterV2(service, db), new SchemaImporterV3(db.getId(), locator));
dialog.show().then(() -> {
refresh();
return null;
});
} else if (UIActions.EDIT.equals(actionId)) {
Optional<ResourceId> selectedFormId = getSelectedFormId();
if (selectedFormId.isPresent()) {
eventBus.fireEvent(new NavigationEvent(NavigationHandler.NAVIGATION_REQUESTED, new ResourcePlace(selectedFormId.get(), ResourcePage.DESIGN_PAGE_ID)));
}
} else if (UIActions.OPEN_TABLE.equals(actionId)) {
Optional<ResourceId> selectedFormId = getSelectedFormId();
if (selectedFormId.isPresent()) {
App3.openNewTable(selectedFormId.get());
}
}
}
use of org.activityinfo.model.resource.ResourceId in project activityinfo by bedatadriven.
the class SchemaImporterV3 method determineReferencesToValidate.
private List<ResourceId> determineReferencesToValidate() {
List<ResourceId> validationList = new ArrayList<>(refMap.size());
for (FormField refField : refMap.values()) {
ReferenceType refType = (ReferenceType) refField.getType();
ResourceId reference = refType.getRange().iterator().next();
if (!isImportedReference(reference)) {
validationList.add(reference);
}
}
return validationList;
}
Aggregations