API Changes between Version 5 and 6

The DaVinci Configurator Classic Version 6 Automation Interface APIs slightly differ from the counterpart Version 5 Automation Interface APIs.

Therefore, your implemented script code might be affected by these API changes.

A detailed tabular overview of all API changes is shown in API Changes Reference.

Changes of ICreateProject

The ICreateProject API for creating a DaVinci Project has changed as shown in the following.

Removal of general block

The optional settings of the general block were moved to the parent createProject block.

projects.createProject {
    projectName 'NewProject'
    projectFolder paths.resolveTempPath('projectFolder')

    general {
        author 'projectAuthor'
        version '0.9'
    }
}

becomes

projects.createProject {
    projectName 'NewProject '
    projectFolder paths.resolveTempPath('projectFolder')

    author 'projectAuthor'
    version '0.9'
}

Introduction of projectType block

For separating the project type settings, the new methods getProjectType() and projectType(Action) were introduced.

projects.createProject {
    projectName 'NewProject'
    projectFolder paths.resolveTempPath('projectFolder')

    projectType EEnvironmentProjectType.SOFTWARE_CLUSTER_CONNECTION
    projectDomain EEnvironmentProjectTypeDomain.GLOBAL_RESOURCE_DB
}

becomes

projects.createProject {
    projectName 'NewProject'
    projectFolder paths.resolveTempPath('projectFolder')

    projectType {
        type EEnvironmentProjectType.SOFTWARE_CLUSTER_CONNECTION
        domain EEnvironmentProjectTypeDomain.GLOBAL_RESOURCE_DB
    }
}

Renaming of project target block

getTarget() or target(Closure)

becomes

getProjectTarget() or projectTarget(Action)

Changes of Model API

IModelObject has been removed, all usages should be replaced with MIObject.

Removal of get***Owner() Methods

Generated methods to access or change the parent objects have been removed from the API, this includes:

  • getParent()
  • setParent()
  • get*Owner()
  • set*Owner()

Exceptions:

  • MIContainer::getParent
  • MIParameterValue::getParent

Any modifications of the parent element should be done on the opposite side:

MIARPackage child = mdfAccess.createMDFObject(MIARPackage.class);
child.

setParent(parent);

becomes

MIARPackage child = mdfAccess.createMDFObject(MIARPackage.class);
parent.

getSubPackage().

add(child);

There are multiple options to replace getParent()/get*Owner() calls:

void handleParent(MIARPackage child) {
    final MIARPackage parent = child.getParent();
    if (parent != null) {
        // ...
    }
}

If only the parent type matters, but not the role:

void handleParent(MIARPackage child) {
    if (child.miImmediateComposite() instanceof MIARPackage parent) {
        // ...
    }
}

If the role matters, IAsrModelAccess#getImmediateParentWithRole can be used:

void handleParent(MIARPackage child) {
    final MIARPackage parent = asrModelAccess.getImmediateParentWithRole(child, MIARPackage.class, MIARPackage.SUB_PACKAGE);
    if (parent != null) {
        // ...
    }
}

Any navigation from ARRefs to their parent should be simplified with IAsrReferenceAccess#getObjectsPointingToOfType as documented below.

Changes of MIHas* Interfaces

The automatic generation of MIHas* interfaces has been removed. I.e. most of the MIHas* interfaces have been removed, except:

  • MIHasAdminData
  • MIHasAnnotation
  • MIHasContainer
  • MIHasContainerDef
  • MIHasDefinition
  • MIHasPackage
  • MIHasVariationPoint

Note: Use concrete types were possible!

Only if concrete types could not be used, here are some recommendations:

  • Use MIObject instead of the MIHas* interface.
  • Use miImmediateComposite() instead of getParent() or get*Owner() (see sec:GetOwnerMethods).

Background

TheMIHas* interfaces were generated automatically if the generator finds the same relation multiple times in different classes. But that leads to breaking changes when a newer AUTOSAR release changes one of the relations, even on the unchanged relations, too.

interface MIT {
}

interface MIHasT {
    MIT getT();
}

interface MIX extends MIHasT {
}

interface MIY extends MIHasT {
}

becomes

interface MIBase {
}

interface MIT extends MIBase {
}

interface MIX {
    MIBase getT(); // same method name because of backward compatibility, but different return type
}

interface MIY {
    MIT getT();
}

Rework of ARRef

The AUTOSAR reference classes (ARRef) in the model are subject to multiple changes. In the following , these changes will be explained in further detail, in case any manual migration has to be performed.

Changes of MI[Name]ARRef to MIGARRef<MI[Name]>

All classes with the naming scheme MI[Name]ARRef were replaced by MIGARRef<MI[Name]>. E.g. MIAllocatorARRef would now be MIGARRef<MIAllocator>. This change has the following implications:

  • The attribute DEST of the references is no longer available in the API. It can be simply removed though, as the DEST attribute is not used inside our tooling. It is calculated automatically by the persistency on writing an ARXML file.
  • The get/setRefTarget(s) methods stay the same.

Creation of ARRef Objects

As the concrete MI[Name]ARRef classes were removed, as mentioned in the section above, the creation of ARRef objects has changed in the stable API (the old way still works in the beta API though). Instead of calling e.g.
MIReferenceValue.setValue(IMdfAccessPublishedExt.createMDFObject(MIReferrableARRef)) to set the target of a reference value to a new ARRef the following call can now be used: MIReferenceValue.withValue().getOrCreate(). To set the reference target then call setRefTarget(MIReferrable).

