Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Data value gen #263

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.polarsys.capella.core.data.capellacore.NamedElement;
import org.polarsys.capella.core.data.capellacore.Type;
import org.polarsys.capella.core.data.information.CollectionValue;
import org.polarsys.capella.core.data.information.datavalue.AbstractExpressionValue;
import org.polarsys.capella.core.data.information.datavalue.BinaryExpression;
import org.polarsys.capella.core.data.information.datavalue.ComplexValue;
import org.polarsys.capella.core.data.information.datavalue.DataValue;
Expand Down Expand Up @@ -66,11 +67,12 @@ private static String getDataValueInformation(DataValue dataValue_p, String proj
buffer.append(CapellaServices.getHyperlinkFromElement(abstractType) + CapellaServices.SPACE);
}
String valueString = getValueOfDataValue(dataValue_p);
if (!valueString.equals("")) {
buffer.append(CapellaServices.VALUE_EQUAL);
// Add the value of data value to the buffer
buffer.append(valueString);
}
if (!valueString.equals("")) {
buffer.append(CapellaServices.VALUE_EQUAL);
// Add the value of data value to the buffer
buffer.append(valueString);
}

if (dataValue_p instanceof NumericValue) {
if (null != ((NumericValue) dataValue_p).getUnit()) {
String unitString = getUnitOfNumericValue((NumericValue) dataValue_p);
Expand Down Expand Up @@ -342,21 +344,22 @@ private static String getValueOfDataValue(DataValue dataValue_p, boolean simple)
// Test the type of the Data Value
if (dataValue_p instanceof LiteralNumericValue)
{
// Return the value
return (((LiteralNumericValue) dataValue_p).getValue());
String value = (((LiteralNumericValue) dataValue_p).getValue());
if (value == null) {
return CapellaServices.UNDEFINED_CHEVRON;
}
}
else
{
if (dataValue_p instanceof BinaryExpression)
if (dataValue_p instanceof AbstractExpressionValue)
{
return (((BinaryExpression) dataValue_p).getExpression());
}
else
if (dataValue_p instanceof UnaryExpression)
{
return (((UnaryExpression) dataValue_p).getExpression());
}
String value = (((AbstractExpressionValue) dataValue_p).getExpression());
if (value == null) {
return CapellaServices.NULL_VALUE;
}
}
else

if (dataValue_p instanceof LiteralBooleanValue)
{
return (String.valueOf(((LiteralBooleanValue) dataValue_p).isValue()));
Expand Down Expand Up @@ -409,9 +412,13 @@ private static String getValueOfDataValue(DataValue dataValue_p, boolean simple)

return CapellaServices.getHyperlinkFromElement(referencedValue);
}
else
return CapellaServices.getFullDataPkgHierarchyLink(referencedValue);
}
}

if (referencedValue == null) {
return CapellaServices.UNDEFINED_CHEVRON;
}

// Return empty if there is no value or if the type is not defined
return CapellaServices.EMPTY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ private CapellaServices() {}

public static final String EMPTY = "";

public static final String NULL_VALUE = "null";

public static final String VALUE_PRESENTER = " : ";
public static final String VALUE_EQUAL = " = ";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--Capella_Version_7.0.0-->
<!--Capella_Version_null-->
<org.polarsys.capella.core.data.capellamodeller:Project xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:libraries="http://www.polarsys.org/capella/common/libraries/7.0.0"
xmlns:org.polarsys.capella.core.data.capellacommon="http://www.polarsys.org/capella/core/common/7.0.0"
Expand Down Expand Up @@ -809,7 +809,33 @@
<ownedDataPkg xsi:type="org.polarsys.capella.core.data.information:DataPkg"
id="be6614b7-9512-4113-b3bc-76a3b7e01a4e" name="Data">
<ownedDataPkgs xsi:type="org.polarsys.capella.core.data.information:DataPkg"
id="25fe63b8-424c-492e-918c-835cafd785b5" name="Classes"/>
id="25fe63b8-424c-492e-918c-835cafd785b5" name="Classes">
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:BinaryExpression"
id="cde94da0-8680-465a-bd5b-9e3e861c510b" name="BinaryExpression 2"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:BooleanReference"
id="92ed5a94-ad34-430c-8289-0abf582d97a8" name="BooleanReference 2"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information:CollectionValue"
id="924c029c-448a-4ee4-85d5-dd3dc04df816" name="CollectionValue 3"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information:CollectionValueReference"
id="41867f86-ee77-4481-80fb-bf802ef408da" name="CollectionValueReference 4"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:ComplexValue"
id="0f5bbd9e-423f-4a42-bff7-f84070bafb30" name="ComplexValue 5"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:ComplexValueReference"
id="358b8ad6-f4cb-45fb-b422-afd5a81fd67a" name="ComplexValueReference 6"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:EnumerationReference"
id="32224177-45d0-4ff0-a92e-3b326f7e2f56" name="EnumerationReference 7"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:LiteralNumericValue"
id="a769e73e-d527-4f67-afd8-8bab2a2e44ed" name="LiteralNumericValue 8"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:LiteralStringValue"
id="3d1a655c-6288-4fc0-a339-999048e2242f" name="LiteralStringValue 9"
value=""/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:NumericReference"
id="1d43e55f-87a3-49bf-99f5-2bc60b2ce30f" name="NumericReference 10"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:StringReference"
id="a950b0e8-987c-4e6d-b53a-f510ff543171" name="StringReference 11"/>
<ownedDataValues xsi:type="org.polarsys.capella.core.data.information.datavalue:UnaryExpression"
id="553839c9-7873-4829-9635-9782253efd3e" name="UnaryExpression 12"/>
</ownedDataPkgs>
<ownedStateEvents xsi:type="org.polarsys.capella.core.data.capellacommon:ChangeEvent"
id="ebc7485e-718b-4753-93bf-4ee63c5ce81b" name="ChangeEvent 1" expression="#f32488b8-bcc5-4e97-acb7-4e0537b0217f">
<ownedConstraints xsi:type="org.polarsys.capella.core.data.capellacore:Constraint"
Expand Down
Binary file not shown.