/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.uima.resource.metadata.impl;

import org.apache.uima.resource.metadata.OperationalProperties;

public class OperationalProperties_impl extends MetaDataObject_impl implements
        OperationalProperties {

  private static final long serialVersionUID = 8649608701550531026L;

  private boolean mModifiesCas;

  private boolean mMultipleDeploymentAllowed;

  private boolean mOutputsNewCASes;

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.uima.resource.metadata.OperationalProperties#getModifiesCas()
   */
  public boolean getModifiesCas() {
    return mModifiesCas;
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.uima.resource.metadata.OperationalProperties#isMultipleDeploymentAllowed()
   */
  public boolean isMultipleDeploymentAllowed() {
    return mMultipleDeploymentAllowed;
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.uima.resource.metadata.OperationalProperties#setModifiesCas(boolean)
   */
  public void setModifiesCas(boolean aModifiesCas) {
    mModifiesCas = aModifiesCas;

  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.uima.resource.metadata.OperationalProperties#setMultipleDeploymentAllowed(boolean)
   */
  public void setMultipleDeploymentAllowed(boolean aMultipleDeploymentAllowed) {
    mMultipleDeploymentAllowed = aMultipleDeploymentAllowed;
  }

  public boolean getOutputsNewCASes() {
    return mOutputsNewCASes;
  }

  public void setOutputsNewCASes(boolean aOutputsNewCASes) {
    mOutputsNewCASes = aOutputsNewCASes;
  }

  protected XmlizationInfo getXmlizationInfo() {
    return XMLIZATION_INFO;
  }

  static final private XmlizationInfo XMLIZATION_INFO = new XmlizationInfo("operationalProperties",
          new PropertyXmlInfo[] { new PropertyXmlInfo("modifiesCas"),
              new PropertyXmlInfo("multipleDeploymentAllowed"),
              new PropertyXmlInfo("outputsNewCASes") });
}

@@ -916,16 +916,211 @@
 perties;
+%0Aimport org.apache.uima.util.InvalidXMLException;%0Aimport org.apache.uima.util.XMLParser;%0Aimport org.apache.uima.util.XMLParser.ParsingOptions;%0Aimport org.w3c.dom.Element;%0Aimport org.w3c.dom.Node;
 %0A%0Apublic
@@ -2881,10 +2881,1238 @@
 s%22) %7D);%0A
-%7D
+%0A  /* (non-Javadoc)%0A   * @see org.apache.uima.resource.metadata.impl.MetaDataObject_impl#buildFromXMLElement(org.w3c.dom.Element, org.apache.uima.util.XMLParser, org.apache.uima.util.XMLParser.ParsingOptions)%0A   */%0A  @Override%0A  public void buildFromXMLElement(Element aElement, XMLParser aParser, ParsingOptions aOptions)%0A      throws InvalidXMLException %7B%0A    // overridden to set proper defaults%0A    // https://issues.apache.org/jira/browse/UIMA-2350%0A    // These change depending on the element which is the parent of the parent of this element%0A    String grandParentName = %22%22;%0A    Node p = aElement.getParentNode();%0A    if (p instanceof Element) %7B%0A      Node gp = p.getParentNode();%0A      if (gp instanceof Element) %7B%0A        grandParentName = ((Element) gp).getTagName();%0A      %7D%0A    %7D%0A    setModifiesCas(grandParentName.equals(%22casConsumerDescription%22) ? false : true);%0A    setOutputsNewCASes(grandParentName.equals(%22collectionReaderDescription%22) ? true : false);%0A    setMultipleDeploymentAllowed(grandParentName.equals(%22collectionReaderDescription%22) %7C%7C%0A                                 grandParentName.equals(%22casConsumerDescription%22) ? false : true);   %0A    super.buildFromXMLElement(aElement, aParser, aOptions);%0A  %7D%0A%7D%0A
 %0A

make operational properties creation from xml have proper defaults