com.ptc.windchill.upgrade.tool
Class ConfirmVersionState

java.lang.Object
  extended bycom.ptc.windchill.upgrade.util.fsm.State
      extended bycom.ptc.windchill.upgrade.tool.AbstractState
          extended bycom.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
              extended bycom.ptc.windchill.upgrade.tool.ConfirmVersionState

public class ConfirmVersionState
extends AbstractStateWithThreadedWork


Nested Class Summary
static class ConfirmVersionState.UpgradePreviouslyCompleted
           
 
Nested classes inherited from class com.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
AbstractState.NonExpressPhaseDone, AbstractStateWithThreadedWork.Cancel, AbstractStateWithThreadedWork.IsStateWithThreadedWorkDone, AbstractStateWithThreadedWork.IsThreadedWorkRunningAndNotCanceled, AbstractStateWithThreadedWork.Outcome, AbstractStateWithThreadedWork.WasThreadedWorkOutcomeSuccessful
 
Field Summary
private static String CLASSNAME
           
private static String CMII
           
private  UpgradeContext context_
           
private static boolean DEBUG
           
private static String DISABLE_SOURCE_VERSION_CHECK_PROPERTY
           
private static DebugWriter LOG
           
private  UpgradePhase[] phasesExecuted_
           
private  WrappingMultiLineTextMessage retrieving_
           
private  boolean targetIncludesWadm_
           
private  JComponent viewComponent_
           
private static String WADM
           
(package private)  int wadmTargetIndex_
           
 
Fields inherited from class com.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
 
Fields inherited from class com.ptc.windchill.upgrade.util.fsm.State
 
Constructor Summary
ConfirmVersionState(StateMachine sm, StateDefinition def)
          Creates a new ConfirmVersionState object.
 
Method Summary
private  String addSpaces(String release)
          Add spaces to the release history information retrieved if it is longer than one.
private  ReleaseId[] findSourceReleaseIdsWhoseSourceConstraintsArentMet()
          Checks that each target version is in the acceptable source version set.
private  ReleaseId[] findTargetReleaseIdsWhoseSourceConstraintsArentMet()
          Checks that each source version is in the acceptable source version set for each target assembly id that cares.
private  ReleaseIdSet getAcceptableSourceReleaseIdSetFor(String assembly_id, JAXPFactories jaxp_factory)
          Attempts to located "com/ptc/windchill/upgrade/tool/"+lowercase()+".arids" on WTContext.
private  UpgradeToolStateMachine getUpgradeToolStateMachine()
           
 JComponent getView()
           
 JComponent getViewComponent()
          Creates and displays the view displayed to the user.
private  boolean isDbAtTargetVersion()
          Checks if the database is at the TargetVersion Level.
private  void renderErrorForSourceVersionsUnacceptable(ReleaseId[] unsatisfied_target_versions)
           
private  void renderErrorForTargetVersionsUnacceptable(ReleaseId[] unsatisfied_source_versions)
           
protected  AbstractStateWithThreadedWork.Outcome runThreadedWork()
          Executes other methods as the hour glass appears to the user, letting them know that it is working to display the source version of the database to be upgraded.
private  void updateConfirmVersionDisplay(int num_phases)
          Updates the viewComponent_ after it has retrieves the target version and source version.
 
Methods inherited from class com.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
activate, clearStatus, deactivate, getApplication, getCancellationMonitor, getCancelPromptMessage, getCancelPromptTitle, getTitle, onCancelRequested, setApplication, setStatus, shouldBeEnclosed, toString
 
Methods inherited from class com.ptc.windchill.upgrade.util.fsm.State
getStateMachine, getStateMachine, isStartState, isStopState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

DISABLE_SOURCE_VERSION_CHECK_PROPERTY

private static final String DISABLE_SOURCE_VERSION_CHECK_PROPERTY
See Also:
Constant Field Values

CMII

private static final String CMII
See Also:
Constant Field Values

WADM

private static final String WADM
See Also:
Constant Field Values

viewComponent_

