Package com.adito.core

Examples of com.adito.core.BundleActionMessage


    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        if (resourceName != null && isCommiting()) {
            ActionErrors errs = new ActionErrors();
            AbstractWizardSequence seq = getWizardSequence(request);
            if (resourceName.equals("")) {
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                    .getCurrentPageForm().getResourcePrefix()
                                + ".error.noResourceName"));
            }
            if (resourceName.length() > Resource.MAX_RESOURCE_NAME_LENGTH) {
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                    .getCurrentPageForm().getResourcePrefix()
                    + ".error.resourceNameTooLong", String.valueOf(Resource.MAX_RESOURCE_NAME_LENGTH)));
            }
            if (resourceDescription.equals("")) {
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                    .getCurrentPageForm().getResourcePrefix()
                                + ".error.noResourceDescription"));
            }
            try {
                if (this.getResourceTypeForAccessRights().getResourceByName(getResourceName(), seq.getSession()) != null) {
                    errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                        .getCurrentPageForm().getResourcePrefix()
                                    + ".error.duplicateName", getResourceName()));
                }
            } catch (Exception e) {
                log.error("Failed to check if named resource already exists.", e);
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                    .getCurrentPageForm().getResourcePrefix()
                                + ".error.failedToCheckForName", e.getMessage()));
            }
            return errs;
        }
View Full Code Here


                    if (expiresOn.before(now) && expiryInDays > 0) {
                        scheme.getServletSession().setAttribute(Constants.PASSWORD_CHANGE_REASON_MESSAGE,
                                        new ActionMessage("passwordChange.expired"));
                    } else if (warningOn.before(now) && warningInDays > 0) {
                        long daysToExpiry = ((expiresOn.getTimeInMillis() - now.getTimeInMillis()) + 86399999l) / 86400000l;
                        GlobalWarningManager.getInstance().addToSession(new GlobalWarning(scheme.getServletSession(), new BundleActionMessage("navigation",
                            "globalWarning.passwordNearExpiry", new Long(daysToExpiry))));

                    }
                } else if (scheme.getUser().requiresPasswordChange()) {
                    scheme.getServletSession().setAttribute(Constants.PASSWORD_CHANGE_REASON_MESSAGE,
View Full Code Here

                int port = Integer.valueOf(sourcePort).intValue();
                if(port < 0 || port > 65535) {
                    throw new IllegalArgumentException();
                }
            } catch (Exception e) {                
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                                .getCurrentPageForm().getResourcePrefix()
                                + ".error.sourcePortNotInteger"));
            }

            try {
                int port = Integer.valueOf(destinationPort).intValue();
                if(port < 1 || port > 65535) {
                    throw new IllegalArgumentException();
                }               
            } catch (Exception e) {
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                                .getCurrentPageForm().getResourcePrefix()
                                + ".error.destinationPortNotInteger"));
            }

            if (destinationHost == null || destinationHost.equals("")) {
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                                .getCurrentPageForm().getResourcePrefix()
                                + ".error.noDestinationHost"));
            }
            else{
                if(!HostnameOrIPAddressWithReplacementsValidator.isValidAsHostOrIp(destinationHost)) {                     
                    errs.add(Globals.ERROR_KEY, new ActionMessage("tunnelWizard.tunnelDetails.error.invalidHost"));                        
                }
            }

            if (transport.equals(TransportType.UDP_TUNNEL) && tunnelType == TransportType.REMOTE_TUNNEL_ID) {
                errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
                                .getCurrentPageForm().getResourcePrefix()
                                + ".error.remote.udp"));
            }

            return errs;
View Full Code Here

    private TaskProgressBar bar;
   
    public TestTask() {
        super("tasks", "test");
        addProgressBar(bar = new TaskProgressBar("testBar", 0, 100, 0));
        bar.setNote(new BundleActionMessage("tasks", "taskProgress.testTask.note.downloadingExtension", "NX Client"));
    }
