use of org.activityinfo.ui.client.component.importDialog.model.strategy.TargetSiteId in project activityinfo by bedatadriven.
the class ColumnMappingPage method collectNotMappedMandatoryColumns.
/**
* @param mandatory if true - then only mandatory, if false then ALL
* @return
*/
public List<ImportTarget> collectNotMappedMandatoryColumns(boolean mandatory) {
List<ImportTarget> list = Lists.newArrayList();
for (final MapExistingAction action : actions) {
final FormField formField = action.getTarget().getFormField();
if (mandatory && !formField.isRequired()) {
continue;
}
final Map<TargetSiteId, ColumnAccessor> mappedColumns = importModel.getMappedColumns(formField.getId());
if (mappedColumns.isEmpty()) {
list.add(action.getTarget());
}
}
return list;
}
use of org.activityinfo.ui.client.component.importDialog.model.strategy.TargetSiteId in project activityinfo by bedatadriven.
the class ImportModel method getMappedColumns.
public Map<TargetSiteId, ColumnAccessor> getMappedColumns(ResourceId fieldId) {
Map<TargetSiteId, ColumnAccessor> mappings = Maps.newHashMap();
for (Map.Entry<SourceColumn, MapExistingAction> entry : getMapExistingActions(fieldId).entrySet()) {
TargetSiteId site = entry.getValue().getTarget().getSite();
ColumnAccessor column = new SourceColumnAccessor(entry.getKey());
mappings.put(site, column);
}
return mappings;
}
use of org.activityinfo.ui.client.component.importDialog.model.strategy.TargetSiteId in project activityinfo by bedatadriven.
the class ImportCommandExecutor method createImporters.
private List<FieldImporter> createImporters(final ImportModel model) {
final List<FieldImporter> importers = Lists.newArrayList();
for (Importer.TargetField field : fields) {
Map<TargetSiteId, ColumnAccessor> mappedColumns = model.getMappedColumns(field.node.getFieldId());
if (!mappedColumns.isEmpty()) {
System.out.println(field + " => " + mappedColumns);
FieldImporter importer = field.strategy.createImporter(field.node, mappedColumns, model);
importers.add(importer);
}
}
return importers;
}
Aggregations