Added is-active field to the Application

revert-70aa11f8
Chatura Dilan 9 years ago
parent f100853031
commit 24b462f4f4

@ -49,8 +49,10 @@ public class Application implements Serializable {
private Properties appProperties; private Properties appProperties;
@ApiModelProperty(name = "applicationIdentifier", value = "The application identifier", required = true) @ApiModelProperty(name = "applicationIdentifier", value = "The application identifier", required = true)
private String applicationIdentifier; private String applicationIdentifier;
@ApiModelProperty(name = "memoryUsage", value = "AMount of memory used by the application", required = true) @ApiModelProperty(name = "memoryUsage", value = "Amount of memory used by the application", required = true)
private int memoryUsage; private int memoryUsage;
@ApiModelProperty(name = "isActive", value = "Is the application actively running", required = true)
private boolean isActive;
public String getType() { public String getType() {
@ -166,4 +168,12 @@ public class Application implements Serializable {
this.appProperties = appProperties; this.appProperties = appProperties;
} }
public boolean isActive() {
return isActive;
}
public void setActive(boolean active) {
isActive = active;
}
} }

@ -47,8 +47,8 @@ public class ApplicationDAOImpl implements ApplicationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
stmt = conn.prepareStatement("INSERT INTO DM_APPLICATION (NAME, PLATFORM, CATEGORY, " + stmt = conn.prepareStatement("INSERT INTO DM_APPLICATION (NAME, PLATFORM, CATEGORY, " +
"VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID, APP_PROPERTIES, APP_IDENTIFIER, MEMORY_USAGE) " + "VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID, APP_PROPERTIES, APP_IDENTIFIER, MEMORY_USAGE, IS_ACTIVE) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
stmt.setString(1, application.getName()); stmt.setString(1, application.getName());
stmt.setString(2, application.getPlatform()); stmt.setString(2, application.getPlatform());
@ -66,6 +66,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
stmt.setString(10, application.getApplicationIdentifier()); stmt.setString(10, application.getApplicationIdentifier());
stmt.setInt(11, application.getMemoryUsage()); stmt.setInt(11, application.getMemoryUsage());
stmt.setBoolean(12, application.isActive());
stmt.execute(); stmt.execute();
rs = stmt.getGeneratedKeys(); rs = stmt.getGeneratedKeys();
@ -109,8 +110,8 @@ public class ApplicationDAOImpl implements ApplicationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
stmt = conn.prepareStatement("INSERT INTO DM_APPLICATION (NAME, PLATFORM, CATEGORY, " + stmt = conn.prepareStatement("INSERT INTO DM_APPLICATION (NAME, PLATFORM, CATEGORY, " +
"VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID,APP_PROPERTIES, APP_IDENTIFIER, MEMORY_USAGE) " + "VERSION, TYPE, LOCATION_URL, IMAGE_URL, TENANT_ID,APP_PROPERTIES, APP_IDENTIFIER, MEMORY_USAGE, IS_ACTIVE) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new String[]{"id"}); "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new String[]{"id"});
for (Application application : applications) { for (Application application : applications) {
@ -131,6 +132,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
stmt.setString(10, application.getApplicationIdentifier()); stmt.setString(10, application.getApplicationIdentifier());
stmt.setInt(11, application.getMemoryUsage()); stmt.setInt(11, application.getMemoryUsage());
stmt.setBoolean(12, application.isActive());
stmt.executeUpdate(); stmt.executeUpdate();
rs = stmt.getGeneratedKeys(); rs = stmt.getGeneratedKeys();
@ -208,7 +210,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " + stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
"LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, TENANT_ID FROM DM_APPLICATION WHERE APP_IDENTIFIER = ? " + "LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE, TENANT_ID FROM DM_APPLICATION WHERE APP_IDENTIFIER = ? " +
"AND TENANT_ID = ?"); "AND TENANT_ID = ?");
stmt.setString(1, identifier); stmt.setString(1, identifier);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
@ -240,7 +242,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " + stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
"LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, TENANT_ID From DM_APPLICATION app " + "LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE, TENANT_ID From DM_APPLICATION app " +
"INNER JOIN " + "INNER JOIN " +
"(Select APPLICATION_ID From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " + "(Select APPLICATION_ID From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " +
"ON " + "ON " +
@ -287,6 +289,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
application.setPlatform(rs.getString("PLATFORM")); application.setPlatform(rs.getString("PLATFORM"));
application.setVersion(rs.getString("VERSION")); application.setVersion(rs.getString("VERSION"));
application.setMemoryUsage(rs.getInt("MEMORY_USAGE")); application.setMemoryUsage(rs.getInt("MEMORY_USAGE"));
application.setActive(rs.getBoolean("IS_ACTIVE"));
application.setApplicationIdentifier(rs.getString("APP_IDENTIFIER")); application.setApplicationIdentifier(rs.getString("APP_IDENTIFIER"));
} catch (IOException e) { } catch (IOException e) {

@ -388,6 +388,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES BLOB NULL, APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL, MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );

@ -392,6 +392,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES BLOB NULL, APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL, MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );

@ -392,6 +392,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES BLOB NULL, APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL, MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );

@ -399,6 +399,7 @@ CREATE TABLE DM_APPLICATION (
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES VARBINARY(max) NULL, APP_PROPERTIES VARBINARY(max) NULL,
MEMORY_USAGE INTEGER NULL, MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BIT NOT NULL DEFAULT 'FALSE',
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
); );

@ -365,6 +365,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES BLOB NULL, APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL, MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; )ENGINE = InnoDB;

@ -661,6 +661,7 @@ CREATE TABLE DM_APPLICATION (
IMAGE_URL VARCHAR2(100) DEFAULT NULL, IMAGE_URL VARCHAR2(100) DEFAULT NULL,
APP_PROPERTIES BLOB NULL, APP_PROPERTIES BLOB NULL,
MEMORY_USAGE NUMBER(10) NULL, MEMORY_USAGE NUMBER(10) NULL,
IS_ACTIVE NUMBER(10) DEFAULT 0 NOT NULL,
TENANT_ID NUMBER(10) NOT NULL, TENANT_ID NUMBER(10) NOT NULL,
CONSTRAINT PK_DM_APPLICATION PRIMARY KEY (ID) CONSTRAINT PK_DM_APPLICATION PRIMARY KEY (ID)
) )

@ -341,6 +341,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
IMAGE_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL,
APP_PROPERTIES BYTEA NULL, APP_PROPERTIES BYTEA NULL,
MEMORY_USAGE INTEGER NULL, MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL TENANT_ID INTEGER NOT NULL
); );

Loading…
Cancel
Save