public static org.fcrepo.server.types.gen.DatastreamDef convertDatastreamDefToGenDatastreamDef(org.fcrepo.server.storage.types.DatastreamDef in) { if (in == null) { return null; } org.fcrepo.server.types.gen.DatastreamDef out = new org.fcrepo.server.types.gen.DatastreamDef(); out.setID(in.dsID); out.setLabel(in.dsLabel); out.setMIMEType(in.dsMIME); return out; }
/** * Test for the existence of a given datastream in VITAL. * * @param fedora An instantiated fedora client * @param vitalPid The VITAL PID to use * @param dsPid The datastream ID on the object * @returns boolean True is found, False if not found or there are errors */ private boolean datastreamExists(FedoraClient fedora, String vitalPid, String dsPid) { try { // Some options: // * getAPIA().listDatastreams... seems best // * getAPIM().getDatastream... causes Exceptions against new IDs // * getAPIM().getDatastreams... is limited to a single state DatastreamDef[] streams = fedora.getAPIA().listDatastreams( vitalPid, null); for (DatastreamDef stream : streams) { if (stream.getID().equals(dsPid)) { return true; } } } catch (Exception ex) { log.error("API Query error: ", ex); } return false; }
/** * Create an instance of {@link DatastreamDef } * */ public DatastreamDef createDatastreamDef() { return new DatastreamDef(); }
@Test public void testFCREPO238() throws Exception { String pid = apim.ingest(TypeUtility.convertBytesToDataHandler(IOUtils.toByteArray(new FileInputStream(RESOURCEBASE + "/" + FOXMLPATH))), FOXML1_1.uri, "testing fcrepo 238"); org.fcrepo.server.types.gen.ObjectProfile profile = apia.getObjectProfile(pid, null); Date objDate = dateFormat.parse(profile.getObjLastModDate()); for (org.fcrepo.server.types.gen.DatastreamDef dd : apia.listDatastreams(pid, null)) { org.fcrepo.server.types.gen.Datastream ds = apim.getDatastream(pid, dd.getID(), null); Date dsDate = dateFormat.parse(ds.getCreateDate()); System.out.print("object:" + dateFormat.format(objDate) + ", "); System.out.println("datastream: " + dateFormat.format(dsDate)); Assert.assertTrue("object last modificaton date is before datastream's create date. check FCREPO-238", objDate.compareTo(dsDate) > -1); } apim.purgeObject(pid, "removing testobject", true); } }
/** * Create an instance of {@link DatastreamDef } * */ public DatastreamDef createDatastreamDef() { return new DatastreamDef(); }
public static org.fcrepo.server.types.gen.DatastreamDef convertDatastreamDefToGenDatastreamDef(org.fcrepo.server.storage.types.DatastreamDef in) { if (in == null) { return null; } org.fcrepo.server.types.gen.DatastreamDef out = new org.fcrepo.server.types.gen.DatastreamDef(); out.setID(in.dsID); out.setLabel(in.dsLabel); out.setMIMEType(in.dsMIME); return out; }