Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
0003064: Allow the event action on group links to be overridden
  • Loading branch information
mmichalek committed Apr 20, 2017
1 parent 3a874cb commit a68eec0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Expand Up @@ -34,7 +34,9 @@ public class NodeGroupLink implements Serializable, Comparable<NodeGroupLink> {

private NodeGroupLinkAction dataEventAction = NodeGroupLinkAction.W;

private boolean syncConfigEnabled = true;
private boolean syncConfigEnabled = true;

private boolean isReversible;

private Date createTime;

Expand Down Expand Up @@ -87,6 +89,14 @@ public void setTargetNodeGroupId(String targetNodeGroupId) {
this.targetNodeGroupId = targetNodeGroupId;
}

public boolean isReversible() {
return isReversible;
}

public void setReversible(boolean isReversible) {
this.isReversible = isReversible;
}

public Date getCreateTime() {
return createTime;
}
Expand Down
Expand Up @@ -182,12 +182,14 @@ public void saveNodeGroupLink(NodeGroupLink link) {

link.setLastUpdateTime(new Date());
if (sqlTemplate.update(getSql("updateNodeGroupLinkSql"), link.getDataEventAction().name(),
link.isSyncConfigEnabled() ? 1 : 0, link.getLastUpdateTime(),
link.isSyncConfigEnabled() ? 1 : 0, link.isReversible() ? 1 : 0,
link.getLastUpdateTime(),
link.getLastUpdateBy(), link.getSourceNodeGroupId(), link.getTargetNodeGroupId()) == 0) {
link.setCreateTime(new Date());
sqlTemplate.update(getSql("insertNodeGroupLinkSql"), link.getDataEventAction().name(),
link.getSourceNodeGroupId(), link.getTargetNodeGroupId(),
link.isSyncConfigEnabled() ? 1 : 0, link.getLastUpdateTime(),
link.isSyncConfigEnabled() ? 1 : 0, link.isReversible() ? 1 : 0,
link.getLastUpdateTime(),
link.getLastUpdateBy(), link.getCreateTime());
}
}
Expand Down Expand Up @@ -625,6 +627,7 @@ public NodeGroupLink mapRow(Row row) {
link.setTargetNodeGroupId(row.getString("target_node_group_id"));
link.setDataEventAction(NodeGroupLinkAction.fromCode(row.getString("data_event_action")));
link.setSyncConfigEnabled(row.getBoolean("sync_config_enabled"));
link.setReversible(row.getBoolean("is_reversible"));
link.setCreateTime(row.getDateTime("create_time"));
link.setLastUpdateBy(row.getString("last_update_by"));
link.setLastUpdateTime(row.getDateTime("last_update_time"));
Expand Down
Expand Up @@ -39,7 +39,7 @@ public ConfigurationServiceSqlMap(IDatabasePlatform platform,
+ " source_node_group_id = ? and target_node_group_id = ? ");

putSql("groupsLinksSql", ""
+ "select source_node_group_id, target_node_group_id, data_event_action, sync_config_enabled, last_update_time, last_update_by, create_time from "
+ "select source_node_group_id, target_node_group_id, data_event_action, sync_config_enabled, is_reversible, last_update_time, last_update_by, create_time from "
+ " $(node_group_link) order by source_node_group_id ");

putSql("updateNodeGroupSql",
Expand All @@ -51,12 +51,12 @@ public ConfigurationServiceSqlMap(IDatabasePlatform platform,
+ " (description, node_group_id, last_update_time, last_update_by, create_time) values(?,?,?,?,?) ");

putSql("updateNodeGroupLinkSql", ""
+ "update $(node_group_link) set data_event_action=?, sync_config_enabled=?, last_update_time=?, last_update_by=? where "
+ "update $(node_group_link) set data_event_action=?, sync_config_enabled=?, is_reversible=?, last_update_time=?, last_update_by=? where "
+ " source_node_group_id=? and target_node_group_id=? ");

putSql("insertNodeGroupLinkSql",
"insert into $(node_group_link) "
+ " (data_event_action, source_node_group_id, target_node_group_id, sync_config_enabled, last_update_time, last_update_by, create_time) values(?,?,?,?,?,?,?)");
+ " (data_event_action, source_node_group_id, target_node_group_id, sync_config_enabled, is_reversible, last_update_time, last_update_by, create_time) values(?,?,?,?,?,?,?,?)");

putSql("selectNodeGroupsSql", ""
+ "select node_group_id, description, last_update_time, last_update_by, create_time from $(node_group) order by node_group_id ");
Expand Down

0 comments on commit a68eec0

Please sign in to comment.