private JComponent viewComponent_

retrieving_

private WrappingMultiLineTextMessage retrieving_

context_

private UpgradeContext context_

phasesExecuted_

private UpgradePhase[] phasesExecuted_

targetIncludesWadm_

private boolean targetIncludesWadm_

wadmTargetIndex_

int wadmTargetIndex_
Constructor Detail

ConfirmVersionState

public ConfirmVersionState(StateMachine sm,
                           StateDefinition def)
Creates a new ConfirmVersionState object.

Parameters:
sm - StateMachine
def - StateMachineDefinition
Method Detail

getViewComponent

public JComponent getViewComponent()
Creates and displays the view displayed to the user.

Specified by:
getViewComponent in class AbstractState
Returns:
viewComponent_ JComponent

getView

public JComponent getView()
Returns:
viewComponent_ to other methods that call this method.

runThreadedWork

protected AbstractStateWithThreadedWork.Outcome runThreadedWork()
                                                         throws UpgradeContextException,
                                                                IUHException,
                                                                ReleaseIdException,
                                                                WTException
Executes other methods as the hour glass appears to the user, letting them know that it is working to display the source version of the database to be upgraded.

Specified by:
runThreadedWork in class AbstractStateWithThreadedWork
Returns:
Outcome to the AbstractStateWithThreadedWork can be true or false
Throws:
UpgradeContextException
IUHException - This is thrown because of retrieving the InstallAndUpgradeHistory
ReleaseIdException
WTException

findTargetReleaseIdsWhoseSourceConstraintsArentMet

private ReleaseId[] findTargetReleaseIdsWhoseSourceConstraintsArentMet()
                                                                throws WTException
Checks that each source version is in the acceptable source version set for each target assembly id that cares. This method will always return an empty array if the property
com.ptc.windchill.upgrade.disableSourceVersionCheck
is set to anything other than "false".

Returns:
non-null, possibly empty array of target release ids
Throws:
WTException

findSourceReleaseIdsWhoseSourceConstraintsArentMet

private ReleaseId[] findSourceReleaseIdsWhoseSourceConstraintsArentMet()
                                                                throws WTException
Checks that each target version is in the acceptable source version set. Currently only checks for CMII compatiblity. This method will always return an empty array if the property
com.ptc.windchill.upgrade.disableSourceVersionCheck
is set to anything other than "false".

Returns:
non-null, possibly empty array of target release ids
Throws:
WTException

getAcceptableSourceReleaseIdSetFor

private ReleaseIdSet getAcceptableSourceReleaseIdSetFor(String assembly_id,
                                                        JAXPFactories jaxp_factory)
                                                 throws WTException
Attempts to located "com/ptc/windchill/upgrade/tool/"+lowercase()+".arids" on WTContext.

Returns:
null if none is found
Throws:
WTException

renderErrorForSourceVersionsUnacceptable

private void renderErrorForSourceVersionsUnacceptable(ReleaseId[] unsatisfied_target_versions)

renderErrorForTargetVersionsUnacceptable

private void renderErrorForTargetVersionsUnacceptable(ReleaseId[] unsatisfied_source_versions)

updateConfirmVersionDisplay

private void updateConfirmVersionDisplay(int num_phases)
                                  throws IUHException,
                                         ReleaseIdException
Updates the viewComponent_ after it has retrieves the target version and source version. The message displayed to the user depends on if an upgrade is a new one, has been started before and not completed, or a brand new upgrade on this database.

Throws:
UpgradeContextException
IUHException - This is thrown because of retrieving the InstallAndUpgradeHistory
ReleaseIdException

getUpgradeToolStateMachine

private UpgradeToolStateMachine getUpgradeToolStateMachine()

isDbAtTargetVersion

private boolean isDbAtTargetVersion()
                             throws IUHException
Checks if the database is at the TargetVersion Level. return a boolean value

Throws:
IUHException

addSpaces

private String addSpaces(String release)
Add spaces to the release history information retrieved if it is longer than one. Otherwise it is a really long line that doesn't get broken up.