+
+ @SCLValue(type = "ReadGraph -> Resource -> a -> b")
+ public static Object techTypeKeys(ReadGraph graph, Resource resource, Object context) throws DatabaseException {
+ if (!(context instanceof Variable))
+ return Collections.<String>emptyList();
+
+ Variable var = (Variable)context;
+ // Typically 'var' is <component>#<property>#HasDisplayValue#HasEnumerationValues
+ // We want the component part
+ while (!(var instanceof AbstractChildVariable))
+ var = var.getParent(graph);
+
+ Resource type = var.getType(graph, StructuralResource2.getInstance(graph).Component);
+ Resource model = var.getIndexRoot(graph);
+ if (model == null)
+ return Collections.<String>emptyList();
+ Resource table = graph.syncRequest(new PossibleTechTypeTable(model , type), TransientCacheListener.instance());
+ if (table == null)
+ return Collections.<String>emptyList();
+
+ Map<String, Map<String, String>> data = graph.syncRequest(new TechTypeTableData(table, true), TransientCacheListener.instance());
+ ArrayList<String> result = new ArrayList<String>(data.keySet());
+
+ // Sort so that all numbers are in growing order
+ result.sort(TechTypeUtils::compareNatural);
+
+ return result;
+ }