JAXB-Models of the VEC, based on the underlying UML model (not only the XSD).
VEC stands for Vehicle Electric Container and defines an information model, a data dictionary, and an XML schema derived from and compliant to the model.
It can be used to define a vehicle with all parts, connections, constraints, etc.
This repository contains two VEC versions, version 1.1.3 and version 1.2.0. The version 1.2.0 doesn't provide a backwards compatibility to version 1.1.3. If you have trouble converting from VEC 1.1.3 to VEC 1.2.0, feel free to contact our colleague Johannes Becker.
For an optimized performance, the XML is parsed by our enhanced xml navigation library which builds on top of JAXB.
More information about VEC can be found in the ECAD wiki.
VEC contains data of a multi-harness overall wiring system and includes its schematic information. Its key features are:
- Multiple 3D harness geometries (including variant configurations)
- Multiple 2D drawing information
- System schematics (including variant configurations)
- Harness topology and wire routing
- Electrical wiring and connectivity
- Module-based bill of material
- Multi-level composite part structures (e.g. for assembly parts)
- Predefined harness configurations
- Powerful property-based extensibility
- Comprehensive master data information
- Universal lifecycle and versioning information
- Defined mappings to external resources
- Elements can have back references to other elements (e.g.
VecUnit -> VecValueWithUnitandVecValueWithUnit -> VecUnit) - Generated AssertJ assertions in additional jar files to write fluent assertions on VEC objects.
Our builds are distributed to Maven Central.
Make sure to replace the VERSION below with a real version as the one shown above!
<dependency>
<groupId>com.foursoft.vecmodel</groupId>
<artifactId>vec113</artifactId>
<version>VERSION</version>
</dependency>and for the assertion library:
<dependency>
<groupId>com.foursoft.vecmodel</groupId>
<artifactId>vec113-assertions</artifactId>
<scope>test<scope>
<version>VERSION</version>
</dependency>implementation group: 'com.foursoft.vecmodel', name: 'vec113', version: 'VERSION'testCompile group: 'com.foursoft.vecmodel', name: 'vec113-assertions', version: 'VERSION'<dependency>
<groupId>com.foursoft.vecmodel</groupId>
<artifactId>vec120</artifactId>
<version>VERSION</version>
</dependency>and for the assertion library:
<dependency>
<groupId>com.foursoft.vecmodel</groupId>
<artifactId>vec120-assertions</artifactId>
<scope>test<scope>
<version>VERSION</version>
</dependency>implementation group: 'com.foursoft.vecmodel', name: 'vec120', version: 'VERSION'testCompile group: 'com.foursoft.vecmodel', name: 'vec120-assertions', version: 'VERSION'In the codebase, the root of a vec file is the VecContent class.
More examples can be found in the examples of each module:
<?xml version="1.0" encoding="UTF-8"?>
<?cs checksum="2764192431"?>
<?xsd validated="true"?>
<vec:VecContent id="id_1000_0" xmlns:vec="http://www.prostep.org/ecad-if/2011/vec" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<CustomProperty id="id_1006_2" xsi:type="vec:SimpleValueProperty">
<PropertyType>ExampleType</PropertyType>
<Value>CAP</Value>
</CustomProperty>
<VecVersion>1.1.3</VecVersion>
<Contract id="id_2107_0">
<CompanyName>4Soft GmbH</CompanyName>
<ContractRole>Oem</ContractRole>
</Contract>
<DocumentVersion id="id_1002_0">
<CompanyName>4Soft GmbH</CompanyName>
<Approval id="id_2014_0">
<Status>Approved</Status>
<Permission id="id_2185_0">
<Permission>Released</Permission>
<PermissionDate>2020-05-28T16:07:46.503+02:00</PermissionDate>
<Permitter id="id_2186_0">
<LastName>/NULL</LastName>
</Permitter>
</Permission>
</Approval>
</DocumentVersion>
</vec:VecContent>public class MyVecReader {
public void readVecFile(final String pathToFile) throws JAXBException, IOException {
try (final InputStream is = MyVecReader.class.getResourceAsStream(pathToFile)) {
final VecReader localReader = VecReader.getLocalReader();
final JaxbModel<VecContent, Identifiable> model = localReader.readModel(is);
final VecApproval approval = model.getIdLookup()
.findById(VecApproval.class, "id_2014_0")
.orElse(null);
// get a specific permission
final VecPermission vecPermission = model.getIdLookup()
.findById(VecPermission.class, "id_2185_0")
.orElse(null);
// get all permissions of an approval (in oop style)
final List<VecPermission> permissions = approval.getPermissions();
}
}
}public class MyVecWriter {
public void writeVecFile(final String target) throws JAXBException, TransformerFactoryConfigurationError, IOException {
final JAXBContext jc = JAXBContext.newInstance(VecContent.class);
final VecContent root = new VecContent();
root.setXmlId("id_1000_0");
root.setVecVersion("1.1.3");
final VecPermission permission = new VecPermission();
permission.setPermission("Released");
final VecApproval approval = new VecApproval();
approval.setStatus("Approved");
approval.getPermissions().add(permission);
final VecDocumentVersion documentVersion = new VecDocumentVersion();
documentVersion.getApprovals().add(approval);
documentVersion.setDocumentNumber("123_456_789");
final VecSpecification specification = new VecConnectorHousingCapSpecification();
specification.setXmlId("id_2000_0");
specification.setIdentification("Ccs-123_456_789-1");
documentVersion.getSpecifications().add(specification);
final VecPartVersion partVersion = new VecPartVersion();
partVersion.setXmlId("id_1001_0");
partVersion.setPartNumber("123_456_789");
root.getDocumentVersions().add(documentVersion);
root.getPartVersions().add(partVersion);
final VecWriter localWriter = VecWriter.getLocalWriter();
try (final FileOutputStream outputStream = new FileOutputStream(target)) {
localWriter.write(root, outputStream);
}
}
}<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:VecContent id="id_1000_0" xmlns:ns2="http://www.prostep.org/ecad-if/2011/vec">
<VecVersion>1.1.3</VecVersion>
<DocumentVersion>
<Approval>
<Status>Approved</Status>
<Permission>
<Permission>Released</Permission>
</Permission>
</Approval>
<DocumentNumber>123_456_789</DocumentNumber>
<Specification xsi:type="ns2:ConnectorHousingCapSpecification" id="id_2000_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Identification>Ccs-123_456_789-1</Identification>
</Specification>
</DocumentVersion>
<PartVersion id="id_1001_0">
<PartNumber>123_456_789</PartNumber>
</PartVersion>
</ns2:VecContent>For each VEC version we provide an additional jar file with generated AssertJ assertions to write fluent assertions on VEC elements. The assertions are generated with the AssertJ assertions generator.
Below is a short example for the usage of these assertions in combination with native AssertJ-Assertions. For detailed information please refer to the original AssertJ Documentation.
Please not the static imports of the assertions entry point and the order of ...Assertions.assertThat;.
package com.foursoft.vec.test;
import static com.foursoft.vecmodel.vec113.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.atIndex;
import org.junit.jupiter.api.Test;
import com.foursoft.vecmodel.vec113.VecConnectorHousingSpecification;
import com.foursoft.vecmodel.vec113.VecDocumentVersion;
import com.foursoft.vecmodel.vec113.VecPartVersion;
public class VecSampleTest {
@Test
void doSomeAssertions() {
//Find the element to test, maybe with a traversing visitor...
VecDocumentVersion partMasterDocument = ...;
assertThat(partMasterDocument).hasDocumentType("PartMaster")
.hasNoCustomProperties()
.satisfies(d -> {
assertThat(d.getSpecificationsWithType(VecConnectorHousingSpecification.class)).hasSize(1)
.satisfies(chs -> {
assertThat(chs).hasIdentification("ABC");
}, atIndex(0));
});
}
}We appreciate if you like to contribute to our project! Please make sure to base your branch off of our develop branch and create your PR into that same branch. We will reject any PRs not following that or if the feature is already worked on.
Please read our detailed Contribution Guidelines for more information, for example code style, formatter, etc.