diff options
| author | Nino Breuer | 2014-11-03 09:17:29 +0100 |
|---|---|---|
| committer | Nino Breuer | 2014-11-03 09:17:29 +0100 |
| commit | 4a078e9847b348441fdd7a36b558e107a7280ff0 (patch) | |
| tree | 8ad894376343bd00b46bceb113ace5ce1e02737c | |
| parent | v (diff) | |
| parent | • fixed bug which caused search guis to be closed when pressing enter in se... (diff) | |
| download | tutor-module-4a078e9847b348441fdd7a36b558e107a7280ff0.tar.gz tutor-module-4a078e9847b348441fdd7a36b558e107a7280ff0.tar.xz tutor-module-4a078e9847b348441fdd7a36b558e107a7280ff0.zip | |
Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module
Conflicts:
dozentenmodulserver/src/main/java/sql/SQL.java
• Note: manual merge
29 files changed, 1866 insertions, 492 deletions
diff --git a/dozentenmodul/src/main/java/ftp/DownloadTask.java b/dozentenmodul/src/main/java/ftp/DownloadTask.java index 17becc52..f040e20d 100644 --- a/dozentenmodul/src/main/java/ftp/DownloadTask.java +++ b/dozentenmodul/src/main/java/ftp/DownloadTask.java @@ -1,16 +1,23 @@ package ftp; -import gui.image.FTPEditDownloader_GUI; -import gui.intro.Login_GUI; - import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Map; import javax.swing.JOptionPane; import javax.swing.SwingWorker; +import models.Image; + +import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; +import org.apache.thrift.TException; + +import config.Config; +import util.ResourceLoader; /** * Execute file download in a background thread and update the progress. @@ -24,9 +31,11 @@ public class DownloadTask extends SwingWorker<Void, Void> { * Logger instance for this class. */ private final static Logger LOGGER = Logger.getLogger(DownloadTask.class); - - // 8MB buffer + private static final int BUFFER_SIZE = 8 * 1024 * 1024; + private static final double UPDATE_INTERVAL_SECONDS = 0.6; + private static final double UPDATE_INTERVAL_MS = UPDATE_INTERVAL_SECONDS * 1000; + private static final double BYTES_PER_MIB = 1024 * 1024; private String host; private int port; @@ -44,7 +53,6 @@ public class DownloadTask extends SwingWorker<Void, Void> { this.password = password; this.downloadPath = downloadPath; this.saveDir = saveDir; - } /** @@ -56,40 +64,47 @@ public class DownloadTask extends SwingWorker<Void, Void> { try { util.connect(); - byte[] buffer = new byte[BUFFER_SIZE]; - int bytesRead = -1; - long totalBytesRead = 0; - percentCompleted = 0; - long start = System.nanoTime(); - final double NANOS_PER_SECOND = 1000000000.0; - final double BYTES_PER_MIB = 1024 * 1024; + // show filesize in the GUI long fileSize = util.getFileSize(downloadPath); - // gui.setFileSize(fileSize); + firePropertyChange("filesize", 0, fileSize); + util.downloadFile(downloadPath); + // prepare the input/output streams String fileName = new File(downloadPath).getName(); - File downloadFile = new File(saveDir + File.separator + fileName); FileOutputStream outputStream = new FileOutputStream(downloadFile); - - util.downloadFile(downloadPath); InputStream inputStream = util.getInputStream(); - while ((bytesRead = inputStream.read(buffer)) != -1 - && isCancelled() == false) { + // initialize the counters needed for speed calculations + percentCompleted = 0; + byte[] buffer = new byte[BUFFER_SIZE]; + int bytesRead = -1; + long totalBytesRead = 0; + long lastUpdate = 0; + long lastBytes = 0; + long currentBytes = 0; + while ((bytesRead = inputStream.read(buffer)) != -1 && !isCancelled()) { outputStream.write(buffer, 0, bytesRead); + currentBytes += bytesRead; totalBytesRead += bytesRead; - double speed = NANOS_PER_SECOND / BYTES_PER_MIB - * totalBytesRead / (System.nanoTime() - start + 1); - percentCompleted = (int) (totalBytesRead * 100 / fileSize); - setProgress(percentCompleted); - firePropertyChange("speed", 0, speed); - firePropertyChange("filesize", 0, fileSize); - firePropertyChange("bytesread", 0, totalBytesRead); - + long now = System.currentTimeMillis(); + if (lastUpdate + UPDATE_INTERVAL_MS < now) { + percentCompleted = (int) ((totalBytesRead * 100) / fileSize); + setProgress(percentCompleted); + lastBytes = (lastBytes * 2 + currentBytes) / 3; + final double speed = lastBytes / UPDATE_INTERVAL_SECONDS; + firePropertyChange("speed", 0, speed / BYTES_PER_MIB); + firePropertyChange("bytesread", 0, totalBytesRead); + lastUpdate = now; + currentBytes = 0; + } } - + // finalize the download by updating the progress bar one last time + // (in case we didn't get to do it because of the time interval) + percentCompleted = (int) ((totalBytesRead * 100) / fileSize); + setProgress(percentCompleted); + firePropertyChange("bytesread", 0, totalBytesRead); outputStream.close(); - util.finish(); } catch (FTPException ex) { JOptionPane.showMessageDialog(null, @@ -112,8 +127,10 @@ public class DownloadTask extends SwingWorker<Void, Void> { protected void done() { if (!isCancelled() && percentCompleted==100) { LOGGER.info("Datei erfolgreich heruntergeladen."); + String vmxResult = ""; + vmxResult = generateVmx() ? "Passende VMX generiert." : "Keine passende VMX generiert!"; JOptionPane.showMessageDialog(null, - "Datei erfolgreich heruntergeladen.", "Message", + "Datei erfolgreich heruntergeladen. " + vmxResult, "Message", JOptionPane.INFORMATION_MESSAGE); } else if(!isCancelled() && percentCompleted != 100){ LOGGER.error("Datei wurde unvollständig heruntergeladen."); @@ -122,4 +139,51 @@ public class DownloadTask extends SwingWorker<Void, Void> { JOptionPane.INFORMATION_MESSAGE); } } -}
\ No newline at end of file + /** + * Helper to generate the vmx for the downloaded image + * @return true|false indicating the success of the file creation + */ + private boolean generateVmx() { + String vmxTemplate = ResourceLoader.getTextFile("/txt/vmx_template"); + // TODO: sanity checks on vmxTemplate would be good here... just to be safe + + // now we replace the placeholder variables with the real data + // for this, we first need to get the image information from the server + LOGGER.debug("Image's ID: " + Image.image.getImageId()); + Map<String, String> imageData = null; + try { + imageData = models.Client.clientcon.getClient().getImageData(Image.image.getImageId(), Image.image.getVersion()); + } catch (TException e) { + LOGGER.error("Thrift exception during transfer, see trace: ", e); + return false; + } + + // sanity check, shouldn't happen. + if (imageData == null) { + LOGGER.error("Could not query the image information from the server!"); + LOGGER.error("Image's ID: " + Image.image.getImageId()); + LOGGER.error("Image's version: " + Image.image.getVersion()); + return false; + } + // TODO: sanity checks on the content of imageData would be good here... + // use the information we received about the image + vmxTemplate = vmxTemplate.replace("%VM_DISPLAY_NAME%", imageData.get("name")); + vmxTemplate = vmxTemplate.replace("%VM_GUEST_OS%", imageData.get("os")); + vmxTemplate = vmxTemplate.replace("%VM_CPU_COUNT%", imageData.get("cpu")); + vmxTemplate = vmxTemplate.replace("%VM_RAM_SIZE%", String.valueOf(Integer.valueOf(imageData.get("ram")) * 1024)); + vmxTemplate = vmxTemplate.replace("%VM_DISK_PATH%", imageData.get("path").replaceFirst("^prod/", "")); + + // build filename for the vmx, basicly the same as the path of the vmdk + // just without the leading "prod/" and "vmx" instead of "vmdk" at the end. + String targetFilename = Config.getLastDownloadPath() + File.separator + + imageData.get("path").replaceFirst("^prod/", "").replaceFirst("\\.vmdk$", "") + ".vmx"; + try { + // try to write it to file + FileUtils.writeStringToFile(new File(targetFilename), vmxTemplate, StandardCharsets.UTF_8); + } catch (IOException e) { + LOGGER.error("Could not write vmx-template to '" + targetFilename + "'. See trace: ", e); + return false; + } + return true; + } +} diff --git a/dozentenmodul/src/main/java/ftp/UploadTask.java b/dozentenmodul/src/main/java/ftp/UploadTask.java index 68af1f3c..2579b125 100644 --- a/dozentenmodul/src/main/java/ftp/UploadTask.java +++ b/dozentenmodul/src/main/java/ftp/UploadTask.java @@ -24,9 +24,7 @@ public class UploadTask extends SwingWorker<Void, Void> { */ private final static Logger LOGGER = Logger.getLogger(UploadTask.class); - // 8MB buffer private static final int BUFFER_SIZE = 1024 * 1024; - private static final double UPDATE_INTERVAL_SECONDS = 0.6; private static final double UPDATE_INTERVAL_MS = UPDATE_INTERVAL_SECONDS * 1000; private static final double BYTES_PER_MIB = 1024 * 1024; @@ -60,11 +58,15 @@ public class UploadTask extends SwingWorker<Void, Void> { util.connect(); util.uploadFile(uploadFile, destDir); - FileInputStream inputStream = new FileInputStream(uploadFile); + // show filesize in the GUI long fileSize = uploadFile.length(); Image.image.setFilesize(fileSize); firePropertyChange("filesize", 0, fileSize); + // prepare input stream + FileInputStream inputStream = new FileInputStream(uploadFile); + + // initialize the counters needed for speed calculations percentCompleted = 0; byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; @@ -88,11 +90,12 @@ public class UploadTask extends SwingWorker<Void, Void> { currentBytes = 0; } } + // finalize the upload by updating the progress bar one last time + // (in case we didn't get to do it because of the time interval) percentCompleted = (int) ((totalBytesRead * 100) / fileSize); setProgress(percentCompleted); firePropertyChange("bytesread", 0, totalBytesRead); inputStream.close(); - util.finish(); } catch (FTPException ex) { JOptionPane.showMessageDialog(null, diff --git a/dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java index 26b40619..41dd1057 100644 --- a/dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java @@ -227,7 +227,7 @@ public class CreateImageAllgemein_GUI extends JFrame { txtrGebenSieBitte.setLineWrap(true); txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); txtrGebenSieBitte - .setText("Geben Sie bitte einen sprechenden Namen für das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); + .setText("Geben Sie bitte einen sprechenden Namen für das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Java Wintersemester bei...\""); txtrGebenSieBitte.setBounds(145, 48, 350, 49); panel_1.add(txtrGebenSieBitte); @@ -447,12 +447,14 @@ public class CreateImageAllgemein_GUI extends JFrame { return false; } - // only allow letter from alphabet and numbers for the image name - if (!imagename.getText().matches("[a-zA-Z0-9]+")) { - LOGGER.info("Image name not alpha-numerical, warning user."); + // only allow letter from alphabet and numbers for the image name and certain special chars + // x2B= "+" x2C="-" x3A=":" x5F="_" + // + if (!imagename.getText().trim().matches("[a-zA-Z0-9\\x2B\\x2D\\x3A\\x5F]+")) { + LOGGER.info("Image name not alpha-numerical, warn user."); JOptionPane.showMessageDialog( c, - "Der Imagename darf keine Leer- oder Sonderzeichen enthalten.", + "Der Imagename darf nur aus Buchstaben, Zahlen und den Zeichen + - _ : bestehen.", "Unerlaubte Zeichen", JOptionPane.ERROR_MESSAGE); return false; diff --git a/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java b/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java index 22344d2f..e3f482e2 100644 --- a/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java @@ -115,22 +115,26 @@ public class DeleteImage_GUI extends JFrame { ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); + + /* final DefaultTableModel modelAll = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; + */ final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; + /* final DefaultTableModel modelPublicVorlagen = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } - }; + };*/ /* final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( modelAll); @@ -153,6 +157,7 @@ public class DeleteImage_GUI extends JFrame { filters.add(RowFilter.regexFilter(".", 0)); rf = RowFilter.orFilter(filters); + addWindowListener(new WindowAdapter() { @@ -165,9 +170,9 @@ public class DeleteImage_GUI extends JFrame { @Override public void windowOpened(WindowEvent arg0) { - initTableModel(modelAll); + //initTableModel(modelAll); initTableModel(modelMyImages); - initTableModel(modelPublicVorlagen); + //initTableModel(modelPublicVorlagen); // auszublendende Angaben // 1=Lizenzpflichtig @@ -497,6 +502,9 @@ public class DeleteImage_GUI extends JFrame { tablemyImages.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { + + if(tablemyImages.getSelectedRow() != -1) + { String imageid = modelMyImages.getValueAt( tablemyImages .convertRowIndexToModel(tablemyImages @@ -508,7 +516,9 @@ public class DeleteImage_GUI extends JFrame { .getSelectedRow()), 7) .toString(); writeImageData(imageid, version); + } } + }); tablemyImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tablemyImages.setModel(modelMyImages); @@ -752,6 +762,8 @@ public class DeleteImage_GUI extends JFrame { // Initiale Beffuelung eines Table models public DefaultTableModel initTableModel(DefaultTableModel model) { + + List<server.generated.Image> images; try { // Hole eine Liste der Images @@ -759,10 +771,12 @@ public class DeleteImage_GUI extends JFrame { Iterator<server.generated.Image> i = images.iterator(); + System.out.println("Size of image list="+images.size()); + int x = 0; - SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); - + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); + while (i.hasNext()) { // erzeuge Objekte fuer die Tabelle Object[] obj = { images.get(x).getImageName(), @@ -778,8 +792,13 @@ public class DeleteImage_GUI extends JFrame { model.addRow(obj); x++; i.next(); + + } + if(x==0){ + System.out.println("Damn... nothing to do here.."); + } return model; } catch (TException | ParseException e1) { @@ -812,8 +831,8 @@ public class DeleteImage_GUI extends JFrame { public void writeImageData(String id, String version) { try { - SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); Map<String, String> res = client.getImageData(id, version); labelName.setText(res.get("name")); labelOS.setText(res.get("os")); diff --git a/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java index 8238c5c1..1d1fbc85 100644 --- a/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java @@ -160,6 +160,7 @@ public class EditImageAllgemein_GUI extends JFrame { Vorname.setEnabled(false); Vorname.setBackground(Color.WHITE); Vorname.setText(person.verantwortlicher.getVorname()); + //Vorname.setText(Image.image.get); Vorname.setColumns(10); Vorname.setBounds(145, 245, 350, 20); panel_1.add(Vorname); @@ -225,7 +226,7 @@ public class EditImageAllgemein_GUI extends JFrame { txtrGebenSieBitte.setLineWrap(true); txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); txtrGebenSieBitte - .setText("Geben Sie bitte einen sprechenden Namen für das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); + .setText("Geben Sie bitte einen sprechenden Namen für das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Java Wintersemester bei...\""); txtrGebenSieBitte.setBounds(145, 48, 350, 55); panel_1.add(txtrGebenSieBitte); diff --git a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java index 8db64f4f..b1c7efb0 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java @@ -574,7 +574,7 @@ public class FTPCreateUploader_GUI extends JFrame implements "Konnte vom Satellit keinen FTP-User erhalten!", "Debug-Message", JOptionPane.ERROR_MESSAGE); } - DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); + DateFormat formatter = new SimpleDateFormat("yyyMMddHHmmss"); LOGGER.info("Setting new name: " + formatter.format(new Date()) + "_" + person.verantwortlicher.getHochschule() + "_" diff --git a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java index 369bf110..c27e6a04 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java @@ -566,7 +566,7 @@ public class FTPEditUploader_GUI extends JFrame implements "Konnte vom Satelliten keine FTP-User erhalten!", "Debug-Message", JOptionPane.ERROR_MESSAGE); } - DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); + DateFormat formatter = new SimpleDateFormat("yyyMMddHHmmss"); LOGGER.info("Setting new Name: " + formatter.format(new Date()) + "_" + person.verantwortlicher.getHochschule() + "_" diff --git a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java index 403520a0..bac85d04 100644 --- a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java @@ -264,25 +264,35 @@ public class SearchEditImage_GUI extends JFrame { //System.out.println("Help, I don't want to be filtered yet...."); // Wenn Textfield nicht leer - if (stext.trim().length() > 0) { + if (stext.trim().length() > 0) + { + activeSearch = true; // Filtere nach der Eingabe - filters.clear(); - filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive - filters.add(RowFilter.regexFilter("(?i)"+stext, 9)); //case insensitive - rf = RowFilter.orFilter(filters); - rowSorterMyImages.setRowFilter(rf); - - + + filters.clear(); + + filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive + filters.add(RowFilter.regexFilter("(?i)"+stext, 9)); //case insensitive + + rf = RowFilter.orFilter(filters); + rowSorterMyImages.setRowFilter(rf); + + } + else + { - } else { activeSearch = false; filters.clear(); filters.add(RowFilter.regexFilter(".", 0)); //case insensitive, filter for anything + rf = RowFilter.orFilter(filters); + rowSorterMyImages.setRowFilter(rf); + } + tablemyImages.clearSelection(); resetImageInfo(); @@ -467,7 +477,7 @@ public class SearchEditImage_GUI extends JFrame { }); okButton.setActionCommand("OK"); buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); + //getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Weiter"); diff --git a/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java b/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java index 67aab17d..1d0a37ce 100644 --- a/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java @@ -20,6 +20,7 @@ import java.net.URI; import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -100,7 +101,7 @@ public class SearchImage_GUI extends JFrame { boolean activeSearch = false;
Component c = null;
String[] titles = { "Name", "Lizenzpflichtig", "OS", "Veranstaltung",
- "Verantwortlicher", "Letztes Update", "ID", "Version", "Template" }; // Angezeigt
+ "Verantwortlicher", "Letztes Update", "ID", "Version", "Template", "Beschreibung" }; // Angezeigt
// werden
// aber
// nur
@@ -143,11 +144,39 @@ public class SearchImage_GUI extends JFrame { modelMyImages);
final TableRowSorter<TableModel> rowSorterPublicVorlagen = new TableRowSorter<TableModel>(
modelPublicVorlagen);
+
+
+
+
+ RowFilter orFilter = null;
+ List<RowFilter<Object,Object>> orFilters = new ArrayList<RowFilter<Object,Object>>();
+
+ //needed for templates, filter for name OR desc AND temp_flag --> (name || desc) && (temp_flag)
+ RowFilter andFilter = null;
+ List<RowFilter<Object,Object>> andFilters = new ArrayList<RowFilter<Object,Object>>();
+ //the final filter which handles the search in the templates
+ RowFilter templateFilter = null;
+ ArrayList<RowFilter<Object, Object>> finalFilters = new ArrayList<RowFilter<Object, Object>>();
+
+
/**
* Create the dialog.
*/
public SearchImage_GUI(Component formerGUI) {
+
+
+ orFilters.add(RowFilter.regexFilter(".", 0)); //search for anything
+ orFilter = RowFilter.orFilter(orFilters);
+
+ andFilters.add(RowFilter.regexFilter("1", 8));
+ andFilter = RowFilter.andFilter(andFilters);
+
+ finalFilters.add(andFilter);
+ finalFilters.add(orFilter);
+
+ templateFilter = RowFilter.andFilter(finalFilters);
+
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
@@ -160,7 +189,7 @@ public class SearchImage_GUI extends JFrame { public void windowOpened(WindowEvent arg0) {
initTableModel(modelAll);
initTableModel(modelMyImages);
- initTableModel(modelPublicVorlagen);
+ initTableModelTemplates(modelPublicVorlagen);
// auszublendende Angaben
// 1=Lizenzpflichtig
@@ -183,32 +212,28 @@ public class SearchImage_GUI extends JFrame { tablemyImages.getColumnModel().getColumn(7).setWidth(0);
tablemyImages.getColumnModel().getColumn(7).setMinWidth(0);
tablemyImages.getColumnModel().getColumn(7).setMaxWidth(0);
+ tablemyImages.getColumnModel().getColumn(9).setWidth(0);
+ tablemyImages.getColumnModel().getColumn(9).setMinWidth(0);
+ tablemyImages.getColumnModel().getColumn(9).setMaxWidth(0);
tablePublicVorlagen.getColumnModel().getColumn(1).setWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(1)
- .setMinWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(1)
- .setMaxWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(1).setMinWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(1).setMaxWidth(0);
tablePublicVorlagen.getColumnModel().getColumn(3).setWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(3)
- .setMinWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(3)
- .setMaxWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(3).setMinWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(3).setMaxWidth(0);
tablePublicVorlagen.getColumnModel().getColumn(8).setWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(8)
- .setMinWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(8)
- .setMaxWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(8).setMinWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(8).setMaxWidth(0);
tablePublicVorlagen.getColumnModel().getColumn(6).setWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(6)
- .setMinWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(6)
- .setMaxWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(6).setMinWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(6).setMaxWidth(0);
tablePublicVorlagen.getColumnModel().getColumn(7).setWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(7)
- .setMinWidth(0);
- tablePublicVorlagen.getColumnModel().getColumn(7)
- .setMaxWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(7).setMinWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(7).setMaxWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(9).setWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(9).setMinWidth(0);
+ tablePublicVorlagen.getColumnModel().getColumn(9).setMaxWidth(0);
tableAllImages.getColumnModel().getColumn(1).setWidth(0);
tableAllImages.getColumnModel().getColumn(1).setMinWidth(0);
@@ -225,6 +250,10 @@ public class SearchImage_GUI extends JFrame { tableAllImages.getColumnModel().getColumn(7).setWidth(0);
tableAllImages.getColumnModel().getColumn(7).setMinWidth(0);
tableAllImages.getColumnModel().getColumn(7).setMaxWidth(0);
+ tableAllImages.getColumnModel().getColumn(9).setWidth(0);
+ tableAllImages.getColumnModel().getColumn(9).setMinWidth(0);
+ tableAllImages.getColumnModel().getColumn(9).setMaxWidth(0);
+
textFieldName.requestFocusInWindow();
}
});
@@ -299,24 +328,63 @@ public class SearchImage_GUI extends JFrame { // Textfield eingabe auslesen
String stext = textFieldName.getText().trim();
+
+
+
+
+
// Wenn Textfield nicht leer
if (stext != "")
{
activeSearch = true;
// Filtere nach der Eingabe
- rowSorterAll.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0));
- rowSorterMyImages.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0));
- rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0));
+ orFilters.clear();
+ andFilters.clear();
+ finalFilters.clear();
+
+ orFilters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive
+ orFilters.add(RowFilter.regexFilter("(?i)"+stext, 9)); //case insensitive
+
+ orFilter = RowFilter.orFilter(orFilters);
+
+ rowSorterAll.setRowFilter(orFilter);
+ rowSorterMyImages.setRowFilter(orFilter);
+
+ andFilters.add(RowFilter.regexFilter("1", 8));
+ andFilter = RowFilter.andFilter(andFilters);
+
+ finalFilters.add(andFilter);
+ finalFilters.add(orFilter);
+ templateFilter = RowFilter.andFilter(finalFilters);
+ rowSorterPublicVorlagen.setRowFilter(templateFilter); //TODO füttere finalFilter mit andFilter und orFilter --> TEST
}
else
{ //refresh list
activeSearch = false;
String username = person.verantwortlicher.getName() + " " + person.verantwortlicher.getVorname();
- rowSorterMyImages.setRowFilter(RowFilter.regexFilter(username, 4));
- rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter("true", 8));
- rowSorterAll.setRowFilter(null);
+
+ orFilters.clear();
+ orFilters.add(RowFilter.regexFilter(username, 4)); //case insensitive, filter for anything
+ orFilter = RowFilter.andFilter(orFilters);
+
+ rowSorterMyImages.setRowFilter(orFilter);
+ rowSorterAll.setRowFilter(orFilter);
+
+ //in addition, templates can only be shown when they really are templates!
+ orFilters.clear();
+ orFilters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive
+ orFilters.add(RowFilter.regexFilter("(?i)"+stext, 9)); //case insensitive
+ orFilters.add(RowFilter.regexFilter("1", 8));
+ orFilter = RowFilter.orFilter(orFilters);
+ rowSorterPublicVorlagen.setRowFilter(orFilter);
}
+
+ tablemyImages.clearSelection();
+ tableAllImages.clearSelection();
+ tablePublicVorlagen.clearSelection();
+
+ resetImageInfo();
}
});
@@ -432,6 +500,10 @@ public class SearchImage_GUI extends JFrame { new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
+
+
+ if(tableAllImages.getSelectedRow() != -1)
+ {
String imageid = modelAll.getValueAt(
tableAllImages
.convertRowIndexToModel(tableAllImages
@@ -445,6 +517,7 @@ public class SearchImage_GUI extends JFrame { writeImageData(imageid, version);
}
+ }
});
tableAllImages.setModel(modelAll);
tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit();
@@ -457,10 +530,12 @@ public class SearchImage_GUI extends JFrame { tablemyImages = new JTable();
tablemyImages.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ if (tablemyImages.getSelectedRow() != -1) {
String imageid = modelMyImages.getValueAt(
tablemyImages
- .convertRowIndexToModel(tablemyImages //hier wird auf myImages zugegriffen, obwohl man sich in Vorlage oder "Alle" befindet.
+ .convertRowIndexToModel(tablemyImages //fehler nur, wenn zeile selektiert und dann suche eingegeben wird!
.getSelectedRow()), 6)
.toString();
String version = modelMyImages.getValueAt(
@@ -469,7 +544,10 @@ public class SearchImage_GUI extends JFrame { .getSelectedRow()), 7)
.toString();
writeImageData(imageid, version);
+ }
}
+
+
});
tablemyImages.setModel(modelMyImages);
tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit();
@@ -487,6 +565,9 @@ public class SearchImage_GUI extends JFrame { tablePublicVorlagen.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
+
+ if(tablePublicVorlagen.getSelectedRow() != -1)
+ {
String imageid = modelPublicVorlagen
.getValueAt(
tablePublicVorlagen
@@ -501,6 +582,9 @@ public class SearchImage_GUI extends JFrame { .toString();
writeImageData(imageid, version);
}
+ }
+
+
});
tablePublicVorlagen.setModel(modelPublicVorlagen);
tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit();
@@ -680,7 +764,7 @@ public class SearchImage_GUI extends JFrame { });
okButton.setActionCommand("OK");
buttonPane.add(okButton);
- getRootPane().setDefaultButton(okButton);
+ //getRootPane().setDefaultButton(okButton); //causes the main menue to open and the search gui to close when pressing enter in search bar
}
}
@@ -907,9 +991,12 @@ public class SearchImage_GUI extends JFrame { images.get(x).getUserData(),
out.format(in.parse(images.get(x).updateTime)),
images.get(x).id, images.get(x).getVersion(),
- images.get(x).getIsTemplate() };
+ images.get(x).getIsTemplate(),
+ images.get(x).getDescription()};
+ System.out.println("filling templates..."+images.get(x).getIsTemplate());
// Fuege diese Objekte der Tabelle hinzu
model.addRow(obj);
+ System.out.println(model.getValueAt(x, 9));
x++;
i.next();
@@ -925,7 +1012,73 @@ public class SearchImage_GUI extends JFrame { }
return model;
}
+
+
+ // Initiale Beffuelung eines Table models
+ public DefaultTableModel initTableModelTemplates(DefaultTableModel model) {
+ List<server.generated.Image> images;
+ try {
+ // Hole eine Liste der Images
+ images = client.getImageListAllTemplates();
+
+ Iterator<server.generated.Image> i = images.iterator();
+ SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ int x = 0;
+
+ while (i.hasNext()) {
+ // erzeuge Objekte fuer die Tabelle
+ Object[] obj = { images.get(x).getImageName(),
+ images.get(x).getLicenseRestriction(),
+ images.get(x).getOsName(),
+ images.get(x).getLectureName(),
+ images.get(x).getUserData(),
+ out.format(in.parse(images.get(x).updateTime)),
+ images.get(x).id, images.get(x).getVersion(),
+ images.get(x).getIsTemplate(),
+ images.get(x).getDescription()};
+ // Fuege diese Objekte der Tabelle hinzu
+ model.addRow(obj);
+ x++;
+ i.next();
+ }
+
+ return model;
+ } catch (TException | ParseException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ JOptionPane.showMessageDialog(c,
+ e1.getCause() + "\n" + e1.getStackTrace(), "Debug-Message",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ return model;
+ }// end initTableModelTemplates
+
+
+
+
+
+
+
+ private void resetImageInfo() {
+ //reset the detailed information on the right hand side when changing search string
+ labelID.setText("");
+ labelVersion.setText("");
+ labelName.setText("");
+ textAreadesc.setText("");
+ labelOS.setText("");
+ labelUpdate.setText("");
+ labelVerantwortlicher.setText("");
+ labelWeitereVerantwortliche.setText("");
+ labelVorlage.setText("");
+ labelLizenzSoftware.setText("");
+ labelInternet.setText("");
+ labelRam.setText("");
+ labelCPU.setText("");
+
+ }
+
public void writeImageData(String id, String version) {
try {
SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
diff --git a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java index fd95bd8d..b54e139a 100644 --- a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java +++ b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java @@ -141,6 +141,9 @@ public class MainMenue_GUI extends JFrame { //reset the list of permissions every time the user goes back to the main menu RightsManagement.rightsManagement.getPermittedUserList().clear(); + //reset model + Image.image.reset(); + //Lecture.lecture.reset(); contentPanel.setBounds(10, 104, 567, 502); @@ -594,12 +597,12 @@ public class MainMenue_GUI extends JFrame { }// end if else // always print rights information - LOGGER.info("Rights: (r, w, cp, a, la) = (" - + GUIRights.rights.getRead() + ", " - + GUIRights.rights.getWrite() + ", " - + GUIRights.rights.getChangePermission() + ", " - + GUIRights.rights.getAdmin() + ", " - + GUIRights.rights.getLinkAllowed() + ")"); + //LOGGER.info("Rights: (r, w, cp, a, la) = (" + // + GUIRights.rights.getRead() + ", " + // + GUIRights.rights.getWrite() + ", " + // + GUIRights.rights.getChangePermission() + ", " + // + GUIRights.rights.getAdmin() + ", " + // + GUIRights.rights.getLinkAllowed() + ")"); }// end setRoleRights public void setCorrectRadioButton() { diff --git a/dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java index bcb14c9e..b4c54ab3 100644 --- a/dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java @@ -77,7 +77,7 @@ public class CreateLectureAllgemein_GUI extends JFrame { "Eine Angabe des Namens des Dozenten kann daher hilfreich sein, wenn mehrere ähnliche Veranstaltungen vorliegen.<br />" + "Geben Sie in der Beschreibung kurz an, was in dieser Veranstaltung behandelt wird, evtl. auch mit welcher Software" + "</div></html>"; - + int maxLifeTime = 180; // Anzahl Tage, die eine Veranstaltung in der Zukunft // aktiv sein darf boolean isDateOrderCorrect, isDateMaxLifeTimeCorrect, @@ -259,15 +259,15 @@ public class CreateLectureAllgemein_GUI extends JFrame { txtFldVeranstaltungsname.setText(Lecture.lecture.getName()); panel_2.add(txtFldVeranstaltungsname); - JTextArea textArea = new JTextArea(); - textArea.setEditable(false); - textArea.setWrapStyleWord(true); - textArea.setText("Geben Sie bitte einen sprechenden Namen für die Veranstaltung an. Dieser soll jedoch recht spezifisch sein.\r\nBeispiel: \"Programmieren 1\", nicht \"Programmieren\""); - textArea.setLineWrap(true); - textArea.setFont(new Font("Tahoma", Font.PLAIN, 12)); - textArea.setBackground(SystemColor.menu); - textArea.setBounds(10, 49, 537, 49); - panel_2.add(textArea); + JTextArea txtrGebenSieBitte = new JTextArea(); + txtrGebenSieBitte.setEditable(false); + txtrGebenSieBitte.setWrapStyleWord(true); + txtrGebenSieBitte.setText("Geben Sie bitte einen sprechenden Namen für die Veranstaltung an. Dieser soll jedoch recht spezifisch sein.\r\nBeispiel: \"Gundlagen Programmieren Sommersemester...\", nicht \"Programmieren\""); + txtrGebenSieBitte.setLineWrap(true); + txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); + txtrGebenSieBitte.setBackground(SystemColor.menu); + txtrGebenSieBitte.setBounds(10, 49, 537, 49); + panel_2.add(txtrGebenSieBitte); JLabel lblDesc = new JLabel("Beschreibung: *"); lblDesc.setBounds(10, 111, 180, 14); diff --git a/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java index 2f4d958a..25c59fa7 100644 --- a/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java @@ -21,6 +21,7 @@ import java.net.URISyntaxException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -95,7 +96,7 @@ public class CreateLectureLink_GUI extends JFrame { Component c = null; private JTextField textFieldName; String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "ID", "Version", "Template" }; + "Verantwortlicher", "Letztes Update", "ID", "Version", "Template", "Beschreibung" }; ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); @@ -105,22 +106,25 @@ public class CreateLectureLink_GUI extends JFrame { + "Wählen Sie das Image aus, das zu Ihrer Veranstaltung passt und klicken Sie anschließend auf \"Veranstaltung erzeugen\"." + "</div></html>"; - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0) { + /*final DefaultTableModel modelAll = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } - }; + + };*/ final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; + /* final DefaultTableModel modelPublicVorlagen = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; + */ // final TableRowSorter<TableModel> rowSorterAll = new // TableRowSorter<TableModel>( // modelAll); @@ -130,11 +134,18 @@ public class CreateLectureLink_GUI extends JFrame { // final TableRowSorter<TableModel> rowSorterPublicVorlagen = new // TableRowSorter<TableModel>( // modelPublicVorlagen); + + RowFilter rf = null; + List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2); /** * Create the dialog. */ public CreateLectureLink_GUI(Component formerGUI) { + + filters.add(RowFilter.regexFilter(".", 0)); + rf = RowFilter.orFilter(filters); + addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { @@ -146,8 +157,8 @@ public class CreateLectureLink_GUI extends JFrame { public void windowOpened(WindowEvent arg0) { try { initTableModel(modelMyImages); - initTableModel(modelAll); - initTableModel(modelPublicVorlagen); + //initTableModel(modelAll); + //initTableModel(modelPublicVorlagen); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -177,6 +188,9 @@ public class CreateLectureLink_GUI extends JFrame { tablemyImages.getColumnModel().getColumn(7).setWidth(0); tablemyImages.getColumnModel().getColumn(7).setMinWidth(0); tablemyImages.getColumnModel().getColumn(7).setMaxWidth(0); + tablemyImages.getColumnModel().getColumn(9).setWidth(0); + tablemyImages.getColumnModel().getColumn(9).setMinWidth(0); + tablemyImages.getColumnModel().getColumn(9).setMaxWidth(0); textFieldName.requestFocusInWindow(); } @@ -250,23 +264,23 @@ public class CreateLectureLink_GUI extends JFrame { if (stext != "") { activeSearch = true; // Filtere nach der Eingabe - // rowSorterAll.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), - // 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - // rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), - // 0)); + filters.clear(); + filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive + filters.add(RowFilter.regexFilter("(?i)"+stext, 9)); //case insensitive + rf = RowFilter.orFilter(filters); + rowSorterMyImages.setRowFilter(rf); + } else { activeSearch = false; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - // rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter("true", - // 8)); - // rowSorterAll.setRowFilter(null); + filters.clear(); + filters.add(RowFilter.regexFilter(".", 0)); //case insensitive, filter for anything + rf = RowFilter.orFilter(filters); + rowSorterMyImages.setRowFilter(rf); } + tablemyImages.clearSelection(); + + resetLectureInfo(); } @@ -353,6 +367,9 @@ public class CreateLectureLink_GUI extends JFrame { tablemyImages.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { + + if(tablemyImages.getSelectedRow() != -1) + { String imageid = modelMyImages.getValueAt( tablemyImages .convertRowIndexToModel(tablemyImages @@ -372,7 +389,10 @@ public class CreateLectureLink_GUI extends JFrame { // TODO Auto-generated catch block e1.printStackTrace(); } + } } + + }); tablemyImages.setModel(modelMyImages); tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); @@ -724,8 +744,8 @@ public class CreateLectureLink_GUI extends JFrame { .getUserID()); Iterator<server.generated.Image> i = images.iterator(); - SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); int x = 0; while (i.hasNext()) { @@ -736,7 +756,8 @@ public class CreateLectureLink_GUI extends JFrame { images.get(x).getUserData(), out.format(in.parse(images.get(x).updateTime)), images.get(x).id, images.get(x).getVersion(), - images.get(x).getIsTemplate() }; + images.get(x).getIsTemplate(), + images.get(x).getDescription()}; // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); @@ -744,16 +765,33 @@ public class CreateLectureLink_GUI extends JFrame { i.next(); } - + return model; } + + private void resetLectureInfo() { + //reset the detailed information on the right hand side when changing search string + labelID.setText(""); + labelVersion.setText(""); + labelName.setText(""); + textAreadesc.setText(""); + labelOS.setText(""); + labelUpdate.setText(""); + labelVerantwortlicher.setText(""); + labelWeitereVerantwortliche.setText(""); + labelVorlage.setText(""); + labelLizenzSoftware.setText(""); + labelInternet.setText(""); + labelRam.setText(""); + labelCPU.setText(""); + } public void writeImageData(String id, String version) throws TException, ParseException { - SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); Map<String, String> res = client.getImageData(id, version); labelName.setText(res.get("name")); labelOS.setText(res.get("os")); diff --git a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java index b2bd4ac8..685f3a81 100644 --- a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java @@ -20,6 +20,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -87,10 +88,11 @@ public class DeleteLecture_GUI extends JFrame { ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); + final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0); - final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( - modelAll); + + + final TableRowSorter<TableModel> rowSorterMyLectures = new TableRowSorter<TableModel>( modelMyLectures); private JButton button; @@ -103,11 +105,18 @@ public class DeleteLecture_GUI extends JFrame { + "Sie können die Veranstaltungen hier löschen. Alternativ werden veraltete Einträge irgendwann automatisch gelöscht.<br />" + "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + "</div></html>"; + + RowFilter rf = null; + List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2); /** * Create the dialog. */ public DeleteLecture_GUI(Component formerGUI) { + + filters.add(RowFilter.regexFilter(".", 0)); + rf = RowFilter.orFilter(filters); + addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { @@ -121,7 +130,7 @@ public class DeleteLecture_GUI extends JFrame { textFieldName.requestFocusInWindow(); try { initTableModel(modelMyLectures); - initTableModel(modelAll); + //initTableModel(modelAll); } catch (ParseException e) { // TODO Auto-generated catch block @@ -154,38 +163,7 @@ public class DeleteLecture_GUI extends JFrame { tablemyLectures.getColumnModel().getColumn(8).setMinWidth(0); tablemyLectures.getColumnModel().getColumn(8).setMaxWidth(0); - /* - * tableAllLectures.getColumnModel().getColumn(1).setWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(1).setMinWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(1).setMaxWidth(0); - * tableAllLectures.getColumnModel().getColumn(2).setWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(2).setMinWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(2).setMaxWidth(0); - * tableAllLectures.getColumnModel().getColumn(3).setWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(3).setMinWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(3).setMaxWidth(0); - * tableAllLectures.getColumnModel().getColumn(6).setWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(6).setMinWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(6).setMaxWidth(0); - * tableAllLectures.getColumnModel().getColumn(7).setWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(7).setMinWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(7).setMaxWidth(0); - * tableAllLectures.getColumnModel().getColumn(8).setWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(8).setMinWidth(0); - * tableAllLectures - * .getColumnModel().getColumn(8).setMaxWidth(0); - */ + } }); // Verhindert das Vergroessern Des Fensters @@ -254,22 +232,30 @@ public class DeleteLecture_GUI extends JFrame { // Textfield eingabe auslesen String stext = textFieldName.getText(); // Wenn Textfield nicht leer - if (stext != "") { + if (stext != "") + { activeSearch = true; // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - } else { + filters.clear(); + filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive + filters.add(RowFilter.regexFilter("(?i)"+stext, 1)); //case insensitive + rf = RowFilter.orFilter(filters); + rowSorterMyLectures.setRowFilter(rf); + + } + else + { activeSearch = false; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - username, 5)); - rowSorterAll.setRowFilter(null); + filters.clear(); + filters.add(RowFilter.regexFilter(".", 0)); //case insensitive, filter for anything + rf = RowFilter.orFilter(filters); + rowSorterMyLectures.setRowFilter(rf); } + + tablemyLectures.clearSelection(); + + resetLectureInfo(); } }); @@ -315,6 +301,9 @@ public class DeleteLecture_GUI extends JFrame { tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { + + if(tablemyLectures.getSelectedRow() != -1) + { String imageid = modelMyLectures.getValueAt( tablemyLectures .convertRowIndexToModel(tablemyLectures @@ -331,6 +320,9 @@ public class DeleteLecture_GUI extends JFrame { e1.printStackTrace(); } } + } + + }); tablemyLectures.setModel(modelMyLectures); @@ -659,7 +651,8 @@ public class DeleteLecture_GUI extends JFrame { lectures.get(x).isActive, out.format(in.parse(lectures.get(x).lastused)), lectures.get(x).username, lectures.get(x).imagename, - " ", lectures.get(x).id }; + " ", lectures.get(x).id, + }; // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; @@ -674,6 +667,21 @@ public class DeleteLecture_GUI extends JFrame { } return model; } + + private void resetLectureInfo() { + //reset the detailed information on the right hand side when changing search string + + labelName.setText(""); + labelVerantwortlicher.setText(""); + labelAktiv.setText(""); + labeldesc.setText(""); + labelenddate.setText(""); + labelimage.setText(""); + labelimageversion.setText(""); + labelstartdate.setText(""); + labelVerantwortlicher.setText(""); + + } public void writeLectureData(String id) throws TException, ParseException { diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java index ab52626f..751f7380 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java @@ -73,7 +73,7 @@ public class EditLectureAllgemein_GUI extends JFrame { // longer than // MAX_DESCRIPTION_LENGTH private final int MAX_DESCRIPTION_LENGTH = 254; - + int maxLifeTime = 180; // Anzahl Tage, die eine Veranstaltung in der Zukunft // aktiv sein darf boolean isDateOrderCorrect, isDateMaxLifeTimeCorrect, diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java index af2ef7e6..415aea3c 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java @@ -147,7 +147,8 @@ public class EditLectureLink_GUI extends JFrame { try { initTableModel(modelAll); initTableModel(modelMyImages); - initTableModel(modelPublicVorlagen); + //initTableModel(modelPublicVorlagen); + initTableModelTemplates(modelPublicVorlagen); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -442,7 +443,7 @@ public class EditLectureLink_GUI extends JFrame { public void valueChanged(ListSelectionEvent e) { String imageid = modelMyImages.getValueAt( tablemyImages - .convertRowIndexToModel(tablemyImages + .convertRowIndexToModel(tablemyImages //selber fehler wie bei image .getSelectedRow()), 6) .toString(); String version = modelMyImages.getValueAt( @@ -551,7 +552,7 @@ public class EditLectureLink_GUI extends JFrame { .toString(); try { DateFormat formatter = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); + "yyyy-MM-dd HH:mm:ss"); // update the lecture client.updateLecturedata( @@ -670,7 +671,7 @@ public class EditLectureLink_GUI extends JFrame { .toString(); try { DateFormat formatter = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); + "yyyy-MM-dd HH:mm:ss"); client.updateLecturedata( Lecture.lecture.getName(), Lecture.lecture.getNewName(), @@ -780,7 +781,7 @@ public class EditLectureLink_GUI extends JFrame { .toString(); try { DateFormat formatter = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); + "yyyy-MM-dd HH:mm:ss"); client.updateLecturedata( Lecture.lecture.getName(), Lecture.lecture.getNewName(), @@ -1107,8 +1108,8 @@ public class EditLectureLink_GUI extends JFrame { .getUserID()); Iterator<server.generated.Image> i = images.iterator(); - SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); int x = 0; while (i.hasNext()) { @@ -1130,11 +1131,51 @@ public class EditLectureLink_GUI extends JFrame { return model; } + + + // Initiale Beffuelung eines Table models + public DefaultTableModel initTableModelTemplates(DefaultTableModel model) + throws TException, ParseException { + List<server.generated.Image> images; + + // Hole eine Liste der Images + //images = client.getImageListPermissionLink(person.verantwortlicher.getUserID()); + images = client.getImageListAllTemplates(); + + Iterator<server.generated.Image> i = images.iterator(); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), images.get(x).getLectureName(), + images.get(x).getUserData(), + out.format(in.parse(images.get(x).updateTime)), + images.get(x).id, images.get(x).getVersion(), + images.get(x).getIsTemplate() }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + + } + + + + + public void writeImageData(String id, String version) { try { - SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); Map<String, String> res = client.getImageData(id, version); labelName.setText(res.get("name")); labelOS.setText(res.get("os")); diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java index 01b93f47..ca33dc3c 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java @@ -21,6 +21,7 @@ import java.net.URISyntaxException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -91,25 +92,33 @@ public class EditLectureSearch_GUI extends JFrame { "Klicken Sie anschließend auf \"Weiter\", um die Details der Veranstaltung sowie die Berechtigungen zu ändern." + "</div></html>"; - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0) { + /*final DefaultTableModel modelAll = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } - }; + };*/ final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; - final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( - modelAll); + /*final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( + modelAll);*/ + final TableRowSorter<TableModel> rowSorterMyLectures = new TableRowSorter<TableModel>( modelMyLectures); + + RowFilter rf = null; + List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2); /** * Create the dialog. */ public EditLectureSearch_GUI(Component formerGUI) { + + filters.add(RowFilter.regexFilter(".", 0)); + rf = RowFilter.orFilter(filters); + addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { @@ -123,7 +132,7 @@ public class EditLectureSearch_GUI extends JFrame { textFieldName.requestFocusInWindow(); try { initTableModel(modelMyLectures); - initTableModel(modelAll); + //initTableModel(modelAll); } catch (ParseException e) { // TODO Auto-generated catch block @@ -223,22 +232,32 @@ public class EditLectureSearch_GUI extends JFrame { // Textfield eingabe auslesen String stext = textFieldName.getText(); // Wenn Textfield nicht leer - if (stext != "") { + if (stext != "") + { activeSearch = true; // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - } else { + filters.clear(); + filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive + filters.add(RowFilter.regexFilter("(?i)"+stext, 1)); //case insensitive + rf = RowFilter.orFilter(filters); + rowSorterMyLectures.setRowFilter(rf); + + + } + else + { activeSearch = false; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - username, 5)); - rowSorterAll.setRowFilter(null); + activeSearch = false; + filters.clear(); + filters.add(RowFilter.regexFilter(".", 0)); //case insensitive, filter for anything + rf = RowFilter.orFilter(filters); + rowSorterMyLectures.setRowFilter(rf); + } + tablemyLectures.clearSelection(); + + resetLectureInfo(); } }); @@ -285,6 +304,9 @@ public class EditLectureSearch_GUI extends JFrame { tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { + + if(tablemyLectures.getSelectedRow() != -1) + { String imageid = modelMyLectures.getValueAt( tablemyLectures .convertRowIndexToModel(tablemyLectures @@ -301,6 +323,8 @@ public class EditLectureSearch_GUI extends JFrame { e1.printStackTrace(); } } + } + }); tablemyLectures.setModel(modelMyLectures); @@ -331,7 +355,7 @@ public class EditLectureSearch_GUI extends JFrame { }); btnBack.setActionCommand("OK"); buttonPane.add(btnBack); - getRootPane().setDefaultButton(btnBack); + //getRootPane().setDefaultButton(btnBack); } { JButton btnContinue = new JButton("Weiter"); @@ -735,6 +759,21 @@ public class EditLectureSearch_GUI extends JFrame { } return model; } + + private void resetLectureInfo() { + //reset the detailed information on the right hand side when changing search string + + labelName.setText(""); + labelVerantwortlicher.setText(""); + labelAktiv.setText(""); + labeldesc.setText(""); + labelenddate.setText(""); + labelimage.setText(""); + labelimageversion.setText(""); + labelstartdate.setText(""); + labelVerantwortlicher.setText(""); + + } public void writeLectureData(String id) throws TException, ParseException { diff --git a/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java index d4d49ec2..8ddd4e81 100644 --- a/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java @@ -93,7 +93,7 @@ public class PermissionCreateLecture_GUI extends JFrame { + "und/oder ob die Veranstaltung auch im VMChooser angezeigt wird." + "</div></html>"; private List<Person> map = null; // List of people who have rights - + final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; diff --git a/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java index 05b7959e..e8dd5608 100644 --- a/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java @@ -91,7 +91,7 @@ public class PermissionEditLecture_GUI extends JFrame { } return false; } - + public Class getColumnClass(int c) { switch (c) { case 0: diff --git a/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java index 146f7640..457d3983 100644 --- a/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java @@ -21,6 +21,7 @@ import java.net.URI; import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -90,26 +91,36 @@ public class SearchLecture_GUI extends JFrame { "Verantwortlicher", "Image", "Schlagwort", "ID" };
ThriftConnection con = new ThriftConnection();
Client client = models.Client.clientcon.getClient();
+
final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){
public boolean isCellEditable(int rowIndex, int mColIndex) {
return false;
}
};
+
final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){
public boolean isCellEditable(int rowIndex, int mColIndex) {
return false;
}
};
+
final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>(
modelAll);
+
final TableRowSorter<TableModel> rowSorterMyLectures = new TableRowSorter<TableModel>(
modelMyLectures);
+ RowFilter rf = null;
+ List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2);
/**
* Create the dialog.
*/
public SearchLecture_GUI(Component formerGUI) {
+
+ filters.add(RowFilter.regexFilter(".", 0));
+ rf = RowFilter.orFilter(filters);
+
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
@@ -121,7 +132,7 @@ public class SearchLecture_GUI extends JFrame { public void windowOpened(WindowEvent arg0) {
try {
initTableModel(modelMyLectures);
- initTableModel(modelAll);
+ //initTableModel(modelAll);
} catch (ParseException e) {
// TODO Auto-generated catch block
@@ -233,19 +244,26 @@ public class SearchLecture_GUI extends JFrame { if (stext != "") {
activeSearch=true;
// Filtere nach der Eingabe
- rowSorterAll.setRowFilter(RowFilter.regexFilter(
- textFieldName.getText(), 0));
- rowSorterMyLectures.setRowFilter(RowFilter.regexFilter(
- textFieldName.getText(), 0));
+ filters.clear();
+ filters.add(RowFilter.regexFilter("(?i)"+stext, 0)); //case insensitive
+ filters.add(RowFilter.regexFilter("(?i)"+stext, 1)); //case insensitive
+ rf = RowFilter.orFilter(filters);
+ rowSorterMyLectures.setRowFilter(rf);
+ rowSorterAll.setRowFilter(rf);
}else{
activeSearch=false;
- String username = person.verantwortlicher.getName() + " "
- + person.verantwortlicher.getVorname();
- rowSorterMyLectures.setRowFilter(RowFilter.regexFilter(
- username, 5));
- rowSorterAll.setRowFilter(null);
+ activeSearch = false;
+ filters.clear();
+ filters.add(RowFilter.regexFilter(".", 0)); //case insensitive, filter for anything
+ rf = RowFilter.orFilter(filters);
+ rowSorterMyLectures.setRowFilter(rf);
+ rowSorterAll.setRowFilter(rf);
}
+ tablemyLectures.clearSelection();
+ tableAllLectures.clearSelection();
+
+ resetLectureInfo();
}
});
@@ -342,6 +360,8 @@ public class SearchLecture_GUI extends JFrame { {
public void valueChanged(ListSelectionEvent e)
{
+ if(tablemyLectures.getSelectedRow() != -1)
+ {
String imageid = modelMyLectures
.getValueAt(
tablemyLectures
@@ -359,6 +379,9 @@ public class SearchLecture_GUI extends JFrame { e1.printStackTrace();
}
}
+ }
+
+
});
tablemyLectures.setModel(modelMyLectures);
@@ -395,7 +418,7 @@ public class SearchLecture_GUI extends JFrame { });
btnBack.setActionCommand("OK");
buttonPane.add(btnBack);
- getRootPane().setDefaultButton(btnBack);
+ //getRootPane().setDefaultButton(btnBack);
}
}
@@ -601,6 +624,23 @@ public class SearchLecture_GUI extends JFrame { }
return model;
}
+
+ private void resetLectureInfo() {
+ //reset the detailed information on the right hand side when changing search string
+
+ labelName.setText("");
+ labelVerantwortlicher.setText("");
+ labelAktiv.setText("");
+ labeldesc.setText("");
+ labelenddate.setText("");
+ labelimage.setText("");
+ labelimageversion.setText("");
+ labelstartdate.setText("");
+ labelVerantwortlicher.setText("");
+
+ }
+
+
public void writeLectureData(String id) throws TException, ParseException{
SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
diff --git a/dozentenmodul/src/main/java/models/Image.java b/dozentenmodul/src/main/java/models/Image.java index fc31e583..4f7f3968 100644 --- a/dozentenmodul/src/main/java/models/Image.java +++ b/dozentenmodul/src/main/java/models/Image.java @@ -195,7 +195,37 @@ public class Image { public void setVorlage(boolean vorlage) { this.vorlage = vorlage; } + + public void reset() + { + ImageId = null; + version = null; + + imagename = null; + + newName = null; + + imagepath = null; + + OS = null; + + shareMode = 0; + + licensed = false; + + internet = false; + + vorlage = false; + + ram = 0; + + cpu = 0; + + filesize = 0; + + desc = null; + } diff --git a/dozentenmodul/src/main/java/models/Lecture.java b/dozentenmodul/src/main/java/models/Lecture.java index 8f67baba..0b55172b 100644 --- a/dozentenmodul/src/main/java/models/Lecture.java +++ b/dozentenmodul/src/main/java/models/Lecture.java @@ -133,6 +133,27 @@ public class Lecture { this.active = active; } + + public void reset() + { + name = null; + + newName = null; + + shortDesc = null; + + desc = null; + + startdate = null; + + enddate = null; + + active = false; + + id = null; + + linkedImagename = null; + } diff --git a/dozentenmodul/src/main/java/models/person.java b/dozentenmodul/src/main/java/models/person.java index 4ad5bb3d..d1621d00 100644 --- a/dozentenmodul/src/main/java/models/person.java +++ b/dozentenmodul/src/main/java/models/person.java @@ -199,4 +199,5 @@ public class person { } + } diff --git a/dozentenmodul/src/main/java/thrift/ThriftConnection.java b/dozentenmodul/src/main/java/thrift/ThriftConnection.java index 98f4cb77..50315ae5 100644 --- a/dozentenmodul/src/main/java/thrift/ThriftConnection.java +++ b/dozentenmodul/src/main/java/thrift/ThriftConnection.java @@ -45,7 +45,7 @@ public class ThriftConnection { LOGGER.info("Verbindung zu "+satAddress+" wurde aufgebaut."); return client; - } + } public void closeThriftConnection() { diff --git a/dozentenmodul/src/main/java/util/ResourceLoader.java b/dozentenmodul/src/main/java/util/ResourceLoader.java index 7c3c9c62..731cedeb 100644 --- a/dozentenmodul/src/main/java/util/ResourceLoader.java +++ b/dozentenmodul/src/main/java/util/ResourceLoader.java @@ -100,9 +100,9 @@ public class ResourceLoader { } /** - * Tries to load the given resource as File + * Tries to load the given resource treating it as a text file * @param path Resource path to load - * @return the file of the loaded resource + * @return content of the loaded resource as String */ public static String getTextFile(String path) { String fileContent = null; diff --git a/dozentenmodul/src/main/resources/txt/vmx_template b/dozentenmodul/src/main/resources/txt/vmx_template new file mode 100755 index 00000000..64b8c168 --- /dev/null +++ b/dozentenmodul/src/main/resources/txt/vmx_template @@ -0,0 +1,70 @@ +#!/usr/bin/vmware +.encoding = "UTF-8" +config.version = "8" + +# general hardware (ehci, 3d accel) +ehci.present = "TRUE" +mks.gl.allowBlacklistedDrivers = "TRUE" +mks.enable3d = "FALSE" + +monitor.virtual_mmu = "automatic" +monitor.virtual_exec = "automatic" + +# id +virtualHW.version = "7" +displayName = "%VM_DISPLAY_NAME%" +guestOS = "%VM_GUEST_OS%" + +# CPU/MEM +numvcpus = "%VM_CPU_COUNT%" +cpuid.coresPerSocket = "%VM_CPU_COUNT%" +maxvcpus = "%VM_CPU_COUNT%" +memsize = "%VM_RAM_SIZE%" +MemAllowAutoScaleDown = "FALSE" +MemTrimRate = "-1" + +# ide-disks +ide0:0.present = "TRUE" +ide0:0.fileName = "%VM_DISK_PATH%" +ide1:0.present = "TRUE" +ide1:0.autodetect = "TRUE" +ide1:0.fileName = "auto detect" +ide1:0.deviceType = "cdrom-raw" + +# nics +ethernet0.present = "TRUE" +ethernet0.addressType = "static" +ethernet0.virtualDev = "e1000" +ethernet0.connectionType = "hostonly" +ethernet0.vnet = "/dev/vmnet1" +ethernet0.address = "00:50:56:15:00:4E" +ethernet0.wakeOnPcktRcv = "FALSE" + +# sound +sound.present = "TRUE" +sound.fileName = "-1" +sound.autodetect = "TRUE" +sound.virtualdev = "es1371" + +# svga +svga.autodetect = "TRUE" + +# usb +usb.present = "TRUE" +usb.generic.autoconnect = "TRUE" + +# pci configuration +usb.pciSlotNumber = "16" +ethernet0.pciSlotNumber = "17" +sound.pciSlotNumber = "18" +ehci.pciSlotNumber = "19" + +# dirs/configs +mainMem.useNamedFile = "TRUE" +snapshot.disabled = "TRUE" +tools.syncTime = "TRUE" +isolation.tools.hgfs.disable = "FALSE" +hgfs.mapRootShare = "TRUE" +isolation.tools.dnd.disable = "FALSE" +isolation.tools.copy.enable = "TRUE" +isolation.tools.paste.enabled = "TRUE" diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index a6412e24..054ab706 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -213,7 +213,7 @@ public class ServerHandler implements Server.Iface { @Override public List<Image> getImageListPermissionLink(String userID) throws TException { - return sql.getImageListPermissionRead(userID); + return sql.getImageListPermissionLink(userID); } @Override @@ -222,6 +222,12 @@ public class ServerHandler implements Server.Iface { return sql.getImageListPermissionAdmin(userID); } + @Override + public List<Image> getImageListAllTemplates() + throws TException { + return sql.getImageListAllTemplates(); + } + @Override public List<String> getAllOS() throws TException { diff --git a/dozentenmodulserver/src/main/java/server/generated/Server.java b/dozentenmodulserver/src/main/java/server/generated/Server.java index c87659ae..088b4293 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Server.java +++ b/dozentenmodulserver/src/main/java/server/generated/Server.java @@ -54,6 +54,8 @@ public class Server { public List<Image> getImageListPermissionAdmin(String userID) throws org.apache.thrift.TException; + public List<Image> getImageListAllTemplates() throws org.apache.thrift.TException; + public List<Lecture> getLectureList() throws org.apache.thrift.TException; public List<Lecture> getLectureListPermissionRead(String userID) throws org.apache.thrift.TException; @@ -134,6 +136,8 @@ public class Server { public void getImageListPermissionAdmin(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getImageListAllTemplates(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getLectureList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getLectureListPermissionRead(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -438,6 +442,28 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageListPermissionAdmin failed: unknown result"); } + public List<Image> getImageListAllTemplates() throws org.apache.thrift.TException + { + send_getImageListAllTemplates(); + return recv_getImageListAllTemplates(); + } + + public void send_getImageListAllTemplates() throws org.apache.thrift.TException + { + getImageListAllTemplates_args args = new getImageListAllTemplates_args(); + sendBase("getImageListAllTemplates", args); + } + + public List<Image> recv_getImageListAllTemplates() throws org.apache.thrift.TException + { + getImageListAllTemplates_result result = new getImageListAllTemplates_result(); + receiveBase(result, "getImageListAllTemplates"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageListAllTemplates failed: unknown result"); + } + public List<Lecture> getLectureList() throws org.apache.thrift.TException { send_getLectureList(); @@ -1532,6 +1558,35 @@ public class Server { } } + public void getImageListAllTemplates(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getImageListAllTemplates_call method_call = new getImageListAllTemplates_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getImageListAllTemplates_call extends org.apache.thrift.async.TAsyncMethodCall { + public getImageListAllTemplates_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 { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getImageListAllTemplates", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getImageListAllTemplates_args args = new getImageListAllTemplates_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Image> 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_getImageListAllTemplates(); + } + } + public void getLectureList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); getLectureList_call method_call = new getLectureList_call(resultHandler, this, ___protocolFactory, ___transport); @@ -2719,6 +2774,7 @@ public class Server { processMap.put("getImageListPermissionRead", new getImageListPermissionRead()); processMap.put("getImageListPermissionLink", new getImageListPermissionLink()); processMap.put("getImageListPermissionAdmin", new getImageListPermissionAdmin()); + processMap.put("getImageListAllTemplates", new getImageListAllTemplates()); processMap.put("getLectureList", new getLectureList()); processMap.put("getLectureListPermissionRead", new getLectureListPermissionRead()); processMap.put("getLectureListPermissionWrite", new getLectureListPermissionWrite()); @@ -2933,6 +2989,26 @@ public class Server { } } + public static class getImageListAllTemplates<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getImageListAllTemplates_args> { + public getImageListAllTemplates() { + super("getImageListAllTemplates"); + } + + public getImageListAllTemplates_args getEmptyArgsInstance() { + return new getImageListAllTemplates_args(); + } + + protected boolean isOneway() { + return false; + } + + public getImageListAllTemplates_result getResult(I iface, getImageListAllTemplates_args args) throws org.apache.thrift.TException { + getImageListAllTemplates_result result = new getImageListAllTemplates_result(); + result.success = iface.getImageListAllTemplates(); + return result; + } + } + public static class getLectureList<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getLectureList_args> { public getLectureList() { super("getLectureList"); @@ -3549,6 +3625,7 @@ public class Server { processMap.put("getImageListPermissionRead", new getImageListPermissionRead()); processMap.put("getImageListPermissionLink", new getImageListPermissionLink()); processMap.put("getImageListPermissionAdmin", new getImageListPermissionAdmin()); + processMap.put("getImageListAllTemplates", new getImageListAllTemplates()); processMap.put("getLectureList", new getLectureList()); processMap.put("getLectureListPermissionRead", new getLectureListPermissionRead()); processMap.put("getLectureListPermissionWrite", new getLectureListPermissionWrite()); @@ -4042,6 +4119,57 @@ public class Server { } } + public static class getImageListAllTemplates<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImageListAllTemplates_args, List<Image>> { + public getImageListAllTemplates() { + super("getImageListAllTemplates"); + } + + public getImageListAllTemplates_args getEmptyArgsInstance() { + return new getImageListAllTemplates_args(); + } + + public AsyncMethodCallback<List<Image>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<List<Image>>() { + public void onComplete(List<Image> o) { + getImageListAllTemplates_result result = new getImageListAllTemplates_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; + getImageListAllTemplates_result result = new getImageListAllTemplates_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, getImageListAllTemplates_args args, org.apache.thrift.async.AsyncMethodCallback<List<Image>> resultHandler) throws TException { + iface.getImageListAllTemplates(resultHandler); + } + } + public static class getLectureList<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getLectureList_args, List<Lecture>> { public getLectureList() { super("getLectureList"); @@ -13781,6 +13909,660 @@ public class Server { } + public static class getImageListAllTemplates_args implements org.apache.thrift.TBase<getImageListAllTemplates_args, getImageListAllTemplates_args._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListAllTemplates_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListAllTemplates_args"); + + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getImageListAllTemplates_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListAllTemplates_argsTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + 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) { + 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; + } + } + 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); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageListAllTemplates_args.class, metaDataMap); + } + + public getImageListAllTemplates_args() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getImageListAllTemplates_args(getImageListAllTemplates_args other) { + } + + public getImageListAllTemplates_args deepCopy() { + return new getImageListAllTemplates_args(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + 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) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getImageListAllTemplates_args) + return this.equals((getImageListAllTemplates_args)that); + return false; + } + + public boolean equals(getImageListAllTemplates_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getImageListAllTemplates_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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("getImageListAllTemplates_args("); + boolean first = true; + + 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 getImageListAllTemplates_argsStandardSchemeFactory implements SchemeFactory { + public getImageListAllTemplates_argsStandardScheme getScheme() { + return new getImageListAllTemplates_argsStandardScheme(); + } + } + + private static class getImageListAllTemplates_argsStandardScheme extends StandardScheme<getImageListAllTemplates_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListAllTemplates_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) { + 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, getImageListAllTemplates_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImageListAllTemplates_argsTupleSchemeFactory implements SchemeFactory { + public getImageListAllTemplates_argsTupleScheme getScheme() { + return new getImageListAllTemplates_argsTupleScheme(); + } + } + + private static class getImageListAllTemplates_argsTupleScheme extends TupleScheme<getImageListAllTemplates_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListAllTemplates_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListAllTemplates_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class getImageListAllTemplates_result implements org.apache.thrift.TBase<getImageListAllTemplates_result, getImageListAllTemplates_result._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListAllTemplates_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListAllTemplates_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 getImageListAllTemplates_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListAllTemplates_resultTupleSchemeFactory()); + } + + public List<Image> success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Image.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageListAllTemplates_result.class, metaDataMap); + } + + public getImageListAllTemplates_result() { + } + + public getImageListAllTemplates_result( + List<Image> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getImageListAllTemplates_result(getImageListAllTemplates_result other) { + if (other.isSetSuccess()) { + List<Image> __this__success = new ArrayList<Image>(other.success.size()); + for (Image other_element : other.success) { + __this__success.add(new Image(other_element)); + } + this.success = __this__success; + } + } + + public getImageListAllTemplates_result deepCopy() { + return new getImageListAllTemplates_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Image> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Image elem) { + if (this.success == null) { + this.success = new ArrayList<Image>(); + } + this.success.add(elem); + } + + public List<Image> getSuccess() { + return this.success; + } + + public getImageListAllTemplates_result setSuccess(List<Image> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Image>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getImageListAllTemplates_result) + return this.equals((getImageListAllTemplates_result)that); + return false; + } + + public boolean equals(getImageListAllTemplates_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getImageListAllTemplates_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("getImageListAllTemplates_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getImageListAllTemplates_resultStandardSchemeFactory implements SchemeFactory { + public getImageListAllTemplates_resultStandardScheme getScheme() { + return new getImageListAllTemplates_resultStandardScheme(); + } + } + + private static class getImageListAllTemplates_resultStandardScheme extends StandardScheme<getImageListAllTemplates_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListAllTemplates_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); + struct.success = new ArrayList<Image>(_list32.size); + for (int _i33 = 0; _i33 < _list32.size; ++_i33) + { + Image _elem34; + _elem34 = new Image(); + _elem34.read(iprot); + struct.success.add(_elem34); + } + iprot.readListEnd(); + } + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getImageListAllTemplates_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Image _iter35 : struct.success) + { + _iter35.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImageListAllTemplates_resultTupleSchemeFactory implements SchemeFactory { + public getImageListAllTemplates_resultTupleScheme getScheme() { + return new getImageListAllTemplates_resultTupleScheme(); + } + } + + private static class getImageListAllTemplates_resultTupleScheme extends TupleScheme<getImageListAllTemplates_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListAllTemplates_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + { + oprot.writeI32(struct.success.size()); + for (Image _iter36 : struct.success) + { + _iter36.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListAllTemplates_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Image>(_list37.size); + for (int _i38 = 0; _i38 < _list37.size; ++_i38) + { + Image _elem39; + _elem39 = new Image(); + _elem39.read(iprot); + struct.success.add(_elem39); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + public static class getLectureList_args implements org.apache.thrift.TBase<getLectureList_args, getLectureList_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureList_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureList_args"); @@ -14336,14 +15118,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); - struct.success = new ArrayList<Lecture>(_list32.size); - for (int _i33 = 0; _i33 < _list32.size; ++_i33) + org.apache.thrift.protocol.TList _list40 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list40.size); + for (int _i41 = 0; _i41 < _list40.size; ++_i41) { - Lecture _elem34; - _elem34 = new Lecture(); - _elem34.read(iprot); - struct.success.add(_elem34); + Lecture _elem42; + _elem42 = new Lecture(); + _elem42.read(iprot); + struct.success.add(_elem42); } iprot.readListEnd(); } @@ -14371,9 +15153,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Lecture _iter35 : struct.success) + for (Lecture _iter43 : struct.success) { - _iter35.write(oprot); + _iter43.write(oprot); } oprot.writeListEnd(); } @@ -14404,9 +15186,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Lecture _iter36 : struct.success) + for (Lecture _iter44 : struct.success) { - _iter36.write(oprot); + _iter44.write(oprot); } } } @@ -14418,14 +15200,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Lecture>(_list37.size); - for (int _i38 = 0; _i38 < _list37.size; ++_i38) + org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list45.size); + for (int _i46 = 0; _i46 < _list45.size; ++_i46) { - Lecture _elem39; - _elem39 = new Lecture(); - _elem39.read(iprot); - struct.success.add(_elem39); + Lecture _elem47; + _elem47 = new Lecture(); + _elem47.read(iprot); + struct.success.add(_elem47); } } struct.setSuccessIsSet(true); @@ -15098,14 +15880,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list40 = iprot.readListBegin(); - struct.success = new ArrayList<Lecture>(_list40.size); - for (int _i41 = 0; _i41 < _list40.size; ++_i41) + org.apache.thrift.protocol.TList _list48 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list48.size); + for (int _i49 = 0; _i49 < _list48.size; ++_i49) { - Lecture _elem42; - _elem42 = new Lecture(); - _elem42.read(iprot); - struct.success.add(_elem42); + Lecture _elem50; + _elem50 = new Lecture(); + _elem50.read(iprot); + struct.success.add(_elem50); } iprot.readListEnd(); } @@ -15133,9 +15915,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Lecture _iter43 : struct.success) + for (Lecture _iter51 : struct.success) { - _iter43.write(oprot); + _iter51.write(oprot); } oprot.writeListEnd(); } @@ -15166,9 +15948,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Lecture _iter44 : struct.success) + for (Lecture _iter52 : struct.success) { - _iter44.write(oprot); + _iter52.write(oprot); } } } @@ -15180,14 +15962,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Lecture>(_list45.size); - for (int _i46 = 0; _i46 < _list45.size; ++_i46) + org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list53.size); + for (int _i54 = 0; _i54 < _list53.size; ++_i54) { - Lecture _elem47; - _elem47 = new Lecture(); - _elem47.read(iprot); - struct.success.add(_elem47); + Lecture _elem55; + _elem55 = new Lecture(); + _elem55.read(iprot); + struct.success.add(_elem55); } } struct.setSuccessIsSet(true); @@ -15860,14 +16642,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list48 = iprot.readListBegin(); - struct.success = new ArrayList<Lecture>(_list48.size); - for (int _i49 = 0; _i49 < _list48.size; ++_i49) + org.apache.thrift.protocol.TList _list56 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list56.size); + for (int _i57 = 0; _i57 < _list56.size; ++_i57) { - Lecture _elem50; - _elem50 = new Lecture(); - _elem50.read(iprot); - struct.success.add(_elem50); + Lecture _elem58; + _elem58 = new Lecture(); + _elem58.read(iprot); + struct.success.add(_elem58); } iprot.readListEnd(); } @@ -15895,9 +16677,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Lecture _iter51 : struct.success) + for (Lecture _iter59 : struct.success) { - _iter51.write(oprot); + _iter59.write(oprot); } oprot.writeListEnd(); } @@ -15928,9 +16710,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Lecture _iter52 : struct.success) + for (Lecture _iter60 : struct.success) { - _iter52.write(oprot); + _iter60.write(oprot); } } } @@ -15942,14 +16724,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Lecture>(_list53.size); - for (int _i54 = 0; _i54 < _list53.size; ++_i54) + org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list61.size); + for (int _i62 = 0; _i62 < _list61.size; ++_i62) { - Lecture _elem55; - _elem55 = new Lecture(); - _elem55.read(iprot); - struct.success.add(_elem55); + Lecture _elem63; + _elem63 = new Lecture(); + _elem63.read(iprot); + struct.success.add(_elem63); } } struct.setSuccessIsSet(true); @@ -16622,14 +17404,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list56 = iprot.readListBegin(); - struct.success = new ArrayList<Lecture>(_list56.size); - for (int _i57 = 0; _i57 < _list56.size; ++_i57) + org.apache.thrift.protocol.TList _list64 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list64.size); + for (int _i65 = 0; _i65 < _list64.size; ++_i65) { - Lecture _elem58; - _elem58 = new Lecture(); - _elem58.read(iprot); - struct.success.add(_elem58); + Lecture _elem66; + _elem66 = new Lecture(); + _elem66.read(iprot); + struct.success.add(_elem66); } iprot.readListEnd(); } @@ -16657,9 +17439,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Lecture _iter59 : struct.success) + for (Lecture _iter67 : struct.success) { - _iter59.write(oprot); + _iter67.write(oprot); } oprot.writeListEnd(); } @@ -16690,9 +17472,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Lecture _iter60 : struct.success) + for (Lecture _iter68 : struct.success) { - _iter60.write(oprot); + _iter68.write(oprot); } } } @@ -16704,14 +17486,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Lecture>(_list61.size); - for (int _i62 = 0; _i62 < _list61.size; ++_i62) + org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list69.size); + for (int _i70 = 0; _i70 < _list69.size; ++_i70) { - Lecture _elem63; - _elem63 = new Lecture(); - _elem63.read(iprot); - struct.success.add(_elem63); + Lecture _elem71; + _elem71 = new Lecture(); + _elem71.read(iprot); + struct.success.add(_elem71); } } struct.setSuccessIsSet(true); @@ -17273,13 +18055,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list64 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list64.size); - for (int _i65 = 0; _i65 < _list64.size; ++_i65) + org.apache.thrift.protocol.TList _list72 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list72.size); + for (int _i73 = 0; _i73 < _list72.size; ++_i73) { - String _elem66; - _elem66 = iprot.readString(); - struct.success.add(_elem66); + String _elem74; + _elem74 = iprot.readString(); + struct.success.add(_elem74); } iprot.readListEnd(); } @@ -17307,9 +18089,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter67 : struct.success) + for (String _iter75 : struct.success) { - oprot.writeString(_iter67); + oprot.writeString(_iter75); } oprot.writeListEnd(); } @@ -17340,9 +18122,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter68 : struct.success) + for (String _iter76 : struct.success) { - oprot.writeString(_iter68); + oprot.writeString(_iter76); } } } @@ -17354,13 +18136,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list69.size); - for (int _i70 = 0; _i70 < _list69.size; ++_i70) + org.apache.thrift.protocol.TList _list77 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list77.size); + for (int _i78 = 0; _i78 < _list77.size; ++_i78) { - String _elem71; - _elem71 = iprot.readString(); - struct.success.add(_elem71); + String _elem79; + _elem79 = iprot.readString(); + struct.success.add(_elem79); } } struct.setSuccessIsSet(true); @@ -17922,13 +18704,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list72 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list72.size); - for (int _i73 = 0; _i73 < _list72.size; ++_i73) + org.apache.thrift.protocol.TList _list80 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list80.size); + for (int _i81 = 0; _i81 < _list80.size; ++_i81) { - String _elem74; - _elem74 = iprot.readString(); - struct.success.add(_elem74); + String _elem82; + _elem82 = iprot.readString(); + struct.success.add(_elem82); } iprot.readListEnd(); } @@ -17956,9 +18738,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter75 : struct.success) + for (String _iter83 : struct.success) { - oprot.writeString(_iter75); + oprot.writeString(_iter83); } oprot.writeListEnd(); } @@ -17989,9 +18771,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter76 : struct.success) + for (String _iter84 : struct.success) { - oprot.writeString(_iter76); + oprot.writeString(_iter84); } } } @@ -18003,13 +18785,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list77 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list77.size); - for (int _i78 = 0; _i78 < _list77.size; ++_i78) + org.apache.thrift.protocol.TList _list85 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list85.size); + for (int _i86 = 0; _i86 < _list85.size; ++_i86) { - String _elem79; - _elem79 = iprot.readString(); - struct.success.add(_elem79); + String _elem87; + _elem87 = iprot.readString(); + struct.success.add(_elem87); } } struct.setSuccessIsSet(true); @@ -18776,15 +19558,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map80 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map80.size); - for (int _i81 = 0; _i81 < _map80.size; ++_i81) + org.apache.thrift.protocol.TMap _map88 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map88.size); + for (int _i89 = 0; _i89 < _map88.size; ++_i89) { - String _key82; - String _val83; - _key82 = iprot.readString(); - _val83 = iprot.readString(); - struct.success.put(_key82, _val83); + String _key90; + String _val91; + _key90 = iprot.readString(); + _val91 = iprot.readString(); + struct.success.put(_key90, _val91); } iprot.readMapEnd(); } @@ -18812,10 +19594,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter84 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter92 : struct.success.entrySet()) { - oprot.writeString(_iter84.getKey()); - oprot.writeString(_iter84.getValue()); + oprot.writeString(_iter92.getKey()); + oprot.writeString(_iter92.getValue()); } oprot.writeMapEnd(); } @@ -18846,10 +19628,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter85 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter93 : struct.success.entrySet()) { - oprot.writeString(_iter85.getKey()); - oprot.writeString(_iter85.getValue()); + oprot.writeString(_iter93.getKey()); + oprot.writeString(_iter93.getValue()); } } } @@ -18861,15 +19643,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map86 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map86.size); - for (int _i87 = 0; _i87 < _map86.size; ++_i87) + org.apache.thrift.protocol.TMap _map94 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map94.size); + for (int _i95 = 0; _i95 < _map94.size; ++_i95) { - String _key88; - String _val89; - _key88 = iprot.readString(); - _val89 = iprot.readString(); - struct.success.put(_key88, _val89); + String _key96; + String _val97; + _key96 = iprot.readString(); + _val97 = iprot.readString(); + struct.success.put(_key96, _val97); } } struct.setSuccessIsSet(true); @@ -23350,15 +24132,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map90 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map90.size); - for (int _i91 = 0; _i91 < _map90.size; ++_i91) + org.apache.thrift.protocol.TMap _map98 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map98.size); + for (int _i99 = 0; _i99 < _map98.size; ++_i99) { - String _key92; - String _val93; - _key92 = iprot.readString(); - _val93 = iprot.readString(); - struct.success.put(_key92, _val93); + String _key100; + String _val101; + _key100 = iprot.readString(); + _val101 = iprot.readString(); + struct.success.put(_key100, _val101); } iprot.readMapEnd(); } @@ -23386,10 +24168,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter94 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter102 : struct.success.entrySet()) { - oprot.writeString(_iter94.getKey()); - oprot.writeString(_iter94.getValue()); + oprot.writeString(_iter102.getKey()); + oprot.writeString(_iter102.getValue()); } oprot.writeMapEnd(); } @@ -23420,10 +24202,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter95 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter103 : struct.success.entrySet()) { - oprot.writeString(_iter95.getKey()); - oprot.writeString(_iter95.getValue()); + oprot.writeString(_iter103.getKey()); + oprot.writeString(_iter103.getValue()); } } } @@ -23435,15 +24217,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map96 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map96.size); - for (int _i97 = 0; _i97 < _map96.size; ++_i97) + org.apache.thrift.protocol.TMap _map104 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map104.size); + for (int _i105 = 0; _i105 < _map104.size; ++_i105) { - String _key98; - String _val99; - _key98 = iprot.readString(); - _val99 = iprot.readString(); - struct.success.put(_key98, _val99); + String _key106; + String _val107; + _key106 = iprot.readString(); + _val107 = iprot.readString(); + struct.success.put(_key106, _val107); } } struct.setSuccessIsSet(true); @@ -24110,15 +24892,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map100 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map100.size); - for (int _i101 = 0; _i101 < _map100.size; ++_i101) + org.apache.thrift.protocol.TMap _map108 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map108.size); + for (int _i109 = 0; _i109 < _map108.size; ++_i109) { - String _key102; - String _val103; - _key102 = iprot.readString(); - _val103 = iprot.readString(); - struct.success.put(_key102, _val103); + String _key110; + String _val111; + _key110 = iprot.readString(); + _val111 = iprot.readString(); + struct.success.put(_key110, _val111); } iprot.readMapEnd(); } @@ -24146,10 +24928,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter104 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter112 : struct.success.entrySet()) { - oprot.writeString(_iter104.getKey()); - oprot.writeString(_iter104.getValue()); + oprot.writeString(_iter112.getKey()); + oprot.writeString(_iter112.getValue()); } oprot.writeMapEnd(); } @@ -24180,10 +24962,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter105 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter113 : struct.success.entrySet()) { - oprot.writeString(_iter105.getKey()); - oprot.writeString(_iter105.getValue()); + oprot.writeString(_iter113.getKey()); + oprot.writeString(_iter113.getValue()); } } } @@ -24195,15 +24977,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map106 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map106.size); - for (int _i107 = 0; _i107 < _map106.size; ++_i107) + org.apache.thrift.protocol.TMap _map114 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map114.size); + for (int _i115 = 0; _i115 < _map114.size; ++_i115) { - String _key108; - String _val109; - _key108 = iprot.readString(); - _val109 = iprot.readString(); - struct.success.put(_key108, _val109); + String _key116; + String _val117; + _key116 = iprot.readString(); + _val117 = iprot.readString(); + struct.success.put(_key116, _val117); } } struct.setSuccessIsSet(true); @@ -38841,13 +39623,13 @@ public class Server { case 1: // USER_ID if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); - struct.userID = new ArrayList<String>(_list110.size); - for (int _i111 = 0; _i111 < _list110.size; ++_i111) + org.apache.thrift.protocol.TList _list118 = iprot.readListBegin(); + struct.userID = new ArrayList<String>(_list118.size); + for (int _i119 = 0; _i119 < _list118.size; ++_i119) { - String _elem112; - _elem112 = iprot.readString(); - struct.userID.add(_elem112); + String _elem120; + _elem120 = iprot.readString(); + struct.userID.add(_elem120); } iprot.readListEnd(); } @@ -38875,9 +39657,9 @@ public class Server { oprot.writeFieldBegin(USER_ID_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.userID.size())); - for (String _iter113 : struct.userID) + for (String _iter121 : struct.userID) { - oprot.writeString(_iter113); + oprot.writeString(_iter121); } oprot.writeListEnd(); } @@ -38908,9 +39690,9 @@ public class Server { if (struct.isSetUserID()) { { oprot.writeI32(struct.userID.size()); - for (String _iter114 : struct.userID) + for (String _iter122 : struct.userID) { - oprot.writeString(_iter114); + oprot.writeString(_iter122); } } } @@ -38922,13 +39704,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list115 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.userID = new ArrayList<String>(_list115.size); - for (int _i116 = 0; _i116 < _list115.size; ++_i116) + org.apache.thrift.protocol.TList _list123 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.userID = new ArrayList<String>(_list123.size); + for (int _i124 = 0; _i124 < _list123.size; ++_i124) { - String _elem117; - _elem117 = iprot.readString(); - struct.userID.add(_elem117); + String _elem125; + _elem125 = iprot.readString(); + struct.userID.add(_elem125); } } struct.setUserIDIsSet(true); @@ -39247,14 +40029,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list118 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list118.size); - for (int _i119 = 0; _i119 < _list118.size; ++_i119) + org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list126.size); + for (int _i127 = 0; _i127 < _list126.size; ++_i127) { - Person _elem120; - _elem120 = new Person(); - _elem120.read(iprot); - struct.success.add(_elem120); + Person _elem128; + _elem128 = new Person(); + _elem128.read(iprot); + struct.success.add(_elem128); } iprot.readListEnd(); } @@ -39282,9 +40064,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter121 : struct.success) + for (Person _iter129 : struct.success) { - _iter121.write(oprot); + _iter129.write(oprot); } oprot.writeListEnd(); } @@ -39315,9 +40097,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter122 : struct.success) + for (Person _iter130 : struct.success) { - _iter122.write(oprot); + _iter130.write(oprot); } } } @@ -39329,14 +40111,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list123 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list123.size); - for (int _i124 = 0; _i124 < _list123.size; ++_i124) + org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list131.size); + for (int _i132 = 0; _i132 < _list131.size; ++_i132) { - Person _elem125; - _elem125 = new Person(); - _elem125.read(iprot); - struct.success.add(_elem125); + Person _elem133; + _elem133 = new Person(); + _elem133.read(iprot); + struct.success.add(_elem133); } } struct.setSuccessIsSet(true); @@ -40109,14 +40891,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list126.size); - for (int _i127 = 0; _i127 < _list126.size; ++_i127) + org.apache.thrift.protocol.TList _list134 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list134.size); + for (int _i135 = 0; _i135 < _list134.size; ++_i135) { - Person _elem128; - _elem128 = new Person(); - _elem128.read(iprot); - struct.success.add(_elem128); + Person _elem136; + _elem136 = new Person(); + _elem136.read(iprot); + struct.success.add(_elem136); } iprot.readListEnd(); } @@ -40144,9 +40926,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter129 : struct.success) + for (Person _iter137 : struct.success) { - _iter129.write(oprot); + _iter137.write(oprot); } oprot.writeListEnd(); } @@ -40177,9 +40959,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter130 : struct.success) + for (Person _iter138 : struct.success) { - _iter130.write(oprot); + _iter138.write(oprot); } } } @@ -40191,14 +40973,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list131.size); - for (int _i132 = 0; _i132 < _list131.size; ++_i132) + org.apache.thrift.protocol.TList _list139 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list139.size); + for (int _i140 = 0; _i140 < _list139.size; ++_i140) { - Person _elem133; - _elem133 = new Person(); - _elem133.read(iprot); - struct.success.add(_elem133); + Person _elem141; + _elem141 = new Person(); + _elem141.read(iprot); + struct.success.add(_elem141); } } struct.setSuccessIsSet(true); @@ -40971,14 +41753,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list134 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list134.size); - for (int _i135 = 0; _i135 < _list134.size; ++_i135) + org.apache.thrift.protocol.TList _list142 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list142.size); + for (int _i143 = 0; _i143 < _list142.size; ++_i143) { - Person _elem136; - _elem136 = new Person(); - _elem136.read(iprot); - struct.success.add(_elem136); + Person _elem144; + _elem144 = new Person(); + _elem144.read(iprot); + struct.success.add(_elem144); } iprot.readListEnd(); } @@ -41006,9 +41788,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter137 : struct.success) + for (Person _iter145 : struct.success) { - _iter137.write(oprot); + _iter145.write(oprot); } oprot.writeListEnd(); } @@ -41039,9 +41821,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter138 : struct.success) + for (Person _iter146 : struct.success) { - _iter138.write(oprot); + _iter146.write(oprot); } } } @@ -41053,14 +41835,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list139 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list139.size); - for (int _i140 = 0; _i140 < _list139.size; ++_i140) + org.apache.thrift.protocol.TList _list147 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list147.size); + for (int _i148 = 0; _i148 < _list147.size; ++_i148) { - Person _elem141; - _elem141 = new Person(); - _elem141.read(iprot); - struct.success.add(_elem141); + Person _elem149; + _elem149 = new Person(); + _elem149.read(iprot); + struct.success.add(_elem149); } } struct.setSuccessIsSet(true); diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index a7aefbe7..235874c2 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -181,7 +181,7 @@ public class SQL { public String setPerson(String login, String lastname, String firstname,
String mail, Date lastlogin, String Institution) {
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Connection con = getConnection();
Statement stm = con.createStatement();
@@ -242,7 +242,7 @@ public class SQL { String desc, String imagePath, long filesize, String shareMode,
String pk_os) {
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int internet_bol = 0;
int license_bol = 0;
@@ -428,12 +428,16 @@ public class SQL { stm = con.createStatement();
- // ResultSet
- ResultSet res = stm
- .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
- + userID
- + "' AND u.userID = pmi.userID AND pmi.link_allowed = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
+ // ResultSet WITHOUT templates
+ //ResultSet res = stm
+ // .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
+ // + userID
+ // + "' AND u.userID = pmi.userID AND (pmi.link_allowed=1 OR vl.image_isTemplate=1) AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
+ // ResultSet WITH templates
+ ResultSet res = stm
+ .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.image_description, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE (vl.image_isTemplate=1 OR (pmi.userID='"+userID+"' AND pmi.link_allowed=1)) AND vl.image_owner=u.userID AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
+
while (res.next()) {
list.add(new Image(
res.getString("GUID_imageID"),
@@ -467,7 +471,9 @@ public class SQL { // ResultSet
ResultSet res = stm
+ .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name,vl_image_description, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"
+ + userID
+ "' AND u.userID = pmi.userID AND pmi.image_admin = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
@@ -485,9 +491,6 @@ public class SQL { res.getString("image_description")
)
);
-
-
-
}
con.close();
} catch (SQLException e) {
@@ -495,7 +498,46 @@ public class SQL { e.printStackTrace();
}
return list;
- }
+ }//end getImageListPermissionAdmin
+
+
+
+ public List<Image> getImageListAllTemplates(){
+ Connection con = getConnection();
+ Statement stm;
+
+ List<Image> list = new ArrayList<Image>();
+ try {
+
+ stm = con.createStatement();
+
+ // ResultSet
+ ResultSet res = stm
+ .executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.image_description, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE vl.image_isTemplate=1 AND vl.content_operatingSystem=os.operatingSystemID AND vl.image_owner=u.userID;");
+
+ while (res.next()) {
+ list.add(new Image(
+ res.getString("GUID_imageID"),
+ res.getString("imageVersion"),
+ res.getString("image_name"),
+ res.getString("cond_hasLicenseRestriction"),
+ res.getString("name") + " " + res.getString("architecture") + " bit",
+ res.getString("lecture"),
+ res.getString("image_update_time"),
+ res.getString("user"),
+ res.getString("image_isTemplate"),
+ res.getString("image_description")
+ )
+ );
+ }
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }//end getImageListAllTemplates
+
@@ -508,7 +550,7 @@ public class SQL { ResultSet res = stm
.executeQuery("SELECT DISTINCT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
- + "WHERE i.GUID_imageID=l.imageID AND pml.rec_read=true AND u.userID=pml.userID AND u.userID='"
+ + "WHERE i.GUID_imageID=l.imageID AND l.lectureID=pml.lectureID AND pml.rec_read=true AND u.userID=pml.userID AND u.userID='"
+ userID + "';");
while (res.next()) {
@@ -569,7 +611,7 @@ public class SQL { ResultSet res = stm
.executeQuery("SELECT DISTINCT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
- + "WHERE i.GUID_imageID=l.imageID AND pml.rec_admin=true AND u.userID=pml.userID AND u.userID='"
+ + "WHERE i.GUID_imageID=l.imageID AND pml.rec_admin=true AND l.lectureID=pml.lectureID AND u.userID=pml.userID AND u.userID='"
+ userID + "';");
while (res.next()) {
@@ -672,7 +714,7 @@ public class SQL { int imageversion, String name, String desc, String shortdesc,
String start, String end, boolean isactive) {
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int active_bol = 0;
if (isactive == true) {
@@ -790,7 +832,7 @@ public class SQL { long filesize, String shareMode, String ospk) {
try {
Connection con = getConnection();
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Statement stm = con.createStatement();
int newVersion = Integer.parseInt(version) + 1;
@@ -803,7 +845,7 @@ public class SQL { license_bol = 1;
}
/*
- log.info(new Date() + " - 'image_name` = '" + newName
+ log.info("'image_name` = '" + newName
+ "\n length of name=" + newName.length());
log.info("now in UpdateImageData()");
@@ -851,13 +893,13 @@ public class SQL { + "',`image_isTemplate` = '"
// + isTemplate
+ "0'"
- + "',`content_operatingSystem` = "
+ + ",`content_operatingSystem` = "
+ ospk
+ ",`image_filesize` = "
+ filesize
- + ",`image_syncMode` = "
+ + ",`image_syncMode` = '"
+ shareMode
- + " WHERE GUID_imageID = '"
+ + "' WHERE GUID_imageID = '"
+ id
+ "' AND imageVersion = "
+ version + ";");
@@ -903,7 +945,7 @@ public class SQL { String name, String newName, String desc, String shortdesc,
String start, String end, boolean isactive, String id) {
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int active_bol = 0;
if (isactive == true) {
@@ -1098,7 +1140,7 @@ public class SQL { try {
Connection con = getConnection();
Statement stm = con.createStatement();
- //log.info(new Date() + " - Getting PrimaryKey for OS: " + os + " architecture: " + architecture);
+ //log.info("Getting PrimaryKey for OS: " + os + " architecture: " + architecture);
ResultSet rs = stm
.executeQuery("SELECT operatingSystemID FROM bwLehrpool.m_operatingSystem where name like '"
+ os
@@ -1117,6 +1159,7 @@ public class SQL { e.printStackTrace();
}
+
return null;
}
@@ -1550,11 +1593,11 @@ public class SQL { + ");");
con.commit();
con.close();
- log.info(new Date() + " - Written additional image rights.");
+ log.info("Written additional image rights.");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- log.info(new Date() + " - Failed to write additional image rights.");
+ log.info("Failed to write additional image rights.");
}
return success;
}// end writeAdditionalImageRights
@@ -1581,7 +1624,7 @@ public class SQL { con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
- log.info(new Date() + "Failed to setLectureRights.");
+ log.info("Failed to setLectureRights.");
e.printStackTrace();
}
return 0;
@@ -1605,13 +1648,12 @@ public class SQL { + isAdmin + ");");
con.commit();
con.close();
- log.info(new Date() + " - Written additional lecture rights for '"
+ log.info("Written additional lecture rights for '"
+ userID + "'.");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- log.info(new Date()
- + " - Failed to write additional lecture rights.");
+ log.info("Failed to write additional lecture rights.");
}
return success;
}// end writeAdditionalLectureRights
diff --git a/dozentenmodulserver/thrift/server.thrift b/dozentenmodulserver/thrift/server.thrift index 605bed6d..4479b4cf 100644 --- a/dozentenmodulserver/thrift/server.thrift +++ b/dozentenmodulserver/thrift/server.thrift @@ -57,6 +57,7 @@ service Server{ list<Image> getImageListPermissionRead(1: string userID), list<Image> getImageListPermissionLink(1: string userID), list<Image> getImageListPermissionAdmin(1: string userID), + list<Image> getImageListAllTemplates(), list<Lecture> getLectureList(), list<Lecture> getLectureListPermissionRead(1: string userID), list<Lecture> getLectureListPermissionWrite(1: string userID), |
