Package au.edu.qut.yawl.worklist.model

Examples of au.edu.qut.yawl.worklist.model.SpecificationData


        response.setContentType("text/xml");
        StringBuffer output = new StringBuffer();
        PrintWriter outputWriter = response.getWriter();
        String specID = request.getParameter("specID");
        if (specID != null) {
            SpecificationData specData = controller.getSpecificationData(
                    specID,
                    (String) request.getSession().getAttribute("sessionHandle"));
            String specAsXML = specData.getAsXML();
            output.append(specAsXML);
        }
        outputWriter.write(output.toString());
        outputWriter.flush();
        outputWriter.close();
View Full Code Here


      // set schema data
        String schema = createCaseSchema(caseID, sessionHandle, _worklistController);
        parameters.put("schema", schema);
       
        // set instance data
        SpecificationData specData = _worklistController.getSpecificationData(caseID, sessionHandle);
        InstanceBuilder ib = new InstanceBuilder(schema, specData.getRootNetID(), null);
        parameters.put("instance", ib.getInstance());
       
        // TODO need to query specData for the names of output params belonging to the case
       
        // set input parameter data (if any)
        //parameters.put("inputparams", getInputOutputParams(specData.getInputParams()));
       
        parameters.put("root", specData.getRootNetID());
        parameters.put("task", URLEncoder.encode(specData.getID(), "UTF-8"));
        parameters.put("task", specData.getID());
        parameters.put("specID", specData.getID());
        parameters.put("JSESSIONID", jsessionid);
       
        // send (post) data to yawlXForms thru interfaceD
        idx.sendWorkItemData(parameters, userID, specData.getID(), sessionHandle);
    }
View Full Code Here

     */
    public String createCaseSchema(String _specID, String _sessionHandle,
                                        WorklistController _worklistController)
            throws IOException, JDOMException, YSchemaBuildingException, YSyntaxException, URISyntaxException {

        SpecificationData specData = _worklistController.getSpecificationData(_specID, _sessionHandle);
        List inputParams = specData.getInputParams();

        List instructions = Collections.synchronizedList(new ArrayList());

        for (int i = 0; i < inputParams.size(); i++) {
            YParameter inputParam = (YParameter) inputParams.get(i);

            if (null != inputParam.getElementName()) {

                String elementName = inputParam.getElementName();
                ElementReuseInstruction instruction = new ElementReuseInstruction(elementName);
                instructions.add(instruction);
            }
            else if (null != inputParam.getDataTypeName()) {

                String elementName = inputParam.getName();
                String typeName = inputParam.getDataTypeName();
                boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(inputParam.getDataTypeNameSpace());
                ElementCreationInstruction instruction = new ElementCreationInstruction(
                        elementName,
                        typeName,
                        isPrimitiveType);
                instructions.add(instruction);
            }
           
            //if (inputParam.getElementName() != null) { // work item input param
            //    input.append(inputParam.getElementName()).append(",");
            //}
            else if (inputParam.isUntyped()) {
//               due to a bug, YAWL converts untyped parameters into creation parameters
                //UntypedElementInstruction instruction = new UntypedElementInstruction();
                //instructions.add(instruction);

                String elementName = inputParam.getName();
                //String typeName = inputParam.getDataTypeName();
                String typeName = "boolean";
                boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(inputParam.getDataTypeNameSpace());
                ElementCreationInstruction instruction = new ElementCreationInstruction(
                        elementName,
                        typeName,
                        isPrimitiveType);
                instructions.add(instruction);
            }
            //else if (inputParam.getName() != null) {
            //    input.append(inputParam.getName()).append(",");
            //}
        }

        XMLToolsForYAWL xmlToolsForYawl = new XMLToolsForYAWL();
        String schemaLibrary = specData.getSchemaLibrary();
        xmlToolsForYawl.setPrimarySchema(schemaLibrary);
        String myNewSchema = xmlToolsForYawl.createYAWLSchema(
          (Instruction[]) instructions.toArray(
            new Instruction[instructions.size()])
            , specData.getRootNetID());
       
       return (myNewSchema);
    }