Removal of ARRefs in specialized packages

All ARRef classes within in a package containing the name specialized were removed. These classes are mostly unused except MISdxARRef.

Instead, IAdminDataMdfAccessPublished should be used.

If further methods are necessary and not contained in IAdminDataMdfAccessPublished, please contact the Vector Support to consider publishing these methods.

Refactoring of IReferenceAccess.getAllReferencesPointingTo(MIReferrable)

It is now easier to obtain all references of a specific type pointing to a MIReferrable. The code below serves as an example for references to MIISignal:

record ExampleClass(IReferenceAccess referenceAccess,MIReferrable systemSignal) {
    // Old 1
    private void foo() {
        for (final MIARRef iSignalRef : referenceAccess.getAllReferencesPointingTo(systemSignal)) {
            if (iSignalRef instanceof MISystemSignalARRef ref2) {
                if (ref2.getISignalSystemSignalOwner() != null) {
                    final MIISignal iSignal = ref2.getISignalSystemSignalOwner();
                    // further code...
                }
            }
        }
    }

    // Old 2
    private void foo() {
        for (final MISystemSignalARRef ref : systemSignal.getSystemSignalARRefRefTargetsOwner()) {
            if (ref.getISignalSystemSignalOwner() != null) {
                final MIISignal iSignal = ref.getISignalSystemSignalOwner();
                // further code...
            }
        }
    }

    // Can be simplified to
    private void foo() {
        for (final MIISignal iSignal : referenceAccess.getObjectsPointingToOfType(systemSignal, MIISignal.class, MIISignal.SYSTEM_SIGNAL)) {
            // further code...
        }
    }
}

Here are some more examples:

Example 1
boolean retVal = false;

for(MIPortGroupARRef miPortGroupARRef :miPortGroup.getPortGroupARRefRefTargetsOwner()){
        if(miPortGroupARRef.getPortGroupInSystemInstanceRefTargetOwner() != null
           && miPortGroupARRef.getPortGroupInSystemInstanceRefTargetOwner().getPncMappingVfcOwner() != null){
            retVal = true;
        }
}
return retVal;

becomes

IAsrModelAccess modelAccess = miPortGroup.getProjectContext().getService(IAsrModelAccess.class);
IAsrReferenceAccess referenceAccess = miPortGroup.getProjectContext().getService(IAsrReferenceAccess.class);
boolean retVal = false;

for(MIPortGroupInSystemInstanceRef portGroupInSystemInstanceRef : referenceAccess.getObjectsPointingToOfType(miPortGroup, MIPortGroupInSystemInstanceRef.class, MIPortGroupInSystemInstanceRef.TARGET)){
        if(modelAccess.getImmediateParentWithRole(portGroupInSystemInstanceRef, MIPncMapping.class, MIPncMapping.VFC) != null){
        retVal =true;
        }
}

The code now has one indirection less because getObjectsPointingToOfType() skips the ARRefs and directly returns the source elements.

Example 2
Stream<MIReferrableARRef> referencesWithoutAdminData =
        containerToCheck.getReferrableARRefRefTargetsOwner().stream()
        .filter(reference -> (reference.getReferenceValueOwner() != null));

List<MIContainer> comIPdus = referencesWithoutAdminData
        .map(reference -> reference.getReferenceValueOwner().getParent())
        .filter(owner -> ComIPdu.DEFREF.isDefinitionOf(owner))
        .collect(Collectors.toList());

becomes

IAsrReferenceAccess referenceAccess = containerToCheck.getProjectContext().getService(IAsrReferenceAccess.class);

Collection<MIReferenceValue> referencesWithoutAdminData =
        referenceAccess.getObjectsPointingToOfType(containerToCheck, MIReferenceValue.class, MIReferenceValue.VALUE);

List<MIContainer> comIPdus = referencesWithoutAdminData.stream()
        .map(referenceValue -> referenceValue.getParent())
        .filter(owner -> ComIPdu.DEFREF.isDefinitionOf(owner))
        .collect(Collectors.toList());

Similarly, with getObjectsPointingToOfType, the ARRef indirection is now skipped and the map only has to traverse one level up instead of two.

Example 3
Set<MISwComponentPrototype> types = Sets.newLinkedHashSet();

for (MISwComponentTypeARRef refType : port.getSwComponentTypePortOwner().getSwComponentTypeARRefRefTargetsOwner()) {
    if (refType != null) {
        MISwComponentPrototype proto = refType.getSwComponentPrototypeTypeOwner();
        if (proto != null) {
            types.add(proto);
        }
    }
}

becomes

IAsrReferenceAccess referenceAccess = port.getProjectContext().getService(IAsrReferenceAccess.class);
Set<MISwComponentPrototype> types = Sets.newLinkedHashSet();

for (MISwComponentPrototype proto : referenceAccess.getObjectsPointingToOfType(((MISwComponentType) port.miImmediateComposite())
        , MISwComponentPrototype.class
        , MISwComponentPrototype.TYPE)) {
    types.add(proto);
}

With the new API, the loop can operate directly on MISwComponentPrototype proto and the null checks aren't necessary anymore.

