| package org.dom4j.persistence; | ||
| import org.dom4j.Document; | ||
| import org.dom4j.Node; | ||
| /* | ||
| * @author <a href="mailto:toby-wan-kenobi@gmx.de">Tobias Rademacher</a> | ||
| * @version 1.0 | ||
| */ | ||
| public class DocumentMemento implements Memento { | ||
| protected String systemId; | ||
| protected MarshallingStrategy marshaller; | ||
| 0x | public DocumentMemento(String aSystemId, MarshallingContext context) throws Exception { | |
| 0x | this.systemId = aSystemId; | |
| 0x | this.marshaller = DocumentMarshalling.getInstance(context); | |
| 0x | } | |
| public Node getState() { | ||
| 0x | return this.marshaller.unmarshal(this.systemId); | |
| } | ||
| public void setState(Node node) throws Exception { | ||
| 0/4 0x | if (this.systemId != null || !this.systemId.equals("")) | |
| 0x | this.marshaller.marshal(this.systemId, node); | |
| 0x | } | |
| public void setState(Document aState) { | ||
| 0x | this.setState(aState); | |
| 0x | } | |
| public MarshallingStrategy getMarshaller() { | ||
| 0x | return this.marshaller; | |
| } | ||
| public String getSystemId() { | ||
| 0x | return this.systemId; | |
| } | ||
| } |