Using ComponentInfo to Process Version Information

The ComponentInfo interface enables you to process version information.

With ComponentInfo you can:

  • Determine whether to create a new version
  • Create a new version based on version properties you set before
  • Get file information for a particular version

After the ComponentInfo interface is initialized in the class definitions, you can use it for creating or identifying artifacts as follows.

Existing Versions

getVersionByName()

// For get version by name
VersionInfo versionInfo = componentInfo.getVersionByName(versionName);     
// your logic here

getAllVersions()

// For all the existing versions
List<VersionInfo> existingVersions = 
  (componentInfo == null) ? null : componentInfo.getAllVersions();
if(existingVersions != null && existingVersions.size() > 0) {
    for(VersionInfo info : existingVersions) {
        // your logic here
    }
}

Latest Versions

// For latest versions
VersionInfo singleLatestVersion = 
  (componentInfo == null) ? null : componentInfo.getLatestVersion();
// your logic goes here.

See the Javadoc and the example for more details.