libreccm-legacy/ccm-cms/pdl/com/arsdigita/content-section/Folder.pdl

121 lines
3.0 KiB
Plaintext
Executable File

//
// 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: Folder.pdl 287 2005-02-22 00:29:02Z sskracic $
// $DateTime: 2004/08/17 23:15:09 $
model com.arsdigita.cms;
import com.arsdigita.kernel.*;
import com.arsdigita.versioning.*;
object type Folder extends ContentItem {
String[0..1] label = cms_folders.label VARCHAR(1000);
reference key(cms_folders.folder_id);
}
association {
ContentItem[0..1] index = join cms_folders.index_id to cms_items.item_id;
Folder[0..1] indexed = join cms_items.item_id to cms_folders.index_id;
}
query folderNotEmpty {
Boolean notEmpty;
do {
select 1 as notEmpty from dual
where exists (
select
item_id
from
cms_items i
where
i.parent_id = :id
)
} map {
notEmpty = notEmpty;
}
}
query folderHasNoSubFolders {
Boolean hasNoSubFolders;
do {
select 1 as hasNoSubFolders from dual
where exists (
select
i.item_id
from
cms_items i, cms_folders f
where
i.parent_id = :id
and
i.item_id = f.folder_id
)
} map {
hasNoSubFolders = hasNoSubFolders;
}
}
//retrieve single item in folder
query ItemInFolder {
ContentItem item;
do {
select
a.object_id, a.object_type, a.display_name, a.default_domain_class
from
acs_objects a
where a.object_id =
(select
i.item_id
from
cms_items i
where i.version = :version
and i.parent_id = :parent
and name = :name)
} map {
item.id = a.object_id;
item.objectType = a.object_type;
item.defaultDomainClass = a.default_domain_class;
item.displayName = a.display_name;
}
}
//retrieve single folder in folder
query FolderInFolder {
ContentItem item;
do {
select
a.object_id, a.object_type, a.display_name, a.default_domain_class
from acs_objects a, cms_items i, cms_folders f
where i.item_id = a.object_id
and a.object_id = i.item_id
and f.folder_id = i.item_id
and i.version = :version
and i.parent_id = :parent
and name = :name
} map {
item.id = a.object_id;
item.objectType = a.object_type;
item.defaultDomainClass = a.default_domain_class;
item.displayName = a.display_name;
}
}