Noam Slomianko has uploaded a new change for review. Change subject: engine: add comment field to Network [4] ......................................................................
engine: add comment field to Network [4] As part of the Free Text RFE Added to the entities flow in the system DB <-> DAO <-> Entity <-> Model <-> UI DB <-> DAO <-> Entity <-> REST Change-Id: I935df2acf56afe5fd09249aead7ff6827e360216 Signed-off-by: Noam Slomianko <[email protected]> --- M backend/manager/dbscripts/create_views.sql M backend/manager/dbscripts/network_sp.sql A backend/manager/dbscripts/upgrade/03_03_0210_add_comment_network.sql M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/NetworkDaoDbFacadeImpl.java M backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java M backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/NetworkConditionFieldAutoCompleter.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabNetworkView.java 14 files changed, 60 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/15484/1 diff --git a/backend/manager/dbscripts/create_views.sql b/backend/manager/dbscripts/create_views.sql index fbbf503..4e9454b 100644 --- a/backend/manager/dbscripts/create_views.sql +++ b/backend/manager/dbscripts/create_views.sql @@ -1095,6 +1095,7 @@ SELECT network.id AS id, network.name AS name, network.description AS description, + network.comment AS comment, network.type AS type, network.addr AS addr, network.subnet AS subnet, diff --git a/backend/manager/dbscripts/network_sp.sql b/backend/manager/dbscripts/network_sp.sql index ee2c3db..a1f1fdf 100644 --- a/backend/manager/dbscripts/network_sp.sql +++ b/backend/manager/dbscripts/network_sp.sql @@ -8,6 +8,7 @@ Create or replace FUNCTION Insertnetwork(v_addr VARCHAR(50) , v_description VARCHAR(4000) , + v_comment text, v_id UUID, v_name VARCHAR(50), v_subnet VARCHAR(20) , @@ -21,8 +22,8 @@ RETURNS VOID AS $procedure$ BEGIN -INSERT INTO network(addr, description, id, name, subnet, gateway, type, vlan_id, stp, storage_pool_id, mtu, vm_network) - VALUES(v_addr, v_description, v_id, v_name, v_subnet, v_gateway, v_type, v_vlan_id, v_stp, v_storage_pool_id, v_mtu, v_vm_network ); +INSERT INTO network(addr, description, comment, id, name, subnet, gateway, type, vlan_id, stp, storage_pool_id, mtu, vm_network) + VALUES(v_addr, v_description, v_comment, v_id, v_name, v_subnet, v_gateway, v_type, v_vlan_id, v_stp, v_storage_pool_id, v_mtu, v_vm_network ); END; $procedure$ LANGUAGE plpgsql; @@ -31,6 +32,7 @@ Create or replace FUNCTION Updatenetwork(v_addr VARCHAR(50) , v_description VARCHAR(4000) , + v_comment text, v_id UUID, v_name VARCHAR(50), v_subnet VARCHAR(20) , @@ -47,7 +49,7 @@ AS $procedure$ BEGIN UPDATE network - SET addr = v_addr,description = v_description,name = v_name,subnet = v_subnet, + SET addr = v_addr,description = v_description, comment = v_comment, name = v_name,subnet = v_subnet, gateway = v_gateway,type = v_type,vlan_id = v_vlan_id, stp = v_stp,storage_pool_id = v_storage_pool_id, mtu = v_mtu, vm_network = v_vm_network @@ -174,7 +176,7 @@ DROP TYPE IF EXISTS networkViewClusterType CASCADE; -CREATE TYPE networkViewClusterType AS(id uuid,name VARCHAR(50),description VARCHAR(4000),type INTEGER, +CREATE TYPE networkViewClusterType AS(id uuid,name VARCHAR(50),description VARCHAR(4000), comment text, type INTEGER, addr VARCHAR(50),subnet VARCHAR(20),gateway VARCHAR(20),vlan_id INTEGER,stp BOOLEAN,storage_pool_id UUID, mtu INTEGER, vm_network BOOLEAN, network_id UUID,cluster_id UUID, status INTEGER, is_display BOOLEAN, required BOOLEAN, migration BOOLEAN); @@ -187,6 +189,7 @@ network.id, network.name, network.description, + network.comment, network.type, network.addr, network.subnet, diff --git a/backend/manager/dbscripts/upgrade/03_03_0210_add_comment_network.sql b/backend/manager/dbscripts/upgrade/03_03_0210_add_comment_network.sql new file mode 100644 index 0000000..32d73a3 --- /dev/null +++ b/backend/manager/dbscripts/upgrade/03_03_0210_add_comment_network.sql @@ -0,0 +1 @@ +select fn_db_add_column('network', 'comment', 'text'); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java index 6d2a36d..6b89a00 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java @@ -10,6 +10,7 @@ import org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions; import org.ovirt.engine.core.common.businessentities.BusinessEntity; +import org.ovirt.engine.core.common.businessentities.Commented; import org.ovirt.engine.core.common.businessentities.IVdcQueryable; import org.ovirt.engine.core.common.businessentities.Nameable; import org.ovirt.engine.core.common.utils.ValidationUtils; @@ -18,7 +19,7 @@ import org.ovirt.engine.core.common.validation.group.UpdateEntity; import org.ovirt.engine.core.compat.Guid; -public class Network extends IVdcQueryable implements Serializable, BusinessEntity<Guid>, Nameable { +public class Network extends IVdcQueryable implements Serializable, BusinessEntity<Guid>, Nameable, Commented { private static final long serialVersionUID = 7357288865938773402L; private Guid id; @@ -30,6 +31,8 @@ @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) private String description; + + private String comment; private Integer type; @@ -97,6 +100,14 @@ public void setDescription(String value) { this.description = value; + } + + public String getComment() { + return comment; + } + + public void setComment(String value) { + comment = value; } @Override @@ -183,6 +194,8 @@ .append(getId()) .append(", description=") .append(getDescription()) + .append(", comment=") + .append(getComment()) .append(", subnet=") .append(getSubnet()) .append(", gateway=") diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/NetworkDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/NetworkDaoDbFacadeImpl.java index d6069ff..3243801 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/NetworkDaoDbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/NetworkDaoDbFacadeImpl.java @@ -93,6 +93,7 @@ return getCustomMapSqlParameterSource() .addValue("addr", network.getAddr()) .addValue("description", network.getDescription()) + .addValue("comment", network.getComment()) .addValue("id", network.getId()) .addValue("name", network.getName()) .addValue("subnet", network.getSubnet()) @@ -137,6 +138,7 @@ entity.setId(Guid.createGuidFromString(rs.getString("id"))); entity.setName(rs.getString("name")); entity.setDescription(rs.getString("description")); + entity.setComment(rs.getString("comment")); entity.setType((Integer) rs.getObject("type")); entity.setAddr(rs.getString("addr")); entity.setSubnet(rs.getString("subnet")); diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd index f19a8c3..f29d8c4 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd +++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd @@ -1722,6 +1722,7 @@ <xs:element name="mtu" type="xs:int" minOccurs="0"/> <xs:element ref="usages" minOccurs="0" maxOccurs="1"/> <xs:element name="required" type="xs:boolean" minOccurs="0"/> + <xs:element name="comment" type="xs:string" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:extension> </xs:complexContent> diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java index 1c7ff44..138cedf 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java @@ -28,6 +28,9 @@ if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } + if (model.isSetComment()) { + entity.setComment(model.getComment()); + } if (model.isSetDataCenter() && model.getDataCenter().isSetId()) { entity.setDataCenterId(GuidUtils.asGuid(model.getDataCenter().getId())); } @@ -79,6 +82,7 @@ model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); + model.setComment(entity.getComment()); if (entity.getDataCenterId() != null) { DataCenter dataCenter = new DataCenter(); dataCenter.setId(entity.getDataCenterId().toString()); diff --git a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/NetworkConditionFieldAutoCompleter.java b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/NetworkConditionFieldAutoCompleter.java index 4c494c9..7268ec1 100644 --- a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/NetworkConditionFieldAutoCompleter.java +++ b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/NetworkConditionFieldAutoCompleter.java @@ -4,6 +4,7 @@ public class NetworkConditionFieldAutoCompleter extends BaseConditionFieldAutoCompleter { private static final String NAME = "NAME"; private static final String DESCRIPTION = "DESCRIPTION"; + private static final String COMMENT = "COMMENT"; private static final String VLAN_ID = "VLANID"; private static final String STP = "STP"; private static final String MTU = "MTU"; @@ -14,6 +15,7 @@ // Building the basic verbs dict. mVerbs.add(NAME); mVerbs.add(DESCRIPTION); + mVerbs.add(COMMENT); mVerbs.add(VLAN_ID); mVerbs.add(STP); mVerbs.add(MTU); @@ -26,6 +28,7 @@ // Building the types dict. getTypeDictionary().put(NAME, String.class); getTypeDictionary().put(DESCRIPTION, String.class); + getTypeDictionary().put(COMMENT, String.class); getTypeDictionary().put(VLAN_ID, Integer.class); getTypeDictionary().put(STP, Boolean.class); getTypeDictionary().put(MTU, Integer.class); @@ -35,6 +38,7 @@ // building the ColumnName dict. columnNameDict.put(NAME, "name"); columnNameDict.put(DESCRIPTION, "description"); + columnNameDict.put(COMMENT, "comment"); columnNameDict.put(VLAN_ID, "vlan_id"); columnNameDict.put(STP, "stp"); columnNameDict.put(MTU, "mtu"); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java index 14a3c3c..6137d44 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java @@ -285,6 +285,7 @@ obj.setAddr(instance.getAddr()); obj.setDescription(instance.getDescription()); + obj.setComment(instance.getComment()); obj.setId(instance.getId()); obj.setName(instance.getName()); obj.setSubnet(instance.getSubnet()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java index 1273da2..935f60cb 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java @@ -26,6 +26,7 @@ getName().setIsChangable(false); } getDescription().setEntity(getNetwork().getDescription()); + getComment().setEntity(getNetwork().getComment()); getIsStpEnabled().setEntity(getNetwork().getStp()); getHasVLanTag().setEntity(getNetwork().getVlanId() != null); getVLanTag().setEntity((getNetwork().getVlanId() == null ? Integer.valueOf(0) : getNetwork().getVlanId())); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java index 7ed31e4..a47e424 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java @@ -15,6 +15,7 @@ import org.ovirt.engine.ui.uicommonweb.validation.LengthValidation; import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation; import org.ovirt.engine.ui.uicommonweb.validation.RegexValidation; +import org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation; import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.Event; import org.ovirt.engine.ui.uicompat.EventArgs; @@ -27,6 +28,7 @@ private EntityModel privateName; private EntityModel privateDescription; + private EntityModel privateComment; private EntityModel privateVLanTag; private EntityModel privateIsStpEnabled; private EntityModel privateHasVLanTag; @@ -51,6 +53,7 @@ this.sourceListModel = sourceListModel; setName(new EntityModel()); setDescription(new EntityModel()); + setComment(new EntityModel()); setDataCenters(new ListModel()); getDataCenters().getSelectedItemChangedEvent().addListener(new IEventListener() { @@ -96,6 +99,14 @@ private void setDescription(EntityModel value) { privateDescription = value; + } + + public EntityModel getComment() { + return privateComment; + } + + private void setComment(EntityModel value) { + privateComment = value; } public EntityModel getVLanTag() @@ -239,6 +250,8 @@ tempVar3.setMaxLength(40); getDescription().validateEntity(new IValidation[] { tempVar3 }); + getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() }); + getVLanTag().setIsValid(true); if ((Boolean) getHasVLanTag().getEntity()) { @@ -258,7 +271,7 @@ } return getName().getIsValid() && getVLanTag().getIsValid() && getDescription().getIsValid() - && getMtu().getIsValid(); + && getComment().getIsValid() && getMtu().getIsValid(); } protected boolean firstInit = true; @@ -304,6 +317,7 @@ network.setName((String) getName().getEntity()); network.setStp((Boolean) getIsStpEnabled().getEntity()); network.setDescription((String) getDescription().getEntity()); + network.setComment((String) getComment().getEntity()); network.setVmNetwork((Boolean) getIsVmNetwork().getEntity()); network.setMtu(0); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java index 08d3d47..ccba788 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java @@ -69,6 +69,10 @@ @Path(value = "description.entity") public EntityModelTextBoxEditor descriptionEditor; + @UiField + @Path(value = "comment.entity") + public EntityModelTextBoxEditor commentEditor; + @UiField(provided = true) @Path(value = "isVmNetwork.entity") public final EntityModelCheckBoxEditor isVmNetworkEditor; @@ -134,6 +138,7 @@ assignLabel.setText(constants.networkPopupAssignLabel()); nameEditor.setLabel(constants.nameLabel()); descriptionEditor.setLabel(constants.descriptionLabel()); + commentEditor.setLabel(constants.commentLabel()); isVmNetworkEditor.setLabel(constants.vmNetworkLabel()); vlanTagging.setLabel(constants.enableVlanTagLabel()); hasMtuEditor.setLabel(constants.overrideMtuLabel()); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml index 1db3e01..3f830ed 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml @@ -57,6 +57,7 @@ <e:ListModelListBoxEditor ui:field="dataCenterEditor"/> <e:EntityModelTextBoxEditor ui:field="nameEditor" /> <e:EntityModelTextBoxEditor ui:field="descriptionEditor" /> + <e:EntityModelTextBoxEditor ui:field="commentEditor" /> <g:HorizontalPanel> <e:EntityModelCheckBoxEditor ui:field="vlanTagging"/> <e:EntityModelTextBoxOnlyEditor ui:field="vlanTag" /> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabNetworkView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabNetworkView.java index c904e52..d1161ba 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabNetworkView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabNetworkView.java @@ -20,6 +20,7 @@ import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.MainTabNetworkPresenter; import org.ovirt.engine.ui.webadmin.section.main.view.AbstractMainTabWithDetailsTableView; import org.ovirt.engine.ui.webadmin.widget.action.WebAdminButtonDefinition; +import org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn; import org.ovirt.engine.ui.webadmin.widget.table.column.NetworkRoleColumnHelper; import com.google.gwt.core.client.GWT; @@ -90,6 +91,8 @@ }; getTable().addColumn(descriptionColumn, constants.descriptionNetwork(), "300px"); //$NON-NLS-1$ + getTable().addColumn(new CommentColumn<NetworkView>(), constants.commentLabel(), "100px"); //$NON-NLS-1$ + SafeHtmlWithSafeHtmlTooltipColumn<NetworkView> roleColumn = new SafeHtmlWithSafeHtmlTooltipColumn<NetworkView>() { @Override -- To view, visit http://gerrit.ovirt.org/15484 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I935df2acf56afe5fd09249aead7ff6827e360216 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Noam Slomianko <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
