private DigitalObjectDocument.DigitalObject createDigitalObject(DigitalObjectDocument dof) {
   DigitalObjectDocument.DigitalObject dobj = dof.addNewDigitalObject();
   dobj.setVERSION(DigitalObjectType.VERSION.X_1_1);
   if (pid != null) {
     dobj.setPID(pid);
   }
   return dobj;
 }
  private void addDCDatastream(DigitalObjectDocument.DigitalObject dobj) {
    DatastreamType ds = dobj.addNewDatastream();
    ds.setID("DC");
    ds.setCONTROLGROUP(DatastreamType.CONTROLGROUP.X);
    ds.setSTATE(StateType.A);

    DatastreamVersionType dsv = ds.addNewDatastreamVersion();
    dsv.setID("DC.0");
    dsv.setFORMATURI("http://www.openarchives.org/OAI/2.0/oai_dc/");
    dsv.setMIMETYPE("text/xml");
    dsv.setLABEL("Dublin Core Record for this object");

    XmlContentType content = dsv.addNewXmlContent();
    DcDocument dcDocument = getDcDocument();
    content.set(dcDocument);
  }
  private void addRELSEXTDatastream(DigitalObjectDocument.DigitalObject dobj) {
    DatastreamType datastream = dobj.addNewDatastream();
    datastream.setID("RELS-EXT");
    datastream.setSTATE(StateType.A);
    datastream.setCONTROLGROUP(DatastreamType.CONTROLGROUP.X);

    DatastreamVersionType version = datastream.addNewDatastreamVersion();
    version.setID("RELS-EXT.0");
    version.setMIMETYPE("application/rdf+xml");
    version.setFORMATURI("info:fedora/fedora-system:FedoraRELSExt-1.0");
    version.setLABEL("RDF Statements about this object");

    XmlContentType content = version.addNewXmlContent();
    RDFDocument rdfDocument = getRDFDescription();
    content.set(rdfDocument);
  }
 private void addFedoraObjectProperties(DigitalObjectDocument.DigitalObject dobj) {
   ObjectPropertiesType pt = dobj.addNewObjectProperties();
   {
     PropertyType p = pt.addNewProperty();
     p.setNAME(PropertyType.NAME.INFO_FEDORA_FEDORA_SYSTEM_DEF_MODEL_STATE);
     p.setVALUE(state);
   }
   {
     PropertyType p = pt.addNewProperty();
     p.setNAME(PropertyType.NAME.INFO_FEDORA_FEDORA_SYSTEM_DEF_MODEL_LABEL);
     p.setVALUE(label);
   }
   {
     PropertyType p = pt.addNewProperty();
     p.setNAME(PropertyType.NAME.INFO_FEDORA_FEDORA_SYSTEM_DEF_MODEL_OWNER_ID);
     p.setVALUE(ownerId);
   }
 }
  private void addQucosaXMLContentDatastream(DigitalObjectDocument.DigitalObject dobj)
      throws ParserConfigurationException {
    DatastreamType ds = dobj.addNewDatastream();
    ds.setID("QUCOSA-XML");
    ds.setCONTROLGROUP(DatastreamType.CONTROLGROUP.X);
    ds.setSTATE(StateType.A);

    DatastreamVersionType dsv = ds.addNewDatastreamVersion();
    dsv.setID("QUCOSA-XML.0");
    dsv.setMIMETYPE("text/xml");
    dsv.setLABEL("Qucosa XML Record for this Object (Opus4-XMLv2)");

    XmlContentType content = dsv.addNewXmlContent();

    // Workaround for https://issues.apache.org/jira/browse/XMLBEANS-100
    // XMLBeans does not work with jdk1.6 as calls made to methods within XObj.java
    // return with a runtime: "java.lang.RuntimeException: DOM Level 3 Not implemented"
    Node childNode =
        content
            .getDomNode()
            .getOwnerDocument()
            .importNode(qucosaXmlDocument.getDocumentElement(), true);
    content.getDomNode().appendChild(childNode);
  }