Search in sources :

Example 16 with Trigger

use of com.cubrid.common.core.common.model.Trigger in project cubrid-manager by CUBRID.

the class CreateTriggerDialog method generateSqlText.

/**
	 *
	 * @return Sql string buffer
	 */
private StringBuffer generateSqlText() {
    // FIXME move this logic to core module
    StringBuffer sql = new StringBuffer();
    Trigger newTrigger = getNewTrigger();
    if (null == trigger) {
        sql.append(TriggerDDL.getDDL(newTrigger));
    } else {
        sql.append(TriggerDDL.getDDL(trigger));
        sql.append(StringUtil.NEWLINE);
        sql.append(StringUtil.NEWLINE);
        sql.append(StringUtil.NEWLINE);
        sql.append(TriggerDDL.getAlterDDL(trigger, newTrigger));
    }
    return sql;
}
Also used : Trigger(com.cubrid.common.core.common.model.Trigger)

Example 17 with Trigger

use of com.cubrid.common.core.common.model.Trigger in project cubrid-manager by CUBRID.

the class GetTriggerInfoTaskTest method testReceive.

public void testReceive() throws Exception {
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/trigger/task/test.message/gettriggerinfo_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    List<Trigger> list = ModelUtil.getTriggerList(node.getChildren().get(0));
    String action = "update resort set number_of_pools=new.number_of_pools-1 where \"name\"=obj.\"name\"";
    assertEquals(2, list.size());
    assertEquals("limit_pools", list.get(0).getName());
    assertEquals("BEFORE", list.get(0).getConditionTime());
    assertEquals("UPDATE", list.get(0).getEventType());
    assertEquals(action, list.get(0).getAction());
    assertEquals("resort", list.get(0).getTarget_class());
    assertEquals("number_of_pools", list.get(0).getTarget_att());
    assertEquals("new.number_of_pools>0", list.get(0).getCondition());
    assertEquals("BEFORE", list.get(0).getActionTime());
    assertEquals("ACTIVE", list.get(0).getStatus());
    assertEquals("00.01", list.get(0).getPriority());
}
Also used : Trigger(com.cubrid.common.core.common.model.Trigger) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Aggregations

Trigger (com.cubrid.common.core.common.model.Trigger)17 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)4 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)3 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)3 SQLException (java.sql.SQLException)3 ITask (com.cubrid.common.core.task.ITask)2 CreateTriggerDialog (com.cubrid.common.ui.cubrid.trigger.dialog.CreateTriggerDialog)2 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)2 GetTriggerListTask (com.cubrid.cubridmanager.core.cubrid.trigger.task.GetTriggerListTask)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 TableItem (org.eclipse.swt.widgets.TableItem)2 SchemaComment (com.cubrid.common.core.schemacomment.model.SchemaComment)1 AlterTriggerAction (com.cubrid.common.ui.cubrid.trigger.action.AlterTriggerAction)1 DropTriggerAction (com.cubrid.common.ui.cubrid.trigger.action.DropTriggerAction)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)1 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 JDBCGetTriggerInfoTask (com.cubrid.cubridmanager.core.cubrid.trigger.task.JDBCGetTriggerInfoTask)1