Package org.jbpm.file.def

Examples of org.jbpm.file.def.FileDefinition


        }
        final ProcessDefinition processDefinition = (ProcessDefinition) processExpression.getValue(ctx);
        if (processDefinition == null) {
            throw new TagException(tag, "Value for process attribute is null");
        }
        final FileDefinition fileDefinition = processDefinition.getFileDefinition();
        if (fileDefinition == null) {
            throw new TagException(tag, "Process has a null fileDefinition property");
        }
        if (! fileDefinition.hasFile(file)) {
            throw new TagException(tag, "Process does not contain file '" + file + "'");
        }
        VariableMapper orig = ctx.getVariableMapper();
        final VariableMapperWrapper newVarMapper = new VariableMapperWrapper(orig);
        ctx.setVariableMapper(newVarMapper);
View Full Code Here


    this.processDefinition = processDefinition;
  }

  public URL findResource(String name) {
    URL url = null;
    FileDefinition fileDefinition = processDefinition.getFileDefinition();
    if (fileDefinition != null) {
      // if the name of the resources starts with a /
      if (name.startsWith("/")) {
        // then we start searching from the root of the process archive

        // we know that the leading slashes are removed in the names of the
        // file definitions, therefore we skip the leading slashes
        while (name.startsWith("/")) {
          name = name.substring(1);
        }
      }
      else {
        // otherwise, (if the resource is relative), we look in the classes
        // directory in the process archive
        name = "classes/" + name;
      }

      byte[] bytes = null;
      if (fileDefinition.hasFile(name)) {
        bytes = fileDefinition.getBytes(name);
      }
      if (bytes != null) {
        try {
          url = new URL(null, "processresource://"
              + processDefinition.getName()
View Full Code Here

      return new ByteArrayInputStream(bytes);
    }
  }

  public Class<?> findClass(String className) throws ClassNotFoundException {
    FileDefinition fileDefinition = processDefinition.getFileDefinition();
    if (fileDefinition != null) {
      String fileName = "classes/" + className.replace('.', '/') + ".class";
      byte[] classBytes = fileDefinition.getBytes(fileName);

      if (classBytes != null) {
        // define the package before defining the class
        // see https://jira.jboss.org/jira/browse/JBPM-1404
        int packageIndex = className.lastIndexOf('.');
View Full Code Here

            }
            if (!(processValue instanceof ProcessDefinition)) {
                context.setError("Error reading form information", "The process value is not of type ProcessDefinition");
            }
            final ProcessDefinition processDefinition = (ProcessDefinition) processValue;
            final FileDefinition fileDefinition = processDefinition.getFileDefinition();
            if (! fileDefinition.hasFile("forms.xml")) {
                targetExpression.setValue(elContext, Collections.emptyMap());
                context.selectOutcome("success");
                return;
            }
            final InputStream inputStream = fileDefinition.getInputStream("forms.xml");
            if (inputStream == null) {
                targetExpression.setValue(elContext, Collections.emptyMap());
                context.selectOutcome("success");
                return;
            }
View Full Code Here

            }
            if (!(processValue instanceof ProcessDefinition)) {
                context.setError("Error getting diagram info", "The process value is not of type ProcessDefinition");
            }
            final ProcessDefinition processDefinition = (ProcessDefinition) processValue;
            final FileDefinition fileDefinition = processDefinition.getFileDefinition();
            if (! fileDefinition.hasFile("gpd.xml")) {
                targetExpression.setValue(elContext, null);
                context.selectOutcome("success");
                return;
            }
            Document document = XmlUtil.parseXmlInputStream(fileDefinition.getInputStream("gpd.xml"));
            Element processDiagramElement = document.getDocumentElement();
            final String widthString = processDiagramElement.getAttribute("width");
            final String heightString = processDiagramElement.getAttribute("height");
            final List<DiagramNodeInfo> diagramNodeInfoList = new ArrayList<DiagramNodeInfo>();
            final NodeList nodeNodeList = processDiagramElement.getElementsByTagName("node");
View Full Code Here

    return EVAL_PAGE;
  }

  private void retrieveByteArrays() {
    try {
      FileDefinition fileDefinition = processDefinition.getFileDefinition();
      gpdBytes = fileDefinition.getBytes("gpd.xml");
      imageBytes = fileDefinition.getBytes("processimage.jpg");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    assertTrue(ContextDefinition.class.isAssignableFrom(processDefinition.getContextDefinition().getClass()));
  }
 
  public void testFileDefinition() {
    ProcessDefinition processDefinition = new ProcessDefinition();
    processDefinition.addDefinition(new FileDefinition());

    processDefinition = saveAndReload(processDefinition);

    assertNotNull(processDefinition.getFileDefinition());
    assertTrue(FileDefinition.class.isAssignableFrom(processDefinition.getFileDefinition().getClass()));
View Full Code Here

    this.processDefinition = processDefinition;
  }

  public URL findResource(String name) {
    URL url = null;
    FileDefinition fileDefinition = processDefinition.getFileDefinition();
    if (fileDefinition!=null) {
      // if the name of the resources starts with a /
      if (name.startsWith("/")) {
        // then we start searching from the root of the process archive

        // we know that the leading slashes are removed in the names of the
        // file definitions, therefor we skip the leading slashes
        while (name.startsWith("/")) {
          name = name.substring(1);
        }
      } else {
        // otherwise, (if the resource is relative), we look in the classes
        // directory in the process archive
        name = "classes/"+name;
      }

      byte[] bytes = null;
      if (fileDefinition.hasFile(name)) {
        bytes = fileDefinition.getBytes(name);
      }
      if (bytes!=null) {
        try {
          url = new URL(null, "processresource://"+processDefinition.getName()+"/classes/"+name, new BytesUrlStreamHandler(bytes));
        } catch (MalformedURLException e) {
View Full Code Here

  }

  public Class findClass(String name) throws ClassNotFoundException {
    Class clazz = null;

    FileDefinition fileDefinition = processDefinition.getFileDefinition();
    if (fileDefinition!=null) {
      String fileName = "classes/" + name.replace( '.', '/' ) + ".class";
      byte[] classBytes;
      try {
        classBytes = fileDefinition.getBytes(fileName);
        clazz = defineClass(name, classBytes, 0, classBytes.length);
      } catch (JbpmException e) {
        clazz = null;
      }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.file.def.FileDefinition

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.