Example 4
IReferenceAccess iReferenceAccess = generatorPackage.getProjectContext().getService(IReferenceAccess.class);
Collection<MIARRef> allReferencesPointingTo = iReferenceAccess.getAllReferencesPointingTo(modeDclGrp);

for (MIARRef miarRef : allReferencesPointingTo) {
    if (miarRef instanceof MIModeDeclarationGroupARRef) {
        MIModeRequestTypeMap modeRequestTypeMapModeGroupOwner = ((MIModeDeclarationGroupARRef) miarRef)
                .getModeRequestTypeMapModeGroupOwner();
        if (modeRequestTypeMapModeGroupOwner != null) {
            // ...
        }
    }
}

becomes

IReferenceAccess iReferenceAccess = generatorPackage.getProjectContext().getService(IReferenceAccess.class);

for (MIModeRequestTypeMap modeRequestTypeMapModeGroupOwner : iReferenceAccess.getObjectsPointingToOfType(modeDclGrp
        , MIModeRequestTypeMap.class
        , MIModeRequestTypeMap.MODE_GROUP)) {
    // ...
}

In this example getObjectsPointingToOfType() can replace:

  1. The untyped loop over all references
  2. The miarRef instanceof MIModeDeclarationGroupARRef check
  3. The null check of the parent of miarRef

Changes of DefRefs

DefRefs have undergone minor changes.

  • DefRef, TypedDefRef and WrappedTypedDefRef have been converted to interfaces and are no longer serializable.
  • The create(String) method has been remove from DefRef. Please use #create(String, String) instead and specify the package part and the module part of the DefRef separately.
  • The hasPackageInfo() method has been removed from DefRef since no DefRefs without package info do exist anymore.
  • DefRef#isRefinedOf(DefRef, IModelAccess) has been replaced by
    IEcucModelAccess#isRefinedOf(DefRef, DefRef). To do so, obtain the IEcucModelAccess by calling getService(IEcucModelAccess.class) on the IProjectContext and then call isRefinedOf(DefRef, DefRef) on your IEcucModelAccess instead, using your original DefRef as the first parameter.

Usage of dynamic DefRefs

DefRef usually represents a static reference of a BSWMD definition (similar to a string constant), but the removed create(String) did allow a dynamic programmatic usage without package part information in the past. If create(String) was used with non-static strings and the package part could not be determined, consider using different APIs, but when - for certain use cases - the derivation of a DefRef is needed, you can migrate the code to the following approach which relies on the existence of the definition in the loaded project:

// Old
String definitionString = <dynamically retrieved>;
DefRef defRef = DefRef.create(definitionString);


// New
String definitionString = <dynamically retrieved>;
MIReferrable definitionObject =
AsrPath.create(definitionString).getAutosarObject(getProjectContext());

if (definitionObject instanceof MIParamConfMultiplicity) {
  DefRef defRef = DefRef.create((MIParamConfMultiplicity) definitionObject));
}

Changes of AsrPath and TypedAsrPath

  • AsrPath and TypedAsrPath have been converted to interfaces.
    • Because of this, all factory methods must be invoked via AsrPath.create(...) instead of TypedAsrPath.create(...)
  • TypedAsrObjectLink has been removed without replacement.
  • getAsrPath(MIReferrable) has been removed from IReferrableAccess. Instead, use create(MIReferrable) on AsrPath.

Changes of AutosarUtil

  • The duplicated method getAllShortnamesInTheRightOrder(String) has been removed.
  • Use getAllShortnames(String) instead, which has the same behavior.

Changes of IReferrableAccess

The following changes need to be done, when using the IReferrableAccess:

  • getValidShortname(MIARObject, String, int):
    IAsrEcucShortnameAccess#getValidShortname(MIARObject, String, int)
  • getValidShortname(MIARObject, String, int, List<String>):
    IAsrEcucShortnameAccess#getValidShortname(MIARObject, String, int, Collection<String>)
  • isValidShortname(MIARObject, String):
    IAsrEcucShortnameAccess#isValidShortname(MIARObject, String)
  • shortnameExists(MIARObject, String) :
    IAsrEcucShortnameAccess#shortnameExists(MIARObject, String)

Changes of IModelAccess

The following changes need to be done, when using the IModelAccess:

  • getAutosarRoot(): Obtain an IProjectContext and call
    getService(IModelRootAccess.class).getAutosarRoot() on it.
  • getObjectByLink(...): Create an AsrObjectLink using one of its create(...) or
    tryCreate(...) methods and call getAutosarObject(IProjectContext) on the created AsrObjectLink.
  • getObjectLink(MIObject): Create an AsrObjectLink using one of its create(...) or
    tryCreate(...) methods and call getObjectLinkString() on the created AsrObjectLink.
  • getRelativeAutosarPath(MIReferrable): Call
    param.getProjectContext().getService(IAsrReferrableAccess.class).getRelativeAutosarPath(param) instead with param being the parameter of the original call.
  • getShortObjectLink(MIObject): Create an AsrObjectLink using one of its create(...) or tryCreate(...) methods and call getShortObjectLinkString() on the created AsrObjectLink.
  • getValueString(MINumericalValue): Call
    param.getProjectContext().getService(IEcuConfigurationAccess.class).cfg((MINumericalValue) param).getValueStringUnchecked() instead with param being the parameter of the original call.
  • setInstanceReferenceValueString (MIInstanceReferenceValue, String , List<String>):
    When last argument is null, replace it with List.of().

