private void setAttribute ( DBCollection content , String fieldName , Object value ) { DBObject header = content . findOne ( HEADER_QUERY ) ; BasicDBObject newHeader = new BasicDBObject ( ) ; // clone header newHeader . put ( FIELD_CHUNK_TYPE , header . get ( FIELD_CHUNK_TYPE ) ) ; newHeader . put ( FIELD_MIME_TYPE , header . get ( FIELD_MIME_TYPE ) ) ; newHeader . put ( FIELD_EXTRACTED_TEXT , header . get ( FIELD_EXTRACTED_TEXT ) ) ; newHeader . put ( FIELD_UNUSED , header . get ( FIELD_UNUSED ) ) ; newHeader . put ( FIELD_UNUSED_SINCE , header . get ( FIELD_UNUSED_SINCE ) ) ; // modify specified field and update record newHeader . put ( fieldName , value ) ; content . update ( HEADER_QUERY , newHeader ) ; }
Modifies content header .