diff options
| author | Nino Breuer | 2014-10-28 20:02:36 +0100 |
|---|---|---|
| committer | Nino Breuer | 2014-10-28 20:02:36 +0100 |
| commit | f1a4b248da7e636a8fb9f2d3001fdd4ba628471c (patch) | |
| tree | 9d74e7ec861c7c81c0c39a2d07e1b6a41fa94720 /dozentenmodulserver/src/main/java | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-f1a4b248da7e636a8fb9f2d3001fdd4ba628471c.tar.gz tutor-module-f1a4b248da7e636a8fb9f2d3001fdd4ba628471c.tar.xz tutor-module-f1a4b248da7e636a8fb9f2d3001fdd4ba628471c.zip | |
changed implementation of full text search in some classes
Diffstat (limited to 'dozentenmodulserver/src/main/java')
| -rw-r--r-- | dozentenmodulserver/src/main/java/server/generated/Image.java | 108 | ||||
| -rw-r--r-- | dozentenmodulserver/src/main/java/sql/SQL.java | 33 |
2 files changed, 122 insertions, 19 deletions
diff --git a/dozentenmodulserver/src/main/java/server/generated/Image.java b/dozentenmodulserver/src/main/java/server/generated/Image.java index 1c8291f7..707864e6 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Image.java +++ b/dozentenmodulserver/src/main/java/server/generated/Image.java @@ -44,6 +44,7 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav private static final org.apache.thrift.protocol.TField UPDATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("updateTime", org.apache.thrift.protocol.TType.STRING, (short)7); private static final org.apache.thrift.protocol.TField USER_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("userData", org.apache.thrift.protocol.TType.STRING, (short)8); private static final org.apache.thrift.protocol.TField IS_TEMPLATE_FIELD_DESC = new org.apache.thrift.protocol.TField("isTemplate", org.apache.thrift.protocol.TType.STRING, (short)9); + private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)10); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -60,6 +61,7 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav public String updateTime; // required public String userData; // required public String isTemplate; // required + public String description; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -71,7 +73,8 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav LECTURE_NAME((short)6, "lectureName"), UPDATE_TIME((short)7, "updateTime"), USER_DATA((short)8, "userData"), - IS_TEMPLATE((short)9, "isTemplate"); + IS_TEMPLATE((short)9, "isTemplate"), + DESCRIPTION((short)10, "description"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -104,6 +107,8 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav return USER_DATA; case 9: // IS_TEMPLATE return IS_TEMPLATE; + case 10: // DESCRIPTION + return DESCRIPTION; default: return null; } @@ -165,6 +170,8 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.IS_TEMPLATE, new org.apache.thrift.meta_data.FieldMetaData("isTemplate", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Image.class, metaDataMap); } @@ -181,7 +188,8 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav String lectureName, String updateTime, String userData, - String isTemplate) + String isTemplate, + String description) { this(); this.id = id; @@ -193,6 +201,7 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav this.updateTime = updateTime; this.userData = userData; this.isTemplate = isTemplate; + this.description = description; } /** @@ -226,6 +235,9 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav if (other.isSetIsTemplate()) { this.isTemplate = other.isTemplate; } + if (other.isSetDescription()) { + this.description = other.description; + } } public Image deepCopy() { @@ -243,6 +255,7 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav this.updateTime = null; this.userData = null; this.isTemplate = null; + this.description = null; } public String getId() { @@ -461,6 +474,30 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav } } + public String getDescription() { + return this.description; + } + + public Image setDescription(String description) { + this.description = description; + return this; + } + + public void unsetDescription() { + this.description = null; + } + + /** Returns true if field description is set (has been assigned a value) and false otherwise */ + public boolean isSetDescription() { + return this.description != null; + } + + public void setDescriptionIsSet(boolean value) { + if (!value) { + this.description = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ID: @@ -535,6 +572,14 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav } break; + case DESCRIPTION: + if (value == null) { + unsetDescription(); + } else { + setDescription((String)value); + } + break; + } } @@ -567,6 +612,9 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav case IS_TEMPLATE: return getIsTemplate(); + case DESCRIPTION: + return getDescription(); + } throw new IllegalStateException(); } @@ -596,6 +644,8 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav return isSetUserData(); case IS_TEMPLATE: return isSetIsTemplate(); + case DESCRIPTION: + return isSetDescription(); } throw new IllegalStateException(); } @@ -694,6 +744,15 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav return false; } + boolean this_present_description = true && this.isSetDescription(); + boolean that_present_description = true && that.isSetDescription(); + if (this_present_description || that_present_description) { + if (!(this_present_description && that_present_description)) + return false; + if (!this.description.equals(that.description)) + return false; + } + return true; } @@ -800,6 +859,16 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav return lastComparison; } } + lastComparison = Boolean.valueOf(isSetDescription()).compareTo(other.isSetDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, other.description); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -891,6 +960,14 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav sb.append(this.isTemplate); } first = false; + if (!first) sb.append(", "); + sb.append("description:"); + if (this.description == null) { + sb.append("null"); + } else { + sb.append(this.description); + } + first = false; sb.append(")"); return sb.toString(); } @@ -1006,6 +1083,14 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 10: // DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.description = iprot.readString(); + struct.setDescriptionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1066,6 +1151,11 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav oprot.writeString(struct.isTemplate); oprot.writeFieldEnd(); } + if (struct.description != null) { + oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC); + oprot.writeString(struct.description); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -1111,7 +1201,10 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav if (struct.isSetIsTemplate()) { optionals.set(8); } - oprot.writeBitSet(optionals, 9); + if (struct.isSetDescription()) { + optionals.set(9); + } + oprot.writeBitSet(optionals, 10); if (struct.isSetId()) { oprot.writeString(struct.id); } @@ -1139,12 +1232,15 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav if (struct.isSetIsTemplate()) { oprot.writeString(struct.isTemplate); } + if (struct.isSetDescription()) { + oprot.writeString(struct.description); + } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, Image struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(9); + BitSet incoming = iprot.readBitSet(10); if (incoming.get(0)) { struct.id = iprot.readString(); struct.setIdIsSet(true); @@ -1181,6 +1277,10 @@ public class Image implements org.apache.thrift.TBase<Image, Image._Fields>, jav struct.isTemplate = iprot.readString(); struct.setIsTemplateIsSet(true); } + if (incoming.get(9)) { + struct.description = iprot.readString(); + struct.setDescriptionIsSet(true); + } } } diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 3bd672e6..3af3bb8f 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -350,22 +350,23 @@ public class SQL { // ResultSet
// res=stm.executeQuery("SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, '' as lecture,vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image as pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and vl.image_owner=u.userID and vl.image_name not in (SELECT vl.image_name FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID) union SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, lect.name as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID;");
ResultSet res = stm
- .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
+ .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate, vl.image_description FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
+ userID
+ "' AND u.userID = pmi.userID AND pmi.image_write = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
while (res.next()) {
- list.add(new Image(res.getString("GUID_imageID"), res
- .getString("imageVersion"),
- res.getString("image_name"), res
- .getString("cond_hasLicenseRestriction"), res
- .getString("name")
- + " "
- + res.getString("architecture") + " bit", res
- .getString("lecture"), res
- .getString("image_update_time"), res
- .getString("user"), res
- .getString("image_isTemplate")));
+ list.add(new Image(res.getString("GUID_imageID"),
+ res.getString("imageVersion"),
+ res.getString("image_name"),
+ res.getString("cond_hasLicenseRestriction"),
+ res.getString("name")
+ + " " +
+ res.getString("architecture") + " bit",
+ res.getString("lecture"),
+ res.getString("image_update_time"),
+ res.getString("user"),
+ res.getString("image_isTemplate"),
+ res.getString("image_description")));
}
con.close();
} catch (SQLException e) {
@@ -388,7 +389,7 @@ public class SQL { // ResultSet
// res=stm.executeQuery("SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, '' as lecture,vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image as pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and vl.image_owner=u.userID and vl.image_name not in (SELECT vl.image_name FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID) union SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, lect.name as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID;");
ResultSet res = stm
- .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
+ .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate, vl.image_description FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
+ userID
+ "' AND u.userID = pmi.userID AND pmi.image_read = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
@@ -403,7 +404,8 @@ public class SQL { .getString("lecture"), res
.getString("image_update_time"), res
.getString("user"), res
- .getString("image_isTemplate")));
+ .getString("image_isTemplate"),
+ res.getString("image_description")));
}
con.close();
} catch (SQLException e) {
@@ -441,7 +443,8 @@ public class SQL { .getString("lecture"), res
.getString("image_update_time"), res
.getString("user"), res
- .getString("image_isTemplate")));
+ .getString("image_isTemplate"),
+ res.getString("image_description")));
}
con.close();
} catch (SQLException e) {
|
