com.ptc.windchill.upgrade.ius
Class ApplicabilitySnapshotModel

java.lang.Object
  extended bycom.ptc.windchill.upgrade.ius.ApplicabilitySnapshotModel

public class ApplicabilitySnapshotModel
extends Object

A snapshot of the applicability of all the updates at a certain point. All the state is produced during construction.If the context changes, the state may no longer be valid, and it is wise to create a new ApplicabilityModel.


Nested Class Summary
private  class ApplicabilitySnapshotModel.Applicability
           
private  class ApplicabilitySnapshotModel.Selection
           
 
Field Summary
private static String CLASSNAME
           
private static boolean DEBUG
           
private  DependencyGraphModel dependencyModel_
           
private  IncrementalUpdateHistory incrementalUpdateHistory_
           
private  boolean isFirstUpgrade_
           
private static DebugWriter LOG
           
private  ReleaseId[] sourceVersions_
           
private  ReleaseId[] targetVersions_
           
private  HashMap updateApplicability_
           
private  HashMap updateSelections_
           
 
Constructor Summary
ApplicabilitySnapshotModel()
           
ApplicabilitySnapshotModel(ReleaseId[] source_versions, ReleaseId[] target_versions, IncrementalUpdateHistory iu_history, boolean is_first_upgrade)
           
 
Method Summary
private  void computeApplicabilities()
           
private  void computeSelections()
          For each applicable iu, earliest to latest, select it if all of its requireds (which should be ordered before it) are selected or have already been applied AND none of its excludings (which should also be ordered before it) has been selected or already run.
(package private)  DependencyGraphModel dependencyModel()
           
private  ApplicabilitySnapshotModel.Applicability getApplicabilityFor(UUID uuid)
           
 IUApplication getIUApplicationFor(UUID uuid)
          The update history for the update with the specified UUID.
private  List getIUSequence()
           
 int getNumberOfApplicableUpdates()
           
 Set getSelectedPredecessorsOf(UUID uuid)
           
private  ApplicabilitySnapshotModel.Selection getSelectionFor(UUID uuid)
           
 List getSequenceOfApplicableUpdates()
          Ordered set of IncrementalUpdates that can be applied.
 List getSequenceOfSelectedUpdates()
          Ordered set of IncrementalUpdates that are to actually be applied(i.e.which are selected).
 List getSequenceOfUpdatesAlreadyApplied()
          Ordered sequence of IncrementalUpdates that have already been applied.
private  IncrementalUpdate getUpdateFor(UUID uuid)
           
private  Iterator getUpdates()
           
private  Iterator getUpdateUuids()
           
 boolean hasAlreadyRun(UUID uuid)
           
 boolean isApplicable(UUID uuid)
           
private static boolean isFirstUpgrade(InstallAndUpgradeHistory iuh)
           
 boolean isRequired(UUID uuid)
           
 boolean isSelected(UUID uuid)
           
 boolean isSelectionUserChangeable(UUID uuid)
           
 void setSelected(UUID uuid, boolean is_selected)
          Changed the selected state of the specified UUID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

dependencyModel_

private DependencyGraphModel dependencyModel_

updateApplicability_

private HashMap updateApplicability_

updateSelections_

private HashMap updateSelections_

sourceVersions_

private ReleaseId[] sourceVersions_

targetVersions_

private ReleaseId[] targetVersions_

incrementalUpdateHistory_

private IncrementalUpdateHistory incrementalUpdateHistory_

isFirstUpgrade_

private boolean isFirstUpgrade_
Constructor Detail

ApplicabilitySnapshotModel

public ApplicabilitySnapshotModel()
                           throws ApplicabilityModelException

ApplicabilitySnapshotModel

public ApplicabilitySnapshotModel(ReleaseId[] source_versions,
                                  ReleaseId[] target_versions,
                                  IncrementalUpdateHistory iu_history,
                                  boolean is_first_upgrade)
                           throws ApplicabilityModelException
Method Detail

isFirstUpgrade

private static boolean isFirstUpgrade(InstallAndUpgradeHistory iuh)
                               throws ApplicabilityModelException
Throws:
ApplicabilityModelException

computeApplicabilities

private void computeApplicabilities()
                             throws ApplicabilityModelException
Throws:
ApplicabilityModelException

computeSelections

private void computeSelections()
                        throws ApplicabilityModelException
For each applicable iu, earliest to latest, select it if all of its requireds (which should be ordered before it) are selected or have already been applied AND none of its excludings (which should also be ordered before it) has been selected or already run. We don't care about the selections of the non-applicables, so only do this for applicables.

Throws:
ApplicabilityModelException

getApplicabilityFor

private ApplicabilitySnapshotModel.Applicability getApplicabilityFor(UUID uuid)

getSelectionFor

private ApplicabilitySnapshotModel.Selection getSelectionFor(UUID uuid)

dependencyModel

DependencyGraphModel dependencyModel()

getIUSequence

private List getIUSequence()

getUpdateUuids

private Iterator getUpdateUuids()

getUpdates

private Iterator getUpdates()

getUpdateFor

private IncrementalUpdate getUpdateFor(UUID uuid)

getSelectedPredecessorsOf

public Set getSelectedPredecessorsOf(UUID uuid)

isSelected

public boolean isSelected(UUID uuid)

isSelectionUserChangeable

public boolean isSelectionUserChangeable(UUID uuid)

isApplicable

public boolean isApplicable(UUID uuid)

isRequired

public boolean isRequired(UUID uuid)

hasAlreadyRun

public boolean hasAlreadyRun(UUID uuid)

getSequenceOfApplicableUpdates

public List getSequenceOfApplicableUpdates()
Ordered set of IncrementalUpdates that can be applied. This isn't necessarily the set that should be run.

Returns:
a new, non-null, but possibly empty List of IncrementalUpdates

getSequenceOfSelectedUpdates

public List getSequenceOfSelectedUpdates()
Ordered set of IncrementalUpdates that are to actually be applied(i.e.which are selected).

Returns:
a new, non-null, but possibly empty List of IncrementalUpdates

getSequenceOfUpdatesAlreadyApplied

public List getSequenceOfUpdatesAlreadyApplied()
Ordered sequence of IncrementalUpdates that have already been applied.

Returns:
a new, non-null, but possibly empty List of IncrementalUpdates

getNumberOfApplicableUpdates

public int getNumberOfApplicableUpdates()

getIUApplicationFor

public IUApplication getIUApplicationFor(UUID uuid)
The update history for the update with the specified UUID.

Returns:
may return null if the update has not been applied

setSelected

public void setSelected(UUID uuid,
                        boolean is_selected)
                 throws ApplicabilityModelException
Changed the selected state of the specified UUID. An error will be thrown if is_selected is false and the update is not deselectable.Similarly, one will be thrown if is_selected is true and the update is not selectable.

Throws:
ApplicabilityModelException - if trying to deselect an update that is not deselectable or select an update that is not selectable
See Also:
#isSelectable, #isDeselectable