diff options
Diffstat (limited to 'Dozentenmodulserver/src/sql/SQL.java')
| -rw-r--r-- | Dozentenmodulserver/src/sql/SQL.java | 69 |
1 files changed, 62 insertions, 7 deletions
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java index ec768a40..72c4098b 100644 --- a/Dozentenmodulserver/src/sql/SQL.java +++ b/Dozentenmodulserver/src/sql/SQL.java @@ -231,7 +231,7 @@ public class SQL { public boolean setImageData(String pk_person, boolean license,
boolean internet, long cpu, long ram, String imagename,
- String imagePath, boolean isTemplate, long filesize, String shareMode) {
+ String imagePath, boolean isTemplate, long filesize, String shareMode, String pk_os) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -263,8 +263,8 @@ public class SQL { + "','" + formatter.format(new Date()) // rec_change_time
+ "','" + pk_person // rec_owner
+ "','" + pk_person // rec_change_by
- + "',0" // content_operatingSystem
- + ",1" // status_isCompressed
+ + "','" + pk_os // content_operatingSystem
+ + "',1" // status_isCompressed
+ ",1" // status_isSecure
+ ",1" // status_isOptimzed
+ ",1" // status_isValid
@@ -358,9 +358,9 @@ public class SQL { Connection con=getConnection();
Statement stm = con.createStatement();
ResultSet rs=stm
- .executeQuery("SELECT name FROM bwLehrpool.m_operatingSystem;");
+ .executeQuery("SELECT name, architecture FROM bwLehrpool.m_operatingSystem;");
while (rs.next()) {
- list.add(rs.getString("name"));
+ list.add(rs.getString("name")+" "+rs.getString("architecture")+" bit");
}
return list;
@@ -487,7 +487,7 @@ public class SQL { Connection con=getConnection();
Statement stm = con.createStatement();
ResultSet data=stm
- .executeQuery("SELECT image_name,cond_hasInternetRestriction,cond_hasLicenseRestriction, cond_minCPUs, cond_minRAM, image_syncMode,image_filesize,image_path, image_isTemplate FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"
+ .executeQuery("SELECT image_name,cond_hasInternetRestriction,cond_hasLicenseRestriction, cond_minCPUs, cond_minRAM, image_syncMode,image_filesize,image_path, image_isTemplate,content_operatingSystem FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"
+ id + "' and imageVersion = '" + version + "' ;");
while (data.next()) {
map.put("name", data.getString("image_name"));
@@ -500,6 +500,10 @@ public class SQL { map.put("filesize", data.getString("image_filesize"));
map.put("path", data.getString("image_path"));
map.put("template", data.getString("image_isTemplate"));
+
+ String os_name=getOS(data.getString("content_operatingSystem"));
+
+ map.put("os", os_name);
}
con.close();
return map;
@@ -513,7 +517,7 @@ public class SQL { public int UpdateImageData(String name, String newName,String image_path,
boolean license, boolean internet, long cpu, long ram, String id,
- String version, boolean isTemplate, long filesize, String shareMode) {
+ String version, boolean isTemplate, long filesize, String shareMode,String ospk) {
try {
Connection con=getConnection();
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -550,6 +554,8 @@ public class SQL { + cpu
+ "',`image_isTemplate` = '"
+ isTemplate
+ + "',`content_operatingSystem` = '"
+ + ospk
+ "',`image_filesize` = '"
+ filesize
+ "',`image_syncMode` = '"
@@ -773,4 +779,53 @@ public class SQL { return null;
}
+
+ public String getOSpk(String os,
+ String architecture) {
+ try {
+ Connection con=getConnection();
+ Statement stm = con.createStatement();
+ //log.info(new Date() + " - OS: "+os+" architecture: "+architecture);
+ ResultSet rs=stm
+ .executeQuery("SELECT operatingSystemID FROM bwLehrpool.m_operatingSystem where name like '"
+ + os
+ + "' and architecture like '"
+ + architecture
+ + "';");
+ rs.first();
+ String pkos=rs.getString("operatingSystemID");
+ con.close();
+ return pkos;
+
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getPathOfImage.");
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public String getOS(String pk) {
+ try {
+ Connection con=getConnection();
+ Statement stm = con.createStatement();
+ //log.info(new Date() + " - OS: "+os+" architecture: "+architecture);
+ ResultSet rs=stm
+ .executeQuery("SELECT name,architecture FROM bwLehrpool.m_operatingSystem where operatingSystemID = '"
+ + pk
+ + "';");
+ rs.first();
+ String os=rs.getString("name")+" "+rs.getString("architecture");
+ con.close();
+ return os;
+
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getPathOfImage.");
+ e.printStackTrace();
+ }
+
+ return null;
+ }
}
|
