modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java | 48 + modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java | 12 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java | 76 -- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java | 96 +++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 67 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java | 68 ++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java | 71 -- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java | 254 ++++++++++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java | 81 +++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 231 --------- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java | 12 13 files changed, 613 insertions(+), 409 deletions(-)
New commits: commit c43e74fbf53cfd2dd58ee9babd328c5866dacb8c Merge: b3313d9... 96a5298... Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 29 15:39:05 2010 -0400
Merge branch 'bundle-jay' into gwt
Conflicts: modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
commit b3313d96a919adf6168c4dc3065e54fdc71ae69c Merge: ef3638d... 8bd78f0... Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 29 15:37:14 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit ef3638df66757fbfd2f84f03c38af3dfa3556513 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Mar 29 15:35:55 2010 -0400
Incorporate group deployment into bundle deploy wizard. Make initial use of Selection widgets. Refactored Pulled AbstractSelector out of ResourceSelector and subclassed ResourceGroupSelector as well.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java index 5b11249..369569b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java @@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deploy; import org.rhq.core.domain.bundle.Bundle; import org.rhq.core.domain.bundle.BundleDeployDefinition; import org.rhq.core.domain.bundle.BundleDeployment; +import org.rhq.core.domain.bundle.BundleGroupDeployment; import org.rhq.core.domain.bundle.BundleVersion; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.definition.ConfigurationTemplate; @@ -33,14 +34,15 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard { private BundleVersion bundleVersion; private BundleDeployDefinition bundleDeployDefinition; private BundleDeployment bundleDeployment; + private BundleGroupDeployment bundleGroupDeployment; private String name; private String description; private ConfigurationTemplate template; private Configuration config; - private Integer platformGroupId; - private Integer platformId; + private Integer deployTargetId; private Boolean newDefinition = Boolean.TRUE; - private Boolean deployNow = null; + private boolean deployNow = true; + private boolean resourceDeploy = true;
public Bundle getBundle() { return bundle; @@ -110,32 +112,36 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard { this.newDefinition = newDefinition; }
- public boolean isDeployNow() { - return Boolean.TRUE.equals(deployNow); + public Integer getPlatformGroupId() { + return deployTargetId; }
- public Boolean getDeployNow() { - return deployNow; + public void setPlatformGroupId(Integer platformGroupId) { + this.deployTargetId = platformGroupId; }
- public void setDeployNow(Boolean deployNow) { - this.deployNow = deployNow; + public Integer getDeployTargetId() { + return deployTargetId; }
- public Integer getPlatformGroupId() { - return platformGroupId; + public void setDeployTargetId(Integer deployTargetId) { + this.deployTargetId = deployTargetId; }
- public void setPlatformGroupId(Integer platformGroupId) { - this.platformGroupId = platformGroupId; + public boolean isResourceDeploy() { + return resourceDeploy; + } + + public Boolean isDeployNow() { + return deployNow; }
- public Integer getPlatformId() { - return platformId; + public void setDeployNow(Boolean deployNow) { + this.deployNow = deployNow; }
- public void setPlatformId(Integer platformId) { - this.platformId = platformId; + public void setResourceDeploy(boolean resourceDeploy) { + this.resourceDeploy = resourceDeploy; }
public BundleDeployment getBundleDeployment() { @@ -146,4 +152,12 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard { this.bundleDeployment = bundleDeployment; }
+ public BundleGroupDeployment getBundleGroupDeployment() { + return bundleGroupDeployment; + } + + public void setBundleGroupDeployment(BundleGroupDeployment bundleGroupDeployment) { + this.bundleGroupDeployment = bundleGroupDeployment; + } + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java index 284d94c..b1b2671 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java @@ -36,8 +36,8 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard { steps.add(new BundleDeployDefinitionInfoStep(this)); steps.add(new SelectTemplateStep(this)); steps.add(new CreateConfigStep(this)); - steps.add(new DeployNowStep(this)); - steps.add(new SelectPlatformsStep(this)); + steps.add(new DeployOptionsStep(this)); + steps.add(new DeployTargetStep(this)); steps.add(new DeployStep(this)); }
@@ -49,8 +49,8 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard { steps.add(new BundleDeployDefinitionInfoStep(this)); steps.add(new SelectTemplateStep(this)); steps.add(new CreateConfigStep(this)); - steps.add(new DeployNowStep(this)); - steps.add(new SelectPlatformsStep(this)); + steps.add(new DeployOptionsStep(this)); + steps.add(new DeployTargetStep(this)); steps.add(new DeployStep(this)); }
@@ -63,8 +63,8 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
steps.add(new SelectTemplateStep(this)); steps.add(new CreateConfigStep(this)); - steps.add(new DeployNowStep(this)); - steps.add(new SelectPlatformsStep(this)); + steps.add(new DeployOptionsStep(this)); + steps.add(new DeployTargetStep(this)); steps.add(new DeployStep(this)); }
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java deleted file mode 100644 index aacf46f..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.gui.coregui.client.bundle.deploy; - -import java.util.LinkedHashMap; - -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.RadioGroupItem; -import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; -import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; - -import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; - -public class DeployNowStep implements WizardStep { - - static private final String DEPLOY_LATER = "later"; - static private final String DEPLOY_NOW = "now"; - - private final BundleDeployWizard wizard; - private DynamicForm form; - - public DeployNowStep(BundleDeployWizard bundleCreationWizard) { - this.wizard = bundleCreationWizard; - } - - public String getName() { - return "Deploy Now or Later"; - } - - public Canvas getCanvas() { - if (form == null) { - form = new DynamicForm(); - form.setWidth100(); - form.setNumCols(2); - form.setColWidths("50%", "*"); - - RadioGroupItem radioGroupItem = new RadioGroupItem("deployTime", "Deployment Time"); - LinkedHashMap<String, String> radioGroupValues = new LinkedHashMap<String, String>(); - radioGroupValues.put(DEPLOY_NOW, "Deploy Now"); - radioGroupValues.put(DEPLOY_LATER, "Save Definition and Deploy Later"); - radioGroupItem.setRequired(true); - radioGroupItem.setValueMap(radioGroupValues); - radioGroupItem.setValue(DEPLOY_NOW); - wizard.setDeployNow(true); - radioGroupItem.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - wizard.setDeployNow(DEPLOY_NOW.equals(event.getValue())); - } - }); - - form.setItems(radioGroupItem); - } - return form; - } - - public boolean nextPage() { - return form.validate(); - } -} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java new file mode 100644 index 0000000..730a466 --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java @@ -0,0 +1,96 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.gui.coregui.client.bundle.deploy; + +import java.util.LinkedHashMap; + +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.RadioGroupItem; +import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; +import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; + +import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; + +public class DeployOptionsStep implements WizardStep { + + static private final String DEPLOY_LATER = "later"; + static private final String DEPLOY_NOW = "now"; + + static private final String DEPLOY_GROUP = "group"; + static private final String DEPLOY_RESOURCE = "resource"; + + private final BundleDeployWizard wizard; + private DynamicForm form; + private RadioGroupItem rgDeployTimeItem; + private RadioGroupItem rgDeployTypeItem; + + public DeployOptionsStep(BundleDeployWizard bundleCreationWizard) { + this.wizard = bundleCreationWizard; + } + + public String getName() { + return "Deploy Options"; + } + + public Canvas getCanvas() { + if (form == null) { + form = new DynamicForm(); + form.setWidth100(); + form.setNumCols(2); + form.setColWidths("50%", "*"); + + rgDeployTimeItem = new RadioGroupItem("deployTime", "Deployment Time"); + LinkedHashMap<String, String> deployTimeValues = new LinkedHashMap<String, String>(); + deployTimeValues.put(DEPLOY_NOW, "Deploy Now"); + deployTimeValues.put(DEPLOY_LATER, "Deploy Later"); + rgDeployTimeItem.setRequired(true); + rgDeployTimeItem.setValueMap(deployTimeValues); + rgDeployTimeItem.setValue(DEPLOY_NOW); + wizard.setDeployNow(true); + rgDeployTimeItem.addChangedHandler(new ChangedHandler() { + public void onChanged(ChangedEvent event) { + wizard.setDeployNow(DEPLOY_NOW.equals(event.getValue())); + rgDeployTypeItem.setDisabled(!wizard.isDeployNow()); + } + }); + + rgDeployTypeItem = new RadioGroupItem("deployTarget", "Deployment Target"); + LinkedHashMap<String, String> deployTypeValues = new LinkedHashMap<String, String>(); + deployTypeValues.put(DEPLOY_RESOURCE, "Deploy to Single Resource"); + deployTypeValues.put(DEPLOY_GROUP, "Deploy to Group of Resources"); + rgDeployTypeItem.setRequired(true); + rgDeployTypeItem.setValueMap(deployTypeValues); + rgDeployTypeItem.setValue(DEPLOY_RESOURCE); + wizard.setResourceDeploy(true); + rgDeployTypeItem.addChangedHandler(new ChangedHandler() { + public void onChanged(ChangedEvent event) { + wizard.setResourceDeploy(DEPLOY_RESOURCE.equals(event.getValue())); + } + }); + + form.setItems(rgDeployTimeItem, rgDeployTypeItem); + } + return form; + } + + public boolean nextPage() { + return form.validate(); + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java index bf3b8b1..197bd9f 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java @@ -28,6 +28,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.BundleDeployDefinition; import org.rhq.core.domain.bundle.BundleDeployment; +import org.rhq.core.domain.bundle.BundleGroupDeployment; import org.rhq.enterprise.gui.coregui.client.CoreGUI; import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync; @@ -80,27 +81,51 @@ public class DeployStep implements WizardStep { + result.getDescription(), Severity.Info)); wizard.setBundleDeployDefinition(result);
- bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard - .getPlatformId(), // - new AsyncCallback<BundleDeployment>() { - public void onSuccess(BundleDeployment result) { - deployingImage.setSrc("/images/status_complete.gif"); - deployingMessage.setText("Bundle Deployment Scheduled!"); - CoreGUI.getMessageCenter().notify( - new Message("Schedule bundle deployment [" - + wizard.getBundleDeployDefinition().getName() + "] resource [" - + result.getResource() + "]", Severity.Info)); - wizard.setBundleDeployment(result); - } - - public void onFailure(Throwable caught) { - deployingImage.setSrc("/images/status_error.gif"); - deployingMessage.setText("Failed to Schedule Deployment!"); - CoreGUI.getErrorHandler().handleError( - "Failed to schedule deployment: " + caught.getMessage(), caught); - wizard.setBundleDeployment(null); - } - }); + if (wizard.isResourceDeploy()) { + bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), + wizard.getDeployTargetId(), // + new AsyncCallback<BundleDeployment>() { + public void onSuccess(BundleDeployment result) { + deployingImage.setSrc("/images/status_complete.gif"); + deployingMessage.setText("Bundle Deployment Scheduled!"); + CoreGUI.getMessageCenter().notify( + new Message("Schedule bundle deployment [" + + wizard.getBundleDeployDefinition().getName() + "] resource [" + + result.getResource() + "]", Severity.Info)); + wizard.setBundleDeployment(result); + } + + public void onFailure(Throwable caught) { + deployingImage.setSrc("/images/status_error.gif"); + deployingMessage.setText("Failed to Schedule Deployment!"); + CoreGUI.getErrorHandler().handleError( + "Failed to schedule deployment: " + caught.getMessage(), caught); + wizard.setBundleDeployment(null); + } + }); + } else { + bundleServer.scheduleBundleGroupDeployment(wizard.getBundleDeployDefinition().getId(), + wizard.getDeployTargetId(), // + new AsyncCallback<BundleGroupDeployment>() { + public void onSuccess(BundleGroupDeployment result) { + deployingImage.setSrc("/images/status_complete.gif"); + deployingMessage.setText("Bundle Group Deployment Scheduled!"); + CoreGUI.getMessageCenter().notify( + new Message("Schedule bundle group deployment [" + + wizard.getBundleDeployDefinition().getName() + + "] resource group [" + result.getGroup() + "]", Severity.Info)); + wizard.setBundleGroupDeployment(result); + } + + public void onFailure(Throwable caught) { + deployingImage.setSrc("/images/status_error.gif"); + deployingMessage.setText("Failed to Schedule Group Deployment!"); + CoreGUI.getErrorHandler().handleError( + "Failed to schedule group deployment: " + caught.getMessage(), caught); + wizard.setBundleGroupDeployment(null); + } + }); + } }
public void onFailure(Throwable caught) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java new file mode 100644 index 0000000..b6803bb --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java @@ -0,0 +1,68 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.gui.coregui.client.bundle.deploy; + +import java.util.HashSet; + +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Canvas; + +import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; +import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.AbstractSelector; +import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector; +import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector; + +public class DeployTargetStep implements WizardStep { + + private final BundleDeployWizard wizard; + + private AbstractSelector selector; + + public DeployTargetStep(BundleDeployWizard bundleCreationWizard) { + this.wizard = bundleCreationWizard; + } + + public String getName() { + return this.wizard.isResourceDeploy() ? "Select Target Resource" : "Select Target Group"; + } + + public Canvas getCanvas() { + if ((null == selector) || isMismatch()) { + selector = this.wizard.isResourceDeploy() ? new ResourceSelector() : new ResourceGroupSelector(); + } + + return selector; + } + + private boolean isMismatch() { + return ((selector instanceof ResourceSelector && !this.wizard.isResourceDeploy()) || (selector instanceof ResourceGroupSelector && this.wizard + .isResourceDeploy())); + } + + public boolean nextPage() { + HashSet<Integer> selection = selector.getSelection(); + if (selection.size() != 1) { + SC.warn("Select only a single target resource for deployment. Use group deploy for multiple targets."); + return false; + } + + wizard.setDeployTargetId(selection.iterator().next()); + return true; + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java deleted file mode 100644 index 1e38fab..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.gui.coregui.client.bundle.deploy; - -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.TextItem; -import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; -import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; - -import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep; - -public class SelectPlatformsStep implements WizardStep { - - private final BundleDeployWizard wizard; - private DynamicForm form; - - public SelectPlatformsStep(BundleDeployWizard bundleCreationWizard) { - this.wizard = bundleCreationWizard; - } - - public String getName() { - return "Select Target Platforms"; - } - - public Canvas getCanvas() { - if (form == null) { - form = new DynamicForm(); - form.setWidth100(); - form.setNumCols(2); - form.setColWidths("50%", "*"); - - // TODO: this is temporary until we have a resource selection step - final TextItem platformIdTextItem = new TextItem("platformId", "Platform Resource Id"); - platformIdTextItem.setRequired(true); - platformIdTextItem.addChangedHandler(new ChangedHandler() { - public void onChanged(ChangedEvent event) { - Object value = event.getValue(); - if (value == null) { - value = ""; - } - wizard.setPlatformId(Integer.valueOf(value.toString())); - } - }); - - form.setItems(platformIdTextItem); - } - - return form; - } - - public boolean nextPage() { - return form.validate(); - } -} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java index 5743653..b55c172 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java @@ -26,6 +26,7 @@ import com.google.gwt.user.client.rpc.RemoteService; import org.rhq.core.domain.bundle.Bundle; import org.rhq.core.domain.bundle.BundleDeployDefinition; import org.rhq.core.domain.bundle.BundleDeployment; +import org.rhq.core.domain.bundle.BundleGroupDeployment; import org.rhq.core.domain.bundle.BundleType; import org.rhq.core.domain.bundle.BundleVersion; import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite; @@ -63,4 +64,7 @@ public interface BundleGWTService extends RemoteService { ArrayList<BundleType> getAllBundleTypes() throws Exception;
BundleDeployment scheduleBundleDeployment(int bundleDeployDefinitionId, int resourceId) throws Exception; + + BundleGroupDeployment scheduleBundleGroupDeployment(int bundleDeployDefinitionId, int resourceGroupId) + throws Exception; } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java index 421a66e..7499f0b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java @@ -54,7 +54,7 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> { return INSTANCE; }
- private ResourceGroupsDataSource() { + public ResourceGroupsDataSource() { super("ResourceGroups");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java new file mode 100644 index 0000000..06c322c --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java @@ -0,0 +1,254 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection; + +import java.util.HashSet; + +import com.google.gwt.user.client.Timer; +import com.smartgwt.client.data.Criteria; +import com.smartgwt.client.data.Record; +import com.smartgwt.client.types.DragDataAction; +import com.smartgwt.client.types.DragTrackerMode; +import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.widgets.ImgProperties; +import com.smartgwt.client.widgets.TransferImgButton; +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.events.ClickHandler; +import com.smartgwt.client.widgets.events.KeyPressEvent; +import com.smartgwt.client.widgets.events.KeyPressHandler; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.events.ItemChangedEvent; +import com.smartgwt.client.widgets.form.events.ItemChangedHandler; +import com.smartgwt.client.widgets.grid.ListGrid; +import com.smartgwt.client.widgets.grid.ListGridField; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.grid.events.RecordDropEvent; +import com.smartgwt.client.widgets.grid.events.RecordDropHandler; +import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler; +import com.smartgwt.client.widgets.grid.events.SelectionEvent; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.LayoutSpacer; +import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.layout.VStack; + +import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; + +/** + * @author Greg Hinkle + */ +public abstract class AbstractSelector extends HLayout { + + protected HashSet<Integer> selection = new HashSet<Integer>(); + + protected ListGrid availableGrid; + protected ListGrid assignedGrid; + + protected TransferImgButton addButton; + protected TransferImgButton removeButton; + protected TransferImgButton addAllButton; + protected TransferImgButton removeAllButton; + + protected Criteria latestCriteria; + + public AbstractSelector() { + setAlign(VerticalAlignment.BOTTOM); + setHeight(380); + } + + public HashSet<Integer> getSelection() { + return selection; + } + + protected abstract DynamicForm getAvailableFilterForm(); + + protected abstract RPCDataSource<?> getDataSource(); + + protected abstract Criteria getLatestCriteria(DynamicForm availableFilterForm); + + @Override + protected void onDraw() { + super.onDraw(); + + final DynamicForm availableFilterForm = getAvailableFilterForm(); + + VLayout availableLayout = new VLayout(); + availableLayout.addMember(new LayoutSpacer()); + + availableLayout.addMember(availableFilterForm); + + availableGrid = new ListGrid(); + availableGrid.setHeight(350); + availableGrid.setCanDragRecordsOut(true); + availableGrid.setDragTrackerMode(DragTrackerMode.ICON); + availableGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16)); + availableGrid.setDragDataAction(DragDataAction.COPY); + availableGrid.setDataSource(getDataSource()); + availableGrid.setFetchDelay(700); + + availableGrid.setAutoFetchData(true); + availableGrid.setFields(new ListGridField("icon", 50), new ListGridField("name")); + + availableLayout.addMember(availableGrid); + + addMember(availableLayout); + + availableFilterForm.addItemChangedHandler(new ItemChangedHandler() { + public void onItemChanged(ItemChangedEvent itemChangedEvent) { + latestCriteria = getLatestCriteria(availableFilterForm); + + Timer t = new Timer() { + @Override + public void run() { + if (latestCriteria != null) { + Criteria c = latestCriteria; + latestCriteria = null; + availableGrid.fetchData(c); + } + } + }; + t.schedule(500); + } + }); + + VStack moveButtonStack = new VStack(6); + moveButtonStack.setAlign(VerticalAlignment.CENTER); + moveButtonStack.setWidth(40); + + addButton = new TransferImgButton(TransferImgButton.RIGHT); + addButton.setDisabled(true); + removeButton = new TransferImgButton(TransferImgButton.LEFT); + removeButton.setDisabled(true); + addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL); + removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL); + removeAllButton.setDisabled(true); + + moveButtonStack.addMember(addButton); + moveButtonStack.addMember(removeButton); + moveButtonStack.addMember(addAllButton); + moveButtonStack.addMember(removeAllButton); + + addMember(moveButtonStack); + + VLayout assignedLayout = new VLayout(); + assignedLayout.addMember(new LayoutSpacer()); + + assignedGrid = new ListGrid(); + assignedGrid.setHeight(350); + assignedGrid.setCanReorderRecords(true); + assignedGrid.setCanDragRecordsOut(true); + + assignedGrid.setCanAcceptDroppedRecords(true); + ListGridField iconField = new ListGridField("icon", 50); + iconField.setType(ListGridFieldType.ICON); + assignedGrid.setFields(iconField, new ListGridField("name")); + + assignedLayout.addMember(assignedGrid); + addMember(assignedLayout); + + addButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + assignedGrid.transferSelectedData(availableGrid); + select(assignedGrid.getSelection()); + updateButtons(); + } + }); + removeButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + deselect(assignedGrid.getSelection()); + assignedGrid.removeSelectedData(); + updateButtons(); + } + }); + addAllButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + availableGrid.selectAllRecords(); + assignedGrid.transferSelectedData(availableGrid); + select(availableGrid.getSelection()); + updateButtons(); + } + }); + removeAllButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + assignedGrid.selectAllRecords(); + deselect(assignedGrid.getSelection()); + assignedGrid.removeSelectedData(); + updateButtons(); + } + }); + + availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() { + public void onSelectionChanged(SelectionEvent selectionEvent) { + updateButtons(); + } + }); + + assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() { + public void onSelectionChanged(SelectionEvent selectionEvent) { + updateButtons(); + } + }); + + assignedGrid.addKeyPressHandler(new KeyPressHandler() { + public void onKeyPress(KeyPressEvent event) { + if ("Delete".equals(event.getKeyName())) { + deselect(assignedGrid.getSelection()); + assignedGrid.removeSelectedData(); + } + } + }); + + assignedGrid.addRecordDropHandler(new RecordDropHandler() { + public void onRecordDrop(RecordDropEvent recordDropEvent) { + select(recordDropEvent.getDropRecords()); + } + }); + } + + protected void updateButtons() { + addButton.setDisabled(!availableGrid.anySelected() || availableGrid.getTotalRows() == 0); + removeButton.setDisabled(!assignedGrid.anySelected() || assignedGrid.getTotalRows() == 0); + addAllButton.setDisabled(availableGrid.getTotalRows() == 0); + removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0); + } + + protected void select(ListGridRecord[] records) { + availableGrid.deselectAllRecords(); + for (ListGridRecord record : records) { + record.setEnabled(false); + selection.add(record.getAttributeAsInt("id")); + } + } + + protected void deselect(ListGridRecord[] records) { + HashSet<Integer> toRemove = new HashSet<Integer>(); + for (ListGridRecord record : records) { + toRemove.add(record.getAttributeAsInt("id")); + } + selection.removeAll(toRemove); + + for (Integer id : toRemove) { + Record r = availableGrid.getDataAsRecordList().find("id", id); + if (r != null) { + ((ListGridRecord) r).setEnabled(true); + } + } + availableGrid.markForRedraw(); + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java new file mode 100644 index 0000000..06f6e4b --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java @@ -0,0 +1,81 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection; + +import com.smartgwt.client.data.Criteria; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.SelectItem; +import com.smartgwt.client.widgets.form.fields.TextItem; +import com.smartgwt.client.widgets.grid.ListGridRecord; + +import org.rhq.core.domain.resource.group.ResourceGroup; +import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource; +import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource; + +/** + * @author Greg Hinkle + */ +public class ResourceGroupSelector extends AbstractSelector { + + public ResourceGroupSelector() { + super(); + } + + protected DynamicForm getAvailableFilterForm() { + DynamicForm availableFilterForm = new DynamicForm(); + availableFilterForm.setNumCols(4); + final TextItem search = new TextItem("search", "Search"); + + SelectItem groupCategorySelect = new SelectItem("groupCategory", "Group Category"); + groupCategorySelect.setValueMap("Compatible", "Mixed"); + groupCategorySelect.setAllowEmptyValue(true); + availableFilterForm.setItems(search, groupCategorySelect); + + return availableFilterForm; + } + + protected RPCDataSource<?> getDataSource() { + return new SelectedResourceGroupsDataSource(); + } + + protected Criteria getLatestCriteria(DynamicForm availableFilterForm) { + Criteria latestCriteria = new Criteria(); + Object search = availableFilterForm.getValue("search"); + Object category = availableFilterForm.getValue("groupCategory"); + latestCriteria.setAttribute("name", search); + latestCriteria.setAttribute("groupCategory", category); + + return latestCriteria; + } + + private class SelectedResourceGroupsDataSource extends ResourceGroupsDataSource { + + @Override + public ListGridRecord[] buildRecords(PageList<ResourceGroup> resourceGroups) { + ListGridRecord[] records = super.buildRecords(resourceGroups); + for (ListGridRecord record : records) { + if (selection.contains(record.getAttributeAsInt("id"))) { + record.setEnabled(false); + } + } + return records; + } + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java index a309ce1..ea092d5 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java @@ -18,72 +18,30 @@ */ package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
-import java.util.HashSet; - -import com.google.gwt.user.client.Timer; import com.smartgwt.client.data.Criteria; -import com.smartgwt.client.data.Record; -import com.smartgwt.client.types.DragDataAction; -import com.smartgwt.client.types.DragTrackerMode; -import com.smartgwt.client.types.ListGridFieldType; -import com.smartgwt.client.types.VerticalAlignment; -import com.smartgwt.client.widgets.ImgProperties; -import com.smartgwt.client.widgets.TransferImgButton; -import com.smartgwt.client.widgets.events.ClickEvent; -import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.events.KeyPressEvent; -import com.smartgwt.client.widgets.events.KeyPressHandler; import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.events.ItemChangedEvent; -import com.smartgwt.client.widgets.form.events.ItemChangedHandler; import com.smartgwt.client.widgets.form.fields.IPickTreeItem; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.TextItem; -import com.smartgwt.client.widgets.grid.ListGrid; -import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; -import com.smartgwt.client.widgets.grid.events.RecordDropEvent; -import com.smartgwt.client.widgets.grid.events.RecordDropHandler; -import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler; -import com.smartgwt.client.widgets.grid.events.SelectionEvent; -import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.layout.LayoutSpacer; -import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.layout.VStack;
import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeDataSource; +import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/** * @author Greg Hinkle */ -public class ResourceSelector extends HLayout { - - private HashSet<Integer> selection = new HashSet<Integer>(); - - private ListGrid availableGrid; - private ListGrid assignedGrid; - - private TransferImgButton addButton; - private TransferImgButton removeButton; - private TransferImgButton addAllButton; - private TransferImgButton removeAllButton; - - private Criteria latestCriteria; +public class ResourceSelector extends AbstractSelector {
public ResourceSelector() { - setAlign(VerticalAlignment.BOTTOM); - setHeight(380); + super(); }
- @Override - protected void onDraw() { - super.onDraw(); - - - final DynamicForm availableFilterForm = new DynamicForm(); + protected DynamicForm getAvailableFilterForm() { + DynamicForm availableFilterForm = new DynamicForm(); availableFilterForm.setNumCols(6); final TextItem search = new TextItem("search", "Search");
@@ -93,190 +51,29 @@ public class ResourceSelector extends HLayout { typeSelectItem.setCanSelectParentItems(true); typeSelectItem.setLoadDataOnDemand(false);
- SelectItem categorySelect = new SelectItem("category", "Category"); categorySelect.setValueMap("Platform", "Server", "Service"); categorySelect.setAllowEmptyValue(true); availableFilterForm.setItems(search, typeSelectItem, categorySelect);
- VLayout availableLayout = new VLayout(); - availableLayout.addMember(new LayoutSpacer()); - - availableLayout.addMember(availableFilterForm); - - availableGrid = new ListGrid(); - availableGrid.setHeight(350); - availableGrid.setCanDragRecordsOut(true); - availableGrid.setDragTrackerMode(DragTrackerMode.ICON); - availableGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16)); - availableGrid.setDragDataAction(DragDataAction.COPY); - availableGrid.setDataSource(new SelectedResourceDataSource()); - availableGrid.setFetchDelay(700); - - availableGrid.setAutoFetchData(true); - availableGrid.setFields(new ListGridField("icon", 50), new ListGridField("name")); - - availableLayout.addMember(availableGrid); - - addMember(availableLayout); - - - availableFilterForm.addItemChangedHandler(new ItemChangedHandler() { - public void onItemChanged(ItemChangedEvent itemChangedEvent) { - latestCriteria = new Criteria(); - latestCriteria.setAttribute("name", availableFilterForm.getValue("search")); - latestCriteria.setAttribute("type", availableFilterForm.getValue("type")); - latestCriteria.setAttribute("category", availableFilterForm.getValue("category")); - - Timer t = new Timer() { - @Override - public void run() { - if (latestCriteria != null) { - Criteria c = latestCriteria; - latestCriteria = null; - availableGrid.fetchData(c); - } - } - }; - t.schedule(500); - } - }); - - - VStack moveButtonStack = new VStack(6); - moveButtonStack.setAlign(VerticalAlignment.CENTER); - moveButtonStack.setWidth(40); - - addButton = new TransferImgButton(TransferImgButton.RIGHT); - addButton.setDisabled(true); - removeButton = new TransferImgButton(TransferImgButton.LEFT); - removeButton.setDisabled(true); - addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL); - removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL); - removeAllButton.setDisabled(true); - - moveButtonStack.addMember(addButton); - moveButtonStack.addMember(removeButton); - moveButtonStack.addMember(addAllButton); - moveButtonStack.addMember(removeAllButton); - - addMember(moveButtonStack); - - - VLayout assignedLayout = new VLayout(); - assignedLayout.addMember(new LayoutSpacer()); - - assignedGrid = new ListGrid(); - assignedGrid.setHeight(350); - assignedGrid.setCanReorderRecords(true); - assignedGrid.setCanDragRecordsOut(true); - - assignedGrid.setCanAcceptDroppedRecords(true); - ListGridField iconField = new ListGridField("icon", 50); - iconField.setType(ListGridFieldType.ICON); - assignedGrid.setFields(iconField, new ListGridField("name")); - - assignedLayout.addMember(assignedGrid); - addMember(assignedLayout); - - - - addButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent clickEvent) { - assignedGrid.transferSelectedData(availableGrid); - select(assignedGrid.getSelection()); - updateButtons(); - } - }); - removeButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent clickEvent) { - deselect(assignedGrid.getSelection()); - assignedGrid.removeSelectedData(); - updateButtons(); - } - }); - addAllButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent clickEvent) { - availableGrid.selectAllRecords(); - assignedGrid.transferSelectedData(availableGrid); - select(availableGrid.getSelection()); - updateButtons(); - } - }); - removeAllButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent clickEvent) { - assignedGrid.selectAllRecords(); - deselect(assignedGrid.getSelection()); - assignedGrid.removeSelectedData(); - updateButtons(); - } - }); - - availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() { - public void onSelectionChanged(SelectionEvent selectionEvent) { - updateButtons(); - } - }); - - assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() { - public void onSelectionChanged(SelectionEvent selectionEvent) { - updateButtons(); - } - }); - - assignedGrid.addKeyPressHandler(new KeyPressHandler() { - public void onKeyPress(KeyPressEvent event) { - if ("Delete".equals(event.getKeyName())) { - deselect(assignedGrid.getSelection()); - assignedGrid.removeSelectedData(); - } - } - }); - - - assignedGrid.addRecordDropHandler(new RecordDropHandler() { - public void onRecordDrop(RecordDropEvent recordDropEvent) { - select(recordDropEvent.getDropRecords()); - } - }); + return availableFilterForm; }
- private void updateButtons() { - addButton.setDisabled(!availableGrid.anySelected() || availableGrid.getTotalRows() == 0); - removeButton.setDisabled(!assignedGrid.anySelected() || assignedGrid.getTotalRows() == 0); - addAllButton.setDisabled(availableGrid.getTotalRows() == 0); - removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0); + protected RPCDataSource<?> getDataSource() { + return new SelectedResourceDataSource(); }
- private void select(ListGridRecord[] records) { - availableGrid.deselectAllRecords(); - for (ListGridRecord record : records) { - record.setEnabled(false); - selection.add(record.getAttributeAsInt("id")); - } - } + protected Criteria getLatestCriteria(DynamicForm availableFilterForm) { + Criteria latestCriteria = new Criteria(); + latestCriteria.setAttribute("name", availableFilterForm.getValue("search")); + latestCriteria.setAttribute("type", availableFilterForm.getValue("type")); + latestCriteria.setAttribute("category", availableFilterForm.getValue("category"));
- private void deselect(ListGridRecord[] records) { - HashSet<Integer> toRemove = new HashSet<Integer>(); - for (ListGridRecord record : records) { - toRemove.add(record.getAttributeAsInt("id")); - } - selection.removeAll(toRemove); - - - for (Integer id : toRemove) { - Record r = availableGrid.getDataAsRecordList().find("id", id); - if (r != null) { - ((ListGridRecord) r).setEnabled(true); - } - } - availableGrid.markForRedraw(); + return latestCriteria; }
- private class SelectedResourceDataSource extends ResourceDatasource {
- @Override public ListGridRecord[] buildRecords(PageList<Resource> resources) { ListGridRecord[] records = super.buildRecords(resources); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java index 5473a94..1477e95 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java @@ -24,6 +24,7 @@ import java.util.HashMap; import org.rhq.core.domain.bundle.Bundle; import org.rhq.core.domain.bundle.BundleDeployDefinition; import org.rhq.core.domain.bundle.BundleDeployment; +import org.rhq.core.domain.bundle.BundleGroupDeployment; import org.rhq.core.domain.bundle.BundleType; import org.rhq.core.domain.bundle.BundleVersion; import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite; @@ -163,4 +164,15 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund throw new RuntimeException(ThrowableUtil.getAllMessages(e)); } } + + public BundleGroupDeployment scheduleBundleGroupDeployment(int bundleDeployDefinitionId, int resourceGroupId) + throws Exception { + try { + BundleGroupDeployment result = bundleManager.scheduleBundleGroupDeployment(getSessionSubject(), + bundleDeployDefinitionId, resourceGroupId); + return SerialUtility.prepare(result, "scheduleBundleGroupDeployment"); + } catch (Exception e) { + throw new RuntimeException(ThrowableUtil.getAllMessages(e)); + } + } } \ No newline at end of file
commit 96a5298c91a6ced21500f864a96f636973179e4b Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Mar 17 16:37:25 2010 -0400
Just added some debug logging confirming successful command handling.
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java index f4cb102..090ea3d 100644 --- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java +++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java @@ -29,6 +29,9 @@ import java.util.List; import java.util.Map; import java.util.Set;
+import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.rhq.bundle.filetemplate.recipe.RecipeContext; import org.rhq.bundle.filetemplate.recipe.RecipeParser; import org.rhq.core.domain.content.PackageVersion; @@ -45,6 +48,8 @@ import org.rhq.core.util.file.FileUtil; */ public class ProcessingRecipeContext extends RecipeContext {
+ private final Log log = LogFactory.getLog(this.getClass()); + private final Map<PackageVersion, File> packageVersionFiles; private final SystemInfo systemInfo; private String baseWorkingDirectory; @@ -73,12 +78,14 @@ public class ProcessingRecipeContext extends RecipeContext { throw new RuntimeException("Failed to unbundle file [" + pe + "]: " + results); } // existingFile.delete(); WOULD WE WANT TO REMOVE THE COMPRESSED FILE? + log.debug("bundle deploy: unzipped " + existingFile + " to " + directory); } else { // not a zipped format - just move the file to the directory as-is File newFile = new File(directory, filename); if (!existingFile.renameTo(newFile)) { throw new RuntimeException("Failed to move [" + existingFile + "] to [" + newFile + "]"); } + log.debug("bundle deploy: renamed " + existingFile + " to " + newFile); } }
@@ -92,6 +99,8 @@ public class ProcessingRecipeContext extends RecipeContext { try { destinationFile.getParentFile().mkdirs(); FileUtil.copyFile(sourceFile, destinationFile); + + log.debug("bundle file: copied " + sourceFile + " to " + destinationFile); } catch (Exception e) { throw new RuntimeException("Failed to copy file [" + sourceFile + "] to [" + destinationFile + "]", e); } @@ -132,6 +141,8 @@ public class ProcessingRecipeContext extends RecipeContext { if (!realizedTmpFile.renameTo(trueFile)) { throw new RuntimeException("Failed to rename realized tmp file [" + realizedTmpFile + "]"); } + + log.debug("bundle realize file: renamed realized" + realizedTmpFile + " to " + trueFile); } catch (Exception e) { throw new RuntimeException("Cannot realize file [" + file + "]", e); } finally { @@ -175,6 +186,8 @@ public class ProcessingRecipeContext extends RecipeContext { if (results.getError() != null) { throw new RuntimeException("Could not execute script [" + pe + "]: " + results, results.getError()); } + + log.debug("bundle script: executed script [" + pe + "]"); }
@Override @@ -191,6 +204,8 @@ public class ProcessingRecipeContext extends RecipeContext { if (results.getError() != null) { throw new RuntimeException("Could not execute command [" + pe + "]: " + results, results.getError()); } + + log.debug("bundle command: executed command [" + pe + "]"); }
private void ensureExecutable(File scriptFile) {
commit 99a7975b4cb031510616a62060c4d2699ca33b6f Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Mar 17 14:47:43 2010 -0400
Add unique indexes to various bundle tables to avoid logical duplicates. Also, fixed up a lot of advisory-related db-upgrade stuff left over from the former core team. The db-upgrade, at least for this stuff, now matches the schema definitions. Also, got the db-upgrade to run through from a 2.3.1 db on postgres. Also tweaked a couple of entity classes to match the schema.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml index b2663d4..683c991 100644 --- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml +++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml @@ -410,8 +410,8 @@ <column name="SEVERITY" size="64" type="VARCHAR2" required="false"/> <column name="ISSUE_DATE" type="LONG" required="false"/> <column name="UPDATE_DATE" type="LONG" required="false"/> - <column name="CTIME" type="LONG" required="false"/> - <column name="LAST_MODIFIED" type="LONG" required="false"/> + <column name="CTIME" type="LONG" required="true"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/>
<index name="RHQ_ADVISORY_NAME_UQ" unique="true"> <field ref="ADVISORY_NAME"/> @@ -423,23 +423,18 @@
<index name="RHQ_ADVISORY_UDATE_IDX" unique="false"> <field ref="UPDATE_DATE"/> - </index> - - <index name="RHQ_ADVISORY_SYN_IDX" unique="false"> - <field ref="SYNOPSIS"/> - </index> - + </index> </table>
<table name="RHQ_ADVISORY_PACKAGE"> - <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> + <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/> <column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/> - <column name="LAST_MODIFIED" type="LONG" required="false"/> + <column name="LAST_MODIFIED" type="LONG" required="true"/>
<index name="RHQ_ADVISORY_PKG_IDX" unique="true"> <field ref="ADVISORY_ID"/> - <field ref="PACKAGE_VERSIOn_ID"/> + <field ref="PACKAGE_VERSION_ID"/> </index> </table>
@@ -492,6 +487,11 @@ <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/> <column name="NAME" size="200" type="VARCHAR2" required="true"/> <column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true"> + <field ref="NAME"/> + </index> </table>
<!-- BUNDLE is a named piece of content that can be versioned and installed somewhere --> @@ -501,6 +501,12 @@ <column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/> <column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/> <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_UNIQUE" unique="true"> + <field ref="BUNDLE_TYPE_ID"/> + <field ref="NAME"/> + </index> </table>
<!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere --> @@ -513,6 +519,13 @@ <column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" /> <column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/> <column name="DISTRIBUTION_ID" type="INTEGER" required="false" references="RHQ_DISTRIBUTION"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true"> + <field ref="BUNDLE_ID"/> + <field ref="NAME"/> + <field ref="VERSION"/> + </index> </table>
<!-- Many-to-many table that links many repos to a particular bundle version --> @@ -548,6 +561,12 @@ <column name="ENFORCEMENT_INTERVAL" type="INTEGER" required="false"/> <column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/> <column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/> + + <!-- This index is for constraint, not performance --> + <index name="RHQ_BUNDLE_DEPLOY_DEF_UNIQUE" unique="true"> + <field ref="BUNDLE_VERSION_ID"/> + <field ref="NAME"/> + </index> </table>
<!-- Represents a bundle version that is deployed on a platform resource --> diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml index 85fe084..23f1fbd 100644 --- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml +++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml @@ -2219,337 +2219,80 @@
<!-- RHQ Advisory Representation --> <schemaSpec version="2.71"> - <schema-directSQL> - <statement> - CREATE TABLE RHQ_ADVISORY_TYPE ( ID INTEGER PRIMARY KEY ) - </statement> - </schema-directSQL> - <schema-alterColumn table="RHQ_ADVISORY_TYPE" column="ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_TYPE" column="NAME" precision="200" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY_TYPE" column="NAME" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_TYPE" column="DESCRIPTION" precision="500" columnType="VARCHAR2" /> - <schema-directSQL> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, NAME, DESCRIPTION ) - VALUES ( 101, 'Bug Fix Advisory', 'Bug fix(RHBA) Advisory' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, NAME, DESCRIPTION ) - VALUES ( 102, 'Product Enhancement Advisory', 'Product Enhancement(RHEA) Advisory' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, NAME, DESCRIPTION ) - VALUES ( 103, 'Security Advisory', 'Security Advisory(RHSA) Advisory' ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement> - CREATE TABLE RHQ_ADVISORY_SEVERITY ( ID INTEGER PRIMARY KEY ) - </statement> - </schema-directSQL> - <schema-alterColumn table="RHQ_ADVISORY_SEVERITY" column="ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_SEVERITY" column="RANK" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_SEVERITY" column="RANK" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_SEVERITY" column="LABEL" precision="40" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY_SEVERITY" column="LABEL" nullable="false" /> - <schema-directSQL> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, RANK, LABEL) - VALUES ( 101, 0, 'errata.sev.label.critical' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, RANK, LABEL) - VALUES ( 102, 1, 'errata.sev.label.important' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, RANK, LABEL) - VALUES ( 103, 2, 'errata.sev.label.moderate' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_TYPE ( ID, RANK, LABEL) - VALUES ( 104, 3, 'errata.sev.label.low' ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement> - CREATE TABLE RHQ_ADVISORY_FILE_TYPE ( ID INTEGER PRIMARY KEY ) - </statement> - </schema-directSQL> - <schema-alterColumn table="RHQ_ADVISORY_FILE_TYPE" column="ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE_TYPE" column="LABEL" precision="40" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE_TYPE" column="LABEL" nullable="false" /> - <schema-directSQL> - <statement> - INSERT INTO - RHQ_ADVISORY_FILE_TYPE ( ID, LABEL) - VALUES ( 101, 'RPM' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_FILE_TYPE ( ID, LABEL) - VALUES ( 102, 'SRPM' ) - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_FILE_TYPE ( ID, LABEL) - VALUES ( 103, 'IMG') - </statement> - <statement> - INSERT INTO - RHQ_ADVISORY_FILE_TYPE ( ID, LABEL) - VALUES ( 104, 'OVAL') - </statement> - </schema-directSQL> <schema-createSequence name="RHQ_ADVISORY_SEQ" initial="10001" /> <schema-directSQL> - <statement desc="Creating table RHQ_ADVISORY"> CREATE TABLE RHQ_ADVISORY ( ID INTEGER PRIMARY KEY ) </statement> </schema-directSQL> + <schema-alterColumn table="RHQ_ADVISORY" column="ID" nullable="false" columnType="INTEGER" /> <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY" precision="64" columnType="VARCHAR2" /> <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE_ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_NAME" precision="64" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_NAME" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE" precision="64" columnType="VARCHAR2" /> + <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_REL" precision="64" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_REL" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY" column="DESCRIPTION" precision="4000" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY" column="DESCRIPTION" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_NAME" precision="64" columnType="VARCHAR2" /> + <schema-addColumn table="RHQ_ADVISORY" column="DESCRIPTION" precision="4000" columnType="VARCHAR2" /> <schema-addColumn table="RHQ_ADVISORY" column="SYNOPSIS" precision="4000" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY" column="SYNOPSIS" nullable="false" /> + <schema-alterColumn table="RHQ_ADVISORY" column="SYNOPSIS" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY" column="TOPIC" precision="4000" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY" column="TOPIC" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY" column="SOLUTION" precision="4000" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY" column="SOLUTION" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY" column="SEVERITY_ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY" column="SEVERITY_ID" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY" column="SEVERITY" precision="64" columnType="VARCHAR2" /> <schema-addColumn table="RHQ_ADVISORY" column="ISSUE_DATE" columnType="LONG" /> - <schema-alterColumn table="RHQ_ADVISORY" column="ISSUE_DATE" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY" column="UPDATE_DATE" columnType="LONG" /> - <schema-alterColumn table="RHQ_ADVISORY" column="UPDATE_DATE" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY" column="CTIME" columnType="LONG" /> <schema-alterColumn table="RHQ_ADVISORY" column="CTIME" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" columnType="LONG" /> <schema-alterColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" nullable="false" /> - <schema-directSQL> - <statement targetDBVendor="postgresql"> - CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ - ON RHQ_ADVISORY ( ADVISORY_NAME ) - </statement> - <statement targetDBVendor="oracle"> - CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ - ON RHQ_ADVISORY ( ADVISORY_NAME ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement targetDBVendor="postgresql"> - CREATE UNIQUE INDEX RHQ_ADVISORY_UQ - ON RHQ_ADVISORY ( ADVISORY ) - </statement> - <statement targetDBVendor="oracle"> - CREATE UNIQUE INDEX RHQ_ADVISORY_UQ - ON RHQ_ADVISORY ( ADVISORY ) - </statement> - </schema-directSQL> - - <schema-directSQL> - <statement targetDBVendor="postgresql"> - CREATE INDEX RHQ_ADVISORY_UDATE_IDX - ON RHQ_ADVISORY (UPDATE_DATE ) - </statement> - <statement targetDBVendor="oracle"> - CREATE INDEX RHQ_ADVISORY_UDATE_IDX - ON RHQ_ADVISORY (UPDATE_DATE ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement targetDBVendor="postgresql"> - CREATE INDEX RHQ_ADVISORY_SYN_IDX - ON RHQ_ADVISORY ( SYNOPSIS ) - </statement> - <statement targetDBVendor="oracle"> - CREATE INDEX RHQ_ADVISORY_SYN_IDX - ON RHQ_ADVISORY ( SYNOPSIS ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY - ADD CONSTRAINT RHQ_ADV_TYPE_FKEY - FOREIGN KEY ( ADVISORY_TYPE_ID ) - REFERENCES RHQ_ADVISORY_TYPE ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY - ADD CONSTRAINT RHQ_ADV_TYPE_FKEY - FOREIGN KEY ( ADVISORY_TYPE_ID ) - REFERENCES RHQ_ADVISORY_TYPE ( ID ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY - ADD CONSTRAINT RHQ_ADV_SEV_FKEY - FOREIGN KEY ( SEVERITY_ID ) - REFERENCES RHQ_ADVISORY_SEVERITY ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY - ADD CONSTRAINT RHQ_ADV_SEV_FKEY - FOREIGN KEY ( SEVERITY_ID ) - REFERENCES RHQ_ADVISORY_SEVERITY ( ID ) - </statement> - </schema-directSQL> - <schema-createSequence name="RHQ_ADVISORY_FILE_SEQ" initial="10001" /> + <schema-directSQL> <statement> - CREATE TABLE RHQ_ADVISORY_FILE ( ID INTEGER ) - </statement> - </schema-directSQL> - <schema-alterColumn table="RHQ_ADVISORY_FILE" column="ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE" column="ADVISORY_ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE" column="ADVISORY_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE" column="FILE_TYPE_ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE" column="FILE_TYPE_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE" column="RELATIVE_FILENAME" precision="256" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE" column="RELATIVE_FILENAME" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE" column="MD5SUM" precision="64" columnType="VARCHAR2" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE" column="MD5SUM" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE" column="LAST_MODIFIED" columnType="LONG" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE" column="LAST_MODIFIED" nullable="false" /> - <schema-directSQL> - <statement targetDBVendor="postgresql"> - CREATE UNIQUE INDEX RHQ_ADVISORY_ID_FILE_UQ - ON RHQ_ADVISORY_FILE ( ADVISORY_ID, RELATIVE_FILENAME ) - </statement> - <statement targetDBVendor="oracle"> - CREATE UNIQUE INDEX RHQ_ADVISORY_ID_FILE_UQ - ON RHQ_ADVISORY_FILE ( ADVISORY_ID, RELATIVE_FILENAME ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_FILE - ADD CONSTRAINT RHQ_ADV_FILE_FKEY - FOREIGN KEY ( ADVISORY_ID) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_FILE - ADD CONSTRAINT RHQ_ADV_FILE_FKEY - FOREIGN KEY ( ADVISORY_ID) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - </schema-directSQL> - <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_FILE - ADD CONSTRAINT RHQ_ADV_FILE_TYPE_FKEY - FOREIGN KEY ( FILE_TYPE_ID ) - REFERENCES RHQ_ADVISORY_FILE_TYPE ( ID ) + CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ ON RHQ_ADVISORY ( ADVISORY_NAME ) </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_FILE - ADD CONSTRAINT RHQ_ADV_FILE_TYPE_FKEY - FOREIGN KEY ( FILE_TYPE_TYPE ) - REFERENCES RHQ_ADVISORY_FILE_TYPE ( ID ) - </statement> - </schema-directSQL> - <schema-directSQL> <statement> - CREATE TABLE RHQ_ADVISORY_PACKAGE_MAP ( ADVISORY_ID INTEGER ) - </statement> - </schema-directSQL> - <schema-alterColumn table="RHQ_ADVISORY_PACKAGE_MAP" column="ADVISORY_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_PACKAGE_MAP" column="PACKAGE_ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_PACKAGE_MAP" column="PACKAGE_ID" nullable="false" /> - <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP - ADD CONSTRAINT RHQ_ADV_PKG_MAP_KEY - PRIMARY KEY ( ADVISORY_ID, PACKAGE_ID ) + CREATE UNIQUE INDEX RHQ_ADVISORY_UQ ON RHQ_ADVISORY ( ADVISORY ) </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP - ADD CONSTRAINT RHQ_ADV_PKG_MAP_KEY - PRIMARY KEY ( ADVISORY_ID, PACKAGE_ID ) - </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP - ADD FOREIGN KEY ( PACKAGE_ID ) - REFERENCES RHQ_PACKAGE ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP - ADD FOREIGN KEY ( PACKAGE_ID ) - REFERENCES RHQ_PACKAGE ( ID ) + <statement> + CREATE INDEX RHQ_ADVISORY_UDATE_IDX ON RHQ_ADVISORY (UPDATE_DATE ) </statement> </schema-directSQL>
+ <schema-createSequence name="RHQ_ADVISORY_PACKAGE_SEQ" initial="10001" /> <schema-directSQL> <statement> - CREATE TABLE RHQ_ADVISORY_FILE_PKG_MAP ( ADVISORY_ID INTEGER ) + CREATE TABLE RHQ_ADVISORY_PACKAGE ( ID INTEGER PRIMARY KEY ) </statement> </schema-directSQL> - <schema-alterColumn table="RHQ_ADVISORY_FILE_PKG_MAP" column="ADVISORY_FILE_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_FILE_PKG_MAP" column="PACKAGE_ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_FILE_PKG_MAP" column="PACKAGE_ID" nullable="false" /> + <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="ID" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="ADVISORY_ID" columnType="INTEGER" /> + <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="ADVISORY_ID" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" columnType="INTEGER" /> + <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" columnType="LONG" /> + <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" nullable="false" /> <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP - ADD CONSTRAINT RHQ_ADV_FILE_PKG_MAP_KEY - PRIMARY KEY ( ADVISORY_FILE_ID, PACKAGE_ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP - ADD CONSTRAINT RHQ_ADV_FILE_PKG_MAP_KEY - PRIMARY KEY ( ADVISORY_FILE_ID, PACKAGE_ID ) - </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP - ADD FOREIGN KEY ( ADVISORY_FILE_ID ) - REFERENCES RHQ_ADVISORY_FILE ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP - ADD FOREIGN KEY ( ADVISORY_FILE_ID ) - REFERENCES RHQ_ADVISORY_FILE ( ID ) - </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP - ADD FOREIGN KEY ( PACKAGE_ID ) - REFERENCES RHQ_PACKAGE ( ID ) + <statement> + CREATE UNIQUE INDEX RHQ_ADVISORY_PACKAGE_UQ ON RHQ_ADVISORY_PACKAGE ( ADVISORY_ID, PACKAGE_VERSION_ID ) </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP - ADD FOREIGN KEY ( PACKAGE_ID ) - REFERENCES RHQ_PACKAGE ( ID ) + <statement> + ALTER TABLE RHQ_ADVISORY_PACKAGE + ADD CONSTRAINT RHQ_ADVISORY_FKEY + FOREIGN KEY ( ADVISORY_ID ) + REFERENCES RHQ_ADVISORY ( ID ) + </statement> + <statement> + ALTER TABLE RHQ_ADVISORY_PACKAGE + ADD CONSTRAINT RHQ_PACKAGE_VERSION_FKEY + FOREIGN KEY ( PACKAGE_VERSION_ID ) + REFERENCES RHQ_PACKAGE_VERSION ( ID ) </statement> </schema-directSQL> + <schema-createSequence name="RHQ_CVE_SEQ" initial="101" /> <schema-directSQL> <statement> - CREATE TABLE RHQ_CVE ( ID INTEGER ) + CREATE TABLE RHQ_CVE ( ID INTEGER PRIMARY KEY ) </statement> </schema-directSQL> <schema-alterColumn table="RHQ_CVE" column="ID" nullable="false" /> @@ -2558,84 +2301,60 @@
<schema-directSQL> <statement> - CREATE TABLE RHQ_ADVISORY_CVE ( ADVISORY_ID INTEGER ) + CREATE TABLE RHQ_ADVISORY_CVE ( ID INTEGER PRIMARY KEY ) </statement> </schema-directSQL> + <schema-alterColumn table="RHQ_ADVISORY_CVE" column="ID" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY_CVE" column="ADVISORY_ID" columnType="INTEGER" /> <schema-alterColumn table="RHQ_ADVISORY_CVE" column="ADVISORY_ID" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" columnType="INTEGER" /> <schema-alterColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_CVE" column="CTIME" columnType="LONG" /> - <schema-alterColumn table="RHQ_ADVISORY_CVE" column="CTIME" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" columnType="LONG" /> <schema-alterColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" nullable="false" /> <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_CVE - ADD CONSTRAINT RHQ_ADV_CVE_MAP_KEY - PRIMARY KEY ( ADVISORY_ID, CVE_ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_CVE - ADD CONSTRAINT RHQ_ADV_CVE_MAP_KEY - PRIMARY KEY ( ADVISORY_ID, CVE_ID ) - </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_CVE - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) + <statement> + CREATE UNIQUE INDEX RHQ_ADVISORY_CVE_UQ ON RHQ_ADVISORY_CVE ( ADVISORY_ID, CVE_ID ) </statement> - <statement targetDBVendor="postgresql"> + <statement> ALTER TABLE RHQ_ADVISORY_CVE - ADD FOREIGN KEY ( ADVISORY_ID ) + ADD CONSTRAINT RHQ_ADVISORY_FKEY + FOREIGN KEY ( ADVISORY_ID ) REFERENCES RHQ_ADVISORY ( ID ) </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_CVE - ADD FOREIGN KEY ( CVE_ID ) - REFERENCES RHQ_CVE ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_CVE - ADD FOREIGN KEY ( CVE_ID ) - REFERENCES RHQ_CVE ( ID ) - </statement> + <statement> + ALTER TABLE RHQ_ADVISORY_CVE + ADD CONSTRAINT RHQ_CVE_FKEY + FOREIGN KEY ( CVE_ID ) + REFERENCES RHQ_CVE ( ID ) + </statement> </schema-directSQL>
+ <schema-createSequence name="RHQ_ADVISORY_BUGLIST_SEQ" initial="10001" /> <schema-directSQL> <statement> - CREATE TABLE RHQ_ADVISORY_BUGLIST ( ADVISORY_ID INTEGER ) + CREATE TABLE RHQ_ADVISORY_BUGLIST ( ID INTEGER PRIMARY KEY) </statement> </schema-directSQL>
+ <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="ID" nullable="false" /> + <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="ADVISORY_ID" columnType="INTEGER" /> <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="ADVISORY_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" columnType="INTEGER" /> + <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" PRECISION="256" columnType="VARCHAR2" /> <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" nullable="false" /> - <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="CTIME" columnType="LONG" /> - <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="CTIME" nullable="false" /> <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" columnType="LONG" /> <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" nullable="false" /> <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_BUGLIST - ADD CONSTRAINT RHQ_ADV_BUG_LIST_KEY - PRIMARY KEY ( ADVISORY_ID, BUG_ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_BUGLIST - ADD CONSTRAINT RHQ_ADV_BUG_LIST_KEY - PRIMARY KEY ( ADVISORY_ID, BUG_ID ) - </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_ADVISORY_BUGLIST - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_ADVISORY_BUGLIST - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> + <statement> + CREATE UNIQUE INDEX RHQ_ADVISORY_BUGLIST_UQ ON RHQ_ADVISORY_BUGLIST ( ADVISORY_ID, BUG_ID ) + </statement> + <statement> + ALTER TABLE RHQ_ADVISORY_BUGLIST + ADD CONSTRAINT RHQ_ADVISORY_FKEY + FOREIGN KEY ( ADVISORY_ID ) + REFERENCES RHQ_ADVISORY ( ID ) + </statement> </schema-directSQL> + <schema-directSQL> <statement> CREATE TABLE RHQ_REPO_ADVISORY ( REPO_ID INTEGER ) @@ -2644,40 +2363,25 @@ <schema-alterColumn table="RHQ_REPO_ADVISORY" column="REPO_ID" nullable="false" /> <schema-addColumn table="RHQ_REPO_ADVISORY" column="ADVISORY_ID" columnType="INTEGER" /> <schema-alterColumn table="RHQ_REPO_ADVISORY" column="ADVISORY_ID" nullable="false" /> - <schema-addColumn table="RHQ_REPO_ADVISORY" column="CTIME" columnType="LONG" /> - <schema-alterColumn table="RHQ_REPO_ADVISORY" column="CTIME" nullable="false" /> <schema-addColumn table="RHQ_REPO_ADVISORY" column="LAST_MODIFIED" columnType="LONG" /> <schema-alterColumn table="RHQ_REPO_ADVISORY" column="LAST_MODIFIED" nullable="false" /> <schema-directSQL> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_REPO_ADVISORY - ADD CONSTRAINT RHQ_REPO_ADV_MAP_KEY - PRIMARY KEY ( REPO_ID, ADVISORY_ID ) - </statement> - <statement targetDBVendor="postgresql"> + <statement> ALTER TABLE RHQ_REPO_ADVISORY ADD CONSTRAINT RHQ_REPO_ADV_MAP_KEY PRIMARY KEY ( REPO_ID, ADVISORY_ID ) </statement> - <statement targetDBVendor="oracle"> - ALTER TABLE RHQ_REPO_ADVISORY - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - <statement targetDBVendor="postgresql"> - ALTER TABLE RHQ_REPO_ADVISORY - ADD FOREIGN KEY ( ADVISORY_ID ) - REFERENCES RHQ_ADVISORY ( ID ) - </statement> - <statement targetDBVendor="oracle"> + <statement> ALTER TABLE RHQ_REPO_ADVISORY - ADD FOREIGN KEY ( REPO_ID ) + ADD CONSTRAINT RHQ_REPO_FKEY + FOREIGN KEY ( REPO_ID ) REFERENCES RHQ_REPO ( ID ) </statement> - <statement targetDBVendor="postgresql"> + <statement> ALTER TABLE RHQ_REPO_ADVISORY - ADD FOREIGN KEY ( REPO_ID ) - REFERENCES RHQ_REPO ( ID ) + ADD CONSTRAINT RHQ_ADVISORY_FKEY + FOREIGN KEY ( ADVISORY_ID ) + REFERENCES RHQ_ADVISORY ( ID ) </statement> </schema-directSQL> </schemaSpec> @@ -2710,54 +2414,6 @@ </schema-directSQL> </schemaSpec>
- <schemaSpec version="2.74"> - <schema-createSequence name="RHQ_ADVISORY_ID_SEQ" initial="10001" /> - <schema-createSequence name="RHQ_ADVISORY_CVE_ID_SEQ" initial="10001" /> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_CVE DROP CONSTRAINT RHQ_ADV_CVE_MAP_KEY - </statement> - </schema-directSQL> - <schema-addColumn table="RHQ_ADVISORY_CVE" column="ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_CVE" column="ID" nullable="false" /> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_CVE ALTER COLUMN ID SET DEFAULT NEXTVAL('RHQ_ADVISORY_CVE_SEQ') - </statement> - </schema-directSQL> - <schema-createSequence name="RHQ_ADVISORY_BUGLIST_ID_SEQ" initial="10001" /> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_BUGLIST DROP CONSTRAINT RHQ_ADV_BUG_LIST_KEY - </statement> - </schema-directSQL> - <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="ID" nullable="false" /> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_BUGLIST ALTER COLUMN ID SET DEFAULT NEXTVAL('RHQ_ADVISORY_BUG_SEQ') - </statement> - </schema-directSQL> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP RENAME TO RHQ_ADVISORY_PACKAGE - </statement> - </schema-directSQL> - <schema-createSequence name="RHQ_ADVISORY_PACKAGE_ID_SEQ" initial="10001" /> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_PACKAGE DROP CONSTRAINT RHQ_ADV_PKG_MAP_KEY - </statement> - </schema-directSQL> - <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="ID" columnType="INTEGER" /> - <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="ID" nullable="false" /> - <schema-directSQL> - <statement> - ALTER TABLE RHQ_ADVISORY_PACKAGE ALTER COLUMN ID SET DEFAULT NEXTVAL('RHQ_ADVISORY_PKG_SEQ') - </statement> - </schema-directSQL> - </schemaSpec> - <schemaSpec version="2.75"> <schema-addColumn table="RHQ_REPO" column="SYNC_SCHEDULE" columnType="VARCHAR2" precision="64" /> </schemaSpec> @@ -3211,6 +2867,32 @@ <schema-addColumn table="RHQ_BUNDLE_VERSION" column="DESCRIPTION" columnType="VARCHAR2" precision="500" /> </schemaSpec>
+ <schemaSpec version="2.78.3"> + <schema-directSQL> + <statement desc="Creating RHQ_BUNDLE_TYPE unique constraint"> + CREATE UNIQUE INDEX RHQ_BUNDLE_TYPE_UNIQUE ON RHQ_BUNDLE_TYPE (name) + </statement> + </schema-directSQL> + + <schema-directSQL> + <statement desc="Creating RHQ_BUNDLE unique constraint"> + CREATE UNIQUE INDEX RHQ_BUNDLE_UNIQUE ON RHQ_BUNDLE (bundle_type_id, name) + </statement> + </schema-directSQL> + + <schema-directSQL> + <statement desc="Creating RHQ_BUNDLE_VERSION unique constraint"> + CREATE UNIQUE INDEX RHQ_BUNDLE_VERSION_UNIQUE ON RHQ_BUNDLE_VERSION (bundle_id, name, version) + </statement> + </schema-directSQL> + + <schema-directSQL> + <statement desc="Creating RHQ_BUNDLE_DEPLOY_DEF unique constraint"> + CREATE UNIQUE INDEX RHQ_BUNDLE_DEPLOY_DEF_UNIQUE ON RHQ_BUNDLE_DEPLOY_DEF (bundle_version_id, name) + </statement> + </schema-directSQL> + </schemaSpec> + <schemaSpec version="2.79"> <schema-directSQL> <statement desc="Normalizing resource group descriptions"> diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java index 32d2518..205d1cc 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java @@ -89,10 +89,10 @@ public class Advisory implements Serializable { @Column(name = "UPDATE_DATE", nullable = true) private long update_date;
- @Column(name = "CTIME", nullable = true) + @Column(name = "CTIME", nullable = false) private long ctime;
- @Column(name = "LAST_MODIFIED", nullable = true) + @Column(name = "LAST_MODIFIED", nullable = false) private long lastModifiedDate;
@OneToMany(mappedBy = "advisory", fetch = FetchType.EAGER, cascade = CascadeType.ALL) @@ -264,9 +264,15 @@ public class Advisory implements Serializable { return true; }
+ public long getCtime() { + return ctime; + } + @PrePersist void onPersist() { - this.setLastModifiedDate(System.currentTimeMillis()); + long now = System.currentTimeMillis(); + this.ctime = now; + this.setLastModifiedDate(now); }
@PreUpdate diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java index 17bd2d8..2185c65 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java @@ -79,7 +79,7 @@ public class AdvisoryPackage implements Serializable { @JoinColumn(name = "PACKAGE_VERSION_ID", referencedColumnName = "ID", nullable = false) private PackageVersion pkg;
- @Column(name = "LAST_MODIFIED", nullable = true) + @Column(name = "LAST_MODIFIED", nullable = false) private long lastModifiedDate;
protected AdvisoryPackage() {
commit b2cc4bca855a6a34e22f4b64ceea0f61638a4608 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Mar 17 14:53:04 2010 -0400
LT
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js index 54f2a5b..7bdcd0d 100644 --- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js +++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js @@ -1,64 +1,64 @@ -/*================================================== - * Default Unit - *================================================== - */ - -SimileAjax.NativeDateUnit = new Object(); - -SimileAjax.NativeDateUnit.makeDefaultValue = function() { - return new Date(); -}; - -SimileAjax.NativeDateUnit.cloneValue = function(v) { - return new Date(v.getTime()); -}; - -SimileAjax.NativeDateUnit.getParser = function(format) { - if (typeof format == "string") { - format = format.toLowerCase(); - } - return (format == "iso8601" || format == "iso 8601") ? - SimileAjax.DateTime.parseIso8601DateTime : - SimileAjax.DateTime.parseGregorianDateTime; -}; - -SimileAjax.NativeDateUnit.parseFromObject = function(o) { - return SimileAjax.DateTime.parseGregorianDateTime(o); -}; - -SimileAjax.NativeDateUnit.toNumber = function(v) { - return v.getTime(); -}; - -SimileAjax.NativeDateUnit.fromNumber = function(n) { - return new Date(n); -}; - -SimileAjax.NativeDateUnit.compare = function(v1, v2) { - var n1, n2; - if (typeof v1 == "object") { - n1 = v1.getTime(); - } else { - n1 = Number(v1); - } - if (typeof v2 == "object") { - n2 = v2.getTime(); - } else { - n2 = Number(v2); - } - - return n1 - n2; -}; - -SimileAjax.NativeDateUnit.earlier = function(v1, v2) { - return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2; -}; - -SimileAjax.NativeDateUnit.later = function(v1, v2) { - return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2; -}; - -SimileAjax.NativeDateUnit.change = function(v, n) { - return new Date(v.getTime() + n); -}; - +/*================================================== + * Default Unit + *================================================== + */ + +SimileAjax.NativeDateUnit = new Object(); + +SimileAjax.NativeDateUnit.makeDefaultValue = function() { + return new Date(); +}; + +SimileAjax.NativeDateUnit.cloneValue = function(v) { + return new Date(v.getTime()); +}; + +SimileAjax.NativeDateUnit.getParser = function(format) { + if (typeof format == "string") { + format = format.toLowerCase(); + } + return (format == "iso8601" || format == "iso 8601") ? + SimileAjax.DateTime.parseIso8601DateTime : + SimileAjax.DateTime.parseGregorianDateTime; +}; + +SimileAjax.NativeDateUnit.parseFromObject = function(o) { + return SimileAjax.DateTime.parseGregorianDateTime(o); +}; + +SimileAjax.NativeDateUnit.toNumber = function(v) { + return v.getTime(); +}; + +SimileAjax.NativeDateUnit.fromNumber = function(n) { + return new Date(n); +}; + +SimileAjax.NativeDateUnit.compare = function(v1, v2) { + var n1, n2; + if (typeof v1 == "object") { + n1 = v1.getTime(); + } else { + n1 = Number(v1); + } + if (typeof v2 == "object") { + n2 = v2.getTime(); + } else { + n2 = Number(v2); + } + + return n1 - n2; +}; + +SimileAjax.NativeDateUnit.earlier = function(v1, v2) { + return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2; +}; + +SimileAjax.NativeDateUnit.later = function(v1, v2) { + return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2; +}; + +SimileAjax.NativeDateUnit.change = function(v, n) { + return new Date(v.getTime() + n); +}; +
rhq-commits@lists.fedorahosted.org