Examples of NodeRecord


Examples of de.fu_berlin.inf.dpp.whiteboard.sxe.records.NodeRecord

  @Override
  public IRecord getIRecord(DocumentRecord document)
      throws MissingRecordException {
    NodeType nodeType = NodeType.fromString(getString(RecordEntry.TYPE));

    NodeRecord record;
    String tmp, rid;

    ISXERecordFactory factory = document.getController().getRecordFactory();

    String parentRid = getString(RecordEntry.PARENT);
    if (parentRid == null) {
      if (!document.isEmpty())
        throw new MalformedRecordException(
            "Received non-root record without parent: "
                + getString(RecordEntry.RID));
    }

    String name = getString(RecordEntry.NAME);
    String ns = getString(RecordEntry.NS);

    switch (nodeType) {
    case ATTR:
      String chdata = getString(RecordEntry.CHDATA);
      AttributeRecord attribute = factory.createAttributeRecord(document,
          ns, name, chdata);
      if (chdata != null)
        attribute.setChdata(chdata);
      record = attribute;
      break;
    case ELEMENT:
      if (parentRid == null)
        record = factory.createRoot(document);
      else
        record = factory.createElementRecord(document, ns, name);
      break;
    default:
      throw new RuntimeException("Unknown node type " + getRecordType());
    }

    rid = getString(RecordEntry.RID);
    record.setRid(rid);

    tmp = getString(RecordEntry.VERSION);
    if (tmp != null)
      record.setVersion(Integer.valueOf(tmp));
    else
      record.setVersion(0);

    if (parentRid != null)
      record.setParent(document.getElementRecordById(parentRid));

    Float pw = getFloat(RecordEntry.PRIMARY_WEIGHT);
    if (pw == null)
      pw = 0f;
    record.setPrimaryWeight(pw);

    tmp = getString(RecordEntry.NAME);
    if (tmp != null)
      record.setName(tmp);

    tmp = getString(RecordEntry.NS);
    if (tmp != null)
      record.setNs(tmp);

    // if no creator specified set sender as creator
    // TODO maybe creator tag is obsolete
    tmp = getString(RecordEntry.CREATOR);
    if (tmp != null)
      record.setCreator(tmp);
    else
      record.setCreator(getSender());

    tmp = getString(RecordEntry.LAST_MODIFIED_BY);
    if (tmp != null)
      record.setLastModifiedBy(tmp);

    record.setSender(getSender());

    return record;
  }
View Full Code Here

Examples of de.fu_berlin.inf.dpp.whiteboard.sxe.records.NodeRecord

    tmp = getString(RecordEntry.TARGET);
    if (tmp == null)
      throw new MalformedRecordException("target rid missing");

    NodeRecord target = document.getRecordById(tmp);
    int version = getInt(RecordEntry.VERSION);

    ElementRecord parent = null;

    tmp = getString(RecordEntry.PARENT);
View Full Code Here

Examples of de.fu_berlin.inf.dpp.whiteboard.sxe.records.NodeRecord

  }

  @Override
  public boolean isAlreadyApplied(DocumentRecord document)
      throws MissingRecordException {
    NodeRecord record = document.getRecordById(getTargetRid());
    IRecord setRecord = getIRecord(document);
    return record.getSetRecords().contains(setRecord);
  }
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

                marshalRecord.setContentHandler(((SAXResult)result).getHandler());
                marshalRecord.setMarshaller(anXMLMarshaller);
                ((SDOMarshalListener)anXMLMarshaller.getMarshalListener()).setRootMarshalReocrd(marshalRecord);
                anXMLMarshaller.marshal(xmlDocument, marshalRecord);
            } else if(result instanceof DOMResult) {
                NodeRecord marshalRecord = new NodeRecord();
                marshalRecord.setDOM(((DOMResult)result).getNode());
                marshalRecord.setMarshaller(anXMLMarshaller);
                ((SDOMarshalListener)anXMLMarshaller.getMarshalListener()).setRootMarshalReocrd(marshalRecord);
                anXMLMarshaller.marshal(xmlDocument, marshalRecord);
            } else {
                StringWriter writer = new StringWriter();
                this.save(xmlDocument, writer, options);
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

            XMLDescriptor xmlDescriptor = getDescriptor(object, isXMLRoot);

            AbstractSession session = xmlContext.getSession(xmlDescriptor);
            //if this is a simple xml root, descriptor and session will be null
            if ((session == null) || !xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument()) {
                NodeRecord nodeRecord = new NodeRecord();
                nodeRecord.setMarshaller(this);
                nodeRecord.setDOM(node);

                if (!isXMLRoot) {
                    if ((null == xmlDescriptor.getDefaultRootElement()) && (node.getNodeType() == Node.ELEMENT_NODE) && (xmlDescriptor.getSchemaReference() != null) && (xmlDescriptor.getSchemaReference().getType() == XMLSchemaReference.COMPLEX_TYPE)) {
                        Attr typeAttr = ((Element) node).getAttributeNodeNS(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
                        if (typeAttr == null) {
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

                xmlRow.setMarshaller(this);
                addDescriptorNamespacesToXMLRecord(descriptor, xmlRow);
            }
            return objectToXML(object, descriptor, xmlRow, isXMLRoot);
        }
        MarshalRecord marshalRecord = new NodeRecord();
        marshalRecord.setMarshaller(this);
        marshal(object, marshalRecord, descriptor, isXMLRoot);
        return marshalRecord.getDocument();
    }
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

                return xmlRow.getDOM();
            } else {
                return doc;
            }
        }
        MarshalRecord marshalRecord = new NodeRecord();
        marshalRecord.setMarshaller(this);
        marshalRecord.getNamespaceResolver().setDOM(rootNode);
        marshal(object, marshalRecord, descriptor, isXMLRoot);
        return marshalRecord.getDocument();
    }
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

        if ((session != null) && xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument()) {
            XMLRecord xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecord(localRootName, parent, session);
            xmlRow.setMarshaller(this);
            return objectToXML(object, descriptor, xmlRow, isXMLRoot);
        }
        MarshalRecord marshalRecord = new NodeRecord(localRootName, parent);
        marshalRecord.setMarshaller(this);
        marshal(object, marshalRecord, descriptor, isXMLRoot);
        return marshalRecord.getDocument();
    }
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

    /**
     * Create a new row/record for the object builder with the given name.
     * This allows subclasses to define different record types.
     */
    public AbstractRecord createRecord(String rootName, AbstractSession session) {
        NodeRecord nRec = new NodeRecord(rootName, getNamespaceResolver());
        nRec.setSession(session);
        return nRec;
    }
View Full Code Here

Examples of org.eclipse.persistence.oxm.record.NodeRecord

    /**
     * Create a new row/record for the object builder with the given name.
     * This allows subclasses to define different record types.
     */
    public AbstractRecord createRecord(String rootName, Node parent, AbstractSession session) {
        NodeRecord nRec = new NodeRecord(rootName, getNamespaceResolver(), parent);
        nRec.setSession(session);
        return nRec;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.