View Full Code Here

    }

    public void run() throws TaskException {
        for(int i = 0 ; i < 100; i++) {
            bar.setValue(i);
            bar.setNote(new BundleActionMessage("tasks", "taskProgress.testTask.note.progress", String.valueOf(i * 2048 ), "NX Client" ));
            try {
                Thread.sleep(1000);
            }
            catch(Exception e) {               
            }
View Full Code Here

                storageCounter++;
            }

            public synchronized void cleared(Serializable arg0) {
                if (storageCounter == cacheSize && !addedWarning) {
                    BundleActionMessage message = new BundleActionMessage(messageBundle, cacheFullText, String.valueOf(cacheSize));
                    GlobalWarningManager.getInstance().addMultipleGlobalWarning(new GlobalWarning(GlobalWarning.MANAGEMENT_USERS, message, DismissType.DISMISS_FOR_USER));
                    addedWarning = true;
                }
                storageCounter--;
            }
View Full Code Here

   */
  public ActionMessage validateItem() throws Exception {
    if (getType() == PropertyDefinition.TYPE_INTEGER) {
      if (getValue().toString().trim().length() == 0) {
        if (!definition.isOptional()) {
          return new BundleActionMessage("properties", "error.integerRequired", app.getMessageResources()
                  .getMessage("application." + app.getId() + "." + getName() + ".name"));
        }
        return null;
      }
    } else if (getType() == PropertyDefinition.TYPE_STRING || getType() == PropertyDefinition.TYPE_TEXT_AREA
      || getType() == PropertyDefinition.TYPE_PASSWORD) {
      if (getValue().toString().trim().length() == 0) {
        if (!definition.isOptional()) {
          return new BundleActionMessage("properties", "error.requiredParameterEmpty", app.getMessageResources()
                  .getMessage("application." + app.getId() + "." + getName() + ".name"));

        }
        return null;
      }
View Full Code Here

          item = new FileItem(fileSystemForm.getLaunchSession(), element.getDisplayName(), element.getContentLength()
                  .longValue(), gc, element.getFile().getType().getName(), false, i);
        } else {
          if (log.isInfoEnabled())
            log.info("Unable to display file " + element.getDisplayName() + " as it is an imaginary file.");
          warnings.add(Constants.REQ_ATTR_WARNINGS, new BundleActionMessage(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY,
                  "vfs.imaginary.file",
                  element.getDisplayName()));

          // decrement the counter as there is no file added.
          i--;
View Full Code Here

          fileSystemForm.getFullURI(),
          e));
      }
      if (e.getStatus() == 405) {
        ActionMessages msgs = getErrors(request);
        msgs.add(Globals.ERROR_KEY, new BundleActionMessage(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY, "vfs.folder.exists", fileSystemForm.getNewFolder()));
        saveErrors(request, msgs);
        return mapping.findForward("list");
      } else if (e.getStatus() == 507) {
              ActionMessages msgs = getErrors(request);
              msgs.add(Globals.ERROR_KEY, new BundleActionMessage(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY, "vfs.folder.not.allowed", fileSystemForm.getNewFolder()));
              saveErrors(request, msgs);
              return mapping.findForward("list");
          } else {
        throw e;
      }
View Full Code Here

  private ActionForward checkMount(VFSResource vfsResource, ActionMapping mapping, FileSystemForm fileSystemForm, HttpServletRequest request)
          throws NoPermissionException {
    if (vfsResource.getMount().isReadOnly()) {
      if(READ_ONLY.contains(fileSystemForm.getActionTarget())) {
        ActionMessages msgs = getErrors(request);
        msgs.add(Globals.ERROR_KEY, new BundleActionMessage(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY, "vfs.readOnly.error"));
        saveMessages(request, msgs);
        return mapping.getInputForward();
      }
    }
    return null;   
View Full Code Here

TOP

Related Classes of com.adito.core.BundleActionMessage

Copyright © 2018 www.massapicom. 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.