/* * * Copyright 2013 Entando S.r.l. (http://www.entando.com) All rights reserved. * * This file is part of Entando Enterprise Edition software. * You can redistribute it and/or modify it * under the terms of the Entando's EULA * * See the file License for the specific language governing permissions * and limitations under the License * * * * Copyright 2013 Entando S.r.l. (http://www.entando.com) All rights reserved. * */ package org.entando.entando.plugins.jpwebdynamicform.aps.system.init.servdb; import com.j256.ormlite.field.DataType; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; import org.entando.entando.aps.system.init.IDatabaseManager; import org.entando.entando.aps.system.init.model.ExtendedColumnDefinition; /** * @author E.Santoboni */ @DatabaseTable(tableName = MessageAttributeRole.TABLE_NAME) public class MessageAttributeRole implements ExtendedColumnDefinition { public MessageAttributeRole() {} @DatabaseField(foreign = true, columnName = "messageid", width = 16, canBeNull = false, index = true) private Message _messageId; @DatabaseField(columnName = "attrname", dataType = DataType.STRING, width = 30, canBeNull = false, index = true) private String _attributeName; @DatabaseField(columnName = "rolename", dataType = DataType.STRING, width = 50, canBeNull = false, index = true) private String _roleName; @Override public String[] extensions(IDatabaseManager.DatabaseType type) { String tableName = TABLE_NAME; String messageTableName = Message.TABLE_NAME; if (IDatabaseManager.DatabaseType.MYSQL.equals(type)) { tableName = "`" + tableName + "`"; messageTableName = "`" + Message.TABLE_NAME + "`"; } return new String[]{"ALTER TABLE " + tableName + " " + "ADD CONSTRAINT jpwebdynamicform_attroles_fkey FOREIGN KEY (messageid) " + "REFERENCES " + messageTableName + " (messageid)"}; } public static final String TABLE_NAME = "jpwebdynamicform_attroles"; }