Changeset 1670


Ignore:
Timestamp:
10/01/11 07:46:20 (8 months ago)
Author:
jharrop
Message:

List<Relationship> sourceRelationships

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/Part.java

    r1649 r1670  
    2323 
    2424import java.net.URI; 
     25import java.util.ArrayList; 
     26import java.util.List; 
    2527 
    2628import org.docx4j.openpackaging.Base; 
     
    5961        protected OpcPackage pack; 
    6062         
    61         private Relationship sourceRelationship; 
     63        private List<Relationship> sourceRelationships = new ArrayList<Relationship>(); 
     64 
     65    /** 
     66     * @since 2.7.1 
     67     */ 
     68        public List<Relationship> getSourceRelationships() { 
     69                return sourceRelationships; 
     70        } 
     71         
    6272        /** 
    6373         * @return the sourceRelationship 
    6474         */ 
     75        @Deprecated 
    6576        public Relationship getSourceRelationship() { 
    66                 return sourceRelationship; 
     77                return sourceRelationships.get(0); 
    6778        } 
    6879        /** 
     
    7283         * @param sourceRelationship the sourceRelationship to set 
    7384         */ 
     85        @Deprecated 
    7486        public void setSourceRelationship(Relationship sourceRelationship) { 
    75                 this.sourceRelationship = sourceRelationship; 
     87                sourceRelationships.clear(); 
     88                sourceRelationships.add(sourceRelationship); 
    7689        } 
    7790         
     
    87100                        // except for a part which isn't yet connected to 
    88101                        // a package via a relationship. 
    89                         return this.sourceRelationship.getType(); 
     102                        return this.sourceRelationships.get(0).getType(); 
     103                        // It ought to be the same in each source rel 
    90104                } else { 
    91105                        return relationshipType; 
     
    217231                        result = result.substring(1); 
    218232                } 
    219                 log.debug("Result " + result);           
    220                 sourceRelationship.setTarget(result); 
     233                log.debug("Result " + result); 
     234                for (Relationship rel : sourceRelationships) { 
     235                        rel.setTarget(result); 
     236                } 
    221237 
    222238                // Set the new part name 
Note: See TracChangeset for help on using the changeset viewer.