diff options
| author | Michael Wilson | 2014-10-08 16:28:11 +0200 |
|---|---|---|
| committer | Michael Wilson | 2014-10-08 16:28:11 +0200 |
| commit | 9187afc018092bf036bfb5a63cc12acbe2f7422e (patch) | |
| tree | 271fea44428f311727f918960fa9505c1a5b1173 | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-9187afc018092bf036bfb5a63cc12acbe2f7422e.tar.gz tutor-module-9187afc018092bf036bfb5a63cc12acbe2f7422e.tar.xz tutor-module-9187afc018092bf036bfb5a63cc12acbe2f7422e.zip | |
-Rechteveraltung funktioniert endlich beim anlegen eines neuen Image -> muss entsprechend für alle anderen Seiten sinnvoll übernommen werden
10 files changed, 1711 insertions, 134 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java b/dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java index 8a6af0da..cd3cca87 100644 --- a/dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java @@ -154,7 +154,7 @@ public class CreateImageTechnisch_GUI extends JFrame { panel_1.add(lblNewLabel_2); chckbxIsLicensed = new JCheckBox(""); - chckbxIsLicensed.setSelected(Image.image.isLicensed()); + chckbxIsLicensed.setSelected(true); chckbxIsLicensed.setBounds(266, 52, 97, 23); panel_1.add(chckbxIsLicensed); diff --git a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java index 985a9bf7..a4300f97 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java @@ -41,6 +41,7 @@ import javax.swing.filechooser.FileNameExtensionFilter; import models.Image; import models.Links; +import models.RightsManagement; import models.SessionData; import models.person; @@ -659,11 +660,15 @@ public class FTPCreateUploader_GUI extends JFrame implements person.verantwortlicher.getEMail(), person.verantwortlicher.getTel(), person.verantwortlicher.getFakultaet(), - Image.image.isLicensed(), Image.image.isInternet(), - Image.image.getRam(), Image.image.getCpu(), "temp/" - + Image.image.getNewName(), - Image.image.isVorlage(), Image.image.getFilesize(), - Image.image.getShareMode(), Image.image.getOS()); + Image.image.isLicensed(), + Image.image.isInternet(), + Image.image.getRam(), + Image.image.getCpu(), + "temp/"+ Image.image.getNewName(), + Image.image.isVorlage(), + Image.image.getFilesize(), + Image.image.getShareMode(), + Image.image.getOS()); client.startFileCopy(Image.image.getNewName()); @@ -673,7 +678,23 @@ public class FTPCreateUploader_GUI extends JFrame implements person.verantwortlicher.getVorname(), person.verantwortlicher.getEMail(), person.verantwortlicher.getHochschule(), - person.verantwortlicher.getRole()); + person.verantwortlicher.getRole() + ); + + for(int i=0; i< RightsManagement.rightsManagement.getPmImageCreateList().size(); i++){ + System.out.println("Writing additional rights for user "+RightsManagement.rightsManagement.getPmImageCreateList().get(i).getUserID()+", User "+i+"/"+RightsManagement.rightsManagement.getPmImageCreateList().size()); + client.writeAdditionalImageRights( + Image.image.getImagename(), + RightsManagement.rightsManagement.getPmImageCreateList().get(i).getUserID(), + RightsManagement.rightsManagement.getPmImageCreateList().get(i).isRead(), + RightsManagement.rightsManagement.getPmImageCreateList().get(i).isWrite(), + RightsManagement.rightsManagement.getPmImageCreateList().get(i).isLinkAllowed(), + RightsManagement.rightsManagement.getPmImageCreateList().get(i).isAdmin() + ); + + }//end for + + } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java b/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java index 37d5eddf..63323969 100644 --- a/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java @@ -196,8 +196,12 @@ public class PermissionCreateImage_GUI extends JFrame { System.out.println("getting data from db"); System.out.println(RightsManagement.rightsManagement .getPmImageCreateList().size()); + + person.verantwortlicher.getUserID(); + System.out.println("Current userID: " +person.verantwortlicher.getUserID()); + try { - map = client.getAllOGUsers(); + map = client.getAllOtherSatelliteUsers(person.verantwortlicher.getUserID()); Iterator<server.generated.Person> i = map.iterator(); int x = 0; diff --git a/dozentenmodul/src/main/java/gui/intro/Login_GUI.java b/dozentenmodul/src/main/java/gui/intro/Login_GUI.java index 8c076dc7..42fa9409 100644 --- a/dozentenmodul/src/main/java/gui/intro/Login_GUI.java +++ b/dozentenmodul/src/main/java/gui/intro/Login_GUI.java @@ -244,6 +244,7 @@ public class Login_GUI extends JFrame { //person.verantwortlicher.setUsername(lblusername.getText().substring(0,lblusername.getText().indexOf("@"))); person.verantwortlicher.setUsername(lblusername.getText().trim()); + person.verantwortlicher.setUserID(lblusername.getText().trim()); person.verantwortlicher.setName(user.lastName); person.verantwortlicher.setVorname(user.firstName); person.verantwortlicher.setEMail(user.eMail); diff --git a/dozentenmodul/src/main/java/models/person.java b/dozentenmodul/src/main/java/models/person.java index b1a44288..1d8e26e1 100644 --- a/dozentenmodul/src/main/java/models/person.java +++ b/dozentenmodul/src/main/java/models/person.java @@ -3,29 +3,21 @@ package models; public class person { private String username; - + private String userID; private String Name; - private String Vorname; - private String Hochschule; - private String EMail; - private String Tel; - private String Fakultaet; - private boolean ischecked; - private String role; - private boolean read; private boolean write; private boolean changePermission; private boolean admin; private boolean linkAllowed; - private String userID; + public boolean isRead() { return read; diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index 30fd5237..a66083c5 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -191,7 +191,7 @@ public class ServerHandler implements Server.Iface { sql.setImageData(pk_person, license, internet, cpu, ram, imagename,desc, imagePath, filesize,mode,pk_os); - + log.info(new Date() + " - written VLdata"); // TODO Auto-generated method stub return true; @@ -475,34 +475,35 @@ public class ServerHandler implements Server.Iface { if(role.equals("Dozent")) { int read=1; int write=1; - int changePermission=0; - int admin=0; + //int changePermission=0; + int admin=1; int linkallowed=1; int roleID=sql.getRoleID(role); - sql.setImageRights(pk_person, pk_image, roleID, read, write, changePermission, admin, linkallowed); + sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, linkallowed); }else if(role.equals("Admin")){ int read=1; int write=1; - int changePermission=1; + //int changePermission=1; int admin=1; int linkallowed=1; int roleID=sql.getRoleID(role); - sql.setImageRights(pk_person, pk_image, roleID, read, write, changePermission, admin, linkallowed); + sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, linkallowed); } else{ int read=1; int write=0; - int changePermission=0; + //int changePermission=0; int admin=0; int linkallowed=0; int roleID=sql.getRoleID(role); - sql.setImageRights(pk_person, pk_image, roleID, read, write, changePermission, admin, linkallowed); + sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, linkallowed); } + log.info(new Date() + " - written image rights"); return true; } @@ -549,10 +550,21 @@ public class ServerHandler implements Server.Iface { } @Override - public List<Person> getAllOGUsers() throws TException { - return sql.getAllOGUsers(); + public List<Person> getAllOtherSatelliteUsers(String userID) throws TException { + return sql.getAllOtherSatelliteUsers(userID); //return null; } -} + public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin){ + boolean success = false; + Map<String, String> map = new HashMap<String, String>(); + map = sql.getImageIDandVersion(imageName); + String imageID = map.get("GUID"); + + sql.writeAdditionalImageRights(imageID, userID, isRead, isWrite, isLinkAllowed, isAdmin); + log.info(new Date() + " - written additional image rights for "+userID); + return success; + } + +}// end class diff --git a/dozentenmodulserver/src/main/java/server/StartServer.java b/dozentenmodulserver/src/main/java/server/StartServer.java index 7280ee99..cf141ae9 100644 --- a/dozentenmodulserver/src/main/java/server/StartServer.java +++ b/dozentenmodulserver/src/main/java/server/StartServer.java @@ -25,13 +25,12 @@ public class StartServer { public static void main(String[] args) { - String version = "Version: 1.03"; - String buildDate = "Build Date: 09.09.2014"; //get going and show basic information in logfile BasicConfigurator.configure(); - log.info("***** " + new Date() + " - starting Application *****"); - log.info(new Date() + " - "+version+" , "+buildDate); + log.info("*************************************************************************************************"); + log.info("******************* " + new Date() + " - starting Application ***********************"); + log.info("*************************************************************************************************"); diff --git a/dozentenmodulserver/src/main/java/server/generated/Server.java b/dozentenmodulserver/src/main/java/server/generated/Server.java index 60f3faae..65bd34e3 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Server.java +++ b/dozentenmodulserver/src/main/java/server/generated/Server.java @@ -82,7 +82,9 @@ public class Server { public boolean writeLectureRights(String lecturename, String username, String lastName, String firstName, String mail, String university, String role) throws org.apache.thrift.TException; - public List<Person> getAllOGUsers() throws org.apache.thrift.TException; + public List<Person> getAllOtherSatelliteUsers(String userID) throws org.apache.thrift.TException; + + public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException; } @@ -134,7 +136,9 @@ public class Server { public void writeLectureRights(String lecturename, String username, String lastName, String firstName, String mail, String university, String role, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getAllOGUsers(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getAllOtherSatelliteUsers(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -765,26 +769,55 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeLectureRights failed: unknown result"); } - public List<Person> getAllOGUsers() throws org.apache.thrift.TException + public List<Person> getAllOtherSatelliteUsers(String userID) throws org.apache.thrift.TException + { + send_getAllOtherSatelliteUsers(userID); + return recv_getAllOtherSatelliteUsers(); + } + + public void send_getAllOtherSatelliteUsers(String userID) throws org.apache.thrift.TException + { + getAllOtherSatelliteUsers_args args = new getAllOtherSatelliteUsers_args(); + args.setUserID(userID); + sendBase("getAllOtherSatelliteUsers", args); + } + + public List<Person> recv_getAllOtherSatelliteUsers() throws org.apache.thrift.TException { - send_getAllOGUsers(); - return recv_getAllOGUsers(); + getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); + receiveBase(result, "getAllOtherSatelliteUsers"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllOtherSatelliteUsers failed: unknown result"); + } + + public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException + { + send_writeAdditionalImageRights(imageName, userID, isRead, isWrite, isLinkAllowed, isAdmin); + return recv_writeAdditionalImageRights(); } - public void send_getAllOGUsers() throws org.apache.thrift.TException + public void send_writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException { - getAllOGUsers_args args = new getAllOGUsers_args(); - sendBase("getAllOGUsers", args); + writeAdditionalImageRights_args args = new writeAdditionalImageRights_args(); + args.setImageName(imageName); + args.setUserID(userID); + args.setIsRead(isRead); + args.setIsWrite(isWrite); + args.setIsLinkAllowed(isLinkAllowed); + args.setIsAdmin(isAdmin); + sendBase("writeAdditionalImageRights", args); } - public List<Person> recv_getAllOGUsers() throws org.apache.thrift.TException + public boolean recv_writeAdditionalImageRights() throws org.apache.thrift.TException { - getAllOGUsers_result result = new getAllOGUsers_result(); - receiveBase(result, "getAllOGUsers"); + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + receiveBase(result, "writeAdditionalImageRights"); if (result.isSetSuccess()) { return result.success; } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllOGUsers failed: unknown result"); + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeAdditionalImageRights failed: unknown result"); } } @@ -1775,21 +1808,24 @@ public class Server { } } - public void getAllOGUsers(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getAllOtherSatelliteUsers(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getAllOGUsers_call method_call = new getAllOGUsers_call(resultHandler, this, ___protocolFactory, ___transport); + getAllOtherSatelliteUsers_call method_call = new getAllOtherSatelliteUsers_call(userID, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } - public static class getAllOGUsers_call extends org.apache.thrift.async.TAsyncMethodCall { - public getAllOGUsers_call(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 { + public static class getAllOtherSatelliteUsers_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getAllOtherSatelliteUsers_call(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); + this.userID = userID; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllOGUsers", org.apache.thrift.protocol.TMessageType.CALL, 0)); - getAllOGUsers_args args = new getAllOGUsers_args(); + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllOtherSatelliteUsers", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getAllOtherSatelliteUsers_args args = new getAllOtherSatelliteUsers_args(); + args.setUserID(userID); args.write(prot); prot.writeMessageEnd(); } @@ -1800,7 +1836,54 @@ public class Server { } 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_getAllOGUsers(); + return (new Client(prot)).recv_getAllOtherSatelliteUsers(); + } + } + + public void writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + writeAdditionalImageRights_call method_call = new writeAdditionalImageRights_call(imageName, userID, isRead, isWrite, isLinkAllowed, isAdmin, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class writeAdditionalImageRights_call extends org.apache.thrift.async.TAsyncMethodCall { + private String imageName; + private String userID; + private boolean isRead; + private boolean isWrite; + private boolean isLinkAllowed; + private boolean isAdmin; + public writeAdditionalImageRights_call(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, 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.imageName = imageName; + this.userID = userID; + this.isRead = isRead; + this.isWrite = isWrite; + this.isLinkAllowed = isLinkAllowed; + this.isAdmin = isAdmin; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("writeAdditionalImageRights", org.apache.thrift.protocol.TMessageType.CALL, 0)); + writeAdditionalImageRights_args args = new writeAdditionalImageRights_args(); + args.setImageName(imageName); + args.setUserID(userID); + args.setIsRead(isRead); + args.setIsWrite(isWrite); + args.setIsLinkAllowed(isLinkAllowed); + args.setIsAdmin(isAdmin); + 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_writeAdditionalImageRights(); } } @@ -1840,7 +1923,8 @@ public class Server { processMap.put("createUser", new createUser()); processMap.put("writeImageRights", new writeImageRights()); processMap.put("writeLectureRights", new writeLectureRights()); - processMap.put("getAllOGUsers", new getAllOGUsers()); + processMap.put("getAllOtherSatelliteUsers", new getAllOtherSatelliteUsers()); + processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); return processMap; } @@ -2318,22 +2402,43 @@ public class Server { } } - public static class getAllOGUsers<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllOGUsers_args> { - public getAllOGUsers() { - super("getAllOGUsers"); + public static class getAllOtherSatelliteUsers<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllOtherSatelliteUsers_args> { + public getAllOtherSatelliteUsers() { + super("getAllOtherSatelliteUsers"); + } + + public getAllOtherSatelliteUsers_args getEmptyArgsInstance() { + return new getAllOtherSatelliteUsers_args(); + } + + protected boolean isOneway() { + return false; + } + + public getAllOtherSatelliteUsers_result getResult(I iface, getAllOtherSatelliteUsers_args args) throws org.apache.thrift.TException { + getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); + result.success = iface.getAllOtherSatelliteUsers(args.userID); + return result; + } + } + + public static class writeAdditionalImageRights<I extends Iface> extends org.apache.thrift.ProcessFunction<I, writeAdditionalImageRights_args> { + public writeAdditionalImageRights() { + super("writeAdditionalImageRights"); } - public getAllOGUsers_args getEmptyArgsInstance() { - return new getAllOGUsers_args(); + public writeAdditionalImageRights_args getEmptyArgsInstance() { + return new writeAdditionalImageRights_args(); } protected boolean isOneway() { return false; } - public getAllOGUsers_result getResult(I iface, getAllOGUsers_args args) throws org.apache.thrift.TException { - getAllOGUsers_result result = new getAllOGUsers_result(); - result.success = iface.getAllOGUsers(); + public writeAdditionalImageRights_result getResult(I iface, writeAdditionalImageRights_args args) throws org.apache.thrift.TException { + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + result.success = iface.writeAdditionalImageRights(args.imageName, args.userID, args.isRead, args.isWrite, args.isLinkAllowed, args.isAdmin); + result.setSuccessIsSet(true); return result; } } @@ -2374,7 +2479,8 @@ public class Server { processMap.put("createUser", new createUser()); processMap.put("writeImageRights", new writeImageRights()); processMap.put("writeLectureRights", new writeLectureRights()); - processMap.put("getAllOGUsers", new getAllOGUsers()); + processMap.put("getAllOtherSatelliteUsers", new getAllOtherSatelliteUsers()); + processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); return processMap; } @@ -3565,21 +3671,73 @@ public class Server { } } - public static class getAllOGUsers<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllOGUsers_args, List<Person>> { - public getAllOGUsers() { - super("getAllOGUsers"); + public static class getAllOtherSatelliteUsers<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllOtherSatelliteUsers_args, List<Person>> { + public getAllOtherSatelliteUsers() { + super("getAllOtherSatelliteUsers"); } - public getAllOGUsers_args getEmptyArgsInstance() { - return new getAllOGUsers_args(); + public getAllOtherSatelliteUsers_args getEmptyArgsInstance() { + return new getAllOtherSatelliteUsers_args(); } public AsyncMethodCallback<List<Person>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<List<Person>>() { public void onComplete(List<Person> o) { - getAllOGUsers_result result = new getAllOGUsers_result(); + getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_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, getAllOtherSatelliteUsers_args args, org.apache.thrift.async.AsyncMethodCallback<List<Person>> resultHandler) throws TException { + iface.getAllOtherSatelliteUsers(args.userID,resultHandler); + } + } + + public static class writeAdditionalImageRights<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, writeAdditionalImageRights_args, Boolean> { + public writeAdditionalImageRights() { + super("writeAdditionalImageRights"); + } + + public writeAdditionalImageRights_args getEmptyArgsInstance() { + return new writeAdditionalImageRights_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) { + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); result.success = o; + result.setSuccessIsSet(true); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -3591,7 +3749,7 @@ public class Server { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - getAllOGUsers_result result = new getAllOGUsers_result(); + writeAdditionalImageRights_result result = new writeAdditionalImageRights_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()); @@ -3611,8 +3769,8 @@ public class Server { return false; } - public void start(I iface, getAllOGUsers_args args, org.apache.thrift.async.AsyncMethodCallback<List<Person>> resultHandler) throws TException { - iface.getAllOGUsers(resultHandler); + public void start(I iface, writeAdditionalImageRights_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.writeAdditionalImageRights(args.imageName, args.userID, args.isRead, args.isWrite, args.isLinkAllowed, args.isAdmin,resultHandler); } } @@ -27949,20 +28107,22 @@ public class Server { } - public static class getAllOGUsers_args implements org.apache.thrift.TBase<getAllOGUsers_args, getAllOGUsers_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllOGUsers_args> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllOGUsers_args"); + public static class getAllOtherSatelliteUsers_args implements org.apache.thrift.TBase<getAllOtherSatelliteUsers_args, getAllOtherSatelliteUsers_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllOtherSatelliteUsers_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllOtherSatelliteUsers_args"); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getAllOGUsers_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getAllOGUsers_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getAllOtherSatelliteUsers_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getAllOtherSatelliteUsers_argsTupleSchemeFactory()); } + public String userID; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; + USER_ID((short)1, "userID"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -27977,6 +28137,8 @@ public class Server { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { + case 1: // USER_ID + return USER_ID; default: return null; } @@ -28015,37 +28177,87 @@ public class Server { return _fieldName; } } + + // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllOGUsers_args.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllOtherSatelliteUsers_args.class, metaDataMap); } - public getAllOGUsers_args() { + public getAllOtherSatelliteUsers_args() { + } + + public getAllOtherSatelliteUsers_args( + String userID) + { + this(); + this.userID = userID; } /** * Performs a deep copy on <i>other</i>. */ - public getAllOGUsers_args(getAllOGUsers_args other) { + public getAllOtherSatelliteUsers_args(getAllOtherSatelliteUsers_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } } - public getAllOGUsers_args deepCopy() { - return new getAllOGUsers_args(this); + public getAllOtherSatelliteUsers_args deepCopy() { + return new getAllOtherSatelliteUsers_args(this); } @Override public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getAllOtherSatelliteUsers_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } } public void setFieldValue(_Fields field, Object value) { switch (field) { + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + } } public Object getFieldValue(_Fields field) { switch (field) { + case USER_ID: + return getUserID(); + } throw new IllegalStateException(); } @@ -28057,6 +28269,8 @@ public class Server { } switch (field) { + case USER_ID: + return isSetUserID(); } throw new IllegalStateException(); } @@ -28065,15 +28279,24 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getAllOGUsers_args) - return this.equals((getAllOGUsers_args)that); + if (that instanceof getAllOtherSatelliteUsers_args) + return this.equals((getAllOtherSatelliteUsers_args)that); return false; } - public boolean equals(getAllOGUsers_args that) { + public boolean equals(getAllOtherSatelliteUsers_args that) { if (that == null) return false; + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + return true; } @@ -28083,13 +28306,23 @@ public class Server { } @Override - public int compareTo(getAllOGUsers_args other) { + public int compareTo(getAllOtherSatelliteUsers_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -28107,9 +28340,16 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("getAllOGUsers_args("); + StringBuilder sb = new StringBuilder("getAllOtherSatelliteUsers_args("); boolean first = true; + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; sb.append(")"); return sb.toString(); } @@ -28135,15 +28375,15 @@ public class Server { } } - private static class getAllOGUsers_argsStandardSchemeFactory implements SchemeFactory { - public getAllOGUsers_argsStandardScheme getScheme() { - return new getAllOGUsers_argsStandardScheme(); + private static class getAllOtherSatelliteUsers_argsStandardSchemeFactory implements SchemeFactory { + public getAllOtherSatelliteUsers_argsStandardScheme getScheme() { + return new getAllOtherSatelliteUsers_argsStandardScheme(); } } - private static class getAllOGUsers_argsStandardScheme extends StandardScheme<getAllOGUsers_args> { + private static class getAllOtherSatelliteUsers_argsStandardScheme extends StandardScheme<getAllOtherSatelliteUsers_args> { - public void read(org.apache.thrift.protocol.TProtocol iprot, getAllOGUsers_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getAllOtherSatelliteUsers_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -28153,6 +28393,14 @@ public class Server { break; } switch (schemeField.id) { + case 1: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -28164,46 +28412,64 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getAllOGUsers_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getAllOtherSatelliteUsers_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class getAllOGUsers_argsTupleSchemeFactory implements SchemeFactory { - public getAllOGUsers_argsTupleScheme getScheme() { - return new getAllOGUsers_argsTupleScheme(); + private static class getAllOtherSatelliteUsers_argsTupleSchemeFactory implements SchemeFactory { + public getAllOtherSatelliteUsers_argsTupleScheme getScheme() { + return new getAllOtherSatelliteUsers_argsTupleScheme(); } } - private static class getAllOGUsers_argsTupleScheme extends TupleScheme<getAllOGUsers_args> { + private static class getAllOtherSatelliteUsers_argsTupleScheme extends TupleScheme<getAllOtherSatelliteUsers_args> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getAllOGUsers_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getAllOtherSatelliteUsers_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getAllOGUsers_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getAllOtherSatelliteUsers_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } } } } - public static class getAllOGUsers_result implements org.apache.thrift.TBase<getAllOGUsers_result, getAllOGUsers_result._Fields>, java.io.Serializable, Cloneable, Comparable<getAllOGUsers_result> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllOGUsers_result"); + public static class getAllOtherSatelliteUsers_result implements org.apache.thrift.TBase<getAllOtherSatelliteUsers_result, getAllOtherSatelliteUsers_result._Fields>, java.io.Serializable, Cloneable, Comparable<getAllOtherSatelliteUsers_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllOtherSatelliteUsers_result"); private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getAllOGUsers_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getAllOGUsers_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getAllOtherSatelliteUsers_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getAllOtherSatelliteUsers_resultTupleSchemeFactory()); } public List<Person> success; // required @@ -28274,13 +28540,13 @@ public class Server { new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Person.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllOGUsers_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllOtherSatelliteUsers_result.class, metaDataMap); } - public getAllOGUsers_result() { + public getAllOtherSatelliteUsers_result() { } - public getAllOGUsers_result( + public getAllOtherSatelliteUsers_result( List<Person> success) { this(); @@ -28290,7 +28556,7 @@ public class Server { /** * Performs a deep copy on <i>other</i>. */ - public getAllOGUsers_result(getAllOGUsers_result other) { + public getAllOtherSatelliteUsers_result(getAllOtherSatelliteUsers_result other) { if (other.isSetSuccess()) { List<Person> __this__success = new ArrayList<Person>(other.success.size()); for (Person other_element : other.success) { @@ -28300,8 +28566,8 @@ public class Server { } } - public getAllOGUsers_result deepCopy() { - return new getAllOGUsers_result(this); + public getAllOtherSatelliteUsers_result deepCopy() { + return new getAllOtherSatelliteUsers_result(this); } @Override @@ -28328,7 +28594,7 @@ public class Server { return this.success; } - public getAllOGUsers_result setSuccess(List<Person> success) { + public getAllOtherSatelliteUsers_result setSuccess(List<Person> success) { this.success = success; return this; } @@ -28387,12 +28653,12 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getAllOGUsers_result) - return this.equals((getAllOGUsers_result)that); + if (that instanceof getAllOtherSatelliteUsers_result) + return this.equals((getAllOtherSatelliteUsers_result)that); return false; } - public boolean equals(getAllOGUsers_result that) { + public boolean equals(getAllOtherSatelliteUsers_result that) { if (that == null) return false; @@ -28414,7 +28680,7 @@ public class Server { } @Override - public int compareTo(getAllOGUsers_result other) { + public int compareTo(getAllOtherSatelliteUsers_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -28448,7 +28714,7 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("getAllOGUsers_result("); + StringBuilder sb = new StringBuilder("getAllOtherSatelliteUsers_result("); boolean first = true; sb.append("success:"); @@ -28483,15 +28749,15 @@ public class Server { } } - private static class getAllOGUsers_resultStandardSchemeFactory implements SchemeFactory { - public getAllOGUsers_resultStandardScheme getScheme() { - return new getAllOGUsers_resultStandardScheme(); + private static class getAllOtherSatelliteUsers_resultStandardSchemeFactory implements SchemeFactory { + public getAllOtherSatelliteUsers_resultStandardScheme getScheme() { + return new getAllOtherSatelliteUsers_resultStandardScheme(); } } - private static class getAllOGUsers_resultStandardScheme extends StandardScheme<getAllOGUsers_result> { + private static class getAllOtherSatelliteUsers_resultStandardScheme extends StandardScheme<getAllOtherSatelliteUsers_result> { - public void read(org.apache.thrift.protocol.TProtocol iprot, getAllOGUsers_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getAllOtherSatelliteUsers_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -28531,7 +28797,7 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getAllOGUsers_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getAllOtherSatelliteUsers_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -28553,16 +28819,16 @@ public class Server { } - private static class getAllOGUsers_resultTupleSchemeFactory implements SchemeFactory { - public getAllOGUsers_resultTupleScheme getScheme() { - return new getAllOGUsers_resultTupleScheme(); + private static class getAllOtherSatelliteUsers_resultTupleSchemeFactory implements SchemeFactory { + public getAllOtherSatelliteUsers_resultTupleScheme getScheme() { + return new getAllOtherSatelliteUsers_resultTupleScheme(); } } - private static class getAllOGUsers_resultTupleScheme extends TupleScheme<getAllOGUsers_result> { + private static class getAllOtherSatelliteUsers_resultTupleScheme extends TupleScheme<getAllOtherSatelliteUsers_result> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getAllOGUsers_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getAllOtherSatelliteUsers_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -28581,7 +28847,7 @@ public class Server { } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getAllOGUsers_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getAllOtherSatelliteUsers_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { @@ -28603,4 +28869,1192 @@ public class Server { } + public static class writeAdditionalImageRights_args implements org.apache.thrift.TBase<writeAdditionalImageRights_args, writeAdditionalImageRights_args._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalImageRights_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalImageRights_args"); + + private static final org.apache.thrift.protocol.TField IMAGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageName", org.apache.thrift.protocol.TType.STRING, (short)1); + 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)2); + private static final org.apache.thrift.protocol.TField IS_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("isRead", org.apache.thrift.protocol.TType.BOOL, (short)3); + private static final org.apache.thrift.protocol.TField IS_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("isWrite", org.apache.thrift.protocol.TType.BOOL, (short)4); + private static final org.apache.thrift.protocol.TField IS_LINK_ALLOWED_FIELD_DESC = new org.apache.thrift.protocol.TField("isLinkAllowed", org.apache.thrift.protocol.TType.BOOL, (short)5); + private static final org.apache.thrift.protocol.TField IS_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("isAdmin", org.apache.thrift.protocol.TType.BOOL, (short)6); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new writeAdditionalImageRights_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new writeAdditionalImageRights_argsTupleSchemeFactory()); + } + + public String imageName; // required + public String userID; // required + public boolean isRead; // required + public boolean isWrite; // required + public boolean isLinkAllowed; // required + public boolean isAdmin; // 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 { + IMAGE_NAME((short)1, "imageName"), + USER_ID((short)2, "userID"), + IS_READ((short)3, "isRead"), + IS_WRITE((short)4, "isWrite"), + IS_LINK_ALLOWED((short)5, "isLinkAllowed"), + IS_ADMIN((short)6, "isAdmin"); + + 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: // IMAGE_NAME + return IMAGE_NAME; + case 2: // USER_ID + return USER_ID; + case 3: // IS_READ + return IS_READ; + case 4: // IS_WRITE + return IS_WRITE; + case 5: // IS_LINK_ALLOWED + return IS_LINK_ALLOWED; + case 6: // IS_ADMIN + return IS_ADMIN; + 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 __ISREAD_ISSET_ID = 0; + private static final int __ISWRITE_ISSET_ID = 1; + private static final int __ISLINKALLOWED_ISSET_ID = 2; + private static final int __ISADMIN_ISSET_ID = 3; + 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.IMAGE_NAME, new org.apache.thrift.meta_data.FieldMetaData("imageName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + 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.IS_READ, new org.apache.thrift.meta_data.FieldMetaData("isRead", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_WRITE, new org.apache.thrift.meta_data.FieldMetaData("isWrite", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_LINK_ALLOWED, new org.apache.thrift.meta_data.FieldMetaData("isLinkAllowed", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_ADMIN, new org.apache.thrift.meta_data.FieldMetaData("isAdmin", 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(writeAdditionalImageRights_args.class, metaDataMap); + } + + public writeAdditionalImageRights_args() { + } + + public writeAdditionalImageRights_args( + String imageName, + String userID, + boolean isRead, + boolean isWrite, + boolean isLinkAllowed, + boolean isAdmin) + { + this(); + this.imageName = imageName; + this.userID = userID; + this.isRead = isRead; + setIsReadIsSet(true); + this.isWrite = isWrite; + setIsWriteIsSet(true); + this.isLinkAllowed = isLinkAllowed; + setIsLinkAllowedIsSet(true); + this.isAdmin = isAdmin; + setIsAdminIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public writeAdditionalImageRights_args(writeAdditionalImageRights_args other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetImageName()) { + this.imageName = other.imageName; + } + if (other.isSetUserID()) { + this.userID = other.userID; + } + this.isRead = other.isRead; + this.isWrite = other.isWrite; + this.isLinkAllowed = other.isLinkAllowed; + this.isAdmin = other.isAdmin; + } + + public writeAdditionalImageRights_args deepCopy() { + return new writeAdditionalImageRights_args(this); + } + + @Override + public void clear() { + this.imageName = null; + this.userID = null; + setIsReadIsSet(false); + this.isRead = false; + setIsWriteIsSet(false); + this.isWrite = false; + setIsLinkAllowedIsSet(false); + this.isLinkAllowed = false; + setIsAdminIsSet(false); + this.isAdmin = false; + } + + public String getImageName() { + return this.imageName; + } + + public writeAdditionalImageRights_args setImageName(String imageName) { + this.imageName = imageName; + return this; + } + + public void unsetImageName() { + this.imageName = null; + } + + /** Returns true if field imageName is set (has been assigned a value) and false otherwise */ + public boolean isSetImageName() { + return this.imageName != null; + } + + public void setImageNameIsSet(boolean value) { + if (!value) { + this.imageName = null; + } + } + + public String getUserID() { + return this.userID; + } + + public writeAdditionalImageRights_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 boolean isIsRead() { + return this.isRead; + } + + public writeAdditionalImageRights_args setIsRead(boolean isRead) { + this.isRead = isRead; + setIsReadIsSet(true); + return this; + } + + public void unsetIsRead() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISREAD_ISSET_ID); + } + + /** Returns true if field isRead is set (has been assigned a value) and false otherwise */ + public boolean isSetIsRead() { + return EncodingUtils.testBit(__isset_bitfield, __ISREAD_ISSET_ID); + } + + public void setIsReadIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISREAD_ISSET_ID, value); + } + + public boolean isIsWrite() { + return this.isWrite; + } + + public writeAdditionalImageRights_args setIsWrite(boolean isWrite) { + this.isWrite = isWrite; + setIsWriteIsSet(true); + return this; + } + + public void unsetIsWrite() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISWRITE_ISSET_ID); + } + + /** Returns true if field isWrite is set (has been assigned a value) and false otherwise */ + public boolean isSetIsWrite() { + return EncodingUtils.testBit(__isset_bitfield, __ISWRITE_ISSET_ID); + } + + public void setIsWriteIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISWRITE_ISSET_ID, value); + } + + public boolean isIsLinkAllowed() { + return this.isLinkAllowed; + } + + public writeAdditionalImageRights_args setIsLinkAllowed(boolean isLinkAllowed) { + this.isLinkAllowed = isLinkAllowed; + setIsLinkAllowedIsSet(true); + return this; + } + + public void unsetIsLinkAllowed() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID); + } + + /** Returns true if field isLinkAllowed is set (has been assigned a value) and false otherwise */ + public boolean isSetIsLinkAllowed() { + return EncodingUtils.testBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID); + } + + public void setIsLinkAllowedIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID, value); + } + + public boolean isIsAdmin() { + return this.isAdmin; + } + + public writeAdditionalImageRights_args setIsAdmin(boolean isAdmin) { + this.isAdmin = isAdmin; + setIsAdminIsSet(true); + return this; + } + + public void unsetIsAdmin() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISADMIN_ISSET_ID); + } + + /** Returns true if field isAdmin is set (has been assigned a value) and false otherwise */ + public boolean isSetIsAdmin() { + return EncodingUtils.testBit(__isset_bitfield, __ISADMIN_ISSET_ID); + } + + public void setIsAdminIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISADMIN_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case IMAGE_NAME: + if (value == null) { + unsetImageName(); + } else { + setImageName((String)value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + case IS_READ: + if (value == null) { + unsetIsRead(); + } else { + setIsRead((Boolean)value); + } + break; + + case IS_WRITE: + if (value == null) { + unsetIsWrite(); + } else { + setIsWrite((Boolean)value); + } + break; + + case IS_LINK_ALLOWED: + if (value == null) { + unsetIsLinkAllowed(); + } else { + setIsLinkAllowed((Boolean)value); + } + break; + + case IS_ADMIN: + if (value == null) { + unsetIsAdmin(); + } else { + setIsAdmin((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case IMAGE_NAME: + return getImageName(); + + case USER_ID: + return getUserID(); + + case IS_READ: + return Boolean.valueOf(isIsRead()); + + case IS_WRITE: + return Boolean.valueOf(isIsWrite()); + + case IS_LINK_ALLOWED: + return Boolean.valueOf(isIsLinkAllowed()); + + case IS_ADMIN: + return Boolean.valueOf(isIsAdmin()); + + } + 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 IMAGE_NAME: + return isSetImageName(); + case USER_ID: + return isSetUserID(); + case IS_READ: + return isSetIsRead(); + case IS_WRITE: + return isSetIsWrite(); + case IS_LINK_ALLOWED: + return isSetIsLinkAllowed(); + case IS_ADMIN: + return isSetIsAdmin(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof writeAdditionalImageRights_args) + return this.equals((writeAdditionalImageRights_args)that); + return false; + } + + public boolean equals(writeAdditionalImageRights_args that) { + if (that == null) + return false; + + boolean this_present_imageName = true && this.isSetImageName(); + boolean that_present_imageName = true && that.isSetImageName(); + if (this_present_imageName || that_present_imageName) { + if (!(this_present_imageName && that_present_imageName)) + return false; + if (!this.imageName.equals(that.imageName)) + 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_isRead = true; + boolean that_present_isRead = true; + if (this_present_isRead || that_present_isRead) { + if (!(this_present_isRead && that_present_isRead)) + return false; + if (this.isRead != that.isRead) + return false; + } + + boolean this_present_isWrite = true; + boolean that_present_isWrite = true; + if (this_present_isWrite || that_present_isWrite) { + if (!(this_present_isWrite && that_present_isWrite)) + return false; + if (this.isWrite != that.isWrite) + return false; + } + + boolean this_present_isLinkAllowed = true; + boolean that_present_isLinkAllowed = true; + if (this_present_isLinkAllowed || that_present_isLinkAllowed) { + if (!(this_present_isLinkAllowed && that_present_isLinkAllowed)) + return false; + if (this.isLinkAllowed != that.isLinkAllowed) + return false; + } + + boolean this_present_isAdmin = true; + boolean that_present_isAdmin = true; + if (this_present_isAdmin || that_present_isAdmin) { + if (!(this_present_isAdmin && that_present_isAdmin)) + return false; + if (this.isAdmin != that.isAdmin) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(writeAdditionalImageRights_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetImageName()).compareTo(other.isSetImageName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageName, other.imageName); + if (lastComparison != 0) { + return lastComparison; + } + } + 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(isSetIsRead()).compareTo(other.isSetIsRead()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsRead()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isRead, other.isRead); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsWrite()).compareTo(other.isSetIsWrite()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsWrite()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isWrite, other.isWrite); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsLinkAllowed()).compareTo(other.isSetIsLinkAllowed()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsLinkAllowed()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isLinkAllowed, other.isLinkAllowed); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsAdmin()).compareTo(other.isSetIsAdmin()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsAdmin()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isAdmin, other.isAdmin); + 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("writeAdditionalImageRights_args("); + boolean first = true; + + sb.append("imageName:"); + if (this.imageName == null) { + sb.append("null"); + } else { + sb.append(this.imageName); + } + first = false; + if (!first) sb.append(", "); + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + if (!first) sb.append(", "); + sb.append("isRead:"); + sb.append(this.isRead); + first = false; + if (!first) sb.append(", "); + sb.append("isWrite:"); + sb.append(this.isWrite); + first = false; + if (!first) sb.append(", "); + sb.append("isLinkAllowed:"); + sb.append(this.isLinkAllowed); + first = false; + if (!first) sb.append(", "); + sb.append("isAdmin:"); + sb.append(this.isAdmin); + 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 writeAdditionalImageRights_argsStandardSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_argsStandardScheme getScheme() { + return new writeAdditionalImageRights_argsStandardScheme(); + } + } + + private static class writeAdditionalImageRights_argsStandardScheme extends StandardScheme<writeAdditionalImageRights_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalImageRights_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: // IMAGE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageName = iprot.readString(); + struct.setImageNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // 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 3: // IS_READ + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isRead = iprot.readBool(); + struct.setIsReadIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // IS_WRITE + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isWrite = iprot.readBool(); + struct.setIsWriteIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // IS_LINK_ALLOWED + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isLinkAllowed = iprot.readBool(); + struct.setIsLinkAllowedIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // IS_ADMIN + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isAdmin = iprot.readBool(); + struct.setIsAdminIsSet(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, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.imageName != null) { + oprot.writeFieldBegin(IMAGE_NAME_FIELD_DESC); + oprot.writeString(struct.imageName); + oprot.writeFieldEnd(); + } + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(IS_READ_FIELD_DESC); + oprot.writeBool(struct.isRead); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_WRITE_FIELD_DESC); + oprot.writeBool(struct.isWrite); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_LINK_ALLOWED_FIELD_DESC); + oprot.writeBool(struct.isLinkAllowed); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_ADMIN_FIELD_DESC); + oprot.writeBool(struct.isAdmin); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class writeAdditionalImageRights_argsTupleSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_argsTupleScheme getScheme() { + return new writeAdditionalImageRights_argsTupleScheme(); + } + } + + private static class writeAdditionalImageRights_argsTupleScheme extends TupleScheme<writeAdditionalImageRights_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetImageName()) { + optionals.set(0); + } + if (struct.isSetUserID()) { + optionals.set(1); + } + if (struct.isSetIsRead()) { + optionals.set(2); + } + if (struct.isSetIsWrite()) { + optionals.set(3); + } + if (struct.isSetIsLinkAllowed()) { + optionals.set(4); + } + if (struct.isSetIsAdmin()) { + optionals.set(5); + } + oprot.writeBitSet(optionals, 6); + if (struct.isSetImageName()) { + oprot.writeString(struct.imageName); + } + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + if (struct.isSetIsRead()) { + oprot.writeBool(struct.isRead); + } + if (struct.isSetIsWrite()) { + oprot.writeBool(struct.isWrite); + } + if (struct.isSetIsLinkAllowed()) { + oprot.writeBool(struct.isLinkAllowed); + } + if (struct.isSetIsAdmin()) { + oprot.writeBool(struct.isAdmin); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(6); + if (incoming.get(0)) { + struct.imageName = iprot.readString(); + struct.setImageNameIsSet(true); + } + if (incoming.get(1)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + if (incoming.get(2)) { + struct.isRead = iprot.readBool(); + struct.setIsReadIsSet(true); + } + if (incoming.get(3)) { + struct.isWrite = iprot.readBool(); + struct.setIsWriteIsSet(true); + } + if (incoming.get(4)) { + struct.isLinkAllowed = iprot.readBool(); + struct.setIsLinkAllowedIsSet(true); + } + if (incoming.get(5)) { + struct.isAdmin = iprot.readBool(); + struct.setIsAdminIsSet(true); + } + } + } + + } + + public static class writeAdditionalImageRights_result implements org.apache.thrift.TBase<writeAdditionalImageRights_result, writeAdditionalImageRights_result._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalImageRights_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalImageRights_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 writeAdditionalImageRights_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new writeAdditionalImageRights_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(writeAdditionalImageRights_result.class, metaDataMap); + } + + public writeAdditionalImageRights_result() { + } + + public writeAdditionalImageRights_result( + boolean success) + { + this(); + this.success = success; + setSuccessIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public writeAdditionalImageRights_result(writeAdditionalImageRights_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + } + + public writeAdditionalImageRights_result deepCopy() { + return new writeAdditionalImageRights_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + } + + public boolean isSuccess() { + return this.success; + } + + public writeAdditionalImageRights_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 writeAdditionalImageRights_result) + return this.equals((writeAdditionalImageRights_result)that); + return false; + } + + public boolean equals(writeAdditionalImageRights_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(writeAdditionalImageRights_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("writeAdditionalImageRights_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 writeAdditionalImageRights_resultStandardSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_resultStandardScheme getScheme() { + return new writeAdditionalImageRights_resultStandardScheme(); + } + } + + private static class writeAdditionalImageRights_resultStandardScheme extends StandardScheme<writeAdditionalImageRights_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalImageRights_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, writeAdditionalImageRights_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 writeAdditionalImageRights_resultTupleSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_resultTupleScheme getScheme() { + return new writeAdditionalImageRights_resultTupleScheme(); + } + } + + private static class writeAdditionalImageRights_resultTupleScheme extends TupleScheme<writeAdditionalImageRights_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_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, writeAdditionalImageRights_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/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 0b5765fa..cb9464eb 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -942,7 +942,7 @@ public class SQL { return ret;
}
- public int setImageRights(String pk_person, String pk_image,int role ,int read, int write, int changePermission, int admin,int linkallowed) {
+ public int setImageRights(String pk_person, String pk_image,int role ,int read, int write, int admin,int linkallowed) {
@@ -951,7 +951,7 @@ public class SQL { Statement stm = con.createStatement();
String uid = UUID.randomUUID().toString();
- stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_image`(`GUID`,`GUID_imageID`,`roleID`,`userID`,`image_read`,`image_write`,`image_admin`,`image_changePermission`,`link_allowed`)VALUES('"
+ stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_image`(`GUID`,`GUID_imageID`,`roleID`,`userID`,`image_read`,`image_write`,`image_admin`,`link_allowed`)VALUES('"
+ uid
+ "','"
+ pk_image
@@ -966,8 +966,6 @@ public class SQL { + "','"
+ admin
+ "','"
- + changePermission
- + "','"
+ linkallowed+ "');");
con.commit();
con.close();
@@ -1057,7 +1055,8 @@ public class SQL { }
//get all users from HS OG -- temp, tb replaced by allUsers bwLehrpool
- public List<Person> getAllOGUsers(){
+ //does -NOT- return the user himself
+ public List<Person> getAllOtherSatelliteUsers(String userID){
Connection con=getConnection();
Statement stm=null;
ResultSet res = null;
@@ -1072,7 +1071,7 @@ public class SQL { e.printStackTrace();
}
try {
- res = stm.executeQuery("SELECT userID, Nachname, Vorname FROM m_user ORDER BY Nachname ASC;");
+ res = stm.executeQuery("SELECT userID, Nachname, Vorname FROM m_user WHERE userID !='"+userID+"' ORDER BY Nachname ASC;");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -1096,7 +1095,101 @@ public class SQL { }
+
+ public boolean updateImagePermissions(){
+ boolean success=true;
+
+ Connection con=getConnection();
+ Statement stm=null;
+ try {
+ stm = con.createStatement();
+ stm.executeQuery("");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return success;
+ }// end setImagePermissions()
+ public boolean deleteImagePermissions(){
+ boolean success=true;
+
+ Connection con=getConnection();
+ Statement stm=null;
+ try {
+ stm = con.createStatement();
+ stm.executeQuery("");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return success;
+ }// end setImagePermissions()
+
+ public boolean writeAdditionalImageRights(String imageID, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin){
+ boolean success= true;
+
+ String uid = UUID.randomUUID().toString();
+ Connection con=getConnection();
+ Statement stm=null;
+
+ try {
+ stm=con.createStatement();
+
+ log.info(new Date() + " - INSERT INTO pm_VLData_image (" +
+ "GUID, " +
+ "GUID_imageID, " +
+ "roleID, " +
+ "userID, " +
+ "image_read, " +
+ "image_write, " +
+ "Image_admin, " +
+ "link_allowed)" +
+ "VALUES(" +
+ "'"+uid+"'," +
+ "'"+imageID+"'," +
+ "1," +
+ "'"+userID+"'," +
+ isRead+"," +
+ isWrite+"," +
+ isLinkAllowed+"," +
+ isAdmin+"" +
+ ")");
+
+ stm.executeUpdate("INSERT INTO pm_VLData_image (" +
+ "GUID, " +
+ "GUID_imageID, " +
+ "roleID, " +
+ "userID, " +
+ "image_read, " +
+ "image_write, " +
+ "Image_admin, " +
+ "link_allowed)" +
+ "VALUES(" +
+ "'"+uid+"'," +
+ "'"+imageID+"'," +
+ "1," +
+ "'"+userID+"'," +
+ isRead+"," +
+ isWrite+"," +
+ isLinkAllowed+"," +
+ isAdmin+"" +
+ ");");
+ con.commit();
+ con.close();
+ log.info(new Date() + " - Written additional image rights.");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ log.info(new Date() + " - Failed to write additional image rights.");
+ }
+
+
+ return success;
+
+ }// end
-}
+}//end class
diff --git a/dozentenmodulserver/thrift/server.thrift b/dozentenmodulserver/thrift/server.thrift index 0a3313e9..3ac11d68 100644 --- a/dozentenmodulserver/thrift/server.thrift +++ b/dozentenmodulserver/thrift/server.thrift @@ -63,5 +63,6 @@ service Server{ bool createUser(1: string loginName, 2: string lastName, 3: string firstName, 4: string mail, 5: string university), bool writeImageRights(1: string imagename, 2: string username, 3: string lastName, 4: string firstName, 5: string mail, 6: string university, 7: string role), bool writeLectureRights(1: string lecturename, 2: string username, 3: string lastName, 4: string firstName, 5: string mail, 6: string university, 7: string role), - list<Person>getAllOGUsers(), + list<Person>getAllOtherSatelliteUsers(1: string userID), + bool writeAdditionalImageRights(1: string imageName, 2: string userID, 3: bool isRead, 4: bool isWrite, 5: bool isLinkAllowed, 6: bool isAdmin), } |
