libreccm-legacy/ccm-docrepo/pdl/com/arsdigita/docrepo/File.pdl

58 lines
1.8 KiB
Plaintext

//
// Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id: docrepo/File.pdl $
model com.arsdigita.docrepo;
import com.arsdigita.kernel.*;
// Note that content retrieval and insert are factored out as separate
// events to speed up loading the meta-data only.
object type File extends ResourceImpl {
// Doesn't need anything that isn't already in ResourceImpl
}
query getFileRevisionBlob {
Blob content;
do {
select
value
from
vcx_txns tx,
vcx_tags tg,
vcx_obj_changes ch,
vcx_operations op,
vcx_blob_operations bo
where
tx.id = ch.txn_id
and tg.txn_id = tx.id
and ch.id = op.change_id
and op.id = bo.id
and tx.id = (select min(tx2.id)
from vcx_txns tx2
where tx2.id > :transactionID
and exists (select 1
from vcx_tags tg2
where tg2.txn_id = tx2.id
and tg2.tagged_oid = tg.tagged_oid))
and op.attribute = 'content'
} map {
content = value;
}
}