Enum Class Serialization

java.lang.Object
java.lang.Enum<Serialization>
com.ptc.windchill.annotations.metadata.Serialization
All Implemented Interfaces:
Serializable, Comparable<Serialization>, Constable

public enum Serialization extends Enum<Serialization>
Indicates the supported remote method invocation (RMI) serialization strategy. Three values are supported: NONE, EXTERNALIZABLE_BASIC, and EVOLVABLE corresponding to "no" RMI, current version only, and "old" version deserialization support.

Note that the actual value a given class gets doesn't necessarily correspond to the value it's assigned. The value for a given class is dependent, instead, on the value calculated for any parent class or interface: EVOLVABLE "trumps" everything and EXTERNALIZABLE_BASIC trumps NONE.

Serialization is applicable to GenAsObjectMappable, GenAsPersistable, GenAsBinaryLink, and GenAsUnPersistable classes. A related member, versions, lists the old externalization version unique identifiers supported for deserialization (for which corresponding readVersion methods must also exist). By definition, "versions" should be applicable only to EVOLVABLE classes. Previous releases of Windchill allowed instances of these non-evolvable classes to be persisted, however, so old version support is still provided to restore these objects.

If you are here due to the compile error "Evolvable class must preserve current version "some version" (see com.ptc.windchill.annotations.metadata.Serialization for resolution instructions)", welcome! You are here because:

  • Your class has been determined to be EVOLVABLE
  • You (or some interace you're implementing) has added, removed, or renamed a (GeneratedProperty or GeneratedForeignKey)
  • The property change has resulted in an RMI (externalization) schema change
  • You need to "preserve" the new, current version and fix any previous versions.
To fix this, you add the new version ("some version") into the versions member annotation and copy over the readVersion<"some version">" method that was generated into the "_" source file. This is the boring part, and if you're an internal Windchill developer, you can let the preserve_versions Ant target do this bit for you (just make sure to checkout the impacted files first). The more exciting part, which you also need to do, is to figure out how the schema change impacts old versions and to adjust them accordingly. For example, say the change was to remove property "a", splitting its content into properties "b" and "c". Obviously, old versions can't simply read "a"'s value and assign it to "a"; you'll, instead, need to destruct it yourself and assign the results appropriately. More typically, the change is a simple addition for which you'll need to decide of the property needs a value explicitly assigned to it.

Rose conversion note: Corresponds to Class Specification -> Windchill -> Serializable.

Supported API: true

  • Enum Constant Details

    • EXTERNALIZABLE_BASIC

      public static final Serialization EXTERNALIZABLE_BASIC
      Indicates that instances of this class may be externalized using RMI, but may not be externalized (blobbed) into the database. No support for deserializing old versions is provided, but if the "versions" list specifies old versions, logic equivalent to that of EVOLVABLE will be generated, allowing the old versions to be read.

      Note: Windchill 10.0 no longer allows non-evolvable objects to be blobbed. Previously, old version support was, nonetheless, maintained for these objects. Windchill 10.0 will continue to support versions supported prior to 10.0, but will not support deserialization (that is, provide a version value and the corresponding readVersion method for) the 10.0 version or any versions going forward.

      Rose conversion note: Corresponds to Externalizable (Basic).

      Supported API: true

    • EVOLVABLE

      public static final Serialization EVOLVABLE
      Indicates that instances of this class may be externalized (blobbed) into the database. USE SPARINGLY!!!: eventually these instances will need to be read back out, perhaps many releases later. An evolvable class must ensure that instances of the class can be deserialized, requiring that each released version have properly implemented "readVersion" methods to properly read and reconstruct the object. This is done by recording each version in the "versions" list and providing the corresponding method for the externalization logic to delegate to.

      Rose conversion note: Corresponds to Evolvable.

      Supported API: true

    • NONE

      public static final Serialization NONE
      Indicates that the class does not support externalization. Classes utilizing this value will not implement Externalizable.

      This property makes sense only for "unpersistables" (GenAsUnPersistable) as anything persistent (implementing ObjectMappable will automatically be elevated to, at least, EXTERNALIZABLE_BASIC and will, consequently, implement Externalizable.

      Supported API: true