use of io.adminshell.aas.v3.model.Property in project uPMT by coco35700.
the class Main method createBasicSchema.
/**
* Creates a basic scheme as a default
* should be improved if desired
*/
private void createBasicSchema() {
Type s = new Schema((_langBundle.getString("default_scheme")));
Type general = new Folder(_langBundle.getString("general"));
Type autre = new Folder(_langBundle.getString("other"));
Type visuel = new Category(_langBundle.getString("visual"));
Type image = new Property(_langBundle.getString("picture"));
Type sensoriel = new Category(_langBundle.getString("sensory"));
Type emotionnel = new Category(_langBundle.getString("emotional"));
Type sonore = new Category(_langBundle.getString("acoustic"));
visuel.addType(image);
general.addType(visuel);
general.addType(sensoriel);
general.addType(emotionnel);
general.addType(sonore);
s.addType(general);
s.addType(autre);
this.BasicSchema = (Schema) s;
}
use of io.adminshell.aas.v3.model.Property in project uPMT by coco35700.
the class Main method writeMoment.
/**
* Recursive method used to recursively transform a Moment and its sub Moments into CSV compatible DATAZ
*/
private void writeMoment(DescriptionInterview ent, MomentExperience m, PrintWriter writer, String hierarchy) {
LinkedList<String> classes = new LinkedList<String>();
for (Type t : m.getTypes()) {
for (Type prop : t.getTypes()) {
Property p = (Property) prop;
classes.add(format(t.getName()) + "," + format(p.getName()) + "," + format(p.getValue()));
}
}
if (!classes.isEmpty()) {
for (String s : classes) {
writer.println(format(ent.getName()) + ",\"" + hierarchy + "\"" + "," + format(m.getName()) + "," + format(m.getDescripteme()) + "," + format(m.getColor()) + "," + format(m.getDuration()) + "," + s);
}
} else {
writer.println(format(ent.getName()) + ",\"" + hierarchy + "\"" + "," + format(m.getName()) + "," + format(m.getDescripteme()) + "," + format(m.getColor()) + "," + format(m.getDuration()) + ",\"\",\"\",\"\"");
}
for (int i = 0; i < m.getSubMoments().size(); i++) {
MomentExperience sub = m.getSubMoments().get(i);
writeMoment(ent, sub, writer, hierarchy + "." + (i + 1));
}
}
use of io.adminshell.aas.v3.model.Property in project uPMT by coco35700.
the class TypeClassRepresentationController method updateVue.
@Override
public void updateVue(Observable obs, Object value) {
// TODO Auto-generated method stub
if (obs.getClass().equals(RenameClassSchemeController.class)) {
renameClass((String) value);
}
if (obs.getClass().equals(ChangeColorClassSchemeController.class)) {
setColor((String) value);
}
if (obs.getClass().equals(AddPropertySchemeController.class)) {
Property n = new Property(((Property) value).getName());
boolean contain = false;
for (Type t : classe.getTypes()) {
if (t.getName().equals(n.getName())) {
contain = true;
break;
}
}
if (!this.classe.getTypes().contains(n)) {
addProperty((Property) n);
} else {
// System.out.println("AH BAH VOILA !!!!!");
}
}
if (obs.getClass().equals(RemovePropertySchemeController.class)) {
Property toRemove = (Property) value;
// System.out.println("Remove dans TypeClassRpzCtrl "+toRemove.getName());
RemoveProperty(toRemove);
}
if (obs.getClass().equals(AddPropertySchemeWithValueController.class)) {
addProperty(stack.pop());
}
if (obs.getClass().equals(RemoveClassSchemeController.class)) {
// System.out.println("DELETINGCLASS");
moment.removeTypeClassRep(this);
}
if (obs.getClass().equals(AddClassSchemeController.class)) {
// System.out.println("REPUTINGCLASS");
moment.putPreviousClassRep();
}
}
use of io.adminshell.aas.v3.model.Property in project uPMT by coco35700.
the class TypeTreeViewControllerClass method addProperty.
@FXML
public void addProperty() {
propertiesNumber++;
Property nt = new Property("Propriete " + propertiesNumber);
AddPropertyToClassCommand cmd = new AddPropertyToClassCommand(type, nt, tree.getTreeItem(), this.main);
cmd.execute();
UndoCollector.INSTANCE.add(cmd);
}
use of io.adminshell.aas.v3.model.Property in project FAAAST-Service by FraunhoferIOSB.
the class ElementValueMapperTest method testEntitySetValueMapping.
@Test
public void testEntitySetValueMapping() throws ValueFormatException {
SubmodelElement actual = new DefaultEntity.Builder().statement(new DefaultProperty.Builder().idShort("property").build()).build();
EntityValue value = EntityValue.builder().statement("property", PropertyValue.of(Datatype.String, "foo")).entityType(EntityType.SELF_MANAGED_ENTITY).globalAssetId(List.of(new DefaultKey.Builder().idType(KeyType.IRI).type(KeyElements.SUBMODEL).value("http://example.org/submodel/1").build(), new DefaultKey.Builder().idType(KeyType.ID_SHORT).type(KeyElements.PROPERTY).value("property1").build())).build();
SubmodelElement expected = new DefaultEntity.Builder().statement(new DefaultProperty.Builder().idShort(value.getStatements().keySet().iterator().next()).valueType(Datatype.String.getName()).value("foo").build()).entityType(value.getEntityType()).globalAssetId(new DefaultReference.Builder().keys(value.getGlobalAssetId()).build()).build();
ElementValueMapper.setValue(actual, value);
Assert.assertEquals(expected, actual);
}
Aggregations