- private void readComponents(ReadGraph graph) throws DatabaseException {
- Layer0 L0 = Layer0.getInstance(graph);
- StructuralResource2 STR = StructuralResource2.getInstance(graph);
- for(Resource container : containers) {
- for(Resource r : CommonDBUtils.objectsWithType(graph, container, L0.ConsistsOf, STR.Component)) {
- if(folders.contains(r))
- continue;
- components.add(r);
- readNameAndParent(graph, container, r);
- Variable v = Variables.getVariable(graph, r);
- TreeMap<String,Variable> properties = new TreeMap<>();
- for(Variable property : v.getProperties(graph))
- properties.put(property.getName(graph), property);
- StringBuilder dump = new StringBuilder();
- for(Variable property : properties.values()) {
- String possibleValue = property.getPossiblePropertyValue(graph, "HasDisplayValue", Bindings.STRING);
- if(possibleValue != null) {
- dump.append(property.getName(graph));
- dump.append(" ");
- dump.append(possibleValue);
- dump.append("\n");
- }
- if(property.getClassifications(graph).contains(StructuralResource2.URIs.ConnectionRelation)) {
- dump.append(property.getName(graph));
- Connection c = property.getValue(graph);
- for(VariableConnectionPointDescriptor desc : c.getConnectionPointDescriptors(graph, null)) {
- dump.append(" ");
- dump.append(desc.getRelativeRVI(graph, v));
+ private void readGeneric(ReadGraph graph) throws DatabaseException {
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+ for(Resource r : parents.keySet()) {
+ if(contentDumps.containsKey(r))
+ continue;
+ TByteArrayList result = new TByteArrayList();
+ try {
+ TreeMap<String,Resource> sortedTypes = new TreeMap<>();
+ for(Resource type : graph.getTypes(r)) {
+ String uri = graph.getPossibleURI(type);
+ if(uri != null)
+ sortedTypes.put(uri, type);
+ }
+ for(Resource type : sortedTypes.values()) {
+ try {
+ Variable typeVariable = Variables.getVariable(graph, type);
+ @SuppressWarnings("rawtypes")
+ Function f = typeVariable.getPossiblePropertyValue(graph, MOD.contentDumpFunction);
+ if(f != null) {
+ @SuppressWarnings("unchecked")
+ byte[] dump = (byte[])Simantics.applySCLRead(graph, f, r);
+ if(dump != null) {
+ result.add(dump);
+ }