Class ReleaseId
- All Implemented Interfaces:
Comparable
assmbly-id.major.minor.servicePack.cps.build.
Assembly names (or ids) are short strings that match the regular expression:
[a-zA-Z][a-zA-Z0-9]+While they are not constrained in length they should be three or four characters long. Assembly ids should be treated as case-insensitive strings in all comparisons.
The version class is Comparable. Versions are expected be monotonically increasing over time for a given assembly id where each field is compared placing greater significance on the fields to the left. Thus:
wnc.2.0.0.0.0 > wnc.1.0.0.0.0
wnc.1.1.0.0.0 > wnc.1.0.0.0.0
wnc.1.1.1.0.0 > wnc.1.1.0.0.0
wnc.1.1.1.1.0 > wnc.1.1.1.0.0
wnc.1.1.1.1.1 > wnc.1.1.1.1.1
Versions with different assembly ids will always report inequality via the equals method.
However, if the compareTo() methods are used, the assembly ids will be compared lexicographically
and then the version numbers will be compared left-to-right.
10.2 Format Change
From 10.2 releaseId will have following six parts assmbly-id.major.minor.servicePack.cps.build.
instead of assmbly-id.major.minor.servicePack.dsu.build.
dsu number will now be used to represent cumulative patch set number (cps).
Prior to 10.2 dsu number was used to represent the MOR number like 10 for M010, 20 for M030 and so on..
From 10.2, MOR number will be represented by servicePack number. As an example, 10.2 M020 build 12 will
be represented as 10.2.20.0.12 instead of the old way 10.2.0.20.12.
For backward compatibility, releaseIds prior to 10.2 will be read and compared the old way.
Comparisons between releaseIds should work as follows:
ReleaseId prior to 10.2 vs ReleaseId prior to 10.2 should work the same way as before 10.2
ReleaseId post 10.2 vs ReleaseId post 10.2 should work the new way
ReleaseId prior to 10.2 vs ReleaseId 10.2 or post 10.2 should work because the major.minor will always be greater
Background on a Format Change Prior to 6.2.3 version numbers did not have an assembly id. They were added to allow for differing release rates of the Windchill Platform and each Solution that depends on the Platform.
Prior to Windchill 6.2 versions were major.minor.dsu.build. ServicePack number was
added during the 6.0 maintenance cycle. Because there was a need to support specification
of service pack level in 6.0 and Version did not have the extra field, the dsu part was encoded
with the service pack number times 1000. So 6.2 service pack 1 DSU 3 would look like 6.2.1003.
Also prior to Windchill 6.2 versions were allowed to be specified with fewer than four numbers.
Doing so would result in a version that only contains the specified numbers. Now five numbers
are required in the string representation of a version. Thus all versions will in string form
will have five fields, with zeros for fields that are not specified. For example, if you create
a version with Version.createFrom("6.2"), the string form of this version will be
6.2.0.0.0.
6.2-to-6.2.3Backward Compatibility(String Representation)
For backward compatibility all version numbers are automatically assigned the wnc assembly id, unless aAssemblyIdResolver is provided to the
createFrom(String,AssemblyResolver) method. The AssemblyIdResolver
will be given an opportunity to determine an alternative assembly id through whatever
means it chooses.
Pre-6.2 Backward Compatibility(String Representation)
Versions that are specified without all five fields are assumed to not contain the service pack value. If the dsu value is specified and is contains an encoded service pack number, then the service pack number will be set by dividing the dsu number by 1000, and the dsu number will be set by mod'ing the dsu number with 1000.If a five digit number is specified, each field is interpreted verbatim. No decoding will occur.
Whenever possible, code should not manipulate version strings directly. Rather, it should create a Version instance from the String and use the Version instead.
6.2-to-6.2.3 Backward Compatibility(XML Representation)
As of 6.2 version numbers should be stored in a single string as an attribute or text element. Therefore, backward compatibility is the same as when parsing version in their string representation.Pre-6.2 Backward Compatibility(XML Representation)
The Version class has always been able to "read" and "write" itself as a DOM Element. The representation for this element was:where the element name could be tailored if desired, and the minor, micro, and build attributes weren't required.
Because of the change in version number representation, the XML structure has been changed. Rather than add another attribute for service pack, versions will now be represented in the format:
where the version's string representation is in the number attribute. This has been don't to reduce coupling between version number format and the XML structure, allowing us more room in the future to handle format changes.
The current version class can handle decoding XML Elements in either form. So as long as code that uses XML version represetations always creates a ReleaseId instance from the Element and uses the ReleaseId class rather than directly querying the Element, this code will be isolated from format changes.
Example Mappings
1 => wnc.1.0.0.0.0
1.2 => wnc.1.2.0.0.0
1.2.3 => wnc.1.2.0.3.0
1.2.3.4 => wnc.1.2.0.3.4
1.2.3.4.5 => wnc.1.2.3.4.5
1.2.3004 => wnc.1.2.3.4.0
1.2.3004.5 => wnc.1.2.3.4.5
1.2.0.3004.5 => wnc.1.2.0.3004.5
1.2.6.3004.5 => wnc.1.2.6.3004.5
Important Note
The version 6.0.2 is always treated as 6.0.0.1000.0 / 6.0.1.0.0. This is because it was meant to be a service pack. However, the service pack-numbering scheme could not be introduced because the version classes were unable to handle numbers of 1000 or greater properly. There wasn't sufficient time to correct the problem for the 6.0 service pack 1 release, so it's version number was changed to 6.0.2.0 even though this release wasn't a DSU release. The problem was corrected immediately, and support for automatically mapping from 6.0.2 to 6.0.1.0.0 was added to later product versions, giving the appearances of correct numbering and preventing future problems.Supported API: true
Extendable: false
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares the argument to this ReleaseId.static final ReleaseIdcreateFrom(String version_string) Constructs a ReleaseId object from a String.booleanReturns true if the argument is a ReleaseId object and have equal major, minor, servicepack, cps, and build levels.final StringReturns the assembly identifier.final intgetBuild()Returns the build number.final intgetCps()Returns the cps number.final StringReturns the first three parts of the version number prior to 10.2.final intgetMajor()Returns the major number.final intgetMinor()Returns the minor number.final StringReturns the version.final intReturns the service pack number.final StringDeprecated.final StringFrom 10.2 it returns the shortened version which is the concatenation of the major, minor, servicePack and cps without the build number separated by periods and stripping any insignificant zeros off of the right-hand portion of the string.final StringDeprecated.final StringReturns the first two parts of the version number.inthashCode()
Supported API: true
Extendable: falsetoString()returns a String representation of this ReleaseId.
-
Constructor Details
-
ReleaseId
public ReleaseId(String assembly_id, Integer major, Integer minor, Integer service_pack, Integer cps, Integer build) throws com.ptc.windchill.instassm.ReleaseIdException Constructs a version from all numeric values
Supported API: true
Extendable: false- Parameters:
assembly_id- Stringmajor- Integerminor- Integerservice_pack- Integercps- Integerbuild- Integer- Throws:
com.ptc.windchill.instassm.ReleaseIdException
-
ReleaseId
public ReleaseId(String assembly_id, int major, int minor, int service_pack, int cps, int build) throws com.ptc.windchill.instassm.ReleaseIdException
Supported API: true
Extendable: false- Throws:
com.ptc.windchill.instassm.ReleaseIdException
-
-
Method Details
-
getAssemblyId
Returns the assembly identifier.
Supported API: true
Extendable: false- Returns:
- a non-null String
-
getReleaseIdComponent
Returns the version. A version is the concatenation of the major, minor, servicepack, cps, and build levels, separated by periods. If the version is not 6.2.x or is prior to 10.2.x then the value could be four parts and include the service pack and cps (actually dsu prior to 10.2) as in one field.
Supported API: true
Extendable: false- Returns:
- non-null String in the form of "major.minor.servicePack.cps.build", e.g. 10.2.30.10.01
-
getShortenedReleaseIdComponent
From 10.2 it returns the shortened version which is the concatenation of the major, minor, servicePack and cps without the build number separated by periods and stripping any insignificant zeros off of the right-hand portion of the string. If the version is not 6.2.x or is prior to 10.2 then the value could be three parts and include the service pack and cps (dsu number prior to 10.2) in one field.
Supported API: true
Extendable: false- Returns:
- non-null String
-
getTwoPartVersionString
Returns the first two parts of the version number.
Supported API: true
Extendable: false- Returns:
- non-null String
-
getThreePartVersionString
Deprecated.As of release x-24, replaced bygetFourPartVersionString()Returns the first three parts of the version number prior to 10.2. The third number will ALWAYS be the combined servicepack-cps (called dsu prior to 10.2) value. From 10.2, returns first four parts of the version number.
Supported API: true
Extendable: false- Returns:
- non-null String
-
getFourPartVersionString
Returns the first three parts of the version number prior to 10.2. The third number will ALWAYS be the combined servicepack-cps (called dsu prior to 10.2) value. From 10.2, returns first four parts of the version number.
Supported API: true
Extendable: false- Returns:
- non-null String
-
getShortenedMajorMinorServicePackComponent
Deprecated.Returns the shortened version which is the concatenation of just the major and minor verison numbers separated by period. The minor number will be stripped if it is zero.
Supported API: true
Extendable: false- Returns:
- non-null String
-
getMajor
public final int getMajor()Returns the major number.
Supported API: true
Extendable: false- Returns:
- a value greater than or equal to zero
-
getMinor
public final int getMinor()Returns the minor number.
Supported API: true
Extendable: false- Returns:
- a value greater than or equal to zero
-
getServicePack
public final int getServicePack()Returns the service pack number.
Supported API: true
Extendable: false- Returns:
- a value greater than or equal to zero
-
getCps
public final int getCps()Returns the cps number.
Supported API: true
Extendable: false- Returns:
- a value greater than or equal to zero
-
getBuild
public final int getBuild()Returns the build number.
Supported API: true
Extendable: false- Returns:
- a value greater than or equal to zero
-
toString
returns a String representation of this ReleaseId. If the version is 6.2.x or greater than equals to 10.2 then the value of the service pack and cps will be output as separate fields (e.g. wnc.6.2.6.0.20). Otherwise, the service pack and cps (called dsu number prior to 10.2) numbers will be combined into a single number (e.g. 6.1.1001.5).
Supported API: true
Extendable: false -
hashCode
public int hashCode()
Supported API: true
Extendable: false -
equals
Returns true if the argument is a ReleaseId object and have equal major, minor, servicepack, cps, and build levels.
Supported API: true
Extendable: false -
compareTo
Compares the argument to this ReleaseId. If they are equal, return zero. If this ReleaseId is less than the argument, returns a negative number. If this ReleaseId is greater than the argument, returns a positive number. If other_ is not a ReleaseId instance, returns -1.
Supported API: true
Extendable: false- Specified by:
compareToin interfaceComparable- Parameters:
other_- Object ReleaseId to be compared with this.- Returns:
- int
-
createFrom
public static final ReleaseId createFrom(String version_string) throws com.ptc.windchill.instassm.ReleaseIdException Constructs a ReleaseId object from a String. Assembly id will be wnc if it is not specified in the string.
Supported API: true
Extendable: false- Parameters:
version_string- String Non-null string in any of the acceptable forms(see class javadocs)- Returns:
- a non-null ReleaseId
- Throws:
com.ptc.windchill.instassm.ReleaseIdException- if version_string is not in an acceptable form
-
getFourPartVersionString()