// // 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 model com.arsdigita.themedirector; object type ThemeFile { BigDecimal[1..1] id = theme_files.file_id INTEGER; Blob[1..1] content = theme_files.content BLOB; // the file path is relative to the theme directory String[1..1] filePath = theme_files.file_path VARCHAR(2000); // version can be 'draft' or 'live' String[1..1] version = theme_files.version VARCHAR(10); Date[1..1] lastModifiedDate = theme_files.last_modified_date TIMESTAMP; Boolean[1..1] deleted = theme_files.is_deleted; // each theme should only have one file per filePath // we cannot add this here becuase persistence does not know how to // map the association column back to the column in this table and // won't let us use regular columns // unique (filePath, theme.id, version); object key (id); } association { Theme[1..1] theme = join theme_files.theme_id to theme_themes.theme_id; ThemeFile[0..n] themeFiles = join theme_themes.theme_id to theme_files.theme_id; } data operation bulkFileUpdate { do { update theme_files set is_deleted = (select t2.is_deleted from theme_files t2 where t2.theme_id = :themeID and t2.file_path = theme_files.file_path and t2.version = 'draft'), last_modified_date = :timestamp where theme_id = :themeID and version = 'live' and file_path in (select t3.file_path from theme_files t3 where t3.theme_id = :themeID and t3.version = 'draft') } }