コード例 #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.apromore.canoniser.yawl.internal.YAWL2Canonical#convertToCanonical(org.yawlfoundation.yawlschema.SpecificationSetFactsType)
   */
  @Override
  public void convertToCanonical(final SpecificationSetFactsType value) throws CanoniserException {
    checkVersion(value.getVersion());
    checkValidSpecification(value);

    // YAWL allows only for one Specification per File
    final YAWLSpecificationFactsType specification = value.getSpecification().get(0);

    // If there is no Organisational Model supplied then create an empty one
    if (orgDataType == null) {
      LOGGER.warn("Canonising YAWL without use of an organisational model!");
      orgDataType = new OrgDataType();
    }

    // First create the Context class for this conversion, the Context is used to store all kind of
    // information that needs to be shared between
    // Handlers
    this.setContext(
        new YAWLConversionContext(specification, value.getLayout(), orgDataType, messageManager));
    // Second create the Factory class that will create the conversion Handlers
    final ConversionFactory factory = new YAWLConversionFactory(this.getContext());

    // Start conversion on the YAWL speciication
    factory.createHandler(specification, null, null).convert();
  }
コード例 #2
0
 @Before
 public void setUp() throws Exception {
   final File file =
       new File(
           TestUtils.TEST_RESOURCES_DIRECTORY
               + "YAWL/Patterns/ControlFlow/WPC3Synchronization.yawl");
   final File orgDatafile =
       new File(
           TestUtils.TEST_RESOURCES_DIRECTORY + "YAWL/OrganisationalData/YAWLDefaultOrgData.ybkp");
   final SpecificationSetFactsType yawlXml = TestUtils.unmarshalYAWL(file);
   final OrgDataType orgDataXml = TestUtils.unmarshalYAWLOrgData(orgDatafile);
   specUnderTest = yawlXml.getSpecification().get(0);
   context =
       new YAWLConversionContext(
           specUnderTest, yawlXml.getLayout(), orgDataXml, new NoOpMessageManager());
 }
コード例 #3
0
 private void checkValidSpecification(final SpecificationSetFactsType value)
     throws CanoniserException {
   if (value.getSpecification().size() == 1) {
     return;
   }
   throw new CanoniserException(
       "Missing specification, a YAWL workflow should contain exact 1 specification!");
 }