Changes of IModelCheckedAccess

Due to the removal of the create(String) from the DefRef, the following methods were removed from the IModelCheckedAccess:

Original API How to migrate
reference(String) reference(DefRef#create(String,String))
parameter(String) parameter(DefRef#create(String,String))
container(String) container(DefRef#create(String,String))

Example:

// Old
mca.parameter("/MICROSAR/Can_CanoeemuCanoe/Can/CanGeneral");

// New
mca.parameter(DefRef.create("/MICROSAR/Can_CanoeemuCanoe", "Can/CanGeneral"));

If your code uses a non-static string approach and the package part of the definition cannot be determined, consider the according approach for DefRef's (see Dynamic DefRef usage).

Changes of ModelCheckedAccessUtil

The class ModelCheckedAccessUtil is no longer available. Instead, use the service IModelCheckedAccess, which provides the same API. You can retrieve it, by obtaining the IProjectContext from the first parameter of the original API call as seen in the example below:

// Old
ModelCheckedAccessUtil.getSymbolicNameValue(container);

// New
container.getProjectContext().getService(IModelCheckedAccess.class).getSymbolicNameValue(container);

Changes of ModelUtil

The class ModelUtil is no longer available. The following table shows the replacements for all methods.

/*Old*/ ModelUtil.getArVersionOfBswImplementation(final MIBswImplementation bswImplementation)
/*New*/ bswImplementation.getProjectContext().getService(IBswImplAccess.class).getArVersionOfBswImplementation(final MIBswImplementation bswImplementation)

/*Old*/ ModelUtil.getArVersionOfBswImplementation(final MIModuleConfiguration moduleConfiguration)
/*New*/ moduleConfiguration.getProjectContext().getService(IBswImplAccess.class).getArVersionOfBswImplementation(final MIModuleConfiguration moduleConfiguration)

/*Old*/ ModelUtil.getAsBoolean(MINumericalValue param)
/*New*/((IEcucBooleanParameter) getProjectContext().getService(IEcuConfigurationAccess.class).cfg(param)).getValue()

/*Old*/ ModelUtil.getAsInteger(final MINumericalValue param)
/*New*/ (IEcucIntegerParameter) getProjectContext().getService(IEcuConfigurationAccess.class).cfg(param).getValue()

/*Old*/ ModelUtil.getBswImplementation(final MIModuleConfiguration moduleConfiguration)
/*New*/ moduleConfiguration.getProjectContext().getService(IBswImplAccess.class).getBswImplementation(moduleConfiguration)

/*Old*/ ModelUtil.getBswImplementations(final MIModuleDef moduleDef)
/*New*/ moduleDef.getProjectContext().getService(IBswImplAccess.class).getBswImplementations(final MIModuleDef moduleDef)

/*Old*/ ModelUtil.getDefinition(final MIHasDefinition hasDefinition)
/*New*/ hasDefinition.getProjectContext().getService(IEcuConfigurationAccess.class).cfg(hasDefinition).getEcucDefinition().getDef()

/*Old*/ ModelUtil.getDefinitionShortName(final MIHasDefinition hasDefinition)
/*New*/ hasDefinition.getProjectContext().getService(IEcucModelAccess.class).getDefinitionShortName(hasDefinition)

/*Old*/ ModelUtil.getDefinitionString(final MIHasDefinition hasDefinition)
/*New*/ hasDefinition.getProjectContext().getService(IEcucModelAccess.class).getDefinitionString(hasDefinition)

/*Old*/ ModelUtil.getFirstSDG(final MIAdminData adminData, final String... gids)
/*New*/ adminData.getProjectContext().getService(IAdminDataMdfAccessPublished.class).getFirstSDG(final MIAdminData adminData, final String... gids)

/*Old*/ ModelUtil.getImmediateParent(final MIObject obj)
/*New*/ obj.miImmediateComposite()

/*Old*/ ModelUtil.getMDFObject(final IDescriptor descriptor, final boolean ignoreFeatureAspect)
/*New*/ descriptor.getMDFOBject(final boolean ignoreFeatureAspect)

/*Old*/ ModelUtil.getModelAccess(final IDescriptor descriptor)
/*New*/ descriptor.getService(IModelAccess.class)

/*Old*/ ModelUtil.getModelAccess(final MIObject obj)
/*New*/ obj.getProjectContext().getService(IModelAccess.class)

/*Old*/ ModelUtil.getNextBestMDFObject(final IDescriptor descriptor)
/*New*/ descriptor.getNextBestMDFObject()

/*Old*/ ModelUtil.getProjectContext(MIObject obj)
/*New*/ obj.getProjectContext()
/*Old*/ ModelUtil.getReferrableAccess(final MIObject obj)
/*New*/ obj.getProjectContext().getService(IReferrableAccess.class)

/*Old*/ ModelUtil.getSchemaVersionOfMDFObject(final MIObject mdfObject)
/*New*/ mdfObject.getProjectContext().getService(IAsrSchemaService.class).getSchemaVersionOfMDFObject(mdfObject)

/*Old*/ ModelUtil.getSchemaVersionOfModuleDef(final MIObject mdfObject)
/*New*/ mdfObject.getProjectContext().getService(IAsrSchemaService.class).getSchemaVersionOfModuleDef(final MIObject mdfObject)

/*Old*/ ModelUtil.getService(final IModelObject obj, final Class<T> service)
/*New*/ obj.getProjectContext().getService(service)

/*Old*/ ModelUtil.getSwVersionOfBswImplementation(final MIBswImplementation bswImplementation)
/*New*/ bswImplementation.getProjectContext().getService(IBswImplAccess.class).getSwVersionOfBswImplementation(final MIBswImplementation bswImplementation)

/*Old*/ ModelUtil.getSwVersionOfBswImplementation(final MIModuleConfiguration moduleConfiguration)
/*New*/ moduleConfiguration.getProjectContext().getService(IBswImplAccess.class).getSwVersionOfBswImplementation(final MIModuleConfiguration moduleConfiguration)

/*Old*/ ModelUtil.getValueString(final MINumericalValue param)
/*New*/ param.getProjectContext().getService(IEcuConfigurationAccess.class).cfg(param).getValueStringUnchecked()

/*Old*/ ModelUtil.getValueString(final MITextualValue param)
/*New*/ param.getProjectContext().getService(IEcuConfigurationAccess.class).cfg(param).getValueStringUnchecked()

/*Old*/ ModelUtil.isDefinedAsBoolean(final MINumericalValue param)
/*New*/ param.getProjectContext().getService(IEcucDefinitionAccess.class).hasBooleanDef(param)

/*Old*/ ModelUtil.isDefinedAsFloat(final MINumericalValue param)
/*New*/ param.getProjectContext().getService(IEcucDefinitionAccess.class).hasFloatDef(param)

/*Old*/ ModelUtil.isDefinedAsInteger(final MINumericalValue param)
/*New*/ param.getProjectContext().getService(IEcucDefinitionAccess.class).hasIntegerDef(param)

/*Old*/ ModelUtil.safeGetContainersByDefinition(final MIHasContainer parent, final String containerDefinition)
/*New*/ parent.getProjectContext().getService(IModelAccess.class).safeGetContainersByDefinition(final MIHasContainer parent, final String containerDefinition)

/*Old*/ ModelUtil.safeGetParametersByDefinition(final MIContainer parent, final String parameterDefinition)
/*New*/ parent.getProjectContext().getService(IModelAccess.class).safeGetParametersByDefinition(final MIContainer parent, final String parameterDefinition)

Changes of ModelAccessUtil

The class ModelAccessUtil is no longer available. The following table shows the replacements for all methods.

/*Old*/ ModelAccessUtil.getProjectContext(final IModelObject obj)
/*New*/ obj.getProjectContext()

/*Old*/ ModelAccessUtil.getService(final IModelObject obj, final Class<T> service)
/*New*/ obj.getProjectContext().getService(service)

/*Old*/ ModelAccessUtil.isRemovedOrInvisible(final MIObject object)
/*New*/ object.moIsRemoved()

/*Old*/ ModelAccessUtil.toDebugStringMDFObject(final IModelObject obj)
/*New*/ obj.toDebugString()

/*Old*/ ModelAccessUtil.toStringMDFObject(final IModelObject obj)
/*New*/ obj.toString()

Changes of IModelEnum

The interface IModelEnum was renamed and moved to IEcucEnum. Its method getAutosarEnumLiterals() was renamed to getAutosarLiterals() and now just returns a Collection of the AUTOSAR enum literals for the current enum literal. The javadoc of IEcucEnum also provides an example usage.

Changes of IMcdTexttableCompuMethod

The methods addEnumerationLiteral and getEnumerationLiterals have been renamed. The table below is a guide to migrate the usage of the removed methods.

/*Old*/ addEnumerationLiteral(String name, String value)
/*New*/ addCompu(String constant, String value)

/*Old*/ addEnumerationLiteral(String name, String lowerLimit, String upperLimit)
/*New*/ addCompu(String constant, String lowerLimit, String upperLimit)

/*Old*/ addEnumerationLiteral(String name, BigInteger value)
/*New*/ addCompu(String constant, BigInteger value)

/*Old*/ addEnumerationLiteral(String name, BigInteger lowerLimit, BigInteger upperLimit)
/*New*/ addCompu(String constant, BigInteger lowerLimit, BigInteger upperLimit)

/*Old*/ addEnumerationLiteral(String name, int value)
/*New*/ addCompu(String constant, BigInteger value)

/*Old*/ addEnumerationLiteral(String name, int lowerLimit, int upperLimit)
/*New*/ addCompu(String constant, int value)

/*Old*/ getEnumerationLiterals()
/*New*/ getComputations()

Changes of Calibration Access Type

Now there is only one way to set the calibration access, which is writting in an McDataInstance, and that can be done by using the method IMcdDataDescription.setCalibrationAccess(EMcdAccessType accessType). The enum EMcdCalibrationAccessType has been removed completely along with all its setters and getters as shown in these tables:

Removed API
EMcdCalibrationAccessType
IMcdDataType.setSwCalibrationAccess(EMcdCalibrationAccessType accessType);
IMcdDataType.getSwCalibrationAccess();
IMcdSwDataDefProps.setSwCalibrationAccess(EMcdCalibrationAccessType accessType);
IMcdSwDataDefProps.getSwCalibrationAccess();
IMcdSwCalprmAxis.setSwCalibrationAccess(EMcdCalibrationAccessType accessType);
IMcdSwCalprmAxis.getSwCalibrationAccess();
Removed the parameter EMcdCalibrationAccessType accessType from these methods in IMcdDataDescBuilder
createComAxisDatatype, createCuboidDatatype, createCube5Datatype, createMapDatatype
createResAxisDatatype, createCurveDatatype , createCube4Datatype, createCalibrationParameterAxis

When adapting the code where the above removed/changed APIs are used, we shall consider the following use-cases:

  1. In case, EMcdCalibrationAccessType.NONE was set, we look at the related McdObject IMcdDataDescription if EMcdAccessType.NONE was set by using the method IMcdDataDescription.setCalibrationAccess, then that is fine.
  2. In case, EMcdCalibrationAccessType.READONLY was set, we look at the related McdObject IMcdDataDescription if either EMcdAccessType.MEASUREMENT_READONLY or EMcdAccessType.CHARACTERISTIC_READONLY was set by using the method
    IMcdDataDescription.setCalibrationAccess, then that is fine. If nothing was set, then it is also fine as EMcdAccessType.MEASUREMENT_READONLY is the default value.
  3. In case, EMcdCalibrationAccessType.READWRITE was set, we look at the related McdObject IMcdDataDescription if either EMcdAccessType.MEASUREMENT_READWRITE or EMcdAccessType.CHARACTERISTIC was set by using the method
    IMcdDataDescription.setCalibrationAccess, then that is fine. If the equivalent enum value was not set according to three rules above, then we shall inform the developer of that code to decide what to set.

Changes of IModelViewManager

The following methods got replaced in class IModelViewManager:

/*Old*/ getAllVariantViews()
/*New*/ getAllPostBuildVariantViews()

/*Old*/ getInvariantEcucDefView()
/*New*/ isPostBuildValueInvariant()

/*Old*/ getInvariantValuesView()
/*New*/ isPostBuildEcucDefInvariant()

/*Old*/ getVisibleVariantViews(MIObject obj)
/*New*/ getVisiblePostBuildVariantViews(MIObject obj)

/*Old*/ getVisibleVariantViewsOrInvariant(MIObject obj)
/*New*/ getVisiblePostBuildVariantViewsOrInvariant(MIObject obj)

/*Old*/ isCurrentlyValueInvariant()
/*New*/ isCurrentlyPostBuildValueInvariant()

/*Old*/ isEcucDefInvariant(MIObject obj)
/*New*/ isPostBuildEcucDefInvariant(MIObject obj)

/*Old*/ isNeverVisible(MIObject obj)
/*New*/ isNeverPostBuildVisible(MIObject obj)

/*Old*/ isValueInvariant(MIObject obj)
/*New*/ isPostBuildValueInvariant(MIObject obj)

Fix of Model Extension Methods

Many APIs that were previously only usable from Groovy PAI scripts are now available directly on model types in any context. This brings some syntactical changes with it that can be seen in the code sample below.

Before vs After - MIObject Method Extension
com.vector.cfg.automation.api.ScriptApi.daVinci {
    scriptTask("foo", DV_PROJECT) {
        code {
            MIContainer miContainer = null
            IDemEvent demEvent = null

            miContainer.adminDataOrCreate
            // VS
            miContainer.withAdminData().orCreate

            miContainer.adminData.docRevision.createAndAdd()
            // VS
            miContainer.adminData.withDocRevision().create()

            miContainer.adminData.docRevision.createAndAdd(MIDocRevision)
            // VS
            miContainer.adminData.withDocRevision().create(MIDocRevision)

            miContainer.adminData.docRevision.createAndAdd(MIDocRevision, 4)
            // VS
            miContainer.adminData.docRevision.add(4, mdfAccess.createMDFObject(MIDocRevision))

            miContainer.subContainer.createAndAdd("name")
            // VS
            miContainer.withSubContainer().create("name", typedDefRef)

            // demEvent implements IHasModelObject
            demEvent.adminData
            // VS
            demEvent.mdfObject.adminData


            miContainer.adminData {

            }
            // VS
            miContainer.adminData.with {
            }

            miContainer.subContainer {

            }
            // VS
            miContainer.subContainer.each {

            }
        }
    }
}

Fix of ScriptLogger API

Changes of ILogger

The published API class com.vector.cfg.util.log.ILogger.java is the interface all script loggers use. The class was refactored to be more comfortable, overall conform and easy to use.

Additional methods

Following methods were added:

  • trace(String), debug(String), info(String), warn(String), error(String)
  • trace(String, Throwable), debug(String, Throwable), info(String, Throwable), warn(String, Throwable), error(String, Throwable)

HINT: There is nothing needed to adapt here. Adding these methods to the given methods like trace(Object) however brings some advantages and performance improvements to the API.

Deprecated methods

Following methods were removed and have a new counterpart to use:

Removed New
traceFormat(String, Object[]) trace(String, Object[])
traceFormat(Throwable, String, Object[]) trace(Throwable, String, Object[])
debugFormat(String, Object[]) debug(String, Object[])
debugFormat(Throwable, String, Object[]) debug(Throwable, String, Object[])
infoFormat(String, Object[]) info(String, Object[])
infoFormat(Throwable, String, Object[]) info(Throwable, String, Object[])
warnFormat(String, Object[]) warn(String, Object[])
warnFormat(Throwable, String, Object[]) warn(Throwable, String, Object[])
errorFormat(String, Object[]) error(String, Object[])
errorFormat(String, Throwable, Object[]) error(Throwable, String, Object[])

Deprecation of LoggerUtil

The published API methods in class com.vector.cfg.util.text.log.LoggerUtil are now deprecated. These methods are outdated and should not be used anymore:

  • traceFormat(ILogger logger, Throwable ex, String pattern, Object... arguments)
  • debugFormat(ILogger logger, Throwable ex, String pattern, Object... arguments)

The class com.vector.cfg.util.log.ILogger defines semantically equivalent methods that should be used instead:

  • trace(@Nullable Throwable t, String message, @Nullable Object... arguments)
  • debug(@Nullable Throwable t, String message, @Nullable Object... arguments)

Refactor use cases as in this example:

// Previous
LoggerUtil.traceFormat(scriptLogger, currentException, "Failed task {}",taskObjectName);

// Current
scriptLogger.trace(currentException, "Failed task {}",taskObjectName);

Fix of Variant Handling API

The EVS Variant Handling API is currently not available in the AutomationInterface. This feature will be available only in a future release which will be announced as soon as possible.

The following APIs will not be supported anymore. We will provide in a future release an alternative solution.

Removed Legacy APIs
com.vector.cfg.project.evs.pai.IAutoModeApi
com.vector.cfg.project.evs.pai.IImportVariantApi
com.vector.cfg.project.evs.pai.IImportVariantApiEntryPoint
com.vector.cfg.project.evs.pai.IModeTypeApi
com.vector.cfg.project.evs.pai.IPostBuildApi
com.vector.cfg.project.evs.pai.IUpdateVariantApiEntryPoint
com.vector.cfg.project.evs.pai.IVariantApi

Fix of Mode Management API

A bug was fixed leaking (GUI) style tags in com.vector.cfg.dom.deprecated.modemgt.pai.bswm.IBswMAutoConfigurationElement identifiers. This should not normally result in migration effort for PAI users. However, PAI users may now rely on identifiers not to contain style tags.

Fix of Runtime System Domain API

The APIs themselves remain unchanged in general, but the model abstraction elements used in the selection APIs and the callback function were replaced by corresponding SIModel elements.

Therefore, the following model abstractions were exchanged by the according SIModel elements. The API methods and class hierarchy remain either equal or very similar, but may have changed slightly. Please refer to the according javadoc and class hierarchy.

Old Model Abstraction Interface New SIModel Interface
com.vector.cfg.model.sysdesc.api.com.IDataMapping com.vector.cfg.sysdesc.model.datamapping.SIDataMapping
com.vector.cfg.model.sysdesc.api.com.ECompatibility com.vector.cfg.sysdesc.model.communication.ECompatibility
com.vector.cfg.model.sysdesc.api.com.EDirection com.vector.cfg.sysdesc.model.communication.EDirection
com.vector.cfg.model.sysdesc.api.com.IAbstractSignalInstance com.vector.cfg.sysdesc.model.communication.instance.SIAbstractSignalInstance
com.vector.cfg.model.sysdesc.api.com.IClientServerDataMapping com.vector.cfg.sysdesc.model.datamapping.SIClientServerToSignalDataMapping
com.vector.cfg.model.sysdesc.api.com.ICommunicationElement com.vector.cfg.sysdesc.model.communication.SICommunicationElement
com.vector.cfg.model.sysdesc.api.com.IDataCommunicationElement com.vector.cfg.sysdesc.model.communication.SIDataCommunicationElement
com.vector.cfg.model.sysdesc.api.com.IOperationCommunicationElement com.vector.cfg.sysdesc.model.communication.SIOperationCommunicationElement
com.vector.cfg.model.sysdesc.api.com.ISenderReceiverDataMapping com.vector.cfg.sysdesc.model.datamapping.SISenderReceiverDataMapping
com.vector.cfg.model.sysdesc.api.com.ISignalGroupInstance com.vector.cfg.sysdesc.model.communication.instance.SISignalGroupInstance
com.vector.cfg.model.sysdesc.api.com.ISignalInstance com.vector.cfg.sysdesc.model.communication.instance.SISignalInstance
com.vector.cfg.model.sysdesc.api.com.ITriggerCommunicationElement com.vector.cfg.sysdesc.model.communication.SITriggerCommunicationElement
com.vector.cfg.model.sysdesc.api.com.ITriggerToSignalMapping com.vector.cfg.sysdesc.model.datamapping.SITriggerToSignalDataMapping
com.vector.cfg.model.sysdesc.api.component.IComponent com.vector.cfg.sysdesc.model.component.SIComponent
com.vector.cfg.model.sysdesc.api.component.IComponentType com.vector.cfg.sysdesc.model.component.SIComponentType
com.vector.cfg.model.sysdesc.api.connection.IConnector com.vector.cfg.sysdesc.model.connector.SIConnector
com.vector.cfg.model.abstraction.api.IIdentifiable com.vector.cfg.sysdesc.model.base.SIIdentifiable
com.vector.cfg.model.abstraction.api.IModelAbstraction com.vector.cfg.model.si.base.SIModelObject
com.vector.cfg.model.sysdesc.api.eoc.IExecutionOrderConstraint com.vector.cfg.sysdesc.model.eoc.SIExecutionOrderConstraint
com.vector.cfg.model.sysdesc.api.origin.IOriginComponentPort com.vector.cfg.sysdesc.model.component.origin.SIOriginComponentPort
com.vector.cfg.model.sysdesc.api.port.EDiagnosticPortRole com.vector.cfg.sysdesc.model.port.EDiagnosticPortRole
com.vector.cfg.model.sysdesc.api.port.IComponentPort com.vector.cfg.sysdesc.model.component.SIComponentPort
com.vector.cfg.model.sysdesc.api.port.IPortInterface com.vector.cfg.sysdesc.model.port.SIPortInterface
com.vector.cfg.model.sysdesc.api.taskmapping.EEventType com.vector.cfg.sysdesc.model.internalbehavior.EEventType
com.vector.cfg.model.sysdesc.api.taskmapping.IEvent com.vector.cfg.sysdesc.model.internalbehavior.SIEvent
com.vector.cfg.model.sysdesc.api.taskmapping.IExecutableEntity com.vector.cfg.sysdesc.model.internalbehavior.SIExecutableEntity
com.vector.cfg.model.sysdesc.api.taskmapping.IPositionInTaskEntry com.vector.cfg.sysdesc.model.taskmapping.SIPositionInTaskEntry
com.vector.cfg.model.sysdesc.api.taskmapping.ITaskMapping com.vector.cfg.sysdesc.model.taskmapping.SITaskMapping
com.vector.cfg.dom.runtimesys.api.assistant.connection.ISourceComponentPort com.vector.cfg.sysdesc.model.connector.SISourceComponentPort
com.vector.cfg.dom.runtimesys.api.assistant.connection.ITargetComponentPort com.vector.cfg.sysdesc.model.connector.SITargetComponentPort

Fix of Project Settings API

The modification of project settings with getProjectSettings() or projectSettings(Transformer) must be now done in a transaction.

See following example:

Access and modify Project Settings - Variant 1
scriptTask("TestsProjectSettings", DV_PROJECT) {
    code {
        activeProject {
            projectSettings {
                transaction {
                    target{

                    // Get the available derivatives as collection
                    def newDerivative = getAvailableDerivatives().getFirst()
                    // Set the derivative setting with the new value
                    derivative(newDerivative)
                    // Returns an Optional containing the new value
                    getDerivative()

                    def newCompiler = getAvailableCompilers().getFirst()
                    compiler(newCompiler)
                    getCompiler()

                    def newPinLayout = getAvailablePinLayouts().getFirst()
                    pinLayout(newPinLayout)
                    getPinLayout()

                    }
                }
            }
        }
    } // code
} // scriptTask

Compare and Merge API Changes

The PAI API for compare and merge was completely revised.

Read only compare API

The previous read only compare API was completely removed:

projectCompare {
    compare {
        configure {
            moduleToCompare("EcuC")

            evaluateDifferencesDaVinciConfigurator {
                def foundDiffs = getDifferences()
                foundDiffs.each { scriptLogger.info("Found difference: " + it.getIdentifier()) }
            }
        }
    }
}

Instead, a new API has been introduced:

IProjectCompare projectCompare = projects.activeProject.projectContext[IProjectCompare]

IProjectCompareConfigBuilder configBuilder = projectCompare.newProjectCompareConfigBuilder(projectToCompareWith)
configBuilder.addModulesToCompare(List.of("EcuC"))

IProjectCompareResult result = projectCompare.compare(configBuilder.build())
def differences = result.getDifferences()

Auto merge API

The previous auto merge API was completely removed:

projectCompare {
    autoMerge {
        configure {
            conflictResolutionApproach = DONT_SOLVE
            projectOther = pathToOther
            projectBase = pathToBase

            comparisonScope = ECUC_ECUEX_ONLY
        }
    }
}

Instead, a new API has been introduced:

IAutomerge automerge = projects.activeProject.projectContext[IAutomerge]

IAutomergeConfigBuilder configBuilder = automerge.newAutomergeConfigBuilder(projectToCompareWith, projectBase)
configBuilder.addModulesToCompare(List.of("EcuC"))

automerge.merge(configBuilder.build())

Change of Script Task Types

Some script task types were changed for the new DaVinci Configurator 6. The old task types are no longer supported and should be replaced with the new ones.

DV_ON_FILE_PREPROCESSING_INPUT_FILE and DV_ON_FILE_PREPROCESSING_RESULT

The script task types DV_ON_FILE_PREPROCESSING_INPUT_FILE and DV_ON_FILE_PREPROCESSING_RESULT have been used in the Update Workflow to customize file preprocessing tasks. These task types are no longer supported in the new DaVinci Configurator 6. They are replaced by the new script task type DV_ON_ECU_EXTRACT_PRODUCER.

The script task type DV_ON_ECU_EXTRACT_PRODUCER cannot be directly used in the DaVinci Configurator 6. That script task type will be only executed by the ECU Extract Producer tool which is part of the DaVinci Configurator 6. That tool handles all file preprocessing tasks and therefore also the script task type DV_ON_ECU_EXTRACT_PRODUCER which allows to modify input files during the file preprocessing as already known from the DaVinci Configurator 5.