use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class CommunicationProperties method getOutputTime.
public static Optional<List<IoTimeSpec>> getOutputTime(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getOutputTime_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return new IoTimeSpec(resolved1, lookupContext, mode);
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class DeploymentProperties method getAllowedConnectionBinding.
public static Optional<List<InstanceObject>> getAllowedConnectionBinding(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getAllowedConnectionBinding_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class DeploymentProperties method getActualConnectionBinding.
public static Optional<List<InstanceObject>> getActualConnectionBinding(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getActualConnectionBinding_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class DeploymentProperties method getAllowedConnectionType.
public static Optional<List<AllowedConnectionType>> getAllowedConnectionType(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getAllowedConnectionType_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return AllowedConnectionType.valueOf(resolved1);
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of com.google.api.expr.v1alpha1.ListValue in project osate2 by osate.
the class PropertyUtils method getSubcomponentList.
/**
* May return an empty list.
*
* @param object
* @param propertyName
* @return
*/
public static List<Subcomponent> getSubcomponentList(ProcessorSubcomponent object, String propertyName) {
List<Subcomponent> res = new ArrayList<Subcomponent>();
PropertyAssociation pa = findPropertyAssociation(propertyName, object);
if (pa != null) {
Property p = pa.getProperty();
if (p.getName().equalsIgnoreCase(propertyName)) {
List<ModalPropertyValue> values = pa.getOwnedValues();
if (values.size() == 1) {
ModalPropertyValue v = values.get(0);
PropertyExpression expr = v.getOwnedValue();
if (expr instanceof ListValue) {
ListValue lv = (ListValue) expr;
for (PropertyExpression pe : lv.getOwnedListElements()) {
if (pe instanceof ReferenceValue) {
ReferenceValue c = ((ReferenceValue) pe);
ContainmentPathElement cpe = c.getContainmentPathElements().get(c.getContainmentPathElements().size() - 1);
res.add((Subcomponent) cpe.getNamedElement());
}
}
}
}
}
}
// try on a refined NamedElement
if (object instanceof RefinableElement) {
RefinableElement re = object;
if (re.getRefinedElement() != null) {
List<Subcomponent> l = getSubcomponentList((ProcessorSubcomponent) re.getRefinedElement(), propertyName);
if (!l.isEmpty()) {
res.addAll(l);
}
}
}
return res;
}
Aggregations