aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src/main/java
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2024-04-19 10:59:30 +0000
committerPJ Fanning <fanningpj@apache.org>2024-04-19 10:59:30 +0000
commit6948f9031dccd3a5e5ddefb83b3e08d889f0b008 (patch)
treeec02d410a5b7f1cd036ddb517d3ebc911e71e7f1 /poi-ooxml/src/main/java
parentff7f1ea72112a58180465a9b342eeb09cee8096e (diff)
downloadpoi-6948f9031dccd3a5e5ddefb83b3e08d889f0b008.tar.gz
poi-6948f9031dccd3a5e5ddefb83b3e08d889f0b008.zip
add javadoc
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1917140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src/main/java')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLDocumentPart.java83
1 files changed, 56 insertions, 27 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLDocumentPart.java b/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
index b80309be9f..570f371258 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
@@ -740,6 +740,62 @@ public class POIXMLDocumentPart {
}
/**
+ * Remove the reference relationship to the specified part in this package.
+ *
+ * @param relId the part which is to be removed
+ * @return true, if the relation was removed
+ * @since POI 5.2.6
+ */
+ public boolean removeReferenceRelationship(String relId) {
+ ReferenceRelationship existing = referenceRelationships.remove(relId);
+ if (existing != null) {
+ packagePart.removeRelationship(relId);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the reference relationship with the specified id.
+ *
+ * @param relId the relation id
+ * @return the reference relationship or {@code null} if not found
+ * @since POI 5.2.6
+ */
+ public ReferenceRelationship getReferenceRelationship(String relId) {
+ return referenceRelationships.get(relId);
+ }
+
+ /**
+ * Create a new reference relationship for this POIXMLDocumentPart.
+ *
+ * @param uri the URI of the target part
+ * @param isExternal true, if the target is an external resource
+ * @param relId the relation id
+ * @return the created reference relationship
+ * @since POI 5.2.6
+ */
+ public HyperlinkRelationship createHyperlink(URI uri, boolean isExternal, String relId) {
+ PackageRelationship pr = packagePart.addRelationship(uri, isExternal ? TargetMode.EXTERNAL : TargetMode.INTERNAL,
+ PackageRelationshipTypes.HYPERLINK_PART, relId);
+ HyperlinkRelationship hyperlink = new HyperlinkRelationship(this, uri, isExternal, relId);
+ referenceRelationships.put(relId, hyperlink);
+ return hyperlink;
+ }
+
+ /**
+ * Returns an unmodifiable list of reference relationships for this POIXMLDocumentPart.
+ *
+ * @return reference relationships
+ * @since POI 5.2.6
+ */
+ public List<ReferenceRelationship> getReferenceRelationships() {
+ List<ReferenceRelationship> list = new ArrayList<>(referenceRelationships.values());
+ return Collections.unmodifiableList(list);
+ }
+
+ /**
* Retrieves the core document part
*
* Since POI 4.1.2 - pkg is closed if this method throws an exception
@@ -772,31 +828,4 @@ public class POIXMLDocumentPart {
throw new POIXMLException("OOXML file structure broken/invalid", e);
}
}
-
- public boolean removeReferenceRelationship(String relId) {
- ReferenceRelationship existing = referenceRelationships.remove(relId);
- if (existing != null) {
- packagePart.removeRelationship(relId);
- return true;
- }
-
- return false;
- }
-
- public ReferenceRelationship getReferenceRelationship(String relId) {
- return referenceRelationships.get(relId);
- }
-
- public HyperlinkRelationship createHyperlink(URI uri, boolean isExternal, String relId) {
- PackageRelationship pr = packagePart.addRelationship(uri, isExternal ? TargetMode.EXTERNAL : TargetMode.INTERNAL,
- PackageRelationshipTypes.HYPERLINK_PART, relId);
- HyperlinkRelationship hyperlink = new HyperlinkRelationship(this, uri, isExternal, relId);
- referenceRelationships.put(relId, hyperlink);
- return hyperlink;
- }
-
- public List<ReferenceRelationship> getReferenceRelationships() {
- List<ReferenceRelationship> list = new ArrayList<>(referenceRelationships.values());
- return Collections.unmodifiableList(list);
- }
}