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);
    }
private void setAttribute ( DBCollection content , String fieldName , Object value ) { DBObject header = content . findOne ( HEADER_QUERY ) ; BasicDBObject newHeader = new BasicDBObject ( ) ; 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 ) ) ; newHeader . put ( fieldName , value ) ; content . update ( HEADER_QUERY , newHeader ) ; }
Modifies content header.

@param content stored content
@param fieldName attribute name
@param value new value for the attribute