diff --git a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDataValueServices.java b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDataValueServices.java index eb26bc8c..76c15af3 100644 --- a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDataValueServices.java +++ b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDataValueServices.java @@ -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; @@ -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); @@ -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())); @@ -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; } diff --git a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaServices.java b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaServices.java index 32d17326..242f8b67 100644 --- a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaServices.java +++ b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaServices.java @@ -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 = " = "; diff --git a/tests/plugins/org.polarsys.capella.docgen.test.ju/model/In-Flight Entertainment System/In-Flight Entertainment System.capella b/tests/plugins/org.polarsys.capella.docgen.test.ju/model/In-Flight Entertainment System/In-Flight Entertainment System.capella index 308fd0b7..08bf51c4 100644 --- a/tests/plugins/org.polarsys.capella.docgen.test.ju/model/In-Flight Entertainment System/In-Flight Entertainment System.capella +++ b/tests/plugins/org.polarsys.capella.docgen.test.ju/model/In-Flight Entertainment System/In-Flight Entertainment System.capella @@ -1,6 +1,6 @@ - + + id="25fe63b8-424c-492e-918c-835cafd785b5" name="Classes"> + + + + + + + + + + + + +