Source:
<code>public static ApplicationBean convertStubApplicationContextToApplicationDefinition( ApplicationContext applicationContext) { if (applicationContext == null) { return null; } Application application = ApplicationManager.getApplications().getApplication(applicationContext.getApplicationId()); ApplicationBean applicationDefinition = new ApplicationBean(); applicationDefinition.setApplicationId(applicationContext.getApplicationId()); applicationDefinition.setAlias(applicationContext.getAlias()); applicationDefinition.setMultiTenant(applicationContext.getMultiTenant()); applicationDefinition.setName(applicationContext.getName()); applicationDefinition.setDescription(applicationContext.getDescription()); <START> if (application.getStatus().name().equals(APPLICATION_STATUS_ACTIVE)) { <END> applicationDefinition.setStatus(application.getStatus().name()); } else { applicationDefinition.setStatus(applicationContext.getStatus()); } if (applicationContext.getComponents() != null) { applicationDefinition.setComponents(new ComponentBean()); if (applicationContext.getComponents().getGroupContexts() != null) { applicationDefinition.getComponents().setGroups( convertStubGroupContextsToGroupDefinitions(applicationContext.getComponents(). getGroupContexts())); } if (applicationContext.getComponents().getDependencyContext() != null) { applicationDefinition.getComponents().setDependencies( convertStubDependencyContextsToDependencyDefinitions(applicationContext.getComponents(). getDependencyContext())); } if (applicationContext.getComponents().getCartridgeContexts() != null) { applicationDefinition.getComponents().setCartridges( convertStubCartridgeContextsToCartridgeReferenceBeans(applicationContext.getComponents(). getCartridgeContexts())); } } return applicationDefinition; }</code><technical_language>reuse ApplicationStatus enum declaring additional constant of APPLICATION_STATUS_ACTIVE</technical_language>

Target:
public static ApplicationBean convertStubApplicationContextToApplicationDefinition( ApplicationContext applicationContext) { if (applicationContext == null) { return null; } Application application = ApplicationManager.getApplications().getApplication(applicationContext.getApplicationId()); ApplicationBean applicationDefinition = new ApplicationBean(); applicationDefinition.setApplicationId(applicationContext.getApplicationId()); applicationDefinition.setAlias(applicationContext.getAlias()); applicationDefinition.setMultiTenant(applicationContext.getMultiTenant()); applicationDefinition.setName(applicationContext.getName()); applicationDefinition.setDescription(applicationContext.getDescription()); if (application.getStatus().equals(ApplicationStatus.Active)) { applicationDefinition.setStatus(application.getStatus().name()); } else { applicationDefinition.setStatus(applicationContext.getStatus()); } if (applicationContext.getComponents() != null) { applicationDefinition.setComponents(new ComponentBean()); if (applicationContext.getComponents().getGroupContexts() != null) { applicationDefinition.getComponents().setGroups( convertStubGroupContextsToGroupDefinitions(applicationContext.getComponents(). getGroupContexts())); } if (applicationContext.getComponents().getDependencyContext() != null) { applicationDefinition.getComponents().setDependencies( convertStubDependencyContextsToDependencyDefinitions(applicationContext.getComponents(). getDependencyContext())); } if (applicationContext.getComponents().getCartridgeContexts() != null) { applicationDefinition.getComponents().setCartridges( convertStubCartridgeContextsToCartridgeReferenceBeans(applicationContext.getComponents(). getCartridgeContexts())); } } return applicationDefinition; }