use of com.cubrid.cubridmanager.core.cubrid.trigger.task.JDBCGetTriggerListTask in project cubrid-manager by CUBRID.
the class CubridTriggerFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
database.getDatabaseInfo().setTriggerList(null);
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
ITask task = null;
if (ApplicationType.CUBRID_MANAGER.equals(PerspectiveManager.getInstance().getCurrentMode())) {
task = new GetTriggerListTask(parent.getServer().getServerInfo());
((GetTriggerListTask) task).setDbName(database.getLabel());
} else {
task = new JDBCGetTriggerListTask(databaseInfo);
}
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
List<Trigger> triggerList = null;
if (task instanceof GetTriggerListTask) {
triggerList = ((GetTriggerListTask) task).getTriggerInfoList();
} else if (task instanceof JDBCGetTriggerListTask) {
triggerList = ((JDBCGetTriggerListTask) task).getTriggerInfoList();
}
if (triggerList != null && !triggerList.isEmpty()) {
for (Trigger trigger : triggerList) {
String id = parent.getId() + NODE_SEPARATOR + trigger.getName();
ICubridNode triggerNode = createTriggerNode(id, trigger);
parent.addChild(triggerNode);
}
}
databaseInfo.setTriggerList(triggerList);
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.cubridmanager.core.cubrid.trigger.task.JDBCGetTriggerListTask in project cubrid-manager by CUBRID.
the class OpenTriggerDetailInfoPartProgress method run.
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
DatabaseInfo databaseInfo = database.getDatabaseInfo();
ITask task = null;
if (ApplicationType.CUBRID_MANAGER.equals(PerspectiveManager.getInstance().getCurrentMode())) {
task = new GetTriggerListTask(database.getServer().getServerInfo());
((GetTriggerListTask) task).setDbName(database.getLabel());
} else {
task = new JDBCGetTriggerListTask(databaseInfo);
}
task.execute();
if (!task.isSuccess()) {
LOGGER.error(task.getErrorMsg());
return;
}
if (task instanceof GetTriggerListTask) {
triggerList = ((GetTriggerListTask) task).getTriggerInfoList();
} else if (task instanceof JDBCGetTriggerListTask) {
triggerList = ((JDBCGetTriggerListTask) task).getTriggerInfoList();
}
success = true;
}
Aggregations