View Full Code Here

            String specID = taskInfo.getSpecificationID();

            //next get specification data which will contain the input schema library
            //that we are going to use to build the schema that we want for this task.
            SpecificationData specData = worklistController.getSpecificationData(specID, _sessionHandle);

            //now we get the parameters signature for the task
            YParametersSchema paramsSignature = taskInfo.getParamSchema();

            //now for each input param build an instruction
            List inputParams = paramsSignature.getInputParams();
            List instructions = Collections.synchronizedList(new ArrayList());

            // this is an XML string containing the instance data for the current task
            // this can be the instance file, and if identical elements are found in
            // the schema during instance creation, the creation of new elements in
            // the instance will be ignored.

            for (int i = 0; i < inputParams.size(); i++) {
                YParameter inputParam = (YParameter) inputParams.get(i);

                if (null != inputParam.getElementName()) {

                    String elementName = inputParam.getElementName();
                    ElementReuseInstruction instruction = new ElementReuseInstruction(elementName);
                    instructions.add(instruction);
                } else if (null != inputParam.getDataTypeName()) {

                    String elementName = inputParam.getName();
                    String typeName = inputParam.getDataTypeName();
                    boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(inputParam.getDataTypeNameSpace());
                    ElementCreationInstruction instruction = new ElementCreationInstruction(
                            elementName, typeName, isPrimitiveType);
                    instructions.add(instruction);
                }
                // currently we convert untyped parameters into creation parameters, due to a bug in YAWL
                else if (inputParam.isUntyped()) {
                    //UntypedElementInstruction instruction = new UntypedElementInstruction();
                    //instructions.add(instruction);

                    String elementName = inputParam.getName();
                    //String typeName = inputParam.getDataTypeName();
                    String typeName = "boolean";
                    boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(inputParam.getDataTypeNameSpace());
                    ElementCreationInstruction instruction = new ElementCreationInstruction(
                            elementName, typeName, isPrimitiveType);
                    instructions.add(instruction);
                }
            }
           
            //for each output param build an instruction
            List outputParams = paramsSignature.getOutputParams();

            for (int i = 0; i < outputParams.size(); i++) {

                YParameter outputParam = (YParameter) outputParams.get(i);

                if (null != outputParam.getElementName()) {

                    String elementName = outputParam.getElementName();
                    ElementReuseInstruction instruction = new ElementReuseInstruction(elementName);

                    // if an instruction with the same name already exists in the instruction list
                    // remove it and add the instruction for this parameter

                    if (instructions.contains(instruction) == true) {

                        // Matching element REUSE instruction found.
                        Instruction tempInstruction;
                        int position = instructions.indexOf(instruction);
                        tempInstruction = (Instruction) instructions.get(position);
                        if (tempInstruction.getElementName().compareTo(instruction.getElementName()) == 0) {
                            instructions.remove(position);
                        }
                    }
                    else {
                      logger.debug("No matching element REUSE instruction found: " + elementName);
                    }

                    instructions.add(instruction);
                } else if (null != outputParam.getDataTypeName()) {

                    String elementName = outputParam.getName();
                    String typeName = outputParam.getDataTypeName();
                    boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(outputParam.getDataTypeNameSpace());
                    ElementCreationInstruction instruction = new ElementCreationInstruction(
                            elementName, typeName, isPrimitiveType);

                    // if an instruction with the same name already exists in the instruction list
                    // remove it and add the instruction for this parameter
                    Instruction[] ins = (Instruction[]) instructions.toArray(new Instruction[instructions.size()]);

                    boolean match = false;
                    for (int j = 0; j < ins.length; j++) {
                        if (ins[j].getElementName().compareTo(elementName) == 0) {
                            match = true;
                            ins[j] = instruction; // replace old instruction with this one
                        }
                    }

                    if (match == true) {
                        // convert updated array back to the instructions arraylist
                        instructions.clear();
                        for (int j = 0; j < ins.length; j++) {
                            instructions.add(ins[j]);
                        }
                    }
                    else {
                        instructions.add(instruction);
                    }
                }
               
                // currently we convert untyped parameters into creation parameters, due to a bug in YAWL
                else if (outputParam.isUntyped()) {
                    //UntypedElementInstruction instruction = new UntypedElementInstruction();
                    //instructions.add(instruction);

                    String elementName = outputParam.getName();
                    //String typeName = outputParam.getDataTypeName();
                    String typeName = "boolean";
                    //boolean isPrimitiveType = "http://www.w3.org/2001/XMLSchema".equals(outputParam.getDataTypeNameSpace());
                    boolean isPrimitiveType = true;
                    ElementCreationInstruction instruction = new ElementCreationInstruction(
                            elementName, typeName, isPrimitiveType);

                    // if an instruction with the same name already exists in the instruction list
                    // remove it and add the instruction for this parameter
                    Instruction[] ins = (Instruction[]) instructions.toArray(new Instruction[instructions.size()]);
                    boolean match = false;

                    for (int j = 0; j < ins.length; j++) {
                      logger.debug(j + ".");
                        if (ins[j].getElementName().compareTo(elementName) == 0) {
                            match = true;
                            ins[j] = instruction; // replace old instruction with this one
                        }
                    }

                    if (match == true) {
                        // convert updated array back to the instructions arraylist
                        instructions.clear();
                        for (int j = 0; j < ins.length; j++) {
                            instructions.add(ins[j]);
                        }
                    }
                    else {
                        instructions.add(instruction);
                    }
                }
            }

            XMLToolsForYAWL xmlToolsForYawl = new XMLToolsForYAWL();
            String schemaLibrary = specData.getSchemaLibrary();
            xmlToolsForYawl.setPrimarySchema(schemaLibrary);
            myNewSchema = xmlToolsForYawl.createYAWLSchema(
                    (Instruction[]) instructions.toArray(new Instruction[instructions.size()]),
                    taskInfo.getDecompositionID());         
        }
View Full Code Here

TOP

Related Classes of au.edu.qut.yawl.worklist.model.SpecificationData

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.