public final class RelationshipsPart extends JaxbXmlPart<Relationships>
Modifier and Type | Class and Description |
---|---|
static class |
RelationshipsPart.AddPartBehaviour |
jaxbElement, jc, MAX_BYTES_Unmarshal_Error
contentType, partName, relationships
Constructor and Description |
---|
RelationshipsPart()
You probably don't want this one (though it is useful for reflection).
|
RelationshipsPart(Base sourceP)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Relationship |
addPart(Part part,
RelationshipsPart.AddPartBehaviour mode,
ContentTypeManager ctm)
Add a newly created part, a relationship and the content type.
|
Relationship |
addPart(Part part,
RelationshipsPart.AddPartBehaviour mode,
ContentTypeManager ctm,
String relId)
Add a newly created part, a relationship and the content type.
|
boolean |
addRelationship(Relationship rel)
Add the specified relationship to the collection.
|
static RelationshipsPart |
createPackageRels() |
static RelationshipsPart |
createRelationshipsPartForPart(Base sourcePart) |
List<Relationship> |
differingContent(RelationshipsPart otherRP)
Identify rels common to both parts, but where rels have different
content.
|
String |
getNextId() |
Part |
getPart(Relationship r) |
Part |
getPart(String id)
Gets a loaded Part by its id
|
PartName |
getPartName() |
Relationship |
getRel(PartName partName)
Is partname a target of any of these rels?
|
Relationship |
getRelationshipByID(String id)
Retrieves a package relationship based on its id.
|
static Relationship |
getRelationshipByTarget(RelationshipsPart rp,
String relativeTarget) |
Relationship |
getRelationshipByType(String type)
Get the first rel with specified relationship type
(see Namespaces for pre-defined constants)
|
Relationships |
getRelationships() |
List<Relationship> |
getRelationshipsByType(String type) |
Base |
getSourceP() |
URI |
getSourceURI() |
static String |
inferSourcePartName(String relationshipsPartName)
Infer the source part's name from this rels part name.
|
void |
init() |
boolean |
isATarget(PartName partName)
Deprecated.
|
boolean |
isPackageRelationshipPart()
This Relationship Part is the package relationship part
if its source is the Package.
|
boolean |
isRelIdOccupied(String relId) |
boolean |
isTarget(PartName partName,
Relationship rel)
Is partName the target of the specified rel?
|
void |
loadPart(Part part,
Relationship sourceRelationship)
Loads a pre-existing target part into the package
(but does not load its contents as such; that is
done elsewhere).
|
void |
marshal(Node node)
Marshal the content tree rooted at jaxbElement into a DOM tree.
|
void |
marshal(OutputStream os)
Marshal the content tree rooted at jaxbElement into an output
stream, using org.docx4j.jaxb.NamespacePrefixMapper.
|
List<PartName> |
removePart(PartName partName)
Remove a part from this package, including its relationships
part and all target parts.
|
List<PartName> |
removeParts()
Remove all parts from this relationships
part
|
void |
removeRelationship(PartName partName) |
void |
removeRelationship(Relationship rel)
Remove a relationship by its reference.
|
void |
removeRelationshipsByType(String type)
Remove relationships by type (eg Namespaces.PRESENTATIONML_SLIDE_LAYOUT)
|
void |
resetIdAllocator()
Assumes relationship ids are all of the form
'rIdn' where n is a positive integer.
|
void |
setRelationships(Relationships jaxbElement) |
void |
setSourceP(Base sourcePart) |
int |
size()
Get the number of relationships in the collection.
|
List<Relationship> |
uniqueToOther(RelationshipsPart otherRP)
Identify the rels in this relationships part which aren't
in the other
|
List<Relationship> |
uniqueToThis(RelationshipsPart otherRP)
Identify the rels in this relationships part which aren't
in the other
|
Relationships |
unmarshal(Element el) |
Relationships |
unmarshal(InputStream is)
Unmarshal XML data from the specified InputStream and return the
resulting content tree.
|
addMcChoiceNamespace, getContents, getJAXBContext, getJaxbElement, getMcChoiceNamespaces, getMceIgnorable, getXML, isContentEqual, isUnmarshalled, marshal, marshal, pipe, pipe, pipe, setContents, setJAXBContext, setJaxbElement, setJaxbElement, setMceIgnorable, transform, variableReplace
getContentLengthAsLoaded, getOwningRelationshipPart, getPackage, getRelationshipType, getSourceRelationship, getSourceRelationships, getVersion, remove, rename, setContentLengthAsLoaded, setOwningRelationshipPart, setPackage, setPartShortcut, setRelationshipType, setSourceRelationship, setVersion
addTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getRelationshipsPart, getRelationshipsPart, getUserData, reset, setContentType, setPartName, setRelationships, setUserData
public RelationshipsPart(Base sourceP) throws InvalidFormatException
sourceP
- Source part for these relationshipsInvalidFormatException
- If the specified URI is not valid.public RelationshipsPart() throws InvalidFormatException
InvalidFormatException
public static RelationshipsPart createPackageRels() throws InvalidFormatException
InvalidFormatException
public void init()
public PartName getPartName()
getPartName
in class Base
public static RelationshipsPart createRelationshipsPartForPart(Base sourcePart)
public Relationships getRelationships()
public void setRelationships(Relationships jaxbElement)
public Base getSourceP()
public void setSourceP(Base sourcePart)
public URI getSourceURI()
public boolean isPackageRelationshipPart()
public Relationship getRelationshipByID(String id)
id
- ID of the package relationship to retrieve.public Relationship getRelationshipByType(String type)
type
- public List<Relationship> getRelationshipsByType(String type)
type
- public Part getPart(Relationship r)
public String getNextId()
public boolean isRelIdOccupied(String relId)
public void resetIdAllocator()
public void loadPart(Part part, Relationship sourceRelationship)
part
- The part to add.public Relationship addPart(Part part, RelationshipsPart.AddPartBehaviour mode, ContentTypeManager ctm) throws InvalidFormatException
part
- The part to add.overwriteExistingTarget
- Whether to replace any part with the same targetctm
- Content type managerInvalidFormatException
public Relationship addPart(Part part, RelationshipsPart.AddPartBehaviour mode, ContentTypeManager ctm, String relId) throws InvalidFormatException
part
- The part to add.overwriteExistingTarget
- Whether to replace any part with the same targetctm
- Content type managerrelId
- the relId we wish to use (provided it is not in use)InvalidFormatException
public boolean addRelationship(Relationship rel) throws InvalidOperationException
rel
- The relationship to add.InvalidOperationException
public List<PartName> removePart(PartName partName)
partName
- The part name of the part to remove.@Deprecated public boolean isATarget(PartName partName)
getRel
public Relationship getRel(PartName partName)
partName
- public boolean isTarget(PartName partName, Relationship rel)
partName
- rel
- public void removeRelationship(Relationship rel)
rel
- The relationship to delete.public void removeRelationship(PartName partName)
public void removeRelationshipsByType(String type)
type
- public int size()
public Relationships unmarshal(InputStream is) throws JAXBException
Implements Unmarshal Global Root Element.
unmarshal
in class JaxbXmlPart<Relationships>
is
- the InputStream to unmarshal XML data fromJAXBException
- If any unexpected errors occur while unmarshallingpublic Relationships unmarshal(Element el) throws JAXBException
unmarshal
in class JaxbXmlPart<Relationships>
JAXBException
public void marshal(Node node) throws JAXBException
JaxbXmlPart
marshal
in class JaxbXmlPart<Relationships>
node
- DOM nodes will be added as children of this node.
This parameter must be a Node that accepts children
(Document
,
DocumentFragment
, or
Element
)JAXBException
- If any unexpected problem occurs during the marshalling.public void marshal(OutputStream os) throws JAXBException
JaxbXmlPart
marshal
in class JaxbXmlPart<Relationships>
os
- XML will be added to this stream.JAXBException
- If any unexpected problem occurs during the marshalling.public List<Relationship> uniqueToThis(RelationshipsPart otherRP)
otherRP
- the other RelationshipsPartpublic List<Relationship> uniqueToOther(RelationshipsPart otherRP)
otherRP
- the other RelationshipsPartpublic List<Relationship> differingContent(RelationshipsPart otherRP) throws Docx4JException
otherRP
- Docx4JException
public static Relationship getRelationshipByTarget(RelationshipsPart rp, String relativeTarget)
Copyright © 2007-2019. All Rights Reserved.