Initial Import Model Library
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\layout\layout-safe.ecf"/>
|
||||
<library name="model" location="..\model\model-safe.ecf"/>
|
||||
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
|
||||
<library name="persistence_mysql" location="..\persistence\implementation\mysql\persistence_mysql-safe.ecf" readonly="false"/>
|
||||
|
||||
19
model/model-safe.ecf
Normal file
19
model/model-safe.ecf
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="model" uuid="57C6F407-E894-4554-8A59-C8D1F3BBC5D7" library_target="model">
|
||||
<target name="model">
|
||||
<root all_classes="True"/>
|
||||
<option warning="true">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<cluster name="model" location=".\src" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
10
model/src/cms_content_type.e
Normal file
10
model/src/cms_content_type.e
Normal file
@@ -0,0 +1,10 @@
|
||||
note
|
||||
description: "Summary description for {CMS_CONTENT_TYPE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_CONTENT_TYPE
|
||||
|
||||
end
|
||||
71
model/src/cms_link.e
Normal file
71
model/src/cms_link.e
Normal file
@@ -0,0 +1,71 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MENU}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_LINK
|
||||
|
||||
inherit
|
||||
REFACTORING_HELPER
|
||||
|
||||
DEBUG_OUTPUT
|
||||
|
||||
ITERABLE [CMS_LINK]
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: READABLE_STRING_32
|
||||
-- link's title.
|
||||
|
||||
location: READABLE_STRING_8
|
||||
-- link's location.
|
||||
|
||||
feature -- status report
|
||||
|
||||
is_active: BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
is_expanded: BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
is_expandable: BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
has_children: BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
parent: detachable CMS_LINK
|
||||
|
||||
children: detachable LIST [CMS_LINK]
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_LINK]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
if attached children as lst then
|
||||
Result := lst.new_cursor
|
||||
else
|
||||
Result := (create {ARRAYED_LIST [CMS_LINK]}.make (0)).new_cursor
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
debug_output: STRING
|
||||
-- String that should be displayed in debugger to represent `Current'.
|
||||
do
|
||||
Result := title.as_string_8 + " -> " + location
|
||||
end
|
||||
|
||||
end
|
||||
27
model/src/cms_link_composite.e
Normal file
27
model/src/cms_link_composite.e
Normal file
@@ -0,0 +1,27 @@
|
||||
note
|
||||
description: "Summary description for {CMS_LINK_COMPOSITE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_LINK_COMPOSITE
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_LINK]
|
||||
|
||||
feature -- Access
|
||||
|
||||
items: detachable LIST [CMS_LINK]
|
||||
deferred
|
||||
end
|
||||
|
||||
extend (lnk: CMS_LINK)
|
||||
deferred
|
||||
end
|
||||
|
||||
remove (lnk: CMS_LINK)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
109
model/src/cms_local_link.e
Normal file
109
model/src/cms_local_link.e
Normal file
@@ -0,0 +1,109 @@
|
||||
note
|
||||
description: "Summary description for {CMS_LOCAL_MENU}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_LOCAL_LINK
|
||||
|
||||
inherit
|
||||
CMS_LINK
|
||||
|
||||
CMS_LINK_COMPOSITE
|
||||
rename
|
||||
items as children,
|
||||
extend as add_link,
|
||||
remove as remove_link
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_title: detachable like title; a_location: like location)
|
||||
do
|
||||
if a_title /= Void then
|
||||
title := a_title
|
||||
else
|
||||
title := a_location
|
||||
end
|
||||
location := a_location
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_active: BOOLEAN
|
||||
|
||||
is_expanded: BOOLEAN
|
||||
do
|
||||
Result := is_expandable and then internal_is_expanded
|
||||
end
|
||||
|
||||
is_expandable: BOOLEAN
|
||||
do
|
||||
Result := internal_is_expandable or internal_is_expanded or has_children
|
||||
end
|
||||
|
||||
has_children: BOOLEAN
|
||||
do
|
||||
Result := attached children as l_children and then not l_children.is_empty
|
||||
end
|
||||
|
||||
permission_arguments: detachable ITERABLE [READABLE_STRING_8]
|
||||
|
||||
children: detachable LIST [CMS_LINK]
|
||||
|
||||
internal_is_expandable: BOOLEAN
|
||||
|
||||
internal_is_expanded: BOOLEAN
|
||||
|
||||
feature -- Element change
|
||||
|
||||
add_link (lnk: CMS_LINK)
|
||||
local
|
||||
lst: like children
|
||||
do
|
||||
lst := children
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [CMS_LINK]} lst.make (1)
|
||||
children := lst
|
||||
end
|
||||
lst.force (lnk)
|
||||
end
|
||||
|
||||
remove_link (lnk: CMS_LINK)
|
||||
local
|
||||
lst: like children
|
||||
do
|
||||
lst := children
|
||||
if lst /= Void then
|
||||
lst.prune_all (lnk)
|
||||
if lst.is_empty then
|
||||
children := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set_children (lst: like children)
|
||||
do
|
||||
children := lst
|
||||
end
|
||||
|
||||
set_expanded (b: like is_expanded)
|
||||
do
|
||||
internal_is_expanded := b
|
||||
end
|
||||
|
||||
set_expandable (b: like is_expandable)
|
||||
do
|
||||
internal_is_expandable := b
|
||||
end
|
||||
|
||||
|
||||
set_permission_arguments (args: like permission_arguments)
|
||||
do
|
||||
permission_arguments := args
|
||||
end
|
||||
|
||||
end
|
||||
72
model/src/cms_menu.e
Normal file
72
model/src/cms_menu.e
Normal file
@@ -0,0 +1,72 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MENU}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_MENU
|
||||
|
||||
inherit
|
||||
CMS_LINK_COMPOSITE
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_title
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name; n: INTEGER)
|
||||
do
|
||||
name := a_name
|
||||
create items.make (n)
|
||||
end
|
||||
|
||||
make_with_title (a_name: like name; a_title: READABLE_STRING_32; n: INTEGER)
|
||||
do
|
||||
make (a_name, n)
|
||||
set_title (a_title)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
items: ARRAYED_LIST [CMS_LINK]
|
||||
|
||||
extend (lnk: CMS_LINK)
|
||||
do
|
||||
items.extend (lnk)
|
||||
end
|
||||
|
||||
remove (lnk: CMS_LINK)
|
||||
do
|
||||
items.prune_all (lnk)
|
||||
end
|
||||
|
||||
feature -- status report
|
||||
|
||||
is_empty: BOOLEAN
|
||||
do
|
||||
Result := items.is_empty
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (t: like title)
|
||||
do
|
||||
title := t
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_LINK]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -31,7 +31,7 @@ feature -- Helper
|
||||
exception_as_error (a_e: like {EXCEPTION_MANAGER}.last_exception)
|
||||
-- Record exception as an error.
|
||||
do
|
||||
if attached a_e as l_e and then attached l_e.exception_trace as l_trace then
|
||||
if attached a_e as l_e and then attached l_e.trace as l_trace then
|
||||
database_error_handler.add_error_details (l_e.code, once "Exception", l_trace.as_string_32)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
|
||||
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
||||
<library name="model" location="..\..\..\model\model-safe.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
||||
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
||||
|
||||
Reference in New Issue
Block a user