Logo Search packages:      
Sourcecode: uimaj version File versions  Download package

void org::apache::uima::cas::impl::XmiCasSerializer::XmiCasDocSerializer::serialize (  ) throws SAXException [inline, private]

Starts serialization

Definition at line 231 of file XmiCasSerializer.java.

References org::apache::uima::cas::CAS::SOFA_INDEX_NAME.

Referenced by org::apache::uima::cas::impl::XmiCasSerializer::serialize().

                                                 {
      // populate nsUriToPrefixMap and xmiTypeNames structures based on CAS 
      // type system, and out of typesytem data if any
      initTypeAndNamespaceMappings();

      int iElementCount = 1; // start at 1 to account for special NULL object

      enqueueIncoming(); //make sure we enqueue every FS that was deserialized into this CAS
      enqueueIndexed();
      enqueueNonsharedMultivaluedFS();
      enqueueFeaturesOfIndexed();
      iElementCount += indexedFSs.size();
      iElementCount += queue.size();

      FSIndex<FeatureStructure> sofaIndex = cas.getBaseCAS().indexRepository.getIndex(CAS.SOFA_INDEX_NAME);
      if (!isDelta) {
      iElementCount += (sofaIndex.size()); // one View element per sofa
      if (this.sharedData != null) {
        iElementCount += this.sharedData.getOutOfTypeSystemElements().size();
      }
      } else {
      int numViews = cas.getBaseSofaCount();
        for (int sofaNum = 1; sofaNum <= numViews; sofaNum++) {
            FSIndexRepositoryImpl loopIR = (FSIndexRepositoryImpl) cas.getBaseCAS()
                    .getSofaIndexRepository(sofaNum);
            if (loopIR != null && loopIR.isModified()) {
                  iElementCount++;
            }
         }
      }
      workAttrs.clear();
      computeNamespaceDeclarationAttrs(workAttrs);
      workAttrs.addAttribute(XMI_NS_URI, XMI_VERSION_LOCAL_NAME, XMI_VERSION_QNAME, "CDATA",
              XMI_VERSION_VALUE);

      startElement(XMI_TAG, workAttrs, iElementCount);
      writeNullObject(); // encodes 1 element
      encodeIndexed(); // encodes indexedFSs.size() element
      encodeQueued(); // encodes queue.size() elements
      if (!isDelta) {
      serializeOutOfTypeSystemElements(); //encodes sharedData.getOutOfTypeSystemElements().size() elements
      }
      writeViews(); // encodes cas.sofaCount + 1 elements
      endElement(XMI_TAG);
    }

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index