-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2881 from SCADA-LTS/release/2.7.7.3
Release/2.7.7.3
- Loading branch information
Showing
14 changed files
with
168 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.scada_lts.dao.model; | ||
|
||
public class BaseObjectIdentifier { | ||
|
||
private int id; | ||
private String xid; | ||
|
||
public BaseObjectIdentifier() {} | ||
|
||
public BaseObjectIdentifier(int id, String xid) { | ||
this.id = id; | ||
this.xid = xid; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public String getXid() { | ||
return xid; | ||
} | ||
|
||
public void setXid(String xid) { | ||
this.xid = xid; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/org/scada_lts/dao/model/BaseObjectIdentifierRowMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.scada_lts.dao.model; | ||
|
||
import org.springframework.jdbc.core.RowMapper; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
public class BaseObjectIdentifierRowMapper implements RowMapper<BaseObjectIdentifier> { | ||
|
||
private static final String COLUMN_NAME_ID = "id"; | ||
private static final String COLUMN_NAME_XID = "xid"; | ||
|
||
private final String idColumnName; | ||
private final String xidColumnName; | ||
|
||
private BaseObjectIdentifierRowMapper(String idColumnName, String xidColumnName) { | ||
this.idColumnName = idColumnName; | ||
this.xidColumnName = xidColumnName; | ||
} | ||
|
||
public static class Builder { | ||
private String idColumnName; | ||
private String xidColumnName; | ||
|
||
public Builder idColumnName(String idColumnName) { | ||
this.idColumnName = idColumnName; | ||
return this; | ||
} | ||
|
||
public Builder xidColumnName(String xidColumnName) { | ||
this.xidColumnName = xidColumnName; | ||
return this; | ||
} | ||
|
||
public BaseObjectIdentifierRowMapper build() { | ||
return new BaseObjectIdentifierRowMapper(idColumnName, xidColumnName); | ||
} | ||
} | ||
|
||
public static BaseObjectIdentifierRowMapper withDefaultNames() { | ||
return new BaseObjectIdentifierRowMapper.Builder() | ||
.idColumnName(COLUMN_NAME_ID) | ||
.xidColumnName(COLUMN_NAME_XID) | ||
.build(); | ||
} | ||
public String selectScadaObjectIdFrom(String tableName) { | ||
return "select " + | ||
idColumnName + ", " + | ||
xidColumnName + ", " + | ||
"FROM " + tableName + " order by " + idColumnName; | ||
} | ||
@Override | ||
public BaseObjectIdentifier mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
return new BaseObjectIdentifier( | ||
rs.getInt(idColumnName), | ||
rs.getString(xidColumnName) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.