summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wilson2014-11-21 14:08:53 +0100
committerMichael Wilson2014-11-21 14:08:53 +0100
commit7675cf0b3f9e0cb7805a008684ba620aaa5b1fc1 (patch)
tree702f828bffa0722c0d8ce79f2c5ac0f84491331d
parentFixed Bug: no new user possible --> query changed (diff)
downloadtutor-module-7675cf0b3f9e0cb7805a008684ba620aaa5b1fc1.tar.gz
tutor-module-7675cf0b3f9e0cb7805a008684ba620aaa5b1fc1.tar.xz
tutor-module-7675cf0b3f9e0cb7805a008684ba620aaa5b1fc1.zip
• Only allow permission changes for users who are authorized to do so
-rw-r--r--dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java31
-rw-r--r--dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java42
-rw-r--r--dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java6
-rw-r--r--dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java29
-rw-r--r--dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java25
-rw-r--r--dozentenmodulserver/src/main/java/server/ServerHandler.java26
-rw-r--r--dozentenmodulserver/src/main/java/server/generated/Server.java1892
-rw-r--r--dozentenmodulserver/src/main/java/sql/SQL.java52
-rw-r--r--dozentenmodulserver/thrift/server.thrift2
9 files changed, 2073 insertions, 32 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java b/dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java
index 2b21bd04..f9701a0c 100644
--- a/dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java
@@ -38,10 +38,10 @@ import javax.swing.border.TitledBorder;
import server.generated.Server.Client;
import thrift.ThriftConnection;
-import util.GuiOrganizer;
import util.OpenLinks;
import models.Image;
import models.Links;
+import models.person;
import javax.swing.JComboBox;
@@ -348,20 +348,27 @@ public class EditImageTechnisch_GUI extends JFrame {
Image.image.setInternet(chckbxIsInternetBlocked.isSelected());
Image.image.setLicensed(chckbxIsLicensed.isSelected());
Image.image.setOS(comboBox.getSelectedItem().toString());
+
- //System.out.println("OS bei Klick auf Weiter: "+Image.image.getOS());
+ LOGGER.info("user is '"+person.verantwortlicher.getUserID()+"' and imageID is '"+Image.image.getImageId()+"'.");
- //LOGGER.info("OS: " + Image.image.getOS() +
- // ", Vorlage: " + Image.image.isVorlage() +
- // ", Lizenzpflichtig: " + Image.image.isLicensed() +
- // ", Internetsperre: " + Image.image.isInternet() +
- // ", CPU: " + Image.image.getCpu() +
- // ", RAM: " + Image.image.getRam());
- // oeffnet das naechste Fenster
- PermissionEditImage_GUI ea=new PermissionEditImage_GUI(c);
- ea.setVisible(true);
- dispose();
+ try {
+ //check if user may change permissions and choose window
+ if(client.userIsImageAdmin(person.verantwortlicher.getUserID(),Image.image.getImageId()) == true){
+ //user has permission, go to permission GUI
+ PermissionEditImage_GUI ea=new PermissionEditImage_GUI(c);
+ ea.setVisible(true);
+ dispose();
+ } else {
+ // user does not have permission, go straight to upload GUI
+ FTPEditUploader_GUI ea = new FTPEditUploader_GUI(c);
+ ea.setVisible(true);
+ dispose();
+ }
+ } catch (TException e1) {
+ e1.printStackTrace();
+ }
}
});
diff --git a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java
index d0a42e4b..415e3dee 100644
--- a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java
@@ -453,10 +453,24 @@ public class FTPEditUploader_GUI extends JFrame implements
}
task.cancel(true);
// not loading files, go back one page
- dispose();
- PermissionEditImage_GUI ei = new PermissionEditImage_GUI(
- c);
- ei.setVisible(true);
+
+ try {
+ if(client.userIsImageAdmin(person.verantwortlicher.getUserID(), Image.image.getImageId()) == true){
+ //user is admin and may change permissions
+ PermissionEditImage_GUI ei = new PermissionEditImage_GUI(c);
+ ei.setVisible(true);
+ dispose();
+ } else {
+ //user may not change permissions
+ EditImageTechnisch_GUI ei = new EditImageTechnisch_GUI(c);
+ ei.setVisible(true);
+ dispose();
+ }
+ } catch (TException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
}// end if coice
} else {
@@ -468,10 +482,22 @@ public class FTPEditUploader_GUI extends JFrame implements
"Abbrechen und zurück",
JOptionPane.YES_NO_OPTION);
if (selectedOption == JOptionPane.YES_OPTION) {
- dispose();
- PermissionEditImage_GUI m = new PermissionEditImage_GUI(
- c);
- m.setVisible(true);
+ try {
+ if(client.userIsImageAdmin(person.verantwortlicher.getUserID(), Image.image.getImageId()) == true){
+ //user is admin and may change permissions
+ PermissionEditImage_GUI ei = new PermissionEditImage_GUI(c);
+ ei.setVisible(true);
+ dispose();
+ } else {
+ //user may not change permissions
+ EditImageTechnisch_GUI ei = new EditImageTechnisch_GUI(c);
+ ei.setVisible(true);
+ dispose();
+ }
+ } catch (TException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
} else {
// for actions if "no" is selected. tbd.
}
diff --git a/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java
index a794f404..7f61d827 100644
--- a/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java
@@ -571,15 +571,12 @@ public class PermissionEditImage_GUI extends JFrame {
// save the entered rights into the model and prepare them to be written to
// the database
private void saveTableToList() {
- //System.out.println("Saving Table to List");
+ //LOGGER.info("Saving Table to List");
List<person> list = new ArrayList<person>();
int seperatorIndex = 0;
- // get values from table and save the checkbox values
- if (map == null)
- //System.out.println("Error: map is null");
// for (int i = 0; i < map.size(); i++) {
for (int i = 0; i < table.getRowCount(); i++) {
@@ -628,6 +625,7 @@ public class PermissionEditImage_GUI extends JFrame {
//permissions could have changed, compare vals at the end and update in db (quick and dirty due to time limitations)
RightsManagement.rightsManagement.setPermittedUserList(list);
+ //LOGGER.info("number of permission="+list.size());
}// end saveTableToList()
private void checkIntegrity(int row) {
diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java
index e66adea2..1d144c89 100644
--- a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java
+++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java
@@ -39,10 +39,15 @@ import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
+import org.apache.thrift.TException;
+
+//import server.generated.Server.Client;
+import models.Client;
import models.Image;
import models.ItemOwner;
import models.Lecture;
import models.Links;
+//import models.person;
import models.person;
import util.OpenLinks;
@@ -70,6 +75,7 @@ public class EditLectureAllgemein_GUI extends JFrame {
Date endDate;
Component c = null;
private final ButtonGroup buttonGroup = new ButtonGroup();
+ server.generated.Server.Client client = models.Client.clientcon.getClient();
private boolean descriptionLengthOK = false; // description may not be
// longer than
// MAX_DESCRIPTION_LENGTH
@@ -490,9 +496,26 @@ public class EditLectureAllgemein_GUI extends JFrame {
Image.image.setImagename(textFieldLaborname
.getText().trim());
- PermissionEditLecture_GUI ev = new PermissionEditLecture_GUI(c);
- ev.setVisible(true);
- dispose();
+ //check which GUI to open
+ try {
+ if(client.userIsLectureAdmin(person.verantwortlicher.getUserID(), Lecture.lecture.getid())){
+ //user is admin of the lecture
+ PermissionEditLecture_GUI ev = new PermissionEditLecture_GUI(c);
+ ev.setVisible(true);
+ dispose();
+
+ } else {
+ //user is not admin of the lecture
+ EditLectureLink_GUI el = new EditLectureLink_GUI(c);
+ el.setVisible(true);
+ dispose();
+ }
+ } catch (TException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+
}
}
diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java
index 4171ff0e..d1fe57e3 100644
--- a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java
+++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java
@@ -627,11 +627,26 @@ public class EditLectureLink_GUI extends JFrame {
JButton btnBack = new JButton("Zurück");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
-
- PermissionEditLecture_GUI el = new PermissionEditLecture_GUI(
- c);
- el.setVisible(true);
- dispose();
+
+ //check which GUI to open
+ try {
+ if(client.userIsLectureAdmin(person.verantwortlicher.getUserID(), Lecture.lecture.getid())){
+ //user is admin of the lecture
+ PermissionEditLecture_GUI ev = new PermissionEditLecture_GUI(c);
+ ev.setVisible(true);
+ dispose();
+
+ } else {
+ //user is not admin of the lecture
+ EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(c);
+ el.setVisible(true);
+ dispose();
+ }
+ } catch (TException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
}
});
btnBack.setActionCommand("OK");
diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java
index 5579e0ca..a0809546 100644
--- a/dozentenmodulserver/src/main/java/server/ServerHandler.java
+++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java
@@ -899,4 +899,30 @@ public class ServerHandler implements Server.Iface
+ @Override
+ public boolean userIsImageAdmin(String userID, String imageID)
+ throws TException {
+
+ if(authenticated())
+ {
+ return sql.userIsImageAdmin(userID,imageID);
+ }
+ return false;
+
+ }
+
+
+
+ @Override
+ public boolean userIsLectureAdmin(String userID, String lectureID)
+ throws TException {
+ if(authenticated())
+ {
+ return sql.userIsLectureAdmin(userID,lectureID);
+ }
+ return false;
+ }
+
+
+
}// end class
diff --git a/dozentenmodulserver/src/main/java/server/generated/Server.java b/dozentenmodulserver/src/main/java/server/generated/Server.java
index b827546e..0b6092ad 100644
--- a/dozentenmodulserver/src/main/java/server/generated/Server.java
+++ b/dozentenmodulserver/src/main/java/server/generated/Server.java
@@ -124,6 +124,10 @@ public class Server {
public String getOsNameForGuestOs(String guestOS) throws org.apache.thrift.TException;
+ public boolean userIsImageAdmin(String userID, String imageID) throws org.apache.thrift.TException;
+
+ public boolean userIsLectureAdmin(String userID, String lectureID) throws org.apache.thrift.TException;
+
public String createRandomUUID() throws org.apache.thrift.TException;
}
@@ -218,6 +222,10 @@ public class Server {
public void getOsNameForGuestOs(String guestOS, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void userIsImageAdmin(String userID, String imageID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void userIsLectureAdmin(String userID, String lectureID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void createRandomUUID(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
@@ -1339,6 +1347,54 @@ public class Server {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getOsNameForGuestOs failed: unknown result");
}
+ public boolean userIsImageAdmin(String userID, String imageID) throws org.apache.thrift.TException
+ {
+ send_userIsImageAdmin(userID, imageID);
+ return recv_userIsImageAdmin();
+ }
+
+ public void send_userIsImageAdmin(String userID, String imageID) throws org.apache.thrift.TException
+ {
+ userIsImageAdmin_args args = new userIsImageAdmin_args();
+ args.setUserID(userID);
+ args.setImageID(imageID);
+ sendBase("userIsImageAdmin", args);
+ }
+
+ public boolean recv_userIsImageAdmin() throws org.apache.thrift.TException
+ {
+ userIsImageAdmin_result result = new userIsImageAdmin_result();
+ receiveBase(result, "userIsImageAdmin");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "userIsImageAdmin failed: unknown result");
+ }
+
+ public boolean userIsLectureAdmin(String userID, String lectureID) throws org.apache.thrift.TException
+ {
+ send_userIsLectureAdmin(userID, lectureID);
+ return recv_userIsLectureAdmin();
+ }
+
+ public void send_userIsLectureAdmin(String userID, String lectureID) throws org.apache.thrift.TException
+ {
+ userIsLectureAdmin_args args = new userIsLectureAdmin_args();
+ args.setUserID(userID);
+ args.setLectureID(lectureID);
+ sendBase("userIsLectureAdmin", args);
+ }
+
+ public boolean recv_userIsLectureAdmin() throws org.apache.thrift.TException
+ {
+ userIsLectureAdmin_result result = new userIsLectureAdmin_result();
+ receiveBase(result, "userIsLectureAdmin");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "userIsLectureAdmin failed: unknown result");
+ }
+
public String createRandomUUID() throws org.apache.thrift.TException
{
send_createRandomUUID();
@@ -3078,6 +3134,76 @@ public class Server {
}
}
+ public void userIsImageAdmin(String userID, String imageID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ userIsImageAdmin_call method_call = new userIsImageAdmin_call(userID, imageID, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class userIsImageAdmin_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String userID;
+ private String imageID;
+ public userIsImageAdmin_call(String userID, String imageID, 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;
+ this.imageID = imageID;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("userIsImageAdmin", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ userIsImageAdmin_args args = new userIsImageAdmin_args();
+ args.setUserID(userID);
+ args.setImageID(imageID);
+ 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_userIsImageAdmin();
+ }
+ }
+
+ public void userIsLectureAdmin(String userID, String lectureID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ userIsLectureAdmin_call method_call = new userIsLectureAdmin_call(userID, lectureID, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class userIsLectureAdmin_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String userID;
+ private String lectureID;
+ public userIsLectureAdmin_call(String userID, String lectureID, 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;
+ this.lectureID = lectureID;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("userIsLectureAdmin", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ userIsLectureAdmin_args args = new userIsLectureAdmin_args();
+ args.setUserID(userID);
+ args.setLectureID(lectureID);
+ 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_userIsLectureAdmin();
+ }
+ }
+
public void createRandomUUID(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
createRandomUUID_call method_call = new createRandomUUID_call(resultHandler, this, ___protocolFactory, ___transport);
@@ -3164,6 +3290,8 @@ public class Server {
processMap.put("deleteAllAdditionalImagePermissions", new deleteAllAdditionalImagePermissions());
processMap.put("deleteAllAdditionalLecturePermissions", new deleteAllAdditionalLecturePermissions());
processMap.put("getOsNameForGuestOs", new getOsNameForGuestOs());
+ processMap.put("userIsImageAdmin", new userIsImageAdmin());
+ processMap.put("userIsLectureAdmin", new userIsLectureAdmin());
processMap.put("createRandomUUID", new createRandomUUID());
return processMap;
}
@@ -4064,6 +4192,48 @@ public class Server {
}
}
+ public static class userIsImageAdmin<I extends Iface> extends org.apache.thrift.ProcessFunction<I, userIsImageAdmin_args> {
+ public userIsImageAdmin() {
+ super("userIsImageAdmin");
+ }
+
+ public userIsImageAdmin_args getEmptyArgsInstance() {
+ return new userIsImageAdmin_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public userIsImageAdmin_result getResult(I iface, userIsImageAdmin_args args) throws org.apache.thrift.TException {
+ userIsImageAdmin_result result = new userIsImageAdmin_result();
+ result.success = iface.userIsImageAdmin(args.userID, args.imageID);
+ result.setSuccessIsSet(true);
+ return result;
+ }
+ }
+
+ public static class userIsLectureAdmin<I extends Iface> extends org.apache.thrift.ProcessFunction<I, userIsLectureAdmin_args> {
+ public userIsLectureAdmin() {
+ super("userIsLectureAdmin");
+ }
+
+ public userIsLectureAdmin_args getEmptyArgsInstance() {
+ return new userIsLectureAdmin_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public userIsLectureAdmin_result getResult(I iface, userIsLectureAdmin_args args) throws org.apache.thrift.TException {
+ userIsLectureAdmin_result result = new userIsLectureAdmin_result();
+ result.success = iface.userIsLectureAdmin(args.userID, args.lectureID);
+ result.setSuccessIsSet(true);
+ return result;
+ }
+ }
+
public static class createRandomUUID<I extends Iface> extends org.apache.thrift.ProcessFunction<I, createRandomUUID_args> {
public createRandomUUID() {
super("createRandomUUID");
@@ -4141,6 +4311,8 @@ public class Server {
processMap.put("deleteAllAdditionalImagePermissions", new deleteAllAdditionalImagePermissions());
processMap.put("deleteAllAdditionalLecturePermissions", new deleteAllAdditionalLecturePermissions());
processMap.put("getOsNameForGuestOs", new getOsNameForGuestOs());
+ processMap.put("userIsImageAdmin", new userIsImageAdmin());
+ processMap.put("userIsLectureAdmin", new userIsLectureAdmin());
processMap.put("createRandomUUID", new createRandomUUID());
return processMap;
}
@@ -6401,6 +6573,110 @@ public class Server {
}
}
+ public static class userIsImageAdmin<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, userIsImageAdmin_args, Boolean> {
+ public userIsImageAdmin() {
+ super("userIsImageAdmin");
+ }
+
+ public userIsImageAdmin_args getEmptyArgsInstance() {
+ return new userIsImageAdmin_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) {
+ userIsImageAdmin_result result = new userIsImageAdmin_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;
+ userIsImageAdmin_result result = new userIsImageAdmin_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, userIsImageAdmin_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
+ iface.userIsImageAdmin(args.userID, args.imageID,resultHandler);
+ }
+ }
+
+ public static class userIsLectureAdmin<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, userIsLectureAdmin_args, Boolean> {
+ public userIsLectureAdmin() {
+ super("userIsLectureAdmin");
+ }
+
+ public userIsLectureAdmin_args getEmptyArgsInstance() {
+ return new userIsLectureAdmin_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) {
+ userIsLectureAdmin_result result = new userIsLectureAdmin_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;
+ userIsLectureAdmin_result result = new userIsLectureAdmin_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, userIsLectureAdmin_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
+ iface.userIsLectureAdmin(args.userID, args.lectureID,resultHandler);
+ }
+ }
+
public static class createRandomUUID<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, createRandomUUID_args, String> {
public createRandomUUID() {
super("createRandomUUID");
@@ -47831,6 +48107,1622 @@ public class Server {
}
+ public static class userIsImageAdmin_args implements org.apache.thrift.TBase<userIsImageAdmin_args, userIsImageAdmin_args._Fields>, java.io.Serializable, Cloneable, Comparable<userIsImageAdmin_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("userIsImageAdmin_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 org.apache.thrift.protocol.TField IMAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("imageID", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new userIsImageAdmin_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new userIsImageAdmin_argsTupleSchemeFactory());
+ }
+
+ public String userID; // required
+ public String imageID; // 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"),
+ IMAGE_ID((short)2, "imageID");
+
+ 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;
+ case 2: // IMAGE_ID
+ return IMAGE_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)));
+ tmpMap.put(_Fields.IMAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("imageID", 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(userIsImageAdmin_args.class, metaDataMap);
+ }
+
+ public userIsImageAdmin_args() {
+ }
+
+ public userIsImageAdmin_args(
+ String userID,
+ String imageID)
+ {
+ this();
+ this.userID = userID;
+ this.imageID = imageID;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public userIsImageAdmin_args(userIsImageAdmin_args other) {
+ if (other.isSetUserID()) {
+ this.userID = other.userID;
+ }
+ if (other.isSetImageID()) {
+ this.imageID = other.imageID;
+ }
+ }
+
+ public userIsImageAdmin_args deepCopy() {
+ return new userIsImageAdmin_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.userID = null;
+ this.imageID = null;
+ }
+
+ public String getUserID() {
+ return this.userID;
+ }
+
+ public userIsImageAdmin_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 String getImageID() {
+ return this.imageID;
+ }
+
+ public userIsImageAdmin_args setImageID(String imageID) {
+ this.imageID = imageID;
+ return this;
+ }
+
+ public void unsetImageID() {
+ this.imageID = null;
+ }
+
+ /** Returns true if field imageID is set (has been assigned a value) and false otherwise */
+ public boolean isSetImageID() {
+ return this.imageID != null;
+ }
+
+ public void setImageIDIsSet(boolean value) {
+ if (!value) {
+ this.imageID = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case USER_ID:
+ if (value == null) {
+ unsetUserID();
+ } else {
+ setUserID((String)value);
+ }
+ break;
+
+ case IMAGE_ID:
+ if (value == null) {
+ unsetImageID();
+ } else {
+ setImageID((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case USER_ID:
+ return getUserID();
+
+ case IMAGE_ID:
+ return getImageID();
+
+ }
+ 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();
+ case IMAGE_ID:
+ return isSetImageID();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof userIsImageAdmin_args)
+ return this.equals((userIsImageAdmin_args)that);
+ return false;
+ }
+
+ public boolean equals(userIsImageAdmin_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;
+ }
+
+ boolean this_present_imageID = true && this.isSetImageID();
+ boolean that_present_imageID = true && that.isSetImageID();
+ if (this_present_imageID || that_present_imageID) {
+ if (!(this_present_imageID && that_present_imageID))
+ return false;
+ if (!this.imageID.equals(that.imageID))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(userIsImageAdmin_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;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetImageID()).compareTo(other.isSetImageID());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetImageID()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageID, other.imageID);
+ 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("userIsImageAdmin_args(");
+ boolean first = true;
+
+ sb.append("userID:");
+ if (this.userID == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userID);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("imageID:");
+ if (this.imageID == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.imageID);
+ }
+ 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 userIsImageAdmin_argsStandardSchemeFactory implements SchemeFactory {
+ public userIsImageAdmin_argsStandardScheme getScheme() {
+ return new userIsImageAdmin_argsStandardScheme();
+ }
+ }
+
+ private static class userIsImageAdmin_argsStandardScheme extends StandardScheme<userIsImageAdmin_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, userIsImageAdmin_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;
+ case 2: // IMAGE_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.imageID = iprot.readString();
+ struct.setImageIDIsSet(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, userIsImageAdmin_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();
+ }
+ if (struct.imageID != null) {
+ oprot.writeFieldBegin(IMAGE_ID_FIELD_DESC);
+ oprot.writeString(struct.imageID);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class userIsImageAdmin_argsTupleSchemeFactory implements SchemeFactory {
+ public userIsImageAdmin_argsTupleScheme getScheme() {
+ return new userIsImageAdmin_argsTupleScheme();
+ }
+ }
+
+ private static class userIsImageAdmin_argsTupleScheme extends TupleScheme<userIsImageAdmin_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, userIsImageAdmin_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetUserID()) {
+ optionals.set(0);
+ }
+ if (struct.isSetImageID()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetUserID()) {
+ oprot.writeString(struct.userID);
+ }
+ if (struct.isSetImageID()) {
+ oprot.writeString(struct.imageID);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, userIsImageAdmin_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.userID = iprot.readString();
+ struct.setUserIDIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.imageID = iprot.readString();
+ struct.setImageIDIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class userIsImageAdmin_result implements org.apache.thrift.TBase<userIsImageAdmin_result, userIsImageAdmin_result._Fields>, java.io.Serializable, Cloneable, Comparable<userIsImageAdmin_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("userIsImageAdmin_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 userIsImageAdmin_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new userIsImageAdmin_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(userIsImageAdmin_result.class, metaDataMap);
+ }
+
+ public userIsImageAdmin_result() {
+ }
+
+ public userIsImageAdmin_result(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public userIsImageAdmin_result(userIsImageAdmin_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public userIsImageAdmin_result deepCopy() {
+ return new userIsImageAdmin_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public userIsImageAdmin_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 userIsImageAdmin_result)
+ return this.equals((userIsImageAdmin_result)that);
+ return false;
+ }
+
+ public boolean equals(userIsImageAdmin_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(userIsImageAdmin_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("userIsImageAdmin_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 userIsImageAdmin_resultStandardSchemeFactory implements SchemeFactory {
+ public userIsImageAdmin_resultStandardScheme getScheme() {
+ return new userIsImageAdmin_resultStandardScheme();
+ }
+ }
+
+ private static class userIsImageAdmin_resultStandardScheme extends StandardScheme<userIsImageAdmin_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, userIsImageAdmin_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, userIsImageAdmin_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 userIsImageAdmin_resultTupleSchemeFactory implements SchemeFactory {
+ public userIsImageAdmin_resultTupleScheme getScheme() {
+ return new userIsImageAdmin_resultTupleScheme();
+ }
+ }
+
+ private static class userIsImageAdmin_resultTupleScheme extends TupleScheme<userIsImageAdmin_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, userIsImageAdmin_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, userIsImageAdmin_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);
+ }
+ }
+ }
+
+ }
+
+ public static class userIsLectureAdmin_args implements org.apache.thrift.TBase<userIsLectureAdmin_args, userIsLectureAdmin_args._Fields>, java.io.Serializable, Cloneable, Comparable<userIsLectureAdmin_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("userIsLectureAdmin_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 org.apache.thrift.protocol.TField LECTURE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("lectureID", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new userIsLectureAdmin_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new userIsLectureAdmin_argsTupleSchemeFactory());
+ }
+
+ public String userID; // required
+ public String lectureID; // 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"),
+ LECTURE_ID((short)2, "lectureID");
+
+ 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;
+ case 2: // LECTURE_ID
+ return LECTURE_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)));
+ tmpMap.put(_Fields.LECTURE_ID, new org.apache.thrift.meta_data.FieldMetaData("lectureID", 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(userIsLectureAdmin_args.class, metaDataMap);
+ }
+
+ public userIsLectureAdmin_args() {
+ }
+
+ public userIsLectureAdmin_args(
+ String userID,
+ String lectureID)
+ {
+ this();
+ this.userID = userID;
+ this.lectureID = lectureID;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public userIsLectureAdmin_args(userIsLectureAdmin_args other) {
+ if (other.isSetUserID()) {
+ this.userID = other.userID;
+ }
+ if (other.isSetLectureID()) {
+ this.lectureID = other.lectureID;
+ }
+ }
+
+ public userIsLectureAdmin_args deepCopy() {
+ return new userIsLectureAdmin_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.userID = null;
+ this.lectureID = null;
+ }
+
+ public String getUserID() {
+ return this.userID;
+ }
+
+ public userIsLectureAdmin_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 String getLectureID() {
+ return this.lectureID;
+ }
+
+ public userIsLectureAdmin_args setLectureID(String lectureID) {
+ this.lectureID = lectureID;
+ return this;
+ }
+
+ public void unsetLectureID() {
+ this.lectureID = null;
+ }
+
+ /** Returns true if field lectureID is set (has been assigned a value) and false otherwise */
+ public boolean isSetLectureID() {
+ return this.lectureID != null;
+ }
+
+ public void setLectureIDIsSet(boolean value) {
+ if (!value) {
+ this.lectureID = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case USER_ID:
+ if (value == null) {
+ unsetUserID();
+ } else {
+ setUserID((String)value);
+ }
+ break;
+
+ case LECTURE_ID:
+ if (value == null) {
+ unsetLectureID();
+ } else {
+ setLectureID((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case USER_ID:
+ return getUserID();
+
+ case LECTURE_ID:
+ return getLectureID();
+
+ }
+ 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();
+ case LECTURE_ID:
+ return isSetLectureID();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof userIsLectureAdmin_args)
+ return this.equals((userIsLectureAdmin_args)that);
+ return false;
+ }
+
+ public boolean equals(userIsLectureAdmin_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;
+ }
+
+ boolean this_present_lectureID = true && this.isSetLectureID();
+ boolean that_present_lectureID = true && that.isSetLectureID();
+ if (this_present_lectureID || that_present_lectureID) {
+ if (!(this_present_lectureID && that_present_lectureID))
+ return false;
+ if (!this.lectureID.equals(that.lectureID))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(userIsLectureAdmin_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;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetLectureID()).compareTo(other.isSetLectureID());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLectureID()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lectureID, other.lectureID);
+ 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("userIsLectureAdmin_args(");
+ boolean first = true;
+
+ sb.append("userID:");
+ if (this.userID == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.userID);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("lectureID:");
+ if (this.lectureID == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.lectureID);
+ }
+ 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 userIsLectureAdmin_argsStandardSchemeFactory implements SchemeFactory {
+ public userIsLectureAdmin_argsStandardScheme getScheme() {
+ return new userIsLectureAdmin_argsStandardScheme();
+ }
+ }
+
+ private static class userIsLectureAdmin_argsStandardScheme extends StandardScheme<userIsLectureAdmin_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, userIsLectureAdmin_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;
+ case 2: // LECTURE_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.lectureID = iprot.readString();
+ struct.setLectureIDIsSet(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, userIsLectureAdmin_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();
+ }
+ if (struct.lectureID != null) {
+ oprot.writeFieldBegin(LECTURE_ID_FIELD_DESC);
+ oprot.writeString(struct.lectureID);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class userIsLectureAdmin_argsTupleSchemeFactory implements SchemeFactory {
+ public userIsLectureAdmin_argsTupleScheme getScheme() {
+ return new userIsLectureAdmin_argsTupleScheme();
+ }
+ }
+
+ private static class userIsLectureAdmin_argsTupleScheme extends TupleScheme<userIsLectureAdmin_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, userIsLectureAdmin_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetUserID()) {
+ optionals.set(0);
+ }
+ if (struct.isSetLectureID()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetUserID()) {
+ oprot.writeString(struct.userID);
+ }
+ if (struct.isSetLectureID()) {
+ oprot.writeString(struct.lectureID);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, userIsLectureAdmin_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.userID = iprot.readString();
+ struct.setUserIDIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.lectureID = iprot.readString();
+ struct.setLectureIDIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class userIsLectureAdmin_result implements org.apache.thrift.TBase<userIsLectureAdmin_result, userIsLectureAdmin_result._Fields>, java.io.Serializable, Cloneable, Comparable<userIsLectureAdmin_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("userIsLectureAdmin_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 userIsLectureAdmin_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new userIsLectureAdmin_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(userIsLectureAdmin_result.class, metaDataMap);
+ }
+
+ public userIsLectureAdmin_result() {
+ }
+
+ public userIsLectureAdmin_result(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public userIsLectureAdmin_result(userIsLectureAdmin_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public userIsLectureAdmin_result deepCopy() {
+ return new userIsLectureAdmin_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public userIsLectureAdmin_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 userIsLectureAdmin_result)
+ return this.equals((userIsLectureAdmin_result)that);
+ return false;
+ }
+
+ public boolean equals(userIsLectureAdmin_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(userIsLectureAdmin_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("userIsLectureAdmin_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 userIsLectureAdmin_resultStandardSchemeFactory implements SchemeFactory {
+ public userIsLectureAdmin_resultStandardScheme getScheme() {
+ return new userIsLectureAdmin_resultStandardScheme();
+ }
+ }
+
+ private static class userIsLectureAdmin_resultStandardScheme extends StandardScheme<userIsLectureAdmin_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, userIsLectureAdmin_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, userIsLectureAdmin_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 userIsLectureAdmin_resultTupleSchemeFactory implements SchemeFactory {
+ public userIsLectureAdmin_resultTupleScheme getScheme() {
+ return new userIsLectureAdmin_resultTupleScheme();
+ }
+ }
+
+ private static class userIsLectureAdmin_resultTupleScheme extends TupleScheme<userIsLectureAdmin_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, userIsLectureAdmin_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, userIsLectureAdmin_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);
+ }
+ }
+ }
+
+ }
+
public static class createRandomUUID_args implements org.apache.thrift.TBase<createRandomUUID_args, createRandomUUID_args._Fields>, java.io.Serializable, Cloneable, Comparable<createRandomUUID_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createRandomUUID_args");
diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java
index 455b1e6d..2d038732 100644
--- a/dozentenmodulserver/src/main/java/sql/SQL.java
+++ b/dozentenmodulserver/src/main/java/sql/SQL.java
@@ -2217,6 +2217,58 @@ public class SQL {
{
return UUID.randomUUID().toString();
}
+
+
+
+
+ public boolean userIsImageAdmin(String userID, String imageID) {
+ Connection con = getConnection();
+ ResultSet rs = null;
+ String sql = "SELECT image_admin FROM bwLehrpool.pm_VLData_image WHERE userID= ? AND GUID_imageID=?";
+
+ try
+ {
+ PreparedStatement prest = con.prepareStatement(sql);
+ prest.setString(1, userID);
+ prest.setString(2, imageID);
+ rs = prest.executeQuery();
+ con.commit();
+ rs.next();
+
+ return rs.getBoolean("image_admin");
+
+ } catch (SQLException e) {
+
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+
+
+
+ public boolean userIsLectureAdmin(String userID, String lectureID) {
+ Connection con = getConnection();
+ ResultSet rs = null;
+ String sql = "SELECT rec_admin FROM bwLehrpool.pm_VLData_lecture WHERE userID= ? AND lectureID=?";
+
+ try
+ {
+ PreparedStatement prest = con.prepareStatement(sql);
+ prest.setString(1, userID);
+ prest.setString(2, lectureID);
+ rs = prest.executeQuery();
+ con.commit();
+ rs.next();
+
+ return rs.getBoolean("rec_admin");
+
+ } catch (SQLException e) {
+
+ e.printStackTrace();
+ }
+ return false;
+ }
diff --git a/dozentenmodulserver/thrift/server.thrift b/dozentenmodulserver/thrift/server.thrift
index 637e9be6..defa0a2e 100644
--- a/dozentenmodulserver/thrift/server.thrift
+++ b/dozentenmodulserver/thrift/server.thrift
@@ -93,5 +93,7 @@ service Server{
void deleteAllAdditionalImagePermissions(1: string imageID, 2:string userID),
void deleteAllAdditionalLecturePermissions(1: string lectureID, 2: string userID),
string getOsNameForGuestOs(1: string guestOS),
+ bool userIsImageAdmin(1: string userID, 2: string imageID),
+ bool userIsLectureAdmin(1: string userID, 2: string lectureID),
string createRandomUUID()
}