Skip to content

Commit

Permalink
Merge pull request #1300 from chv348/KAA-1566-release-010
Browse files Browse the repository at this point in the history
KAA-1566: Error occurs with long fields in Administration UI
  • Loading branch information
rasendubi authored Nov 18, 2016
2 parents 6af43cb + 3691227 commit c152008
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class DaoConstants {

public static final String OPTIMISTIC_LOCK_PROPERTY = "OPT_LOCK";

public static final int DESCRIPTION_ROW_LENGTH = 1024;

/**
* Common constants.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import static org.kaaproject.kaa.server.common.dao.DaoConstants.BASE_SCHEMA_NAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.BASE_SCHEMA_TABLE_NAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.BASE_SCHEMA_VERSION;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.DESCRIPTION_ROW_LENGTH;
import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId;

import org.hibernate.annotations.OnDelete;
Expand Down Expand Up @@ -57,7 +58,7 @@ public abstract class BaseSchema<T extends BaseSchemaDto> extends GenericModel<T
@Column(name = BASE_SCHEMA_NAME)
protected String name;

@Column(name = BASE_SCHEMA_DESCRIPTION)
@Column(name = BASE_SCHEMA_DESCRIPTION, length = DESCRIPTION_ROW_LENGTH)
protected String description;

@Column(name = BASE_SCHEMA_CREATED_USERNAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.kaaproject.kaa.server.common.dao.model.sql;

import static org.kaaproject.kaa.server.common.dao.DaoConstants.DESCRIPTION_ROW_LENGTH;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.ENDPOINT_GROUP_APPLICATION_ID;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.ENDPOINT_GROUP_CREATED_TIME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.ENDPOINT_GROUP_CREATED_USERNAME;
Expand Down Expand Up @@ -66,7 +67,7 @@ public class EndpointGroup extends GenericModel<EndpointGroupDto> implements Ser
@Column(name = ENDPOINT_GROUP_ENDPOINT_COUNT)
private long endpointCount;

@Column(name = ENDPOINT_GROUP_DESCRIPTION, length = 255)
@Column(name = ENDPOINT_GROUP_DESCRIPTION, length = DESCRIPTION_ROW_LENGTH)
private String description;

@Column(name = ENDPOINT_GROUP_CREATED_USERNAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.kaaproject.kaa.server.common.dao.model.sql;

import static org.kaaproject.kaa.server.common.dao.DaoConstants.DESCRIPTION_ROW_LENGTH;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_CLASS_NAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_CREATED_TIME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_CREATED_USERNAME;
Expand Down Expand Up @@ -46,7 +47,7 @@
public class EventClassFamily extends GenericModel<EventClassFamilyDto> {

private static final long serialVersionUID = 3766947955702551264L;
@Column(name = EVENT_CLASS_FAMILY_DESCRIPTION)
@Column(name = EVENT_CLASS_FAMILY_DESCRIPTION, length = DESCRIPTION_ROW_LENGTH)
protected String description;
@Column(name = EVENT_CLASS_FAMILY_CREATED_USERNAME)
protected String createdUsername;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.kaaproject.kaa.server.common.dao.model.sql;

import static org.kaaproject.kaa.server.common.dao.DaoConstants.DESCRIPTION_ROW_LENGTH;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.PLUGIN_APPLICATION_ID;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.PLUGIN_CLASS_NAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.PLUGIN_CREATED_TIME;
Expand Down Expand Up @@ -55,7 +56,7 @@ public abstract class Plugin<T extends PluginDto> extends GenericModel<T> implem
protected Application application;
@Column(name = PLUGIN_NAME)
private String name;
@Column(name = PLUGIN_DESCRIPTION, length = 1000)
@Column(name = PLUGIN_DESCRIPTION, length = DESCRIPTION_ROW_LENGTH)
private String description;
@Column(name = PLUGIN_CREATED_USERNAME)
private String createdUsername;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.kaaproject.kaa.server.common.dao.model.sql;

import static org.kaaproject.kaa.server.common.dao.DaoConstants.DESCRIPTION_ROW_LENGTH;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.ENDPOINT_GROUP_APPLICATION_ID;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.ENDPOINT_GROUP_TOPICS_ENDPOINT_GROUP_ID;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.ENDPOINT_GROUP_TOPICS_TABLE_NAME;
Expand Down Expand Up @@ -58,7 +59,7 @@
public class Topic extends GenericModel<TopicDto> implements Serializable {

private static final long serialVersionUID = -5617352698933455002L;
@Column(name = TOPIC_DESCRIPTION)
@Column(name = TOPIC_DESCRIPTION, length = DESCRIPTION_ROW_LENGTH)
protected String description;
@Column(name = TOPIC_CREATED_USERNAME)
protected String createdUsername;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TenantDto implements HasId, Serializable {
private static final long serialVersionUID = 330532156388681820L;

private String id;
@Size(min = 2, max = 255)
@Size(min = 2, max = 100)
@NotNull(message = "tenant name can't be null")
private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class AddSdkProfileViewImpl
implements AddSdkProfileView, ValueChangeHandler<VersionDto> {

private static final String REQUIRED = Utils.avroUiStyle.requiredField();
private static final int SDK_NAME_TEXT_SIZE_BOX = 255;

private SizedTextBox name;

Expand Down Expand Up @@ -88,7 +89,7 @@ protected void initDetailsTable() {

Widget label = new Label(Utils.constants.name());
label.addStyleName(REQUIRED);
name = new KaaAdminSizedTextBox(256);
name = new KaaAdminSizedTextBox(SDK_NAME_TEXT_SIZE_BOX);
name.addInputHandler(this);
detailsTable.setWidget(0, 0, label);
detailsTable.setWidget(0, 1, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
public class TenantViewImpl extends BaseDetailsViewImpl implements TenantView {

private static final String REQUIRED = Utils.avroUiStyle.requiredField();
private static final int TENANT_NAME_TEXT_SIZE_BOX = 100;

private SizedTextBox tenantName;

Expand Down Expand Up @@ -65,7 +66,7 @@ protected String getSubTitle() {
@Override
protected void initDetailsTable() {

tenantName = new KaaAdminSizedTextBox(DEFAULT_TEXTBOX_SIZE);
tenantName = new KaaAdminSizedTextBox(TENANT_NAME_TEXT_SIZE_BOX);
tenantName.setWidth("100%");
tenantName.addInputHandler(this);
lableUser = new Label("Users");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
#
# Copyright 2014-2016 CyberVision, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

SQL_PROVIDER_NAME=$1

if [ -z "${SQL_PROVIDER_NAME}" ]; then
echo "Please specify sql provider name.
mariadb or postgresql"
else
case $SQL_PROVIDER_NAME in
mariadb)
echo "Upgrade mariadb 0.10.0 to 0.10.1 Kaa version"
mysql -usqladmin -padmin kaa < upgradeSql0100to0101kaaVersionMariadb.sql
;;
postgresql)
echo "Upgrade postgresql 0.10.0 to 0.10.1 Kaa version"
sudo -u postgres psql -d kaa -a -f upgradeSql0100to0101kaaVersionPostgreSQL.sql
;;
*)
exit 1
;;
esac

echo "Upgrade finished!"
fi




Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2014 CyberVision, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ALTER TABLE base_schems MODIFY description VARCHAR(1024);
ALTER TABLE plugin MODIFY description VARCHAR(1024);
ALTER TABLE topic MODIFY description VARCHAR(1024);
ALTER TABLE endpoint_group MODIFY description VARCHAR(1024);
ALTER TABLE events_class_family MODIFY description VARCHAR(1024);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2014 CyberVision, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ALTER TABLE base_schems ALTER COLUMN description TYPE varchar(1024);
ALTER TABLE plugin ALTER COLUMN description TYPE varchar(1024);
ALTER TABLE topic ALTER COLUMN description TYPE varchar(1024);
ALTER TABLE endpoint_group ALTER COLUMN description TYPE varchar(1024);
ALTER TABLE events_class_family ALTER COLUMN description TYPE varchar(1024);

0 comments on commit c152008

Please sign in to comment.