예제 #1
0
 private Element createDatastreamElement(
     Element rootElement, String state, DATASTREAM_CONTROLGROUP controlGroup, DATASTREAM_ID dsId) {
   Element dataStream = rootElement.addElement(new QName("datastream", Namespaces.foxml));
   dataStream.addAttribute("VERSIONABLE", VERSIONABLE.toString());
   dataStream.addAttribute("STATE", state);
   dataStream.addAttribute("CONTROL_GROUP", controlGroup.name());
   dataStream.addAttribute("ID", dsId.getValue());
   return dataStream;
 }
예제 #2
0
 protected void appendDatastream(
     DATASTREAM_CONTROLGROUP dsCGroup,
     DATASTREAM_ID dsId,
     Element content,
     String name,
     String reference) {
   Element datastreamEl = createDatastreamElement(rootElement, "A", dsCGroup, dsId);
   String versionId = dsId.toString() + ".0";
   Element dataStreamVersion = null;
   switch (dsId) {
     case DC:
       dataStreamVersion =
           createDatastreamVersionElement(
               datastreamEl,
               FedoraNamespaces.OAI_DC_NAMESPACE_URI,
               "text/xml",
               "Dublin Core Record for this object",
               versionId);
       break;
     case BIBLIO_MODS:
       dataStreamVersion =
           createDatastreamVersionElement(
               datastreamEl,
               FedoraNamespaces.BIBILO_MODS_URI,
               "text/xml",
               "BIBLIO_MODS description of current object",
               versionId);
       break;
     case RELS_EXT:
       dataStreamVersion =
           createDatastreamVersionElement(
               datastreamEl,
               FedoraNamespaces.RELS_EXT_NAMESPACE_URI,
               "application/rdf+xml",
               "RDF Statements about this object",
               versionId);
       break;
     case IMG_FULL:
       dataStreamVersion =
           createDatastreamVersionElement(datastreamEl, null, "image/jpeg", "", versionId);
       break;
     case IMG_THUMB:
       dataStreamVersion =
           createDatastreamVersionElement(datastreamEl, null, "image/jpeg", "", versionId);
       break;
     case IMG_PREVIEW:
       dataStreamVersion =
           createDatastreamVersionElement(datastreamEl, null, "image/jpeg", "", versionId);
       break;
     case WAV:
       dataStreamVersion =
           createDatastreamVersionElement(
               datastreamEl, null, "audio/wav", "Wav version of this audio track", versionId);
       break;
     case MP3:
       dataStreamVersion =
           createDatastreamVersionElement(
               datastreamEl, null, "audio/mpeg", "Mp3 version of this audio track", versionId);
       break;
     case OGG:
       dataStreamVersion =
           createDatastreamVersionElement(
               datastreamEl,
               null,
               "audio/ogg",
               "Ogg Vorbis version of this audio track",
               versionId);
   }
   switch (dsCGroup) {
     case X:
       addXmlContent(content, dataStreamVersion);
       break;
     case E:
     case R:
       addContentLocation(name, reference, dataStreamVersion);
       break;
     default:
       throw new IllegalArgumentException("Unable to add Fedora managed content");
   }
 }