Search in sources :

Example 1 with AuthorSet

use of org.omg.space.xtce.HeaderType.AuthorSet in project CCDD by nasa.

the class CcddXTCEHandler method convertTablesToXTCE.

/**
 ********************************************************************************************
 * Convert the project database contents to XTCE XML format
 *
 * @param tableNames
 *            array of table names to convert
 *
 * @param replaceMacros
 *            true to replace any embedded macros with their corresponding values
 *
 * @param includeReservedMsgIDs
 *            true to include the contents of the reserved message ID table in the export file
 *
 * @param includeVariablePaths
 *            true to include the variable path for each variable in a structure table, both in
 *            application format and using the user-defined separator characters
 *
 * @param variableHandler
 *            variable handler class reference; null if includeVariablePaths is false
 *
 * @param separators
 *            string array containing the variable path separator character(s), show/hide data
 *            types flag ('true' or 'false'), and data type/variable name separator
 *            character(s); null if includeVariablePaths is false
 *
 * @param endianess
 *            EndianType.BIG_ENDIAN for big endian, EndianType.LITTLE_ENDIAN for little endian
 *
 * @param version
 *            version attribute
 *
 * @param validationStatus
 *            validation status attribute
 *
 * @param classification1
 *            first level classification attribute
 *
 * @param classification2
 *            second level classification attribute
 *
 * @param classification3
 *            third level classification attribute
 ********************************************************************************************
 */
private void convertTablesToXTCE(String[] tableNames, CcddVariableSizeAndConversionHandler variableHandler, String[] separators, EndianType endianess, String version, String validationStatus, String classification1, String classification2, String classification3) {
    this.endianess = endianess;
    // Store the attributes
    versionAttr = version;
    validationStatusAttr = validationStatus;
    classification1Attr = classification1;
    classification2Attr = classification2;
    classification3Attr = classification3;
    // Create the root space system
    SpaceSystemType rootSystem = addSpaceSystem(null, dbControl.getProjectName(), dbControl.getDatabaseDescription(dbControl.getDatabaseName()), classification1Attr, validationStatusAttr, versionAttr);
    // Set the project's build information
    AuthorSet author = factory.createHeaderTypeAuthorSet();
    author.getAuthor().add(dbControl.getUser());
    rootSystem.getHeader().setAuthorSet(author);
    NoteSet note = factory.createHeaderTypeNoteSet();
    note.getNote().add("Generated by CCDD " + ccddMain.getCCDDVersionInformation());
    note.getNote().add("Date: " + new Date().toString());
    note.getNote().add("Project: " + dbControl.getProjectName());
    note.getNote().add("Host: " + dbControl.getServer());
    note.getNote().add("Endianess: " + (endianess == EndianType.BIG_ENDIAN ? "big" : "little"));
    rootSystem.getHeader().setNoteSet(note);
    // Get the names of the tables representing the CCSDS telemetry and command headers
    tlmHeaderTable = fieldHandler.getFieldValue(CcddFieldHandler.getFieldProjectName(), InputDataType.XML_TLM_HDR);
    cmdHeaderTable = fieldHandler.getFieldValue(CcddFieldHandler.getFieldProjectName(), InputDataType.XML_CMD_HDR);
    // Get the telemetry and command header argument column names for the application ID and
    // the command function code. These are stored as project-level data fields
    ccsdsAppID = fieldHandler.getFieldValue(CcddFieldHandler.getFieldProjectName(), InputDataType.XML_APP_ID);
    ccsdsFuncCode = fieldHandler.getFieldValue(CcddFieldHandler.getFieldProjectName(), InputDataType.XML_FUNC_CODE);
    // Check if the application ID argument column name isn't set in the project
    if (ccsdsAppID == null) {
        // Use the default application ID argument column name
        ccsdsAppID = ArgumentColumnName.APP_ID.getDefaultArgColName();
    }
    // Check if the command function code argument column name isn't set in the project
    if (ccsdsFuncCode == null) {
        // Use the default command function code argument column name
        ccsdsFuncCode = ArgumentColumnName.FUNC_CODE.getDefaultArgColName();
    }
    // The application ID or command function code argument column names are stored as
    // ancillary data which is used if the export file is imported into CCDD
    AncillaryDataSet ancillarySet = factory.createDescriptionTypeAncillaryDataSet();
    AncillaryData appID = factory.createDescriptionTypeAncillaryDataSetAncillaryData();
    appID.setName(ArgumentColumnName.APP_ID.getAncillaryName());
    appID.setValue(ccsdsAppID);
    ancillarySet.getAncillaryData().add(appID);
    project.getValue().setAncillaryDataSet(ancillarySet);
    AncillaryData funcCode = factory.createDescriptionTypeAncillaryDataSetAncillaryData();
    funcCode.setName(ArgumentColumnName.FUNC_CODE.getAncillaryName());
    funcCode.setValue(ccsdsFuncCode);
    ancillarySet.getAncillaryData().add(funcCode);
    project.getValue().setAncillaryDataSet(ancillarySet);
    // Add the project's space systems, parameters, and commands
    buildSpaceSystems(tableNames, variableHandler, separators);
}
Also used : NoteSet(org.omg.space.xtce.HeaderType.NoteSet) AuthorSet(org.omg.space.xtce.HeaderType.AuthorSet) AncillaryDataSet(org.omg.space.xtce.DescriptionType.AncillaryDataSet) AncillaryData(org.omg.space.xtce.DescriptionType.AncillaryDataSet.AncillaryData) SpaceSystemType(org.omg.space.xtce.SpaceSystemType) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 AncillaryDataSet (org.omg.space.xtce.DescriptionType.AncillaryDataSet)1 AncillaryData (org.omg.space.xtce.DescriptionType.AncillaryDataSet.AncillaryData)1 AuthorSet (org.omg.space.xtce.HeaderType.AuthorSet)1 NoteSet (org.omg.space.xtce.HeaderType.NoteSet)1 SpaceSystemType (org.omg.space.xtce.SpaceSystemType)1