! You are browsing an archive website for Modelio 1.x. Click here to visit the official website for most recent versions of Modelio

Home Support Forum
Modelio
Welcome, Guest
Please Login or Register.    Lost Password?
How to retrieve a property value for a requirement Forum is locked
(0 viewing) 
Discuss about Modelio module design and development.
Go to bottom
TOPIC: How to retrieve a property value for a requirement
#607
tony
Junior Boarder
Posts: 29
graphgraph
User Offline Click here to see the profile of this user
How to retrieve a property value for a requirement 6 Years, 7 Months ago  
This is an example to retrieve a property value for a requirement.
You want to retrieve the 'Origin' or the 'Benefit' of a requirement. Define the following operation and call it:
ObRequirement myRequirement = ...
String value = getPropertyValue (myRequirement, "Benefit");

Code:

public static String getPropertyValue(ObRequirement element,
        String propertyName) {
// Retrieve the PropertyValueSet defined for the requirement
ObPropertyValueSet propertySet = element.getProperties();
if (propertySet != null) {
ObList<ObPropertyValue> values = propertySet.getValue();
for (ObPropertyValue value : values) {
// Search for the property
ObProperty property = value.getKey();
if (property != null) {
if (property.getName().equals(propertyName)) {
return value.getValue();
}
}
}
}
return ""; //$NON-NLS-1$
}


To retrieve a property value for a term, replace ObRequirement->ObTerm
 
Logged Logged
 
Last Edit: 2011/02/15 17:19 By tony.
  The topic has been locked.
Go to top