summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Spitzer2014-08-25 09:56:04 +0200
committerTobias Spitzer2014-08-25 09:56:04 +0200
commit5559990807740a5bdd10dbacfe390e07987a7a33 (patch)
treecdac47008e24b2516efdacbb3342624898c00dbc
parentModel für Rechte hinzugefügt (diff)
downloadtutor-module-5559990807740a5bdd10dbacfe390e07987a7a33.tar.gz
tutor-module-5559990807740a5bdd10dbacfe390e07987a7a33.tar.xz
tutor-module-5559990807740a5bdd10dbacfe390e07987a7a33.zip
CheckExist
-rw-r--r--Dozentenmodul/bin/gui/image/DeleteImage_GUI.classbin16836 -> 16839 bytes
-rw-r--r--Dozentenmodul/bin/gui/image/SearchEditImage_GUI.classbin16981 -> 16984 bytes
-rw-r--r--Dozentenmodul/bin/gui/image/SearchImage_GUI.classbin16757 -> 16760 bytes
-rw-r--r--Dozentenmodul/bin/gui/intro/Login_GUI.classbin10578 -> 10853 bytes
-rw-r--r--Dozentenmodul/src/gui/intro/Login_GUI.java6
-rw-r--r--Dozentenmodul/src/models/LectureRights.java37
-rw-r--r--Dozentenmodulserver/bin/server/Server$getLectureData_args$getLectureData_argsTupleScheme.classbin2139 -> 2139 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$getLectureData_result$_Fields.classbin3040 -> 3040 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$getPersonData_args$_Fields.classbin3096 -> 3096 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$getPersonData_result$_Fields.classbin3030 -> 3030 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$startFileCopy_args$startFileCopy_argsTupleSchemeFactory.classbin1138 -> 1138 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$startFileCopy_args.classbin9460 -> 9460 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$startFileCopy_result$_Fields.classbin3030 -> 3030 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$updateImageData_args.classbin25783 -> 25783 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$updateImageData_result$_Fields.classbin3050 -> 3050 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$updateImageData_result.classbin9798 -> 9798 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$writeLecturedata_args$writeLecturedata_argsTupleSchemeFactory.classbin1186 -> 1186 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$writeLecturedata_args.classbin25807 -> 25807 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$writeLecturedata_result$_Fields.classbin3060 -> 3060 bytes
-rw-r--r--Dozentenmodulserver/bin/server/Server$writeVLdata_args.classbin30564 -> 30564 bytes
-rw-r--r--Dozentenmodulserver/bin/sql/SQL.classbin26078 -> 26628 bytes
-rw-r--r--Dozentenmodulserver/src/server/Server.java842
-rw-r--r--Dozentenmodulserver/src/server/ServerHandler.java8
-rw-r--r--Dozentenmodulserver/src/sql/SQL.java27
-rw-r--r--Dozentenmodulserver/thrift/server.thrift1
25 files changed, 921 insertions, 0 deletions
diff --git a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class
index a15ca0fe..18b00f77 100644
--- a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class
+++ b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class
Binary files differ
diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class
index 0a129b98..8051fcb8 100644
--- a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class
+++ b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class
Binary files differ
diff --git a/Dozentenmodul/bin/gui/image/SearchImage_GUI.class b/Dozentenmodul/bin/gui/image/SearchImage_GUI.class
index d59c5e1b..8173d4ba 100644
--- a/Dozentenmodul/bin/gui/image/SearchImage_GUI.class
+++ b/Dozentenmodul/bin/gui/image/SearchImage_GUI.class
Binary files differ
diff --git a/Dozentenmodul/bin/gui/intro/Login_GUI.class b/Dozentenmodul/bin/gui/intro/Login_GUI.class
index 5f91f8a2..883df8b1 100644
--- a/Dozentenmodul/bin/gui/intro/Login_GUI.class
+++ b/Dozentenmodul/bin/gui/intro/Login_GUI.class
Binary files differ
diff --git a/Dozentenmodul/src/gui/intro/Login_GUI.java b/Dozentenmodul/src/gui/intro/Login_GUI.java
index f93d700d..316f7b7c 100644
--- a/Dozentenmodul/src/gui/intro/Login_GUI.java
+++ b/Dozentenmodul/src/gui/intro/Login_GUI.java
@@ -295,6 +295,12 @@ public class Login_GUI extends JFrame {
person.verantwortlicher.setVorname(user.firstName);
person.verantwortlicher.setEMail(user.eMail);
person.verantwortlicher.setHochschule(hochschule);
+
+ //Rechte anlegen bzw. checken ob user existiert wenn nicht anlegen
+ if(SessionData.session.getRole().equals("Student")){
+ boolean ret=bwClient.checkUser(person.verantwortlicher.getUsername());
+ System.out.println("User exist: "+ret);
+ }
try {
// Lege config File an und entscheide welches Fenster
diff --git a/Dozentenmodul/src/models/LectureRights.java b/Dozentenmodul/src/models/LectureRights.java
new file mode 100644
index 00000000..c136141f
--- /dev/null
+++ b/Dozentenmodul/src/models/LectureRights.java
@@ -0,0 +1,37 @@
+package models;
+
+public class LectureRights {
+ private int recRead;
+ private int recWrite;
+ private int recChangePermission;
+ private int recAdmin;
+
+ public static LectureRights rights =new LectureRights();
+
+ public int getRecRead() {
+ return recRead;
+ }
+ public void setRecRead(int recRead) {
+ this.recRead = recRead;
+ }
+ public int getRecWrite() {
+ return recWrite;
+ }
+ public void setRecWrite(int recWrite) {
+ this.recWrite = recWrite;
+ }
+ public int getRecChangePermission() {
+ return recChangePermission;
+ }
+ public void setRecChangePermission(int recChangePermission) {
+ this.recChangePermission = recChangePermission;
+ }
+ public int getRecAdmin() {
+ return recAdmin;
+ }
+ public void setRecAdmin(int recAdmin) {
+ this.recAdmin = recAdmin;
+ }
+
+
+}
diff --git a/Dozentenmodulserver/bin/server/Server$getLectureData_args$getLectureData_argsTupleScheme.class b/Dozentenmodulserver/bin/server/Server$getLectureData_args$getLectureData_argsTupleScheme.class
index 60544e6a..f53bda5c 100644
--- a/Dozentenmodulserver/bin/server/Server$getLectureData_args$getLectureData_argsTupleScheme.class
+++ b/Dozentenmodulserver/bin/server/Server$getLectureData_args$getLectureData_argsTupleScheme.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$getLectureData_result$_Fields.class b/Dozentenmodulserver/bin/server/Server$getLectureData_result$_Fields.class
index 0f177c60..b7a97cbe 100644
--- a/Dozentenmodulserver/bin/server/Server$getLectureData_result$_Fields.class
+++ b/Dozentenmodulserver/bin/server/Server$getLectureData_result$_Fields.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$getPersonData_args$_Fields.class b/Dozentenmodulserver/bin/server/Server$getPersonData_args$_Fields.class
index dde9b3e7..1bfa2f37 100644
--- a/Dozentenmodulserver/bin/server/Server$getPersonData_args$_Fields.class
+++ b/Dozentenmodulserver/bin/server/Server$getPersonData_args$_Fields.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$getPersonData_result$_Fields.class b/Dozentenmodulserver/bin/server/Server$getPersonData_result$_Fields.class
index 82f49d2e..c7072aa6 100644
--- a/Dozentenmodulserver/bin/server/Server$getPersonData_result$_Fields.class
+++ b/Dozentenmodulserver/bin/server/Server$getPersonData_result$_Fields.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$startFileCopy_args$startFileCopy_argsTupleSchemeFactory.class b/Dozentenmodulserver/bin/server/Server$startFileCopy_args$startFileCopy_argsTupleSchemeFactory.class
index a0412d98..86ec4c25 100644
--- a/Dozentenmodulserver/bin/server/Server$startFileCopy_args$startFileCopy_argsTupleSchemeFactory.class
+++ b/Dozentenmodulserver/bin/server/Server$startFileCopy_args$startFileCopy_argsTupleSchemeFactory.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$startFileCopy_args.class b/Dozentenmodulserver/bin/server/Server$startFileCopy_args.class
index 3a31e4b6..111b548e 100644
--- a/Dozentenmodulserver/bin/server/Server$startFileCopy_args.class
+++ b/Dozentenmodulserver/bin/server/Server$startFileCopy_args.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$startFileCopy_result$_Fields.class b/Dozentenmodulserver/bin/server/Server$startFileCopy_result$_Fields.class
index 99e6378f..0c1c5adf 100644
--- a/Dozentenmodulserver/bin/server/Server$startFileCopy_result$_Fields.class
+++ b/Dozentenmodulserver/bin/server/Server$startFileCopy_result$_Fields.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$updateImageData_args.class b/Dozentenmodulserver/bin/server/Server$updateImageData_args.class
index 916c3f40..8b2b685f 100644
--- a/Dozentenmodulserver/bin/server/Server$updateImageData_args.class
+++ b/Dozentenmodulserver/bin/server/Server$updateImageData_args.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$updateImageData_result$_Fields.class b/Dozentenmodulserver/bin/server/Server$updateImageData_result$_Fields.class
index 05bc2843..d72cc254 100644
--- a/Dozentenmodulserver/bin/server/Server$updateImageData_result$_Fields.class
+++ b/Dozentenmodulserver/bin/server/Server$updateImageData_result$_Fields.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$updateImageData_result.class b/Dozentenmodulserver/bin/server/Server$updateImageData_result.class
index dbc041c3..67fe7810 100644
--- a/Dozentenmodulserver/bin/server/Server$updateImageData_result.class
+++ b/Dozentenmodulserver/bin/server/Server$updateImageData_result.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$writeLecturedata_args$writeLecturedata_argsTupleSchemeFactory.class b/Dozentenmodulserver/bin/server/Server$writeLecturedata_args$writeLecturedata_argsTupleSchemeFactory.class
index 4278abfb..13103810 100644
--- a/Dozentenmodulserver/bin/server/Server$writeLecturedata_args$writeLecturedata_argsTupleSchemeFactory.class
+++ b/Dozentenmodulserver/bin/server/Server$writeLecturedata_args$writeLecturedata_argsTupleSchemeFactory.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$writeLecturedata_args.class b/Dozentenmodulserver/bin/server/Server$writeLecturedata_args.class
index df8469a4..dc2cd8d4 100644
--- a/Dozentenmodulserver/bin/server/Server$writeLecturedata_args.class
+++ b/Dozentenmodulserver/bin/server/Server$writeLecturedata_args.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$writeLecturedata_result$_Fields.class b/Dozentenmodulserver/bin/server/Server$writeLecturedata_result$_Fields.class
index 55cbb3c0..4d671e3f 100644
--- a/Dozentenmodulserver/bin/server/Server$writeLecturedata_result$_Fields.class
+++ b/Dozentenmodulserver/bin/server/Server$writeLecturedata_result$_Fields.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/server/Server$writeVLdata_args.class b/Dozentenmodulserver/bin/server/Server$writeVLdata_args.class
index 714b534b..908aa944 100644
--- a/Dozentenmodulserver/bin/server/Server$writeVLdata_args.class
+++ b/Dozentenmodulserver/bin/server/Server$writeVLdata_args.class
Binary files differ
diff --git a/Dozentenmodulserver/bin/sql/SQL.class b/Dozentenmodulserver/bin/sql/SQL.class
index 3d436d78..899f8594 100644
--- a/Dozentenmodulserver/bin/sql/SQL.class
+++ b/Dozentenmodulserver/bin/sql/SQL.class
Binary files differ
diff --git a/Dozentenmodulserver/src/server/Server.java b/Dozentenmodulserver/src/server/Server.java
index d61101e8..a9f8a753 100644
--- a/Dozentenmodulserver/src/server/Server.java
+++ b/Dozentenmodulserver/src/server/Server.java
@@ -74,6 +74,8 @@ public class Server {
public boolean deleteLecture(String id, String hs, String user) throws org.apache.thrift.TException;
+ public boolean checkUser(String username) throws org.apache.thrift.TException;
+
}
public interface AsyncIface {
@@ -116,6 +118,8 @@ public class Server {
public void deleteLecture(String id, String hs, String user, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void checkUser(String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -637,6 +641,29 @@ public class Server {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "deleteLecture failed: unknown result");
}
+ public boolean checkUser(String username) throws org.apache.thrift.TException
+ {
+ send_checkUser(username);
+ return recv_checkUser();
+ }
+
+ public void send_checkUser(String username) throws org.apache.thrift.TException
+ {
+ checkUser_args args = new checkUser_args();
+ args.setUsername(username);
+ sendBase("checkUser", args);
+ }
+
+ public boolean recv_checkUser() throws org.apache.thrift.TException
+ {
+ checkUser_result result = new checkUser_result();
+ receiveBase(result, "checkUser");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkUser failed: unknown result");
+ }
+
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
@@ -1449,6 +1476,38 @@ public class Server {
}
}
+ public void checkUser(String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ checkUser_call method_call = new checkUser_call(username, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class checkUser_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String username;
+ public checkUser_call(String username, 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.username = username;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("checkUser", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ checkUser_args args = new checkUser_args();
+ args.setUsername(username);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public boolean 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_checkUser();
+ }
+ }
+
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -1481,6 +1540,7 @@ public class Server {
processMap.put("deleteImageServer", new deleteImageServer());
processMap.put("connectedToLecture", new connectedToLecture());
processMap.put("deleteLecture", new deleteLecture());
+ processMap.put("checkUser", new checkUser());
return processMap;
}
@@ -1874,6 +1934,27 @@ public class Server {
}
}
+ public static class checkUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, checkUser_args> {
+ public checkUser() {
+ super("checkUser");
+ }
+
+ public checkUser_args getEmptyArgsInstance() {
+ return new checkUser_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public checkUser_result getResult(I iface, checkUser_args args) throws org.apache.thrift.TException {
+ checkUser_result result = new checkUser_result();
+ result.success = iface.checkUser(args.username);
+ result.setSuccessIsSet(true);
+ return result;
+ }
+ }
+
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@@ -1906,6 +1987,7 @@ public class Server {
processMap.put("deleteImageServer", new deleteImageServer());
processMap.put("connectedToLecture", new connectedToLecture());
processMap.put("deleteLecture", new deleteLecture());
+ processMap.put("checkUser", new checkUser());
return processMap;
}
@@ -2888,6 +2970,58 @@ public class Server {
}
}
+ public static class checkUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, checkUser_args, Boolean> {
+ public checkUser() {
+ super("checkUser");
+ }
+
+ public checkUser_args getEmptyArgsInstance() {
+ return new checkUser_args();
+ }
+
+ public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Boolean>() {
+ public void onComplete(Boolean o) {
+ checkUser_result result = new checkUser_result();
+ result.success = o;
+ result.setSuccessIsSet(true);
+ 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;
+ checkUser_result result = new checkUser_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, checkUser_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
+ iface.checkUser(args.username,resultHandler);
+ }
+ }
+
}
public static class getFtpUser_args implements org.apache.thrift.TBase<getFtpUser_args, getFtpUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<getFtpUser_args> {
@@ -22789,4 +22923,712 @@ public class Server {
}
+ public static class checkUser_args implements org.apache.thrift.TBase<checkUser_args, checkUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<checkUser_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkUser_args");
+
+ private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", 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 checkUser_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new checkUser_argsTupleSchemeFactory());
+ }
+
+ public String username; // 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 {
+ USERNAME((short)-1, "username");
+
+ 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: // USERNAME
+ return USERNAME;
+ 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.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", 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(checkUser_args.class, metaDataMap);
+ }
+
+ public checkUser_args() {
+ }
+
+ public checkUser_args(
+ String username)
+ {
+ this();
+ this.username = username;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public checkUser_args(checkUser_args other) {
+ if (other.isSetUsername()) {
+ this.username = other.username;
+ }
+ }
+
+ public checkUser_args deepCopy() {
+ return new checkUser_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.username = null;
+ }
+
+ public String getUsername() {
+ return this.username;
+ }
+
+ public checkUser_args setUsername(String username) {
+ this.username = username;
+ return this;
+ }
+
+ public void unsetUsername() {
+ this.username = null;
+ }
+
+ /** Returns true if field username is set (has been assigned a value) and false otherwise */
+ public boolean isSetUsername() {
+ return this.username != null;
+ }
+
+ public void setUsernameIsSet(boolean value) {
+ if (!value) {
+ this.username = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case USERNAME:
+ if (value == null) {
+ unsetUsername();
+ } else {
+ setUsername((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case USERNAME:
+ return getUsername();
+
+ }
+ 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 USERNAME:
+ return isSetUsername();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof checkUser_args)
+ return this.equals((checkUser_args)that);
+ return false;
+ }
+
+ public boolean equals(checkUser_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_username = true && this.isSetUsername();
+ boolean that_present_username = true && that.isSetUsername();
+ if (this_present_username || that_present_username) {
+ if (!(this_present_username && that_present_username))
+ return false;
+ if (!this.username.equals(that.username))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(checkUser_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUsername()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+ 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("checkUser_args(");
+ boolean first = true;
+
+ sb.append("username:");
+ if (this.username == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.username);
+ }
+ 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 checkUser_argsStandardSchemeFactory implements SchemeFactory {
+ public checkUser_argsStandardScheme getScheme() {
+ return new checkUser_argsStandardScheme();
+ }
+ }
+
+ private static class checkUser_argsStandardScheme extends StandardScheme<checkUser_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, checkUser_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: // USERNAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.username = iprot.readString();
+ struct.setUsernameIsSet(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, checkUser_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.username != null) {
+ oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+ oprot.writeString(struct.username);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class checkUser_argsTupleSchemeFactory implements SchemeFactory {
+ public checkUser_argsTupleScheme getScheme() {
+ return new checkUser_argsTupleScheme();
+ }
+ }
+
+ private static class checkUser_argsTupleScheme extends TupleScheme<checkUser_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, checkUser_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetUsername()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetUsername()) {
+ oprot.writeString(struct.username);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, checkUser_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.username = iprot.readString();
+ struct.setUsernameIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class checkUser_result implements org.apache.thrift.TBase<checkUser_result, checkUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<checkUser_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkUser_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new checkUser_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new checkUser_resultTupleSchemeFactory());
+ }
+
+ public boolean 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
+ private static final int __SUCCESS_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ 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.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(checkUser_result.class, metaDataMap);
+ }
+
+ public checkUser_result() {
+ }
+
+ public checkUser_result(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public checkUser_result(checkUser_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public checkUser_result deepCopy() {
+ return new checkUser_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public checkUser_result setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ return this;
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ }
+ 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 checkUser_result)
+ return this.equals((checkUser_result)that);
+ return false;
+ }
+
+ public boolean equals(checkUser_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(checkUser_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("checkUser_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ 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 {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ 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 checkUser_resultStandardSchemeFactory implements SchemeFactory {
+ public checkUser_resultStandardScheme getScheme() {
+ return new checkUser_resultStandardScheme();
+ }
+ }
+
+ private static class checkUser_resultStandardScheme extends StandardScheme<checkUser_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, checkUser_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.BOOL) {
+ struct.success = iprot.readBool();
+ 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, checkUser_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class checkUser_resultTupleSchemeFactory implements SchemeFactory {
+ public checkUser_resultTupleScheme getScheme() {
+ return new checkUser_resultTupleScheme();
+ }
+ }
+
+ private static class checkUser_resultTupleScheme extends TupleScheme<checkUser_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, checkUser_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.writeBool(struct.success);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, checkUser_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
}
diff --git a/Dozentenmodulserver/src/server/ServerHandler.java b/Dozentenmodulserver/src/server/ServerHandler.java
index 12985219..be8d430d 100644
--- a/Dozentenmodulserver/src/server/ServerHandler.java
+++ b/Dozentenmodulserver/src/server/ServerHandler.java
@@ -423,6 +423,8 @@ public class ServerHandler implements Server.Iface {
}
+
+
public static int nthIndexOf(final String string, final String token,
final int index)
{
@@ -436,4 +438,10 @@ public class ServerHandler implements Server.Iface {
return j;
}
+
+ @Override
+ public boolean checkUser(String username) throws TException {
+ return sql.checkUser(username);
+
+ }
}
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java
index a60cef59..3ba59923 100644
--- a/Dozentenmodulserver/src/sql/SQL.java
+++ b/Dozentenmodulserver/src/sql/SQL.java
@@ -867,4 +867,31 @@ public class SQL {
}
return null;
}
+
+ public boolean checkUser(String username) {
+ Statement stm;
+ boolean ret=false;
+ try {
+ 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.");
+ }
+ con.close();
+
+
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+
+ e.printStackTrace();
+ }
+ return ret;
+ }
}
diff --git a/Dozentenmodulserver/thrift/server.thrift b/Dozentenmodulserver/thrift/server.thrift
index dfd2b2d1..0665c978 100644
--- a/Dozentenmodulserver/thrift/server.thrift
+++ b/Dozentenmodulserver/thrift/server.thrift
@@ -54,4 +54,5 @@ service Server{
bool deleteImageServer(string id, string version),
bool connectedToLecture(string id, string version),
bool deleteLecture(string id, string hs, string user),
+ bool checkUser(string username),
} \ No newline at end of file