Package org.uengine.contexts

Examples of org.uengine.contexts.FileContext


        beanId = null;
    }
   
    public int doStartTag() throws JspException {
        try {
          FileContext fc = null;
            JspWriter out = pageContext.getOut();
            Object[] beanValues = HttpUtils.getParameterAsObject(beanId, name, dVal, viewmode, pageContext); //mapping values
     
            if (beanValues[0] instanceof FileContext) {
              fc = (FileContext) beanValues[0];
View Full Code Here


        fileSystemDir += File.separatorChar;
      }
     
      String tempDir = "temp" + File.separator;
      String outPath = null;
      FileContext fc = null;
      Iterator interator = parameterMap.keySet().iterator();
      for(int i = 0; i < parameterMap.size(); i++) {
        String key = (String)interator.next();
        String[] value = (String[])parameterMap.get(key);
        //File Move
        if (value != null) {
          for (int j=0; j<value.length; j++) {
            if (value[j].contains("<org.uengine.contexts.FileContext>")
                && value[j].contains("<path>" + tempDir)) {
              fc = (FileContext) GlobalContext.deserialize(value[j], FileContext.class);
              outPath = fc.getPath().replace(tempDir, "");
              new File(fileSystemDir + fc.getPath()).renameTo(new File(fileSystemDir + outPath));
              fc.setPath(outPath);
              value[j] = GlobalContext.serialize(fc, FileContext.class);
            }
          }
          parameterMap.put(key, value);
        }
View Full Code Here

//  }

  public Object createValueFromHTTPRequest(Map parameterValues, String section, String fieldName, Object oldValue) {
    String filePath = TextInput.createStringFromHTTPRequest(parameterValues, section, fieldName);
   
    FileContext fileContext = (oldValue!=null ? (FileContext)oldValue : new FileContext());
    fileContext.setPath(filePath);
   
    return fileContext;
  }
View Full Code Here

  public String getInputterHTML(String section, FieldDescriptor fd, Object defaultValue, Map options) {
    if(options==null) options = new HashMap();
   
    if(defaultValue!=null && defaultValue instanceof FileContext){
      FileContext defaultFileContext = (FileContext)defaultValue;
     
      ProcessDefinitionRemote pdr = (ProcessDefinitionRemote)options.get("definitionRemote");
      ProcessVariable[] variables = pdr.getProcessVariableDescriptors();
      for(int i=0; i<variables.length; i++){
        if(variables[i].getName().equals(fd.getName()))
            defaultFileContext = (FileContext)variables[i].getDefaultValue();
      }
     
      ProcessInstance instance = (ProcessInstance)options.get("instance");
     
      if(defaultFileContext.isFtpFile()){
        StringBuffer inputterHTML = new StringBuffer();

        String defaultPath = defaultFileContext.getPath();
       
        if(!UEngineUtil.isNotEmpty(defaultPath))
          defaultPath = null;
       
        if(defaultPath!=null){
          if(     defaultPath.indexOf("<") > -1
            ||   defaultPath.indexOf(">") > -1
            ||   defaultPath.indexOf("%") > -1
            ||   defaultPath.indexOf("=") > -1
            ) defaultPath = "";
        }else{
          if(instance != null)
            try {
              defaultPath = defaultFileContext.getFullSavingFTPURL(instance);
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
        }
         
       
        inputterHTML
          .append("input type=button value='Open'")
          .append(" onclick=\"ftp_openFile('")
          .append(defaultPath)
          .append("','")
          .append(defaultFileContext.getFtpAddress())
          .append("','")
          .append(defaultFileContext.getFtpDirectory())
          .append("','")
          .append(defaultFileContext.getFtpUserId())
          .append("','")
          .append(defaultFileContext.getFtpPassword())
        ;
       
        if(options.containsKey("instanceId"))
          inputterHTML
            .append("','")
            .append(options.get("instanceId"))
          ;
        else
          inputterHTML.append("','null");
       
        if(options.containsKey("defVerId"))
          inputterHTML
            .append("','")
            .append(options.get("defVerId"))
          ;
        else
          inputterHTML.append("','null");

        inputterHTML
          .append("','")
          .append(fd.getName())
        ;

        inputterHTML.append("')\"");
       
//        inputterHTML = new StringBuffer(inputterHTML.toString().replaceAll("<","").replaceAll(">","").replaceAll("%",""));
       
        inputterHTML
          .insert(0, "<")
          .append(">")
        ;
       
        try{
          StringBuffer hiddenInptter = new StringBuffer();
          hiddenInptter
            .append("input type=hidden")
            .append(HTML.getAttrHTML("name", createNameAttribute(section, fd.getName())))
            .append(" value='"+ (defaultPath!=null ? defaultPath : defaultFileContext.getFullSavingFTPURL(null)) +"'")
          ;
         
//          hiddenInptter = new StringBuffer(hiddenInptter.toString().replaceAll("<","").replaceAll(">","").replaceAll("%","").replaceAll("=",""));
     
          hiddenInptter
View Full Code Here

    );
  }

  public String getViewerHTML(String section, FieldDescriptor fd, Object defaultValue, Map options) {
    if(defaultValue!=null){
      FileContext fileContext = (FileContext)defaultValue;
     
      if(fileContext.isFtpFile()){
        StringBuffer viewerHTML = new StringBuffer();
        String defaultPath = fileContext.getPath();
        if(defaultPath==null)
          defaultPath = fileContext.getTemplateFilePath();

        viewerHTML
          .append("<input type=button value='View'")
          .append(" onclick=\"ftp_openFileReadOnly('")
          .append(defaultPath)
          .append("')\">")
        ;
       
        return viewerHTML.toString();

      }else{
        File file = fileContext.getFile();
        if(file==null) return "No file";
       
        String fNameOnly = file.getName();
       
        return "<a href='"+GlobalContext.WEB_CONTEXT_ROOT+"/uploads/"+ fNameOnly + "'>"+fNameOnly+"</a>";
View Full Code Here

TOP

Related Classes of org.uengine.contexts.FileContext

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.