kz.greetgo.msoffice.docx.RelationshipMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of greetgo.msoffice Show documentation
Show all versions of greetgo.msoffice Show documentation
greetgo library to generate or parse MS Office files
/**
*
*/
package kz.greetgo.msoffice.docx;
import kz.greetgo.msoffice.util.UtilOffice;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
class RelationshipMap implements FilePart {
private Map relationships = new HashMap();
private final String partName;
private RelationshipMap(String partName) {
this.partName = partName;
}
static RelationshipMap createBySubjectPartName(String subjectPartName) {
return new RelationshipMap("/word/_rels/" + UtilOffice.extractBaseName(subjectPartName)
+ ".rels");
}
static RelationshipMap createWithPartName(String partName) {
return new RelationshipMap(partName);
}
@Override
public String getPartName() {
return partName;
}
public void put(Relationship r) {
relationships.put(r.getTarget(), r);
}
@Override
public void write(PrintStream out) {
out.print("\n");
out.print("");
for (Relationship r : relationships.values()) {
r.write(out);
}
out.print(" ");
}
}