Examples of FileEntry


Examples of com.liferay.portal.kernel.repository.model.FileEntry

      long length)
    throws Exception {

    setServiceContext(fileName);

    FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(
      userId, groupId, parentFolderId, fileName,
      MimeTypesUtil.getContentType(fileName),
      FileUtil.stripExtension(fileName), StringPool.BLANK,
      StringPool.BLANK, inputStream, length, serviceContext);
View Full Code Here

Examples of com.liferay.portal.kernel.repository.model.FileEntry

      String smallImageFileName = assetJSONObject.getString("smallImage");

      if (Validator.isNotNull(smallImageFileName)) {
        smallImage = true;

        FileEntry fileEntry = _fileEntries.get(smallImageFileName);

        if (fileEntry != null) {
          smallImageURL = DLUtil.getPreviewURL(
            fileEntry, fileEntry.getFileVersion(), null,
            StringPool.BLANK);
        }
      }
    }
View Full Code Here

Examples of com.liferay.portal.kernel.repository.model.FileEntry

    Matcher matcher = _fileEntryPattern.matcher(content);

    while (matcher.find()) {
      String fileName = matcher.group(1);

      FileEntry fileEntry = _fileEntries.get(fileName);

      String fileEntryURL = StringPool.BLANK;

      if (fileEntry != null) {
        fileEntryURL = DLUtil.getPreviewURL(
          fileEntry, fileEntry.getFileVersion(), null,
          StringPool.BLANK);
      }

      content = matcher.replaceFirst(fileEntryURL);
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

        sessionConfigurations = ClientHelper.readFileProperties(CONFIGS_FOLDER + CONFIGS_LIBRARY, CONFIGS_FOLDER);

        final JComboBox configs = new JComboBox();
        configs.setMaximumRowCount(20);

        configs.addItem(new FileEntry("", null));
        if (sessionConfigurations != null) {
            for (FileEntry fe : sessionConfigurations) {
                configs.addItem(fe);
            }
        }
        expertPanel.add(configs, BorderLayout.PAGE_START);

        sessionParameterTextArea = new JTextArea();
        sessionParameterTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
        expertPanel.add(new JScrollPane(sessionParameterTextArea), BorderLayout.CENTER);

        loginTabs.addTab("Expert", expertPanel);

        // repository
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS));
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
        add(buttonPanel, BorderLayout.PAGE_END);

        loadRepositoryButton = createButton("Load Repositories");
        buttonPanel.add(loadRepositoryButton);
        getRootPane().setDefaultButton(loadRepositoryButton);

        createRepositoryBox(buttonPanel);

        loginButton = createButton("Login");
        buttonPanel.add(loginButton);
        loginButton.setEnabled(false);

        // listeners
        loadRepositoryButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                repositoryBox.removeAllItems();

                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    createClientSession();

                    List<Repository> repositories = clientSession.getRepositories();
                    if (repositories.size() > 0) {

                        for (Repository repository : repositories) {
                            repositoryBox.addItem(repository);
                        }

                        repositoryBox.setEnabled(true);
                        loginButton.setEnabled(true);
                        getRootPane().setDefaultButton(loginButton);
                    } else {
                        repositoryBox.setEnabled(false);
                        loginButton.setEnabled(false);
                        getRootPane().setDefaultButton(loadRepositoryButton);
                    }
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);
                    getRootPane().setDefaultButton(loadRepositoryButton);

                    ClientHelper.showError(getOwner(), ex);
                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });

        loginButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                    clientSession.createSession(repositoryBox.getSelectedIndex());
                    canceled = false;
                    hideDialog();
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);
                    getRootPane().setDefaultButton(loadRepositoryButton);

                    ClientHelper.showError(getOwner(), ex);

                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    getRootPane().setDefaultButton(loadRepositoryButton);
                }
            }
        });

        loginTabs.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                expertLogin = (loginTabs.getSelectedComponent() == expertPanel);

                if (expertLogin) {
                    configs.setSelectedIndex(0);

                    StringBuilder sb = new StringBuilder();
                    for (Map.Entry<String, String> parameter : createBasicSessionParameters().entrySet()) {
                        sb.append(parameter.getKey());
                        sb.append("=");
                        sb.append(parameter.getValue());
                        sb.append("\n");
                    }

                    sessionParameterTextArea.setText(sb.toString());
                    sessionParameterTextArea.setCaretPosition(0);
                }
            }
        });

        configs.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                FileEntry fe = (FileEntry) e.getItem();

                sessionParameterTextArea.setText(ClientHelper.readFileAndRemoveHeader(fe.getFile()));
                sessionParameterTextArea.setCaretPosition(0);
            }
        });

        ClientHelper.installEscapeBinding(this, getRootPane(), false);
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

        sessionConfigurations = ClientHelper.readFileProperties(CONFIGS_FOLDER + CONFIGS_LIBRARY, CONFIGS_FOLDER);

        final JComboBox configs = new JComboBox();
        configs.setMaximumRowCount(20);

        configs.addItem(new FileEntry("", null));
        if (sessionConfigurations != null) {
            for (FileEntry fe : sessionConfigurations) {
                configs.addItem(fe);
            }
        }
        expertPanel.add(configs, BorderLayout.PAGE_START);

        sessionParameterTextArea = new JTextArea();
        sessionParameterTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
        expertPanel.add(new JScrollPane(sessionParameterTextArea), BorderLayout.CENTER);

        loginTabs.addTab("Expert", expertPanel);

        // repository
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS));
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
        add(buttonPanel, BorderLayout.PAGE_END);

        loadRepositoryButton = createButton("Load Repositories");
        buttonPanel.add(loadRepositoryButton);
        getRootPane().setDefaultButton(loadRepositoryButton);

        createRepositoryBox(buttonPanel);

        loginButton = createButton("Login");
        buttonPanel.add(loginButton);
        loginButton.setEnabled(false);

        // listeners
        loadRepositoryButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                repositoryBox.removeAllItems();

                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    createClientSession();

                    List<Repository> repositories = clientSession.getRepositories();

                    Collections.sort(repositories, new Comparator<Repository>() {
                        @Override
                        public int compare(Repository r1, Repository r2) {
                            if (r1 == null || r1.getName() == null) {
                                return 1;
                            }

                            if (r2 == null || r2.getName() == null) {
                                return -1;
                            }

                            return r1.getName().compareTo(r2.getName());
                        }
                    });

                    if (repositories.size() > 0) {

                        for (Repository repository : repositories) {
                            repositoryBox.addItem(repository);
                        }

                        repositoryBox.setEnabled(true);
                        loginButton.setEnabled(true);
                        getRootPane().setDefaultButton(loginButton);
                    } else {
                        repositoryBox.setEnabled(false);
                        loginButton.setEnabled(false);
                        getRootPane().setDefaultButton(loadRepositoryButton);
                    }
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);
                    getRootPane().setDefaultButton(loadRepositoryButton);

                    ClientHelper.showError(getOwner(), ex);
                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });

        loginButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                    clientSession.createSession(repositoryBox.getSelectedIndex());
                    canceled = false;
                    hideDialog();
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);
                    getRootPane().setDefaultButton(loadRepositoryButton);

                    ClientHelper.showError(getOwner(), ex);

                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    getRootPane().setDefaultButton(loadRepositoryButton);
                }
            }
        });

        loginTabs.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                expertLogin = (loginTabs.getSelectedComponent() == expertPanel);

                if (expertLogin) {
                    configs.setSelectedIndex(0);

                    StringBuilder sb = new StringBuilder();
                    for (Map.Entry<String, String> parameter : createBasicSessionParameters().entrySet()) {
                        sb.append(parameter.getKey());
                        sb.append("=");
                        sb.append(parameter.getValue());
                        sb.append("\n");
                    }

                    sessionParameterTextArea.setText(sb.toString());
                    sessionParameterTextArea.setCaretPosition(0);
                }
            }
        });

        configs.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                FileEntry fe = (FileEntry) e.getItem();

                sessionParameterTextArea.setText(ClientHelper.readFileAndRemoveHeader(fe.getFile()));
                sessionParameterTextArea.setCaretPosition(0);
            }
        });

        ClientHelper.installEscapeBinding(this, getRootPane(), false);
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

    private List<FileEntry> readScriptLibrary() {
        List<FileEntry> result = ClientHelper.readFileProperties(GROOVY_SCRIPT_FOLDER + GROOVY_SCRIPT_LIBRARY,
                GROOVY_SCRIPT_FOLDER);
        if (result == null) {
            result = Collections.singletonList(new FileEntry("Groovy Console", null));
        }

        return result;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

        sessionConfigurations = ClientHelper.readFileProperties(CONFIGS_FOLDER + CONFIGS_LIBRARY, CONFIGS_FOLDER);

        final JComboBox configs = new JComboBox();
        configs.setMaximumRowCount(20);

        configs.addItem(new FileEntry("", null));
        if (sessionConfigurations != null) {
            for (FileEntry fe : sessionConfigurations) {
                configs.addItem(fe);
            }
        }
        expertPanel.add(configs, BorderLayout.PAGE_START);

        sessionParameterTextArea = new JTextArea();
        sessionParameterTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
        expertPanel.add(new JScrollPane(sessionParameterTextArea), BorderLayout.CENTER);

        loginTabs.addTab("Expert", expertPanel);

        // repository
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS));
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
        add(buttonPanel, BorderLayout.PAGE_END);

        loadRepositoryButton = createButton("Load Repositories");
        buttonPanel.add(loadRepositoryButton);

        createRepositoryBox(buttonPanel);

        loginButton = createButton("Login");
        buttonPanel.add(loginButton);
        loginButton.setEnabled(false);

        // listeners
        loadRepositoryButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                repositoryBox.removeAllItems();

                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    createClientSession();

                    List<Repository> repositories = clientSession.getRepositories();
                    if (repositories.size() > 0) {

                        for (Repository repository : repositories) {
                            repositoryBox.addItem(repository);
                        }

                        repositoryBox.setEnabled(true);
                        loginButton.setEnabled(true);
                    } else {
                        repositoryBox.setEnabled(false);
                        loginButton.setEnabled(false);
                    }
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);

                    ClientHelper.showError(getOwner(), ex);
                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });

        loginButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                    clientSession.createSession(repositoryBox.getSelectedIndex());
                    canceled = false;
                    hideDialog();
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);

                    ClientHelper.showError(getOwner(), ex);

                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });

        loginTabs.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                expertLogin = (loginTabs.getSelectedComponent() == expertPanel);

                if (expertLogin) {
                    configs.setSelectedIndex(0);

                    StringBuilder sb = new StringBuilder();
                    for (Map.Entry<String, String> parameter : createBasicSessionParameters().entrySet()) {
                        sb.append(parameter.getKey());
                        sb.append("=");
                        sb.append(parameter.getValue());
                        sb.append("\n");
                    }

                    sessionParameterTextArea.setText(sb.toString());
                    sessionParameterTextArea.setCaretPosition(0);
                }
            }
        });

        configs.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                FileEntry fe = (FileEntry) e.getItem();

                sessionParameterTextArea.setText(ClientHelper.readFileAndRemoveHeader(fe.getFile()));
                sessionParameterTextArea.setCaretPosition(0);
            }
        });

        setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

        sessionConfigurations = ClientHelper.readFileProperties(CONFIGS_FOLDER + CONFIGS_LIBRARY, CONFIGS_FOLDER);

        final JComboBox configs = new JComboBox();
        configs.setMaximumRowCount(20);

        configs.addItem(new FileEntry("", null));
        if (sessionConfigurations != null) {
            for (FileEntry fe : sessionConfigurations) {
                configs.addItem(fe);
            }
        }
        expertPanel.add(configs, BorderLayout.PAGE_START);

        sessionParameterTextArea = new JTextArea();
        sessionParameterTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
        expertPanel.add(new JScrollPane(sessionParameterTextArea), BorderLayout.CENTER);

        loginTabs.addTab("Expert", expertPanel);

        // repository
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS));
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
        add(buttonPanel, BorderLayout.PAGE_END);

        loadRepositoryButton = createButton("Load Repositories");
        buttonPanel.add(loadRepositoryButton);

        createRepositoryBox(buttonPanel);

        loginButton = createButton("Login");
        buttonPanel.add(loginButton);
        loginButton.setEnabled(false);

        // listeners
        loadRepositoryButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                repositoryBox.removeAllItems();

                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    createClientSession();

                    List<Repository> repositories = clientSession.getRepositories();
                    if (repositories.size() > 0) {

                        for (Repository repository : repositories) {
                            repositoryBox.addItem(repository);
                        }

                        repositoryBox.setEnabled(true);
                        loginButton.setEnabled(true);
                    } else {
                        repositoryBox.setEnabled(false);
                        loginButton.setEnabled(false);
                    }
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);

                    ClientHelper.showError(getOwner(), ex);
                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });

        loginButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                    clientSession.createSession(repositoryBox.getSelectedIndex());
                    canceled = false;
                    hideDialog();
                } catch (Exception ex) {
                    repositoryBox.setEnabled(false);
                    loginButton.setEnabled(false);

                    ClientHelper.showError(getOwner(), ex);

                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        });

        loginTabs.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                expertLogin = (loginTabs.getSelectedComponent() == expertPanel);

                if (expertLogin) {
                    configs.setSelectedIndex(0);

                    StringBuilder sb = new StringBuilder();
                    for (Map.Entry<String, String> parameter : createBasicSessionParameters().entrySet()) {
                        sb.append(parameter.getKey());
                        sb.append("=");
                        sb.append(parameter.getValue());
                        sb.append("\n");
                    }

                    sessionParameterTextArea.setText(sb.toString());
                    sessionParameterTextArea.setCaretPosition(0);
                }
            }
        });

        configs.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                FileEntry fe = (FileEntry) e.getItem();

                sessionParameterTextArea.setText(ClientHelper.readFileAndRemoveHeader(fe.getFile()));
                sessionParameterTextArea.setCaretPosition(0);
            }
        });

        setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

    private List<FileEntry> readScriptLibrary() {
        List<FileEntry> result = ClientHelper.readFileProperties(GROOVY_SCRIPT_FOLDER + GROOVY_SCRIPT_LIBRARY,
                GROOVY_SCRIPT_FOLDER);
        if (result == null) {
            result = Collections.singletonList(new FileEntry("Groovy Console", null));
        }

        return result;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.workbench.ClientHelper.FileEntry

    private List<FileEntry> readScriptLibrary() {
        List<FileEntry> result = ClientHelper.readFileProperties(GROOVY_SCRIPT_FOLDER + GROOVY_SCRIPT_LIBRARY,
                GROOVY_SCRIPT_FOLDER);
        if (result == null) {
            result = Collections.singletonList(new FileEntry("Groovy Console", null));
        }

        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.