diff options
| author | Michael Wilson | 2014-10-21 18:02:43 +0200 |
|---|---|---|
| committer | Michael Wilson | 2014-10-21 18:02:43 +0200 |
| commit | 6ccc95939c22f4b771856b3a19e76288c3b5f113 (patch) | |
| tree | 42fa2a34bb4156713fed70a0475ced1ce85d1e43 /dozentenmodulserver/src/main/java | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-6ccc95939c22f4b771856b3a19e76288c3b5f113.tar.gz tutor-module-6ccc95939c22f4b771856b3a19e76288c3b5f113.tar.xz tutor-module-6ccc95939c22f4b771856b3a19e76288c3b5f113.zip | |
-Fehler behoben, Liste der Benutzer für Berechtigung nun korrekt
-Backend vorbereitet für personenabhängige Liste der Veranstaltungen nach Rechten
Diffstat (limited to 'dozentenmodulserver/src/main/java')
3 files changed, 3331 insertions, 535 deletions
diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index 2d6a62bc..f9835738 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -337,6 +337,30 @@ public class ServerHandler implements Server.Iface { } + + @Override + public List<Lecture> getLectureListPermissionRead(String userID){ + log.info(new Date().toString() + " - returning LectureListRead: "+sql.getLectureListPermissionRead(userID).size()+" items"); + return sql.getLectureListPermissionRead(userID); + }//end getLectureListPermissionRead + + @Override + public List<Lecture> getLectureListPermissionWrite(String userID){ + log.info(new Date().toString() + " - returning LectureListWrite: "+sql.getLectureListPermissionWrite(userID).size()+" items"); + return sql.getLectureListPermissionWrite(userID); + }//end getLectureListPermissionRead + + @Override + public List<Lecture> getLectureListPermissionAdmin(String userID){ + log.info(new Date().toString() + " - returning LectureListAdmin: "+sql.getLectureListPermissionAdmin(userID).size()+" items"); + return sql.getLectureListPermissionAdmin(userID); + }//end getLectureListPermissionRead + + + + + + @Override public boolean updateLecturedata(String name, String newName, diff --git a/dozentenmodulserver/src/main/java/server/generated/Server.java b/dozentenmodulserver/src/main/java/server/generated/Server.java index d8267f25..39763c69 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Server.java +++ b/dozentenmodulserver/src/main/java/server/generated/Server.java @@ -54,6 +54,12 @@ public class Server { public List<Lecture> getLectureList() throws org.apache.thrift.TException; + public List<Lecture> getLectureListPermissionRead(String userID) throws org.apache.thrift.TException; + + public List<Lecture> getLectureListPermissionWrite(String userID) throws org.apache.thrift.TException; + + public List<Lecture> getLectureListPermissionAdmin(String userID) throws org.apache.thrift.TException; + public List<String> getAllOS() throws org.apache.thrift.TException; public List<String> getAllUniversities() throws org.apache.thrift.TException; @@ -120,6 +126,12 @@ public class Server { public void getLectureList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getLectureListPermissionRead(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void getLectureListPermissionWrite(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void getLectureListPermissionAdmin(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getAllOS(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getAllUniversities(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -409,6 +421,75 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLectureList failed: unknown result"); } + public List<Lecture> getLectureListPermissionRead(String userID) throws org.apache.thrift.TException + { + send_getLectureListPermissionRead(userID); + return recv_getLectureListPermissionRead(); + } + + public void send_getLectureListPermissionRead(String userID) throws org.apache.thrift.TException + { + getLectureListPermissionRead_args args = new getLectureListPermissionRead_args(); + args.setUserID(userID); + sendBase("getLectureListPermissionRead", args); + } + + public List<Lecture> recv_getLectureListPermissionRead() throws org.apache.thrift.TException + { + getLectureListPermissionRead_result result = new getLectureListPermissionRead_result(); + receiveBase(result, "getLectureListPermissionRead"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLectureListPermissionRead failed: unknown result"); + } + + public List<Lecture> getLectureListPermissionWrite(String userID) throws org.apache.thrift.TException + { + send_getLectureListPermissionWrite(userID); + return recv_getLectureListPermissionWrite(); + } + + public void send_getLectureListPermissionWrite(String userID) throws org.apache.thrift.TException + { + getLectureListPermissionWrite_args args = new getLectureListPermissionWrite_args(); + args.setUserID(userID); + sendBase("getLectureListPermissionWrite", args); + } + + public List<Lecture> recv_getLectureListPermissionWrite() throws org.apache.thrift.TException + { + getLectureListPermissionWrite_result result = new getLectureListPermissionWrite_result(); + receiveBase(result, "getLectureListPermissionWrite"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLectureListPermissionWrite failed: unknown result"); + } + + public List<Lecture> getLectureListPermissionAdmin(String userID) throws org.apache.thrift.TException + { + send_getLectureListPermissionAdmin(userID); + return recv_getLectureListPermissionAdmin(); + } + + public void send_getLectureListPermissionAdmin(String userID) throws org.apache.thrift.TException + { + getLectureListPermissionAdmin_args args = new getLectureListPermissionAdmin_args(); + args.setUserID(userID); + sendBase("getLectureListPermissionAdmin", args); + } + + public List<Lecture> recv_getLectureListPermissionAdmin() throws org.apache.thrift.TException + { + getLectureListPermissionAdmin_result result = new getLectureListPermissionAdmin_result(); + receiveBase(result, "getLectureListPermissionAdmin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLectureListPermissionAdmin failed: unknown result"); + } + public List<String> getAllOS() throws org.apache.thrift.TException { send_getAllOS(); @@ -1337,6 +1418,102 @@ public class Server { } } + public void getLectureListPermissionRead(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getLectureListPermissionRead_call method_call = new getLectureListPermissionRead_call(userID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getLectureListPermissionRead_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getLectureListPermissionRead_call(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.userID = userID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getLectureListPermissionRead", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getLectureListPermissionRead_args args = new getLectureListPermissionRead_args(); + args.setUserID(userID); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Lecture> getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getLectureListPermissionRead(); + } + } + + public void getLectureListPermissionWrite(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getLectureListPermissionWrite_call method_call = new getLectureListPermissionWrite_call(userID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getLectureListPermissionWrite_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getLectureListPermissionWrite_call(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.userID = userID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getLectureListPermissionWrite", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getLectureListPermissionWrite_args args = new getLectureListPermissionWrite_args(); + args.setUserID(userID); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Lecture> getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getLectureListPermissionWrite(); + } + } + + public void getLectureListPermissionAdmin(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getLectureListPermissionAdmin_call method_call = new getLectureListPermissionAdmin_call(userID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getLectureListPermissionAdmin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getLectureListPermissionAdmin_call(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.userID = userID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getLectureListPermissionAdmin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getLectureListPermissionAdmin_args args = new getLectureListPermissionAdmin_args(); + args.setUserID(userID); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Lecture> getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getLectureListPermissionAdmin(); + } + } + public void getAllOS(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); getAllOS_call method_call = new getAllOS_call(resultHandler, this, ___protocolFactory, ___transport); @@ -2285,6 +2462,9 @@ public class Server { processMap.put("getImageListPermissionRead", new getImageListPermissionRead()); processMap.put("getImageListPermissionLink", new getImageListPermissionLink()); processMap.put("getLectureList", new getLectureList()); + processMap.put("getLectureListPermissionRead", new getLectureListPermissionRead()); + processMap.put("getLectureListPermissionWrite", new getLectureListPermissionWrite()); + processMap.put("getLectureListPermissionAdmin", new getLectureListPermissionAdmin()); processMap.put("getAllOS", new getAllOS()); processMap.put("getAllUniversities", new getAllUniversities()); processMap.put("getPersonData", new getPersonData()); @@ -2492,6 +2672,66 @@ public class Server { } } + public static class getLectureListPermissionRead<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getLectureListPermissionRead_args> { + public getLectureListPermissionRead() { + super("getLectureListPermissionRead"); + } + + public getLectureListPermissionRead_args getEmptyArgsInstance() { + return new getLectureListPermissionRead_args(); + } + + protected boolean isOneway() { + return false; + } + + public getLectureListPermissionRead_result getResult(I iface, getLectureListPermissionRead_args args) throws org.apache.thrift.TException { + getLectureListPermissionRead_result result = new getLectureListPermissionRead_result(); + result.success = iface.getLectureListPermissionRead(args.userID); + return result; + } + } + + public static class getLectureListPermissionWrite<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getLectureListPermissionWrite_args> { + public getLectureListPermissionWrite() { + super("getLectureListPermissionWrite"); + } + + public getLectureListPermissionWrite_args getEmptyArgsInstance() { + return new getLectureListPermissionWrite_args(); + } + + protected boolean isOneway() { + return false; + } + + public getLectureListPermissionWrite_result getResult(I iface, getLectureListPermissionWrite_args args) throws org.apache.thrift.TException { + getLectureListPermissionWrite_result result = new getLectureListPermissionWrite_result(); + result.success = iface.getLectureListPermissionWrite(args.userID); + return result; + } + } + + public static class getLectureListPermissionAdmin<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getLectureListPermissionAdmin_args> { + public getLectureListPermissionAdmin() { + super("getLectureListPermissionAdmin"); + } + + public getLectureListPermissionAdmin_args getEmptyArgsInstance() { + return new getLectureListPermissionAdmin_args(); + } + + protected boolean isOneway() { + return false; + } + + public getLectureListPermissionAdmin_result getResult(I iface, getLectureListPermissionAdmin_args args) throws org.apache.thrift.TException { + getLectureListPermissionAdmin_result result = new getLectureListPermissionAdmin_result(); + result.success = iface.getLectureListPermissionAdmin(args.userID); + return result; + } + } + public static class getAllOS<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllOS_args> { public getAllOS() { super("getAllOS"); @@ -2967,6 +3207,9 @@ public class Server { processMap.put("getImageListPermissionRead", new getImageListPermissionRead()); processMap.put("getImageListPermissionLink", new getImageListPermissionLink()); processMap.put("getLectureList", new getLectureList()); + processMap.put("getLectureListPermissionRead", new getLectureListPermissionRead()); + processMap.put("getLectureListPermissionWrite", new getLectureListPermissionWrite()); + processMap.put("getLectureListPermissionAdmin", new getLectureListPermissionAdmin()); processMap.put("getAllOS", new getAllOS()); processMap.put("getAllUniversities", new getAllUniversities()); processMap.put("getPersonData", new getPersonData()); @@ -3453,6 +3696,159 @@ public class Server { } } + public static class getLectureListPermissionRead<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getLectureListPermissionRead_args, List<Lecture>> { + public getLectureListPermissionRead() { + super("getLectureListPermissionRead"); + } + + public getLectureListPermissionRead_args getEmptyArgsInstance() { + return new getLectureListPermissionRead_args(); + } + + public AsyncMethodCallback<List<Lecture>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<List<Lecture>>() { + public void onComplete(List<Lecture> o) { + getLectureListPermissionRead_result result = new getLectureListPermissionRead_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getLectureListPermissionRead_result result = new getLectureListPermissionRead_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getLectureListPermissionRead_args args, org.apache.thrift.async.AsyncMethodCallback<List<Lecture>> resultHandler) throws TException { + iface.getLectureListPermissionRead(args.userID,resultHandler); + } + } + + public static class getLectureListPermissionWrite<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getLectureListPermissionWrite_args, List<Lecture>> { + public getLectureListPermissionWrite() { + super("getLectureListPermissionWrite"); + } + + public getLectureListPermissionWrite_args getEmptyArgsInstance() { + return new getLectureListPermissionWrite_args(); + } + + public AsyncMethodCallback<List<Lecture>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<List<Lecture>>() { + public void onComplete(List<Lecture> o) { + getLectureListPermissionWrite_result result = new getLectureListPermissionWrite_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getLectureListPermissionWrite_result result = new getLectureListPermissionWrite_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getLectureListPermissionWrite_args args, org.apache.thrift.async.AsyncMethodCallback<List<Lecture>> resultHandler) throws TException { + iface.getLectureListPermissionWrite(args.userID,resultHandler); + } + } + + public static class getLectureListPermissionAdmin<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getLectureListPermissionAdmin_args, List<Lecture>> { + public getLectureListPermissionAdmin() { + super("getLectureListPermissionAdmin"); + } + + public getLectureListPermissionAdmin_args getEmptyArgsInstance() { + return new getLectureListPermissionAdmin_args(); + } + + public AsyncMethodCallback<List<Lecture>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<List<Lecture>>() { + public void onComplete(List<Lecture> o) { + getLectureListPermissionAdmin_result result = new getLectureListPermissionAdmin_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getLectureListPermissionAdmin_result result = new getLectureListPermissionAdmin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getLectureListPermissionAdmin_args args, org.apache.thrift.async.AsyncMethodCallback<List<Lecture>> resultHandler) throws TException { + iface.getLectureListPermissionAdmin(args.userID,resultHandler); + } + } + public static class getAllOS<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllOS_args, List<String>> { public getAllOS() { super("getAllOS"); @@ -12727,6 +13123,2292 @@ public class Server { } + public static class getLectureListPermissionRead_args implements org.apache.thrift.TBase<getLectureListPermissionRead_args, getLectureListPermissionRead_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureListPermissionRead_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureListPermissionRead_args"); + + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getLectureListPermissionRead_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getLectureListPermissionRead_argsTupleSchemeFactory()); + } + + public String userID; // 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 { + USER_ID((short)1, "userID"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // USER_ID + return USER_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", 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(getLectureListPermissionRead_args.class, metaDataMap); + } + + public getLectureListPermissionRead_args() { + } + + public getLectureListPermissionRead_args( + String userID) + { + this(); + this.userID = userID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getLectureListPermissionRead_args(getLectureListPermissionRead_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } + } + + public getLectureListPermissionRead_args deepCopy() { + return new getLectureListPermissionRead_args(this); + } + + @Override + public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getLectureListPermissionRead_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER_ID: + return getUserID(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER_ID: + return isSetUserID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getLectureListPermissionRead_args) + return this.equals((getLectureListPermissionRead_args)that); + return false; + } + + public boolean equals(getLectureListPermissionRead_args that) { + if (that == null) + return false; + + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getLectureListPermissionRead_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getLectureListPermissionRead_args("); + boolean first = true; + + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getLectureListPermissionRead_argsStandardSchemeFactory implements SchemeFactory { + public getLectureListPermissionRead_argsStandardScheme getScheme() { + return new getLectureListPermissionRead_argsStandardScheme(); + } + } + + private static class getLectureListPermissionRead_argsStandardScheme extends StandardScheme<getLectureListPermissionRead_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getLectureListPermissionRead_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getLectureListPermissionRead_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getLectureListPermissionRead_argsTupleSchemeFactory implements SchemeFactory { + public getLectureListPermissionRead_argsTupleScheme getScheme() { + return new getLectureListPermissionRead_argsTupleScheme(); + } + } + + private static class getLectureListPermissionRead_argsTupleScheme extends TupleScheme<getLectureListPermissionRead_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionRead_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionRead_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + } + } + + } + + public static class getLectureListPermissionRead_result implements org.apache.thrift.TBase<getLectureListPermissionRead_result, getLectureListPermissionRead_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureListPermissionRead_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureListPermissionRead_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getLectureListPermissionRead_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getLectureListPermissionRead_resultTupleSchemeFactory()); + } + + public List<Lecture> success; // 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 { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Lecture.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getLectureListPermissionRead_result.class, metaDataMap); + } + + public getLectureListPermissionRead_result() { + } + + public getLectureListPermissionRead_result( + List<Lecture> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getLectureListPermissionRead_result(getLectureListPermissionRead_result other) { + if (other.isSetSuccess()) { + List<Lecture> __this__success = new ArrayList<Lecture>(other.success.size()); + for (Lecture other_element : other.success) { + __this__success.add(new Lecture(other_element)); + } + this.success = __this__success; + } + } + + public getLectureListPermissionRead_result deepCopy() { + return new getLectureListPermissionRead_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Lecture> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Lecture elem) { + if (this.success == null) { + this.success = new ArrayList<Lecture>(); + } + this.success.add(elem); + } + + public List<Lecture> getSuccess() { + return this.success; + } + + public getLectureListPermissionRead_result setSuccess(List<Lecture> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Lecture>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getLectureListPermissionRead_result) + return this.equals((getLectureListPermissionRead_result)that); + return false; + } + + public boolean equals(getLectureListPermissionRead_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getLectureListPermissionRead_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getLectureListPermissionRead_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getLectureListPermissionRead_resultStandardSchemeFactory implements SchemeFactory { + public getLectureListPermissionRead_resultStandardScheme getScheme() { + return new getLectureListPermissionRead_resultStandardScheme(); + } + } + + private static class getLectureListPermissionRead_resultStandardScheme extends StandardScheme<getLectureListPermissionRead_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getLectureListPermissionRead_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list32.size); + for (int _i33 = 0; _i33 < _list32.size; ++_i33) + { + Lecture _elem34; + _elem34 = new Lecture(); + _elem34.read(iprot); + struct.success.add(_elem34); + } + iprot.readListEnd(); + } + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getLectureListPermissionRead_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Lecture _iter35 : struct.success) + { + _iter35.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getLectureListPermissionRead_resultTupleSchemeFactory implements SchemeFactory { + public getLectureListPermissionRead_resultTupleScheme getScheme() { + return new getLectureListPermissionRead_resultTupleScheme(); + } + } + + private static class getLectureListPermissionRead_resultTupleScheme extends TupleScheme<getLectureListPermissionRead_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionRead_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + { + oprot.writeI32(struct.success.size()); + for (Lecture _iter36 : struct.success) + { + _iter36.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionRead_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list37.size); + for (int _i38 = 0; _i38 < _list37.size; ++_i38) + { + Lecture _elem39; + _elem39 = new Lecture(); + _elem39.read(iprot); + struct.success.add(_elem39); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class getLectureListPermissionWrite_args implements org.apache.thrift.TBase<getLectureListPermissionWrite_args, getLectureListPermissionWrite_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureListPermissionWrite_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureListPermissionWrite_args"); + + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getLectureListPermissionWrite_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getLectureListPermissionWrite_argsTupleSchemeFactory()); + } + + public String userID; // 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 { + USER_ID((short)1, "userID"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // USER_ID + return USER_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", 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(getLectureListPermissionWrite_args.class, metaDataMap); + } + + public getLectureListPermissionWrite_args() { + } + + public getLectureListPermissionWrite_args( + String userID) + { + this(); + this.userID = userID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getLectureListPermissionWrite_args(getLectureListPermissionWrite_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } + } + + public getLectureListPermissionWrite_args deepCopy() { + return new getLectureListPermissionWrite_args(this); + } + + @Override + public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getLectureListPermissionWrite_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER_ID: + return getUserID(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER_ID: + return isSetUserID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getLectureListPermissionWrite_args) + return this.equals((getLectureListPermissionWrite_args)that); + return false; + } + + public boolean equals(getLectureListPermissionWrite_args that) { + if (that == null) + return false; + + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getLectureListPermissionWrite_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getLectureListPermissionWrite_args("); + boolean first = true; + + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getLectureListPermissionWrite_argsStandardSchemeFactory implements SchemeFactory { + public getLectureListPermissionWrite_argsStandardScheme getScheme() { + return new getLectureListPermissionWrite_argsStandardScheme(); + } + } + + private static class getLectureListPermissionWrite_argsStandardScheme extends StandardScheme<getLectureListPermissionWrite_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getLectureListPermissionWrite_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getLectureListPermissionWrite_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getLectureListPermissionWrite_argsTupleSchemeFactory implements SchemeFactory { + public getLectureListPermissionWrite_argsTupleScheme getScheme() { + return new getLectureListPermissionWrite_argsTupleScheme(); + } + } + + private static class getLectureListPermissionWrite_argsTupleScheme extends TupleScheme<getLectureListPermissionWrite_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionWrite_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionWrite_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + } + } + + } + + public static class getLectureListPermissionWrite_result implements org.apache.thrift.TBase<getLectureListPermissionWrite_result, getLectureListPermissionWrite_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureListPermissionWrite_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureListPermissionWrite_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getLectureListPermissionWrite_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getLectureListPermissionWrite_resultTupleSchemeFactory()); + } + + public List<Lecture> success; // 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 { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Lecture.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getLectureListPermissionWrite_result.class, metaDataMap); + } + + public getLectureListPermissionWrite_result() { + } + + public getLectureListPermissionWrite_result( + List<Lecture> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getLectureListPermissionWrite_result(getLectureListPermissionWrite_result other) { + if (other.isSetSuccess()) { + List<Lecture> __this__success = new ArrayList<Lecture>(other.success.size()); + for (Lecture other_element : other.success) { + __this__success.add(new Lecture(other_element)); + } + this.success = __this__success; + } + } + + public getLectureListPermissionWrite_result deepCopy() { + return new getLectureListPermissionWrite_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Lecture> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Lecture elem) { + if (this.success == null) { + this.success = new ArrayList<Lecture>(); + } + this.success.add(elem); + } + + public List<Lecture> getSuccess() { + return this.success; + } + + public getLectureListPermissionWrite_result setSuccess(List<Lecture> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Lecture>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getLectureListPermissionWrite_result) + return this.equals((getLectureListPermissionWrite_result)that); + return false; + } + + public boolean equals(getLectureListPermissionWrite_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getLectureListPermissionWrite_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getLectureListPermissionWrite_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getLectureListPermissionWrite_resultStandardSchemeFactory implements SchemeFactory { + public getLectureListPermissionWrite_resultStandardScheme getScheme() { + return new getLectureListPermissionWrite_resultStandardScheme(); + } + } + + private static class getLectureListPermissionWrite_resultStandardScheme extends StandardScheme<getLectureListPermissionWrite_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getLectureListPermissionWrite_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list40 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list40.size); + for (int _i41 = 0; _i41 < _list40.size; ++_i41) + { + Lecture _elem42; + _elem42 = new Lecture(); + _elem42.read(iprot); + struct.success.add(_elem42); + } + iprot.readListEnd(); + } + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getLectureListPermissionWrite_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Lecture _iter43 : struct.success) + { + _iter43.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getLectureListPermissionWrite_resultTupleSchemeFactory implements SchemeFactory { + public getLectureListPermissionWrite_resultTupleScheme getScheme() { + return new getLectureListPermissionWrite_resultTupleScheme(); + } + } + + private static class getLectureListPermissionWrite_resultTupleScheme extends TupleScheme<getLectureListPermissionWrite_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionWrite_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + { + oprot.writeI32(struct.success.size()); + for (Lecture _iter44 : struct.success) + { + _iter44.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionWrite_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list45.size); + for (int _i46 = 0; _i46 < _list45.size; ++_i46) + { + Lecture _elem47; + _elem47 = new Lecture(); + _elem47.read(iprot); + struct.success.add(_elem47); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class getLectureListPermissionAdmin_args implements org.apache.thrift.TBase<getLectureListPermissionAdmin_args, getLectureListPermissionAdmin_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureListPermissionAdmin_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureListPermissionAdmin_args"); + + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getLectureListPermissionAdmin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getLectureListPermissionAdmin_argsTupleSchemeFactory()); + } + + public String userID; // 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 { + USER_ID((short)1, "userID"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // USER_ID + return USER_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", 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(getLectureListPermissionAdmin_args.class, metaDataMap); + } + + public getLectureListPermissionAdmin_args() { + } + + public getLectureListPermissionAdmin_args( + String userID) + { + this(); + this.userID = userID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getLectureListPermissionAdmin_args(getLectureListPermissionAdmin_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } + } + + public getLectureListPermissionAdmin_args deepCopy() { + return new getLectureListPermissionAdmin_args(this); + } + + @Override + public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getLectureListPermissionAdmin_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER_ID: + return getUserID(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER_ID: + return isSetUserID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getLectureListPermissionAdmin_args) + return this.equals((getLectureListPermissionAdmin_args)that); + return false; + } + + public boolean equals(getLectureListPermissionAdmin_args that) { + if (that == null) + return false; + + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getLectureListPermissionAdmin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getLectureListPermissionAdmin_args("); + boolean first = true; + + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getLectureListPermissionAdmin_argsStandardSchemeFactory implements SchemeFactory { + public getLectureListPermissionAdmin_argsStandardScheme getScheme() { + return new getLectureListPermissionAdmin_argsStandardScheme(); + } + } + + private static class getLectureListPermissionAdmin_argsStandardScheme extends StandardScheme<getLectureListPermissionAdmin_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getLectureListPermissionAdmin_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getLectureListPermissionAdmin_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getLectureListPermissionAdmin_argsTupleSchemeFactory implements SchemeFactory { + public getLectureListPermissionAdmin_argsTupleScheme getScheme() { + return new getLectureListPermissionAdmin_argsTupleScheme(); + } + } + + private static class getLectureListPermissionAdmin_argsTupleScheme extends TupleScheme<getLectureListPermissionAdmin_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionAdmin_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionAdmin_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + } + } + + } + + public static class getLectureListPermissionAdmin_result implements org.apache.thrift.TBase<getLectureListPermissionAdmin_result, getLectureListPermissionAdmin_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureListPermissionAdmin_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureListPermissionAdmin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getLectureListPermissionAdmin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getLectureListPermissionAdmin_resultTupleSchemeFactory()); + } + + public List<Lecture> success; // 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 { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Lecture.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getLectureListPermissionAdmin_result.class, metaDataMap); + } + + public getLectureListPermissionAdmin_result() { + } + + public getLectureListPermissionAdmin_result( + List<Lecture> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getLectureListPermissionAdmin_result(getLectureListPermissionAdmin_result other) { + if (other.isSetSuccess()) { + List<Lecture> __this__success = new ArrayList<Lecture>(other.success.size()); + for (Lecture other_element : other.success) { + __this__success.add(new Lecture(other_element)); + } + this.success = __this__success; + } + } + + public getLectureListPermissionAdmin_result deepCopy() { + return new getLectureListPermissionAdmin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Lecture> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Lecture elem) { + if (this.success == null) { + this.success = new ArrayList<Lecture>(); + } + this.success.add(elem); + } + + public List<Lecture> getSuccess() { + return this.success; + } + + public getLectureListPermissionAdmin_result setSuccess(List<Lecture> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Lecture>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getLectureListPermissionAdmin_result) + return this.equals((getLectureListPermissionAdmin_result)that); + return false; + } + + public boolean equals(getLectureListPermissionAdmin_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getLectureListPermissionAdmin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getLectureListPermissionAdmin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getLectureListPermissionAdmin_resultStandardSchemeFactory implements SchemeFactory { + public getLectureListPermissionAdmin_resultStandardScheme getScheme() { + return new getLectureListPermissionAdmin_resultStandardScheme(); + } + } + + private static class getLectureListPermissionAdmin_resultStandardScheme extends StandardScheme<getLectureListPermissionAdmin_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getLectureListPermissionAdmin_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list48 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list48.size); + for (int _i49 = 0; _i49 < _list48.size; ++_i49) + { + Lecture _elem50; + _elem50 = new Lecture(); + _elem50.read(iprot); + struct.success.add(_elem50); + } + iprot.readListEnd(); + } + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getLectureListPermissionAdmin_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Lecture _iter51 : struct.success) + { + _iter51.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getLectureListPermissionAdmin_resultTupleSchemeFactory implements SchemeFactory { + public getLectureListPermissionAdmin_resultTupleScheme getScheme() { + return new getLectureListPermissionAdmin_resultTupleScheme(); + } + } + + private static class getLectureListPermissionAdmin_resultTupleScheme extends TupleScheme<getLectureListPermissionAdmin_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionAdmin_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + { + oprot.writeI32(struct.success.size()); + for (Lecture _iter52 : struct.success) + { + _iter52.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getLectureListPermissionAdmin_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list53.size); + for (int _i54 = 0; _i54 < _list53.size; ++_i54) + { + Lecture _elem55; + _elem55 = new Lecture(); + _elem55.read(iprot); + struct.success.add(_elem55); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + public static class getAllOS_args implements org.apache.thrift.TBase<getAllOS_args, getAllOS_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllOS_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllOS_args"); @@ -13279,13 +15961,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list32.size); - for (int _i33 = 0; _i33 < _list32.size; ++_i33) + org.apache.thrift.protocol.TList _list56 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list56.size); + for (int _i57 = 0; _i57 < _list56.size; ++_i57) { - String _elem34; - _elem34 = iprot.readString(); - struct.success.add(_elem34); + String _elem58; + _elem58 = iprot.readString(); + struct.success.add(_elem58); } iprot.readListEnd(); } @@ -13313,9 +15995,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter35 : struct.success) + for (String _iter59 : struct.success) { - oprot.writeString(_iter35); + oprot.writeString(_iter59); } oprot.writeListEnd(); } @@ -13346,9 +16028,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter36 : struct.success) + for (String _iter60 : struct.success) { - oprot.writeString(_iter36); + oprot.writeString(_iter60); } } } @@ -13360,13 +16042,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list37.size); - for (int _i38 = 0; _i38 < _list37.size; ++_i38) + org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list61.size); + for (int _i62 = 0; _i62 < _list61.size; ++_i62) { - String _elem39; - _elem39 = iprot.readString(); - struct.success.add(_elem39); + String _elem63; + _elem63 = iprot.readString(); + struct.success.add(_elem63); } } struct.setSuccessIsSet(true); @@ -13928,13 +16610,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list40 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list40.size); - for (int _i41 = 0; _i41 < _list40.size; ++_i41) + org.apache.thrift.protocol.TList _list64 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list64.size); + for (int _i65 = 0; _i65 < _list64.size; ++_i65) { - String _elem42; - _elem42 = iprot.readString(); - struct.success.add(_elem42); + String _elem66; + _elem66 = iprot.readString(); + struct.success.add(_elem66); } iprot.readListEnd(); } @@ -13962,9 +16644,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter43 : struct.success) + for (String _iter67 : struct.success) { - oprot.writeString(_iter43); + oprot.writeString(_iter67); } oprot.writeListEnd(); } @@ -13995,9 +16677,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter44 : struct.success) + for (String _iter68 : struct.success) { - oprot.writeString(_iter44); + oprot.writeString(_iter68); } } } @@ -14009,13 +16691,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list45.size); - for (int _i46 = 0; _i46 < _list45.size; ++_i46) + org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list69.size); + for (int _i70 = 0; _i70 < _list69.size; ++_i70) { - String _elem47; - _elem47 = iprot.readString(); - struct.success.add(_elem47); + String _elem71; + _elem71 = iprot.readString(); + struct.success.add(_elem71); } } struct.setSuccessIsSet(true); @@ -14782,15 +17464,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map48 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map48.size); - for (int _i49 = 0; _i49 < _map48.size; ++_i49) + org.apache.thrift.protocol.TMap _map72 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map72.size); + for (int _i73 = 0; _i73 < _map72.size; ++_i73) { - String _key50; - String _val51; - _key50 = iprot.readString(); - _val51 = iprot.readString(); - struct.success.put(_key50, _val51); + String _key74; + String _val75; + _key74 = iprot.readString(); + _val75 = iprot.readString(); + struct.success.put(_key74, _val75); } iprot.readMapEnd(); } @@ -14818,10 +17500,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter52 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter76 : struct.success.entrySet()) { - oprot.writeString(_iter52.getKey()); - oprot.writeString(_iter52.getValue()); + oprot.writeString(_iter76.getKey()); + oprot.writeString(_iter76.getValue()); } oprot.writeMapEnd(); } @@ -14852,10 +17534,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter53 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter77 : struct.success.entrySet()) { - oprot.writeString(_iter53.getKey()); - oprot.writeString(_iter53.getValue()); + oprot.writeString(_iter77.getKey()); + oprot.writeString(_iter77.getValue()); } } } @@ -14867,15 +17549,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map54 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map54.size); - for (int _i55 = 0; _i55 < _map54.size; ++_i55) + org.apache.thrift.protocol.TMap _map78 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map78.size); + for (int _i79 = 0; _i79 < _map78.size; ++_i79) { - String _key56; - String _val57; - _key56 = iprot.readString(); - _val57 = iprot.readString(); - struct.success.put(_key56, _val57); + String _key80; + String _val81; + _key80 = iprot.readString(); + _val81 = iprot.readString(); + struct.success.put(_key80, _val81); } } struct.setSuccessIsSet(true); @@ -19356,15 +22038,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map58 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map58.size); - for (int _i59 = 0; _i59 < _map58.size; ++_i59) + org.apache.thrift.protocol.TMap _map82 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map82.size); + for (int _i83 = 0; _i83 < _map82.size; ++_i83) { - String _key60; - String _val61; - _key60 = iprot.readString(); - _val61 = iprot.readString(); - struct.success.put(_key60, _val61); + String _key84; + String _val85; + _key84 = iprot.readString(); + _val85 = iprot.readString(); + struct.success.put(_key84, _val85); } iprot.readMapEnd(); } @@ -19392,10 +22074,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter62 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter86 : struct.success.entrySet()) { - oprot.writeString(_iter62.getKey()); - oprot.writeString(_iter62.getValue()); + oprot.writeString(_iter86.getKey()); + oprot.writeString(_iter86.getValue()); } oprot.writeMapEnd(); } @@ -19426,10 +22108,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter63 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter87 : struct.success.entrySet()) { - oprot.writeString(_iter63.getKey()); - oprot.writeString(_iter63.getValue()); + oprot.writeString(_iter87.getKey()); + oprot.writeString(_iter87.getValue()); } } } @@ -19441,15 +22123,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map64 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map64.size); - for (int _i65 = 0; _i65 < _map64.size; ++_i65) + org.apache.thrift.protocol.TMap _map88 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map88.size); + for (int _i89 = 0; _i89 < _map88.size; ++_i89) { - String _key66; - String _val67; - _key66 = iprot.readString(); - _val67 = iprot.readString(); - struct.success.put(_key66, _val67); + String _key90; + String _val91; + _key90 = iprot.readString(); + _val91 = iprot.readString(); + struct.success.put(_key90, _val91); } } struct.setSuccessIsSet(true); @@ -20116,15 +22798,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map68 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map68.size); - for (int _i69 = 0; _i69 < _map68.size; ++_i69) + org.apache.thrift.protocol.TMap _map92 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map92.size); + for (int _i93 = 0; _i93 < _map92.size; ++_i93) { - String _key70; - String _val71; - _key70 = iprot.readString(); - _val71 = iprot.readString(); - struct.success.put(_key70, _val71); + String _key94; + String _val95; + _key94 = iprot.readString(); + _val95 = iprot.readString(); + struct.success.put(_key94, _val95); } iprot.readMapEnd(); } @@ -20152,10 +22834,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter72 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter96 : struct.success.entrySet()) { - oprot.writeString(_iter72.getKey()); - oprot.writeString(_iter72.getValue()); + oprot.writeString(_iter96.getKey()); + oprot.writeString(_iter96.getValue()); } oprot.writeMapEnd(); } @@ -20186,10 +22868,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter73 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter97 : struct.success.entrySet()) { - oprot.writeString(_iter73.getKey()); - oprot.writeString(_iter73.getValue()); + oprot.writeString(_iter97.getKey()); + oprot.writeString(_iter97.getValue()); } } } @@ -20201,15 +22883,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map74 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map74.size); - for (int _i75 = 0; _i75 < _map74.size; ++_i75) + org.apache.thrift.protocol.TMap _map98 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map98.size); + for (int _i99 = 0; _i99 < _map98.size; ++_i99) { - String _key76; - String _val77; - _key76 = iprot.readString(); - _val77 = iprot.readString(); - struct.success.put(_key76, _val77); + String _key100; + String _val101; + _key100 = iprot.readString(); + _val101 = iprot.readString(); + struct.success.put(_key100, _val101); } } struct.setSuccessIsSet(true); @@ -32922,14 +35604,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list78 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list78.size); - for (int _i79 = 0; _i79 < _list78.size; ++_i79) + org.apache.thrift.protocol.TList _list102 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list102.size); + for (int _i103 = 0; _i103 < _list102.size; ++_i103) { - Person _elem80; - _elem80 = new Person(); - _elem80.read(iprot); - struct.success.add(_elem80); + Person _elem104; + _elem104 = new Person(); + _elem104.read(iprot); + struct.success.add(_elem104); } iprot.readListEnd(); } @@ -32957,9 +35639,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter81 : struct.success) + for (Person _iter105 : struct.success) { - _iter81.write(oprot); + _iter105.write(oprot); } oprot.writeListEnd(); } @@ -32990,9 +35672,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter82 : struct.success) + for (Person _iter106 : struct.success) { - _iter82.write(oprot); + _iter106.write(oprot); } } } @@ -33004,14 +35686,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list83 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list83.size); - for (int _i84 = 0; _i84 < _list83.size; ++_i84) + org.apache.thrift.protocol.TList _list107 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list107.size); + for (int _i108 = 0; _i108 < _list107.size; ++_i108) { - Person _elem85; - _elem85 = new Person(); - _elem85.read(iprot); - struct.success.add(_elem85); + Person _elem109; + _elem109 = new Person(); + _elem109.read(iprot); + struct.success.add(_elem109); } } struct.setSuccessIsSet(true); @@ -34972,14 +37654,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list86 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list86.size); - for (int _i87 = 0; _i87 < _list86.size; ++_i87) + org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list110.size); + for (int _i111 = 0; _i111 < _list110.size; ++_i111) { - Person _elem88; - _elem88 = new Person(); - _elem88.read(iprot); - struct.success.add(_elem88); + Person _elem112; + _elem112 = new Person(); + _elem112.read(iprot); + struct.success.add(_elem112); } iprot.readListEnd(); } @@ -35007,9 +37689,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter89 : struct.success) + for (Person _iter113 : struct.success) { - _iter89.write(oprot); + _iter113.write(oprot); } oprot.writeListEnd(); } @@ -35040,9 +37722,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter90 : struct.success) + for (Person _iter114 : struct.success) { - _iter90.write(oprot); + _iter114.write(oprot); } } } @@ -35054,14 +37736,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list91 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list91.size); - for (int _i92 = 0; _i92 < _list91.size; ++_i92) + org.apache.thrift.protocol.TList _list115 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list115.size); + for (int _i116 = 0; _i116 < _list115.size; ++_i116) { - Person _elem93; - _elem93 = new Person(); - _elem93.read(iprot); - struct.success.add(_elem93); + Person _elem117; + _elem117 = new Person(); + _elem117.read(iprot); + struct.success.add(_elem117); } } struct.setSuccessIsSet(true); diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 7b58fa06..99b4219f 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -22,8 +22,6 @@ import server.generated.Image; import server.generated.Lecture;
import server.generated.Person;
-
-
public class SQL {
private static Logger log = Logger.getLogger(BinaryListener.class);
@@ -37,10 +35,12 @@ public class SQL { e.printStackTrace();
}
try {
- Connection con = DriverManager
- .getConnection("jdbc:mysql://"+Configuration.config.getSql_connection()+"?user="+Configuration.config.getSql_user()+"&password="+Configuration.config.getSql_pass()+"");
+ Connection con = DriverManager.getConnection("jdbc:mysql://"
+ + Configuration.config.getSql_connection() + "?user="
+ + Configuration.config.getSql_user() + "&password="
+ + Configuration.config.getSql_pass() + "");
con.setAutoCommit(false);
-
+
return con;
} catch (SQLException e) {
// TODO Auto-generated catch block
@@ -53,7 +53,7 @@ public class SQL { public int writeFTPUser(String user, String pass) {
Statement stm;
try {
- Connection con=getConnection();
+ Connection con = getConnection();
stm = con.createStatement();
int ret = stm
@@ -61,7 +61,9 @@ public class SQL { + user
+ "',SHA1('"
+ pass
- + "'),'10001','12345','"+Configuration.config.getAbsolute_path()+"temp/');");
+ + "'),'10001','12345','"
+ + Configuration.config.getAbsolute_path()
+ + "temp/');");
con.commit();
con.close();
log.info(new Date() + " - created FTPUser " + user + " : " + pass
@@ -78,7 +80,7 @@ public class SQL { public int DeleteUser(String user) {
Statement stm;
try {
- Connection con=getConnection();
+ Connection con = getConnection();
stm = con.createStatement();
int ret = stm
@@ -98,13 +100,13 @@ public class SQL { public ResultSet getImage() {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet rs=stm
+ ResultSet rs = stm
.executeQuery("SELECT image_name FROM bwLehrpool.m_VLData_imageInfo;");
con.close();
- return rs;
-
+ return rs;
+
} catch (SQLException e) {
// TODO Auto-generated catch block
log.info(new Date() + " - Failed to getImage.");
@@ -114,21 +116,20 @@ public class SQL { return null;
}
- public String getPathOfImage(String image_id,
- String version) {
+ public String getPathOfImage(String image_id, String version) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet rs=stm
+ ResultSet rs = stm
.executeQuery("SELECT image_path FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID='"
+ image_id
+ "' and imageVersion='"
+ version
+ "';");
rs.first();
- String path=rs.getString("image_path");
+ String path = rs.getString("image_path");
con.close();
- return path;
+ return path;
} catch (SQLException e) {
// TODO Auto-generated catch block
@@ -141,15 +142,15 @@ public class SQL { public String setInstitution(String university) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet ret = stm
.executeQuery("SELECT * FROM bwLehrpool.m_institution where name like'"
+ university + "';");
-
+
if (ret.next() == false) {
-
+
String id = UUID.randomUUID().toString();
stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_institution`(`institutionID`,`name`)VALUES('"
+ id + "','" + university + "');");
@@ -158,12 +159,12 @@ public class SQL { .executeQuery("SELECT institutionID FROM bwLehrpool.m_institution WHERE name like '"
+ university + "';");
rs.next();
- String institution=rs.getString("institutionID");
+ String institution = rs.getString("institutionID");
con.close();
-
+
return institution;
} else {
- String institution=ret.getString("institutionID");
+ String institution = ret.getString("institutionID");
con.close();
return institution;
}
@@ -176,11 +177,11 @@ public class SQL { return "-1";
}
- public String setPerson(String login, String lastname,
- String firstname, String mail, Date lastlogin, String Institution) {
+ public String setPerson(String login, String lastname, String firstname,
+ String mail, Date lastlogin, String Institution) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet ret = stm
@@ -189,10 +190,10 @@ public class SQL { + "' and Vorname like '"
+ firstname
+ "';");
-
+
if (ret.next() == false) {
-
- //String id = UUID.randomUUID().toString();
+
+ // String id = UUID.randomUUID().toString();
stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_user`(`userID`,`loginName`,`nachname`,`vorname`,`mail`,`lastLogin`,`institution`)VALUES('"
+ login
+ "','"
@@ -216,12 +217,12 @@ public class SQL { + firstname
+ "';");
rs.next();
- String userid=rs.getString("userID");
+ String userid = rs.getString("userID");
con.close();
return userid;
} else {
ret.first();
- String userid=ret.getString("userID");
+ String userid = ret.getString("userID");
con.close();
return userid;
}
@@ -235,8 +236,9 @@ public class SQL { }
public boolean setImageData(String pk_person, boolean license,
- boolean internet, long cpu, long ram, String imagename,String desc,
- String imagePath, long filesize, String shareMode, String pk_os) {
+ boolean internet, long cpu, long ram, String imagename,
+ String desc, String imagePath, long filesize, String shareMode,
+ String pk_os) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -250,18 +252,20 @@ public class SQL { }
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- //create a UUID
+ // create a UUID
String uid = UUID.randomUUID().toString();
-
- log.info(" - Query is: "+"INSERT INTO `bwLehrpool`.`m_VLData_imageInfo`(`GUID_imageID`,`imageVersion`,`image_name`,`image_description`,`image_path`,`image_lastCall`,`image_create_time`,`image_update_time`,`image_owner`,`image_change_by`,`rec_create_time`,`rec_change_time`,`rec_owner`,`rec_change_by`,`content_operatingSystem`,`status_isCompressed`,`status_isSecure`,`status_isOptimzed`,`status_isValid`,`status_isReady`,`status_isDeleted`,`status_isLastOfficialVersion`,`cond_hasLicenseRestriction`,`cond_hasInternetRestriction`,`cond_minRAM`,`cond_minCPUs`,`image_isTemplate`,`image_filesize`,`image_syncMode`)VALUES('"
+
+ log.info(" - Query is: "
+ + "INSERT INTO `bwLehrpool`.`m_VLData_imageInfo`(`GUID_imageID`,`imageVersion`,`image_name`,`image_description`,`image_path`,`image_lastCall`,`image_create_time`,`image_update_time`,`image_owner`,`image_change_by`,`rec_create_time`,`rec_change_time`,`rec_owner`,`rec_change_by`,`content_operatingSystem`,`status_isCompressed`,`status_isSecure`,`status_isOptimzed`,`status_isValid`,`status_isReady`,`status_isDeleted`,`status_isLastOfficialVersion`,`cond_hasLicenseRestriction`,`cond_hasInternetRestriction`,`cond_minRAM`,`cond_minCPUs`,`image_isTemplate`,`image_filesize`,`image_syncMode`)VALUES('"
+ uid // GUID_imageID
+ "',1,'" // imageVersion
+ imagename // image_name
- // Ticket #1144 ist hier zu lösen, desc sollte nicht zu lang sein, sonst merkert die DB
- + "','" +desc //image_description
+ // Ticket #1144 ist hier zu lösen, desc sollte nicht zu lang
+ // sein, sonst merkert die DB
+ + "','" + desc // image_description
+ "','" + imagePath // image_path
+ "','" + formatter.format(new Date()) // image_lastCall
+ "','" + formatter.format(new Date()) // image_create_time
@@ -284,17 +288,18 @@ public class SQL { + "','" + internet_bol // cond_hasInternetRestriction
+ "','" + ram // cond_minRAM
+ "','" + cpu // cond_minCPUs
- + "','0'" //image_isTemplate
- + ",'" + filesize //image_filesize
- + "','" + shareMode //shareMode
+ + "','0'" // image_isTemplate
+ + ",'" + filesize // image_filesize
+ + "','" + shareMode // shareMode
+ "');");
-
+
stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_VLData_imageInfo`(`GUID_imageID`,`imageVersion`,`image_name`,`image_description`,`image_path`,`image_lastCall`,`image_create_time`,`image_update_time`,`image_owner`,`image_change_by`,`rec_create_time`,`rec_change_time`,`rec_owner`,`rec_change_by`,`content_operatingSystem`,`status_isCompressed`,`status_isSecure`,`status_isOptimzed`,`status_isValid`,`status_isReady`,`status_isDeleted`,`status_isLastOfficialVersion`,`cond_hasLicenseRestriction`,`cond_hasInternetRestriction`,`cond_minRAM`,`cond_minCPUs`,`image_isTemplate`,`image_filesize`,`image_syncMode`)VALUES('"
+ uid // GUID_imageID
+ "',1,'" // imageVersion
+ imagename // image_name
- // Ticket #1144 ist hier zu lösen, desc sollte nicht zu lang sein, sonst merkert die DB
- + "','" +desc //image_description
+ // Ticket #1144 ist hier zu lösen, desc sollte nicht zu lang
+ // sein, sonst merkert die DB
+ + "','" + desc // image_description
+ "','" + imagePath // image_path
+ "','" + formatter.format(new Date()) // image_lastCall
+ "','" + formatter.format(new Date()) // image_create_time
@@ -317,9 +322,9 @@ public class SQL { + "','" + internet_bol // cond_hasInternetRestriction
+ "','" + ram // cond_minRAM
+ "','" + cpu // cond_minCPUs
- + "','0'" //image_isTemplate
- + ",'" + filesize //image_filesize
- + "','" + shareMode //shareMode
+ + "','0'" // image_isTemplate
+ + ",'" + filesize // image_filesize
+ + "','" + shareMode // shareMode
+ "');");
con.commit();
con.close();
@@ -333,106 +338,216 @@ public class SQL { }
public List<Image> getImageListPermissionWrite(String userID) {
-
- Connection con=getConnection();
- Statement stm;
-
- List<Image> list = new ArrayList<Image>();
- try {
-
- stm = con.createStatement();
-
- //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='"+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")));
- }
- con.close();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return list;
+
+ Connection con = getConnection();
+ Statement stm;
+
+ List<Image> list = new ArrayList<Image>();
+ try {
+
+ stm = con.createStatement();
+
+ // 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='"
+ + 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")));
+ }
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
}
-
-
+
public List<Image> getImageListPermissionRead(String userID) {
-
- Connection con=getConnection();
+
+ Connection con = getConnection();
Statement stm;
-
+
List<Image> list = new ArrayList<Image>();
try {
stm = con.createStatement();
- //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='"+userID+"' AND u.userID = pmi.userID AND pmi.image_read = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
-
+ // 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='"
+ + userID
+ + "' AND u.userID = pmi.userID AND pmi.image_read = 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")));
+ }
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
return list;
}
-
-
-public List<Image> getImageListPermissionLink(String userID) {
-
- Connection con=getConnection();
+
+ public List<Image> getImageListPermissionLink(String userID) {
+
+ Connection con = getConnection();
Statement stm;
-
+
List<Image> list = new ArrayList<Image>();
try {
stm = con.createStatement();
- //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='"+userID+"' AND u.userID = pmi.userID AND pmi.link_allowed = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
-
+ // 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='"
+ + userID
+ + "' AND u.userID = pmi.userID AND pmi.link_allowed = 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")));
+ }
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
return list;
}
+
+ public List<Lecture> getLectureListPermissionRead(String userID) {
+ List<Lecture> list = new ArrayList<Lecture>();
+
+ try {
+ Connection con = getConnection();
+ Statement stm = con.createStatement();
+ ResultSet res = stm
+ .executeQuery("SELECT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ + "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
+ + "WHERE i.GUID_imageID=l.imageID AND pml.rec_read=true AND u.userID=pml.userID AND u.userID='"+userID+";");
+ while (res.next()) {
+
+ list.add(new Lecture(res.getString("lectureID"), res
+ .getString("name"), res.getString("isActive"), res
+ .getString("startTime"), res.getString("endTime"), res
+ .getString("lastUsed"), res.getString("description"),
+ res.getString("image_name"), res.getString("user")));
+
+ }
+ con.close();
+ return list;
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getLectureListPermissionRead.");
+ e.printStackTrace();
+ }
+ return list;
+ }//end getLectureListPermissionRead
+
+
+ public List<Lecture> getLectureListPermissionWrite(String userID) {
+ List<Lecture> list = new ArrayList<Lecture>();
+
+ try {
+ Connection con = getConnection();
+ Statement stm = con.createStatement();
+ ResultSet res = stm
+ .executeQuery("SELECT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ + "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
+ + "WHERE i.GUID_imageID=l.imageID AND pml.rec_write=true AND u.userID=pml.userID AND u.userID='"+userID+";");
+ while (res.next()) {
+
+ list.add(new Lecture(res.getString("lectureID"), res
+ .getString("name"), res.getString("isActive"), res
+ .getString("startTime"), res.getString("endTime"), res
+ .getString("lastUsed"), res.getString("description"),
+ res.getString("image_name"), res.getString("user")));
+
+ }
+ con.close();
+ return list;
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getLectureListPermissionWrite.");
+ e.printStackTrace();
+ }
+ return list;
+ }//end getLectureListPermissionWrite
+ public List<Lecture> getLectureListPermissionAdmin(String userID) {
+ List<Lecture> list = new ArrayList<Lecture>();
+
+ try {
+ Connection con = getConnection();
+ Statement stm = con.createStatement();
+ ResultSet res = stm
+ .executeQuery("SELECT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ + "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
+ + "WHERE i.GUID_imageID=l.imageID AND pml.rec_admin=true AND u.userID=pml.userID AND u.userID='"+userID+";");
+ while (res.next()) {
+
+ list.add(new Lecture(res.getString("lectureID"), res
+ .getString("name"), res.getString("isActive"), res
+ .getString("startTime"), res.getString("endTime"), res
+ .getString("lastUsed"), res.getString("description"),
+ res.getString("image_name"), res.getString("user")));
+
+ }
+ con.close();
+ return list;
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to getLectureListPermissionAdmin.");
+ e.printStackTrace();
+ }
+ return list;
+ }//end getLectureListPermissionAdmin
+
public List<Lecture> getLectureList() {
List<Lecture> list = new ArrayList<Lecture>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet res=stm
+ ResultSet res = stm
.executeQuery("SELECT l.lectureID, l.name, l.isActive,l.startTime,l.endTime,l.lastUsed,l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.m_user u where i.GUID_imageID=l.imageID and l.admin_owner=u.userID;");
while (res.next()) {
@@ -456,15 +571,16 @@ public List<Image> getImageListPermissionLink(String userID) { public List<String> getAllOS() {
List<String> list = new ArrayList<>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet rs=stm
+ ResultSet rs = stm
.executeQuery("SELECT name, architecture FROM bwLehrpool.m_operatingSystem;");
while (rs.next()) {
- list.add(rs.getString("name")+" "+rs.getString("architecture")+" bit");
+ list.add(rs.getString("name") + " "
+ + rs.getString("architecture") + " bit");
}
return list;
-
+
} catch (SQLException e) {
// TODO Auto-generated catch block
log.info(new Date() + " - Failed to getAllOS.");
@@ -475,13 +591,12 @@ public List<Image> getImageListPermissionLink(String userID) { }
- public Map<String,String> getPersonData(String Vorname,
- String Nachname) {
+ public Map<String, String> getPersonData(String Vorname, String Nachname) {
Map<String, String> map = new HashMap<String, String>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet rs= stm
+ ResultSet rs = stm
.executeQuery("SELECT u.Nachname, u.Vorname, u.mail, i.name FROM bwLehrpool.m_user u, bwLehrpool.m_institution i where u.Nachname like '"
+ Nachname
+ "' and u.Vorname like '"
@@ -516,9 +631,9 @@ public List<Image> getImageListPermissionLink(String userID) { active_bol = 1;
}
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
-
+
String uid = UUID.randomUUID().toString();
stm.executeUpdate("INSERT INTO `bwLehrpool`.`m_VLData_lecture`(`lectureID`,`name`,`isActive`,`startTime`,`endTime`,`lastUsed`,`shortDescription`,`description`,`imageID`,`imageVersion`,`admin_createTime`,`admin_changeTime`,`admin_owner`,`admin_change_by`)VALUES('"
+ uid
@@ -559,17 +674,18 @@ public List<Image> getImageListPermissionLink(String userID) { }
- public Map<String,String> getImageIDandVersion(String name) {
+ public Map<String, String> getImageIDandVersion(String name) {
Map<String, String> map = new HashMap<String, String>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet image= stm
+ ResultSet image = stm
.executeQuery("SELECT GUID_imageID, imageVersion FROM bwLehrpool.m_VLData_imageInfo where image_name like '"
+ name + "';");
while (image.next()) {
map.put("GUID", image.getString("GUID_imageID"));
- map.put("version", String.valueOf(image.getString("imageVersion")));
+ map.put("version",
+ String.valueOf(image.getString("imageVersion")));
}
con.close();
@@ -582,13 +698,14 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
- public Map<String,String> getImageData(String id, String version) {
+ public Map<String, String> getImageData(String id, String version) {
Map<String, String> map = new HashMap<String, String>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet data=stm
- .executeQuery("SELECT u.mail, i.GUID_imageID, i.imageVersion, i.image_name,i.image_description,i.image_update_time,i.cond_hasInternetRestriction,i.cond_hasLicenseRestriction, i.cond_minCPUs,i.cond_minRAM, i.image_syncMode,i.image_filesize,i.image_path, i.image_isTemplate,os.GuestOS, concat(u.Nachname,' ',u.Vorname) as Owner FROM bwLehrpool.m_VLData_imageInfo i,bwLehrpool.m_user u,bwLehrpool.m_operatingSystem os where i.image_owner=u.userID and i.content_operatingSystem=os.operatingSystemID and GUID_imageID = '" + id + "' and imageVersion = '" + version + "' ;");
+ ResultSet data = stm
+ .executeQuery("SELECT u.mail, i.GUID_imageID, i.imageVersion, i.image_name,i.image_description,i.image_update_time,i.cond_hasInternetRestriction,i.cond_hasLicenseRestriction, i.cond_minCPUs,i.cond_minRAM, i.image_syncMode,i.image_filesize,i.image_path, i.image_isTemplate,os.GuestOS, concat(u.Nachname,' ',u.Vorname) as Owner FROM bwLehrpool.m_VLData_imageInfo i,bwLehrpool.m_user u,bwLehrpool.m_operatingSystem os where i.image_owner=u.userID and i.content_operatingSystem=os.operatingSystemID and GUID_imageID = '"
+ + id + "' and imageVersion = '" + version + "' ;");
while (data.next()) {
map.put("name", data.getString("image_name"));
map.put("internet",
@@ -600,7 +717,7 @@ public List<Image> getImageListPermissionLink(String userID) { map.put("filesize", data.getString("image_filesize"));
map.put("path", data.getString("image_path"));
map.put("template", data.getString("image_isTemplate"));
- map.put("os",data.getString("GuestOS"));
+ map.put("os", data.getString("GuestOS"));
map.put("owner", data.getString("Owner"));
map.put("lastupdate", data.getString("image_update_time"));
map.put("desc", data.getString("image_description"));
@@ -619,11 +736,12 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
- public int UpdateImageData(String name, String newName,String desc,String image_path,
- boolean license, boolean internet, long cpu, long ram, String id,
- String version, boolean isTemplate, long filesize, String shareMode,String ospk) {
+ public int UpdateImageData(String name, String newName, String desc,
+ String image_path, boolean license, boolean internet, long cpu,
+ long ram, String id, String version, boolean isTemplate,
+ long filesize, String shareMode, String ospk) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Statement stm = con.createStatement();
int newVersion = Integer.parseInt(version) + 1;
@@ -636,43 +754,30 @@ public List<Image> getImageListPermissionLink(String userID) { if (license == true) {
license_bol = 1;
}
- log.info(new Date() + " - 'image_name` = '" + newName+ "\n length of name="+newName.length());
-
+ log.info(new Date() + " - 'image_name` = '" + newName
+ + "\n length of name=" + newName.length());
+
log.info("now in UpdateImageData()");
log.info("UPDATE bwLehrpool.m_VLData_imageInfo SET imageVersion = "
- + newVersion
- + ",image_name = '"
- + newName
- + "',`image_description` = '"
- + desc
- + "',`image_path` = '"
- + image_path
- + "',`image_update_time` = '"
+ + newVersion + ",image_name = '" + newName
+ + "',`image_description` = '" + desc + "',`image_path` = '"
+ + image_path + "',`image_update_time` = '"
+ + formatter.format(new Date()) + "',`rec_change_time` = '"
+ formatter.format(new Date())
- + "',`rec_change_time` = '"
- + formatter.format(new Date())
- + "',`cond_hasLicenseRestriction` = '"
- + license_bol
- + "',`cond_hasInternetRestriction` = '"
- + internet_bol
+ + "',`cond_hasLicenseRestriction` = '" + license_bol
+ + "',`cond_hasInternetRestriction` = '" + internet_bol
+ "',`cond_minRAM` = '"
+ ram
+ "',`cond_minCPUs` = '"
+ cpu
+ "',`image_isTemplate` = '"
- //+ isTemplate
- + "0'"
- + ",`content_operatingSystem` = "
- + ospk
- + ",`image_filesize` = "
- + filesize
- + ",`image_syncMode` = '"
- + shareMode
- + "' WHERE GUID_imageID = '"
- + id
- + "' AND imageVersion = " + version + ";");
-
-
+ // + isTemplate
+ + "0'" + ",`content_operatingSystem` = " + ospk
+ + ",`image_filesize` = " + filesize
+ + ",`image_syncMode` = '" + shareMode
+ + "' WHERE GUID_imageID = '" + id + "' AND imageVersion = "
+ + version + ";");
+
stm.executeUpdate("UPDATE bwLehrpool.m_VLData_imageInfo SET imageVersion = "
+ newVersion
+ ",image_name = '"
@@ -694,7 +799,7 @@ public List<Image> getImageListPermissionLink(String userID) { + "',`cond_minCPUs` = '"
+ cpu
+ "',`image_isTemplate` = '"
- //+ isTemplate
+ // + isTemplate
+ "0'"
+ "',`content_operatingSystem` = "
+ ospk
@@ -704,8 +809,9 @@ public List<Image> getImageListPermissionLink(String userID) { + shareMode
+ " WHERE GUID_imageID = '"
+ id
- + "' AND imageVersion = " + version + ";");
-
+ + "' AND imageVersion = "
+ + version + ";");
+
con.commit();
con.close();
return 0;
@@ -720,7 +826,7 @@ public List<Image> getImageListPermissionLink(String userID) { public boolean deleteImage(String id, String version) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '"
@@ -739,10 +845,9 @@ public List<Image> getImageListPermissionLink(String userID) { return false;
}
- public int updateLectureData(String pk_image,
- String imageversion, String name, String newName, String desc,
- String shortdesc, String start, String end, boolean isactive,
- String id) {
+ public int updateLectureData(String pk_image, String imageversion,
+ String name, String newName, String desc, String shortdesc,
+ String start, String end, boolean isactive, String id) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
int active_bol = 0;
@@ -751,7 +856,7 @@ public List<Image> getImageListPermissionLink(String userID) { active_bol = 1;
}
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
stm.executeUpdate("UPDATE `bwLehrpool`.`m_VLData_lecture` SET `name` = '"
+ newName
@@ -787,13 +892,13 @@ public List<Image> getImageListPermissionLink(String userID) { public boolean connectedToLecture(String id, String version) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery("SELECT lectureID FROM "
+ "bwLehrpool.m_VLData_lecture WHERE imageID = '" + id
+ "' AND imageVersion = '" + version + "';");
- boolean ret=rs.first();
+ boolean ret = rs.first();
con.close();
return ret;
@@ -811,11 +916,11 @@ public List<Image> getImageListPermissionLink(String userID) { public boolean deleteLecture(String id) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_lecture WHERE lectureID = '"
+ id + "';");
-
+
con.commit();
con.close();
return true;
@@ -831,7 +936,7 @@ public List<Image> getImageListPermissionLink(String userID) { public String getFile(String imageid, String imageversion) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm
@@ -841,7 +946,7 @@ public List<Image> getImageListPermissionLink(String userID) { + imageversion
+ "';");
rs.next();
- String path=rs.getString("image_path");
+ String path = rs.getString("image_path");
con.close();
return path;
@@ -854,10 +959,10 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
- public Map<String,String> getDeleteXMLData(String id) {
+ public Map<String, String> getDeleteXMLData(String id) {
Map<String, String> map = new HashMap<String, String>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm
@@ -867,7 +972,6 @@ public List<Image> getImageListPermissionLink(String userID) { map.put("date", rs.getString("admin_createTime").replace(" ", "")
.replace("-", "").replace(":", ""));
map.put("name", rs.getString("name"));
-
con.close();
return map;
@@ -880,22 +984,24 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
-
+
public int UpdateImagePath(String name) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- String image_path="prod/"+name;
-
- log.info(new Date() + " - Updating ImagePath with: UPDATE `bwLehrpool`.`m_VLData_imageInfo` SET `image_path` = '"
- + image_path
- + "' WHERE `image_path` = '"
- + "temp/"+name + "';");
-
+ String image_path = "prod/" + name;
+
+ log.info(new Date()
+ + " - Updating ImagePath with: UPDATE `bwLehrpool`.`m_VLData_imageInfo` SET `image_path` = '"
+ + image_path + "' WHERE `image_path` = '" + "temp/" + name
+ + "';");
+
stm.executeUpdate("UPDATE `bwLehrpool`.`m_VLData_imageInfo` SET `image_path` = '"
+ image_path
+ "' WHERE `image_path` = '"
- + "temp/"+name + "';");
+ + "temp/"
+ + name
+ + "';");
con.commit();
con.close();
return 0;
@@ -906,19 +1012,19 @@ public List<Image> getImageListPermissionLink(String userID) { }
return -1;
}
-
+
public List<String> getAllUniversities() {
List<String> list = new ArrayList<>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet rs=stm
+ ResultSet rs = stm
.executeQuery("SELECT name FROM bwLehrpool.m_institution;");
while (rs.next()) {
list.add(rs.getString("name"));
}
return list;
-
+
} catch (SQLException e) {
// TODO Auto-generated catch block
log.info(new Date() + " - Failed to getAllUniversities.");
@@ -928,24 +1034,24 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
-
- public String getOSpk(String os,
- String architecture) {
+
+ public String getOSpk(String os, String architecture) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- log.info(new Date() + " - Getting PrimaryKey for OS: "+os+" architecture: "+architecture);
- ResultSet rs=stm
+ log.info(new Date() + " - Getting PrimaryKey for 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");
- log.info(new Date() + " - Key is "+pkos);
+ String pkos = rs.getString("operatingSystemID");
+ log.info(new Date() + " - Key is " + pkos);
con.close();
- return pkos;
+ return pkos;
} catch (SQLException e) {
// TODO Auto-generated catch block
@@ -955,20 +1061,21 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
-
+
public String getOS(String pk) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- //log.info(new Date() + " - OS: "+os+" architecture: "+architecture);
- ResultSet rs=stm
+ // log.info(new Date() +
+ // " - OS: "+os+" architecture: "+architecture);
+ ResultSet rs = stm
.executeQuery("SELECT name,architecture FROM bwLehrpool.m_operatingSystem where operatingSystemID = '"
- + pk
- + "';");
+ + pk + "';");
rs.first();
- String os=rs.getString("name")+" "+rs.getString("architecture");
+ String os = rs.getString("name") + " "
+ + rs.getString("architecture");
con.close();
- return os;
+ return os;
} catch (SQLException e) {
// TODO Auto-generated catch block
@@ -978,18 +1085,18 @@ public List<Image> getImageListPermissionLink(String userID) { return null;
}
-
- public Map<String,String> getLectureData(String id) {
+
+ public Map<String, String> getLectureData(String id) {
Map<String, String> map = new HashMap<String, String>();
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet data=stm
- .executeQuery("select l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_path, l.imageVersion, concat(u.Nachname,' ',u.Vorname) as owner from m_VLData_lecture l, m_user u, m_VLData_imageInfo i where l.admin_owner=u.userID and l.imageID=i.GUID_imageID and lectureID= '" + id + "' ;");
+ ResultSet data = stm
+ .executeQuery("select l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_path, l.imageVersion, concat(u.Nachname,' ',u.Vorname) as owner from m_VLData_lecture l, m_user u, m_VLData_imageInfo i where l.admin_owner=u.userID and l.imageID=i.GUID_imageID and lectureID= '"
+ + id + "' ;");
while (data.next()) {
map.put("name", data.getString("name"));
- map.put("isActive",
- data.getString("isActive"));
+ map.put("isActive", data.getString("isActive"));
map.put("startTime", data.getString("startTime"));
map.put("endTime", data.getString("endTime"));
map.put("lastUsed", data.getString("lastUsed"));
@@ -1008,42 +1115,42 @@ public List<Image> getImageListPermissionLink(String userID) { }
return null;
}
-
+
public boolean checkUser(String username) {
Statement stm;
- boolean ret=false;
+ boolean ret = false;
try {
- Connection con=getConnection();
+ Connection con = getConnection();
stm = con.createStatement();
- ResultSet rs=stm.executeQuery("Select * from m_user where loginName like '"+username+"'");
- if(rs.next())
- {
- ret=true;
- log.info(new Date() + " - User " + rs.getString("loginName") + " exist.");
- }
- else{
- ret=false;
- log.info(new Date() + " - User " + rs.getString("loginName") + " not exist.");
+ ResultSet rs = stm
+ .executeQuery("Select * from m_user where loginName like '"
+ + username + "'");
+ if (rs.next()) {
+ ret = true;
+ log.info(new Date() + " - User " + rs.getString("loginName")
+ + " exist.");
+ } else {
+ ret = false;
+ log.info(new Date() + " - User " + rs.getString("loginName")
+ + " not exist.");
}
con.close();
-
-
+
} catch (SQLException e) {
// TODO Auto-generated catch block
-
+
e.printStackTrace();
}
return ret;
}
-
- public int setImageRights(String pk_person, String pk_image,int role ,int read, int write,int linkallowed, int admin) {
-
+ public int setImageRights(String pk_person, String pk_image, int role,
+ int read, int write, int linkallowed, int admin) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
-
+
String uid = UUID.randomUUID().toString();
stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_image`(`GUID`,`GUID_imageID`,`roleID`,`userID`,`image_read`,`image_write`,`image_admin`,`link_allowed`)VALUES('"
+ uid
@@ -1060,7 +1167,7 @@ public List<Image> getImageListPermissionLink(String userID) { + "','"
+ admin
+ "','"
- + linkallowed+ "');");
+ + linkallowed + "');");
con.commit();
con.close();
} catch (SQLException e) {
@@ -1071,18 +1178,19 @@ public List<Image> getImageListPermissionLink(String userID) { return 0;
}
+
public int getRoleID(String role) {
-
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
-
- ResultSet rs=stm
- .executeQuery("SELECT roleID FROM bwLehrpool.m_role where name like '"+ role+ "';");
+
+ ResultSet rs = stm
+ .executeQuery("SELECT roleID FROM bwLehrpool.m_role where name like '"
+ + role + "';");
rs.first();
- return rs.getInt("roleID");
+ return rs.getInt("roleID");
} catch (SQLException e) {
// TODO Auto-generated catch block
@@ -1091,14 +1199,14 @@ public List<Image> getImageListPermissionLink(String userID) { }
return -1;
}
- public int setLectureRights(String pk_person, String pk_lecture,int role ,int read, int write, int changePermission, int admin) {
-
+ public int setLectureRights(String pk_person, String pk_lecture, int role,
+ int read, int write, int changePermission, int admin) {
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
-
+
String uid = UUID.randomUUID().toString();
stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_lecture`(`GUID`,`lectureID`,`roleID`,`userID`,`rec_read`,`rec_write`,`rec_admin`,`rec_changePermission`)VALUES('"
+ uid
@@ -1114,8 +1222,7 @@ public List<Image> getImageListPermissionLink(String userID) { + write
+ "','"
+ admin
- + "','"
- + changePermission+ "');");
+ + "','" + changePermission + "');");
con.commit();
con.close();
} catch (SQLException e) {
@@ -1126,17 +1233,18 @@ public List<Image> getImageListPermissionLink(String userID) { return 0;
}
+
public String getLectureID(String name) {
- String id=null;
+ String id = null;
try {
- Connection con=getConnection();
+ Connection con = getConnection();
Statement stm = con.createStatement();
- ResultSet lecture= stm
+ ResultSet lecture = stm
.executeQuery("SELECT lectureID FROM bwLehrpool.m_VLData_lecture where name like '"
+ name + "';");
while (lecture.next()) {
- id=lecture.getString("lectureID");
-
+ id = lecture.getString("lectureID");
+
}
con.close();
return id;
@@ -1147,16 +1255,16 @@ public List<Image> getImageListPermissionLink(String userID) { }
return id;
}
-
- //get all users from satellite -- temp, tb replaced by allUsers bwLehrpool
- //does -NOT- return the user himself
- public List<Person> getAllOtherSatelliteUsers(String userID){
- Connection con=getConnection();
- Statement stm=null;
+
+ // get all users from satellite -- temp, tb replaced by allUsers bwLehrpool
+ // does -NOT- return the user himself
+ public List<Person> getAllOtherSatelliteUsers(String userID) {
+ Connection con = getConnection();
+ Statement stm = null;
ResultSet res = null;
List<Person> list = new ArrayList<Person>();
-
+
try {
stm = con.createStatement();
} catch (SQLException e) {
@@ -1164,34 +1272,38 @@ public List<Image> getImageListPermissionLink(String userID) { e.printStackTrace();
}
try {
- res = stm.executeQuery("SELECT userID, Nachname, Vorname FROM m_user WHERE userID !='"+userID+"' ORDER BY Nachname ASC;");
+ res = stm
+ .executeQuery("SELECT userID, Nachname, Vorname FROM m_user WHERE userID !='"
+ + userID + "' ORDER BY Nachname ASC;");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
while (res.next()) {
- //fill the list with users - permissions are all false because the image is new
- list.add(new Person(res.getString("userID"),
- res.getString("Nachname"),
- res.getString("Vorname"), false, false, false, false, false, false, false));
+ // fill the list with users - permissions are all false because
+ // the image is new
+ list.add(new Person(res.getString("userID"), res
+ .getString("Nachname"), res.getString("Vorname"),
+ false, false, false, false, false, false, false));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
- }//end getAllOtherSatelliteUsers()
-
-
- // get the permissions of an image for all other registered users -EXCEPT- the logged on user
- public List<Person> getPermissionForUserAndImage(String userID, String imageID){
- Connection con=getConnection();
- Statement stm=null;
+ }// end getAllOtherSatelliteUsers()
+
+ // get the permissions of an image for all other registered users -EXCEPT-
+ // the logged on user
+ public List<Person> getPermissionForUserAndImage(String userID,
+ String imageID) {
+ Connection con = getConnection();
+ Statement stm = null;
ResultSet res = null;
List<Person> list = new ArrayList<Person>();
-
+
try {
stm = con.createStatement();
} catch (SQLException e) {
@@ -1199,72 +1311,72 @@ public List<Image> getImageListPermissionLink(String userID) { e.printStackTrace();
}
try {
- res = stm.executeQuery("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"+userID+"' AND pmi.GUID_imageID='"+imageID+"' AND pmi.userID=u.userID AND pmi.image_write=1 ORDER BY u.Nachname ASC;");
- System.out.println("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"+userID+"' AND pmi.GUID_imageID='"+imageID+"' AND pmi.userID=u.userID AND pmi.image_write=1 ORDER BY u.Nachname ASC;");
+ res = stm
+ .executeQuery("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"
+ + userID
+ + "' AND pmi.GUID_imageID='"
+ + imageID
+ + "' AND pmi.userID=u.userID ORDER BY u.Nachname ASC;");
+ System.out
+ .println("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"
+ + userID
+ + "' AND pmi.GUID_imageID='"
+ + imageID
+ + "' AND pmi.userID=u.userID ORDER BY u.Nachname ASC;");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
- boolean image_read,image_write,link_allowed, image_admin, lecture_read, lecture_write, lecture_admin;
-
+ boolean image_read, image_write, link_allowed, image_admin, lecture_read, lecture_write, lecture_admin;
+
while (res.next()) {
- //reset old values and set the correct new values
+ // reset old values and set the correct new values
image_read = false;
image_write = false;
- link_allowed=false;
- image_admin=false;
- lecture_read=false;
- lecture_write=false;
- lecture_admin=false;
-
- if(Integer.parseInt(res.getString("image_read")) != 0){
+ link_allowed = false;
+ image_admin = false;
+ lecture_read = false;
+ lecture_write = false;
+ lecture_admin = false;
+
+ if (Integer.parseInt(res.getString("image_read")) != 0) {
image_read = true;
}
- if(Integer.parseInt(res.getString("image_write")) != 0){
- image_write=true;
+ if (Integer.parseInt(res.getString("image_write")) != 0) {
+ image_write = true;
}
- if(Integer.parseInt(res.getString("link_allowed")) != 0){
- link_allowed=true;
+ if (Integer.parseInt(res.getString("link_allowed")) != 0) {
+ link_allowed = true;
}
- if(Integer.parseInt(res.getString("image_admin")) != 0 ){
- image_admin=true;
+ if (Integer.parseInt(res.getString("image_admin")) != 0) {
+ image_admin = true;
}
-
- //fill the list with users - permissions are all false because the image is new
- list.add(new Person(res.getString("userID"),
- res.getString("Nachname"),
- res.getString("Vorname"),
- //Boolean.parseBoolean(Integer.parseInt(res.getString("image_read"))),
- image_read,
- image_write,
- link_allowed,
- image_admin,
- false, //lecture_read
- false, //lecture_write
- false) //lecture_admin
+
+ // fill the list with users - permissions are all false because
+ // the image is new
+ list.add(new Person(res.getString("userID"), res
+ .getString("Nachname"), res.getString("Vorname"),
+ // Boolean.parseBoolean(Integer.parseInt(res.getString("image_read"))),
+ image_read, image_write, link_allowed, image_admin,
+ false, // lecture_read
+ false, // lecture_write
+ false) // lecture_admin
);
- //System.out.println(res.getString("Nachname")+" "+Boolean.parseBoolean(res.getString("image_read"))+" "+Boolean.parseBoolean(res.getString("image_write"))+" "+Boolean.parseBoolean(res.getString("image_admin")));
+ // System.out.println(res.getString("Nachname")+" "+Boolean.parseBoolean(res.getString("image_read"))+" "+Boolean.parseBoolean(res.getString("image_write"))+" "+Boolean.parseBoolean(res.getString("image_admin")));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
- }//end getPermissionFOrUserAndImage()
-
-
-
-
-
-
-
-
- public boolean updateImagePermissions(){
- boolean success=true;
-
- Connection con=getConnection();
- Statement stm=null;
+ }// end getPermissionFOrUserAndImage()
+
+ public boolean updateImagePermissions() {
+ boolean success = true;
+
+ Connection con = getConnection();
+ Statement stm = null;
try {
stm = con.createStatement();
stm.executeQuery("");
@@ -1272,15 +1384,15 @@ public List<Image> getImageListPermissionLink(String userID) { // TODO Auto-generated catch block
e.printStackTrace();
}
-
+
return success;
}// end setImagePermissions()
-
- public boolean deleteImagePermissions(){
- boolean success=true;
-
- Connection con=getConnection();
- Statement stm=null;
+
+ public boolean deleteImagePermissions() {
+ boolean success = true;
+
+ Connection con = getConnection();
+ Statement stm = null;
try {
stm = con.createStatement();
stm.executeQuery("");
@@ -1288,59 +1400,37 @@ public List<Image> getImageListPermissionLink(String userID) { // TODO Auto-generated catch block
e.printStackTrace();
}
-
+
return success;
}// end setImagePermissions()
-
- public boolean writeAdditionalImageRights(String imageID, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin){
- boolean success= true;
-
+
+ public boolean writeAdditionalImageRights(String imageID, String userID,
+ boolean isRead, boolean isWrite, boolean isLinkAllowed,
+ boolean isAdmin) {
+ boolean success = true;
+
String uid = UUID.randomUUID().toString();
- Connection con=getConnection();
- Statement stm=null;
-
+ Connection con = getConnection();
+ Statement stm = null;
+
try {
- stm=con.createStatement();
-
- log.info(new Date() + " - INSERT INTO pm_VLData_image (" +
- "GUID, " +
- "GUID_imageID, " +
- "roleID, " +
- "userID, " +
- "image_read, " +
- "image_write, " +
- "Image_admin, " +
- "link_allowed)" +
- "VALUES(" +
- "'"+uid+"'," +
- "'"+imageID+"'," +
- "1," +
- "'"+userID+"'," +
- isRead+"," +
- isWrite+"," +
- isLinkAllowed+"," +
- isAdmin+"" +
- ")");
-
- stm.executeUpdate("INSERT INTO pm_VLData_image (" +
- "GUID, " +
- "GUID_imageID, " +
- "roleID, " +
- "userID, " +
- "image_read, " +
- "image_write, " +
- "Image_admin, " +
- "link_allowed)" +
- "VALUES(" +
- "'"+uid+"'," +
- "'"+imageID+"'," +
- "1," +
- "'"+userID+"'," +
- isRead+"," +
- isWrite+"," +
- isLinkAllowed+"," +
- isAdmin+"" +
- ");");
+ stm = con.createStatement();
+
+ log.info(new Date() + " - INSERT INTO pm_VLData_image (" + "GUID, "
+ + "GUID_imageID, " + "roleID, " + "userID, "
+ + "image_read, " + "image_write, " + "Image_admin, "
+ + "link_allowed)" + "VALUES(" + "'" + uid + "'," + "'"
+ + imageID + "'," + "1," + "'" + userID + "'," + isRead
+ + "," + isWrite + "," + isLinkAllowed + "," + isAdmin + ""
+ + ")");
+
+ stm.executeUpdate("INSERT INTO pm_VLData_image (" + "GUID, "
+ + "GUID_imageID, " + "roleID, " + "userID, "
+ + "image_read, " + "image_write, " + "Image_admin, "
+ + "link_allowed)" + "VALUES(" + "'" + uid + "'," + "'"
+ + imageID + "'," + "1," + "'" + userID + "'," + isRead
+ + "," + isWrite + "," + isLinkAllowed + "," + isAdmin + ""
+ + ");");
con.commit();
con.close();
log.info(new Date() + " - Written additional image rights.");
@@ -1349,27 +1439,27 @@ public List<Image> getImageListPermissionLink(String userID) { e.printStackTrace();
log.info(new Date() + " - Failed to write additional image rights.");
}
-
-
+
return success;
-
- }// end
- public void deleteAllAdditionalImagePermissions(String imageID,String userID)
- {
- Connection con=getConnection();
+ }// end
+
+ public void deleteAllAdditionalImagePermissions(String imageID,
+ String userID) {
+ Connection con = getConnection();
Statement stm = null;
-
-
- try {
-
- stm = con.createStatement();
- int ret = stm.executeUpdate("DELETE FROM pm_VLData_image WHERE GUID_imageID = '" + imageID + "' AND userID != '" + userID + "';");
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+
+ try {
+
+ stm = con.createStatement();
+ int ret = stm
+ .executeUpdate("DELETE FROM pm_VLData_image WHERE GUID_imageID = '"
+ + imageID + "' AND userID != '" + userID + "';");
+
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
-
-}//end class
+
+}// end class
|
