private ObjectFields getObjectFields ( String pid ) throws UnrecognizedFieldException , ObjectIntegrityException , RepositoryConfigurationException , StreamIOException , ServerException { DOReader r = m_repoReader . getReader ( Server . USE_DEFINITIVE_STORE , ReadOnlyContext . EMPTY , pid ) ; ObjectFields f ; // If there's a DC record available, use SAX to parse the most // recent version of it into f. Datastream dcmd = null ; try { dcmd = r . GetDatastream ( "DC" , null ) ; } catch ( ClassCastException cce ) { throw new ObjectIntegrityException ( "Object " + r . GetObjectPID ( ) + " has a DC datastream, but it's not inline XML." ) ; } if ( dcmd != null ) { f = new ObjectFields ( m_resultFields , dcmd . getContentStream ( ) ) ; // add dcmDate if wanted for ( String element : m_resultFields ) { if ( element . equals ( "dcmDate" ) ) { f . setDCMDate ( dcmd . DSCreateDT ) ; } } } else { f = new ObjectFields ( ) ; } // add non-dc values from doReader for the others in m_resultFields[] // Disseminator[] disses=null; for ( String n : m_resultFields ) { if ( n . equals ( "pid" ) ) { f . setPid ( pid ) ; } if ( n . equals ( "label" ) ) { f . setLabel ( r . GetObjectLabel ( ) ) ; } if ( n . equals ( "state" ) ) { f . setState ( r . GetObjectState ( ) ) ; } if ( n . equals ( "ownerId" ) ) { f . setOwnerId ( r . getOwnerId ( ) ) ; } if ( n . equals ( "cDate" ) ) { f . setCDate ( r . getCreateDate ( ) ) ; } if ( n . equals ( "mDate" ) ) { f . setMDate ( r . getLastModDate ( ) ) ; } } return f ; }
For the given pid get a reader on the object from the repository and return an ObjectFields object with resultFields fields populated .