java.lang.Object
com.nomagic.magicreport.engine.ooxml.child.docx.DocumentInfo

@OpenApiAll public class DocumentInfo extends Object
Handle document information.
The DOCX template contains files in zip.
For example:
- [Content_Type].xml
- word/document.xml
- word/_rels/document.xml.rels
- word/styles.xml
- etc. When it include content from another template, the related file should be included.
  • Field Details

    • reservedRelationshipType

      public static List<String> reservedRelationshipType
      List of Type attribute value in word/_rels/document.xml.rels that should be at most one in the file
    • reservedContentType

      public static List<String> reservedContentType
      List of ContentType attribute value in [Content_Type].xml that should be at most one can have the value in the file
  • Constructor Details

    • DocumentInfo

      public DocumentInfo(String id, DocumentInfo mainDocInfo, String filePath)
      Constructor
      Parameters:
      id - document id
      mainDocInfo - main document info
      filePath - file path of document
  • Method Details

    • getId

      public String getId()
      Get document id
      Returns:
      document id
    • setId

      public void setId(String id)
      Set document id
      Parameters:
      id - document id
    • getFile

      public File getFile()
      Get document file
      Returns:
      document file
    • getFilePath

      public String getFilePath()
      Get path of document
      Returns:
      path of document
    • setFilePath

      public void setFilePath(String filePath)
      Set path of document
      Parameters:
      filePath - path of document
    • getMainDocInfo

      public DocumentInfo getMainDocInfo()
      Get main document
      Returns:
      main document
    • setMainDocInfo

      public void setMainDocInfo(DocumentInfo mainDocInfo)
      set main document
      Parameters:
      mainDocInfo - document
    • getDocumentBuffer

      public StringBuilder getDocumentBuffer()
      Get documentation content.
      Returns:
      documentation content
    • setDocumentBuffer

      public void setDocumentBuffer(StringBuilder documentBuffer)
      Set documentation content.
      Parameters:
      documentBuffer - documentation content
    • getDocumentNameSpaceMap

      public Map<String,String> getDocumentNameSpaceMap()
    • setDocumentNameSpaceMap

      public void setDocumentNameSpaceMap(Map<String,String> documentNameSpaceMap)
    • updateDocumentNameSpaceMap

      public void updateDocumentNameSpaceMap(String key, String value)
    • getContentTypes

      public Set<com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType> getContentTypes()
      Get set of DocumentContentType. DocumentContentType contains key and value of each attribute in [Content_Type].xml
      Returns:
      list of content type objects
    • setContentTypes

      public void setContentTypes(Set<com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType> contentTypes)
      Set set of DocumentContentType.
      Parameters:
      contentTypes - set of DocumentContentType
    • addContentTypes

      public void addContentTypes(com.nomagic.magicreport.engine.ooxml.child.docx.DocumentContentType contentTypes)
      Add a DocumentContentType object to set of DocumentContentType.
      Parameters:
      contentTypes - content type object
    • getContentTypeNameSpaceMap

      public Map<String,String> getContentTypeNameSpaceMap()
    • setContentTypeNameSpaceMap

      public void setContentTypeNameSpaceMap(Map<String,String> contentTypeNameSpaceMap)
    • updateContentTypeNameSpaceMap

      public void updateContentTypeNameSpaceMap(String key, String value)
    • getRelationshipMap

      public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> getRelationshipMap()
      Get map of relationship.
      {relationship id, DocumentRelationship}
      Returns:
      map of relationship
    • setRelationshipMap

      public void setRelationshipMap(Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> relationshipMap)
      Set map of relationship.
      Parameters:
      relationshipMap - map of relationship
    • updateRelationshipMap

      public void updateRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship relationship)
      Update map of relationship.
      Parameters:
      id - relationship id
      relationship - DocumentRelationship object
    • getStaticRelationshipMap

      public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> getStaticRelationshipMap()
      Get map of static relationship.
      {static relationship id, DocumentRelationship}
      Returns:
      map of static relationship id and related DocumentRelationship object
    • setStaticRelationshipMap

      public void setStaticRelationshipMap(Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship> staticRelationshipMap)
      Set map of static relationship.
      Parameters:
      staticRelationshipMap - map of static relationship
    • updateStaticRelationshipMap

      public void updateStaticRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentRelationship documentRelationship)
      Update map of static relationship.
      Parameters:
      id - static relationship id
      documentRelationship - DocumentRelationship object
    • getDynamicRelationshipMap

      public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship> getDynamicRelationshipMap()
      Get map of dynamic relationship.
      {dynamic relationship id, DocumentRelationship}
      Returns:
      map of dynamic relationship
    • setDynamicRelationshipMap

      public void setDynamicRelationshipMap(Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship> dynamicRelationshipMap)
      Set map of dynamic relationship.
      Parameters:
      dynamicRelationshipMap - map of dynamic relationship
    • updateDynamicRelationshipMap

      public void updateDynamicRelationshipMap(String id, com.nomagic.magicreport.engine.ooxml.child.docx.DynamicDocumentRelationship documentRelationship)
      Update map of dynamic relationship.
      Parameters:
      id - dynamic relationship id
      documentRelationship - DocumentRelationship object
    • getChildPathAndIDMap

      public Map<String,String> getChildPathAndIDMap()
      Get map of child path and child id.
      Returns:
      map of child path and child id
    • setChildPathAndIDMap

      public void setChildPathAndIDMap(Map<String,String> childPathAndIDMap)
      Set map of child path and child id.
      Parameters:
      childPathAndIDMap - map of child path and child id
    • updateChildPathAndIDMap

      public void updateChildPathAndIDMap(String childPath, String childId)
      Update map of child path and child id.
      When the engine found child template, child id will be created.
      The child template file path and child id will be added to this map.

      For example:
      #includeSection("child.docx", "A")
      child path = "child.docx"
      child id = "sectionChild1"
      The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
      Parameters:
      childPath - child path
      childId - child id
    • getChildDocumentInfoMap

      public Map<String,DocumentInfo> getChildDocumentInfoMap()
      Get map of child id and child DocumentInfo.
      Returns:
      map of child id and DocumentInfo of child
    • setChildDocumentInfoMap

      public void setChildDocumentInfoMap(Map<String,DocumentInfo> childDocumentInfoMap)
      Set map of child id and child DocumentInfo.
      Parameters:
      childDocumentInfoMap - map of child id and DocumentInfo of child
    • upateSectionChildMap

      public void upateSectionChildMap(String childid, DocumentInfo childDocumentInfo)
      Update map of child id and child DocumentInfo.
      When the engine found child template, child DocumentInfo will be created.
      The child id and child DocumentInfo will be added to this map of Main DocumentInfo.

      For example:
      #includeSection("child.docx", "A")
      child path = "child.docx"
      child id = "sectionChild1"
      The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
      The child DocumentInfo of "child.docx" template will be created.
      The pair of {"sectionChild1", childDocumentInfo} will be added to childDocumentInfoMap of Main DocumentInfo.
      Parameters:
      childid - child template id
      childDocumentInfo - child DocumentInfo
    • getSectionInfoMap

      public Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection> getSectionInfoMap()
      Get map of section id and DocumentSection.
      Returns:
      map of section id and DocumentSection.
    • setSectionInfoMap

      public void setSectionInfoMap(Map<String,com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection> sectionInfoMap)
      Set map of section id and DocumentSection.
      Parameters:
      sectionInfoMap - map of section id and DocumentSection.
    • updateSectionInfoMap

      public void updateSectionInfoMap(String sectionName, com.nomagic.magicreport.engine.ooxml.child.docx.DocumentSection documentSection)
      Update map of section id and DocumentSection.
      When the engine found section of child document, DocumentSection will be created.
      The sectionName and DocumentSection will be added to this map of child DocumentInfo.

      For example:
      #includeSection("child.docx", "A")
      child path = "child.docx"
      child id = "sectionChild1"
      The pair of {"child.docx", "sectionChild1"} will be added to childPathAndIDMap of Main DocumentInfo.
      The child DocumentInfo of "child.docx" template will be created.
      The pair of {"sectionChild1", childDocumentInfo} will be added to childDocumentInfoMap of Main DocumentInfo.
      The DocumentSection of section A will be created.
      The pair of {"A", aDocumentSection} will be added to sectionInfoMap of childDocumentInfo.
      Parameters:
      sectionName - section name
      documentSection - DocumentSection
    • getRelationshipContent

      public StringBuilder getRelationshipContent()
      Get content of word/_rels/document.xml.rels.
      Returns:
      content of word/_rels/document.xml.rels
    • setRelationshipContent

      public void setRelationshipContent(StringBuilder relationshipContent)
      Set content of word/_rels/document.xml.rels.
      Parameters:
      relationshipContent - content of word/_rels/document.xml.rels
    • getContentTypeContent

      public StringBuilder getContentTypeContent()
      Get content of [Content_Type].xml
      Returns:
      content of [Content_Type].xml
    • setContentTypeContent

      public void setContentTypeContent(StringBuilder contentTypeContent)
      Set content of [Content_Type].xml
      Parameters:
      contentTypeContent - content of [Content_Type].xml
    • getStyleContent

      public StringBuilder getStyleContent()
      Get content of word/styles.xml
      Returns:
      content of word/styles.xml
    • setStyleContent

      public void setStyleContent(StringBuilder styleContent)
      Set content of word/styles.xml
      Parameters:
      styleContent - content of word/styles.xml
    • getAbstractNumberingMap

      public Map<String,String> getAbstractNumberingMap()
      Get map of old id and new id to handle w:abstractNumId.
      Returns:
      map of abstractNumId
    • setAbstractNumberingMap

      public void setAbstractNumberingMap(Map<String,String> abstractNumberingMap)
      Set map of old id and new id from w:abstractNumId in numbering.xml. The w:abstractNumId of child template may duplicate to main template. So, the value should be updated
      Parameters:
      abstractNumberingMap - map of abstractNumId
    • updateAbstractNumberingMap

      public void updateAbstractNumberingMap(String oldId, String newId)
      Add or update old id and new id from w:abstractNumId
      Parameters:
      oldId - original value id of w:abstractNumId
      newId - new value id of w:abstractNumId
    • getNumberingMap

      public Map<String,String> getNumberingMap()
      Get map of old id and new id to handle w:numId.
      Returns:
      map of w:numId
    • setNumberingMap

      public void setNumberingMap(Map<String,String> numberingMap)
      Set map of old id and new id from w:numId in numbering.xml. The w:numId of child template may duplicate to main template. So, the value should be updated
      Parameters:
      numberingMap - map of numId
    • updateNumberingMap

      public void updateNumberingMap(String oldId, String newId)
      Add or update old id and new id from w:numId.
      Parameters:
      oldId - original value id of w:numId
      newId - new value id of w:numId
    • getNumberingContent

      public StringBuilder getNumberingContent()
      Get content of word/numbering.xml
      Returns:
      content of word/numbering.xml
    • setNumberingContent

      public void setNumberingContent(StringBuilder numberingContent)
      Set content of word/numbering.xml
      Parameters:
      numberingContent - content of word/numbering.xml
    • getChildStyleIdMap

      public Map<String,String> getChildStyleIdMap()
    • setChildStyleIdMap

      public void setChildStyleIdMap(Map<String,String> childStyleIdMap)
    • updateChildStyleIdMap

      public void updateChildStyleIdMap(String oldStyleId, String newStyleId)
    • isUpdateChildStyleAndNumbering

      public boolean isUpdateChildStyleAndNumbering()
      Check if child style has been updated or not. This value help us to avoid updating same style.
      Returns:
      true if child style has already been updated.
    • setUpdateChildStyleAndNumbering

      public void setUpdateChildStyleAndNumbering(boolean updateChildStyleAndNumbering)