Integrity

Versioned Items

From PTC Integrity 10.5 and higher, Items can be versioned by using the CheckInCommand.

Extract from Integrity documentation : To track the evolution of your documents through the project lifecycle, you create unique document versions at various stages of the project. You create a new version by checking in your document or content item. Creating a document or content version provides you with an exact record of the document as it was at the time you performed the check-in operation.

When you create a new version by checking in a document or a content item, the live document can continue to evolve through its lifecycle, while document version cannot be edited once you create it.

Determining if an Item is Versioned

The ID of the document version is different from the ID of the Live Item, but the ID displayed has the following pattern: Live Item ID-major.minor. To get the ID of the Live Item from a document version, you can get it from the field "Live Item ID". To know if an Item is a versioned Item, you just need to use the method isVersionedItem() on the Item.

Ignoring Versioned Items

To enable or disable reading versioned items, you neet to use the option: Options.OPTION_IGNORE_INCLUDE_VERSIONED_ITEM
MDWorkbench workbench = null;
Model model = null;
try {
    // configure connection on Integrity server
    Map<String, Object> options = new HashMap<String, Object>();
    options.put(Options.OPTION_IGNORE_CONNECTOR_UI, true);
    options.put(Options.OPTION_INTEGRATION_POINT_KIND, IntegrationPointKind.SERVER);
    options.put(Options.OPTION_SERVER, "myserver");
    options.put(Options.OPTION_PORT, "7001");
    options.put(Options.OPTION_USER, "myUser");
    options.put(Options.OPTION_PASSWORD, "myPassword");
    
    // restrict content to one particular project
    DatabaseConfiguration configuration = new DatabaseConfiguration();
    configuration.getProjects().add("/MyProject");
    options.put(Options.OPTION_DATABASE_CONFIGURATION, configuration);

    // Set this option to true to disable include versioned items
    options.put(Options.OPTION_IGNORE_INCLUDE_VERSIONED_ITEM, true);

    // read the model
    model = workbench.getMetamodelManager().getMetamodel(IntegrityPackage.eINSTANCE).createModel();
    model.read("Application", "", options);
    
    // get the database instance
    Database database = model.<Database>getInstances(IntegrityPackage.Literals.DATABASE).first();
    
    // access on-demand the content of the database
    List<Type> types = database.getTypes();
    ...
}
finally {
    // disposes the model
    if (model != null) {
        model.clear();
    }
    if (workbench != null) {
        workbench.shutdown();
    }
}

Related reference
Metamodel Overview
API Reference