01: /* Copyright 2002 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.layout.restrictions;
07:
08: import org.jasig.portal.PortalException;
09: import org.jasig.portal.layout.node.ILayoutNode;
10:
11: /**
12: * IUserLayoutRestriction is the base interface for UserLayout restrictions.
13: *
14: * @author Michael Ivanov
15: * @version $Revision: 36684 $
16: */
17: // create table up_restrictions (restriction_id integer(10) primary key, restriction_name varchar(50) not null );
18: // insert into up_restrictions (restriction_id,restriction_name) values (1,'priority');
19: // create table up_layout_restrictions ( user_id integer(10) not null, layout_id integer(10) not null, node_id varchar(20) not null, restriction_id integer(10) not null,
20: // restriction_value varchar(200) not null, restriction_tree_path varchar(300), constraint up_layout_restrictions_pk primary key (user_id,layout_id,node_id,restriction_id),
21: // constraint up_layout_restrictions_fk foreign key (restriction_id) references up_restrictions (restriction_id));
22: // insert into up_layout_restrictions ( user_id, layout_id, node_id, restriction_id, restriction_value) values (2,1,5,1,'2-5,8');
23: // insert into up_layout_struct_aggr (user_id,layout_id,struct_id,next_struct_id,chld_struct_id,external_id,chan_id,name,type,hidden,
24: // immutable,unremovable) select user_id,layout_id,struct_id,next_struct_id,chld_struct_id,external_id,chan_id,name,type,hidden,
25: // immutable,unremovable from up_layout_struct;
26: // delete from up_layout_struct_aggr where user_id != 2 or layout_id != 1;
27:
28: public interface IUserLayoutRestriction {
29:
30: // The local restriction path defined for every restriction by default
31: public final static String LOCAL_RESTRICTION_PATH = "local";
32:
33: // The parent restriction path, could be setup to a parent node
34: public final static String PARENT_RESTRICTION_PATH = "parent";
35:
36: // The children restriction path, could be setup to all children
37: public final static String CHILDREN_RESTRICTION_PATH = "children";
38:
39: /**
40: * Returns the name of the current restriction
41: * @return a <code>String</code> name
42: */
43: public String getName();
44:
45: /**
46: * Sets the name of the current restriction
47: * @param name <code>String</code> name
48: */
49: public void setName(String name);
50:
51: /**
52: * Gets the unique key of the current restriction
53: * @return a <code>String</code> unique key
54: */
55: public String getUniqueKey();
56:
57: /**
58: * Checks the restriction for the given property value
59: * @param propertyValue a <code>String</code> property value to be checked
60: * @return a boolean value
61: * @exception PortalException
62: */
63: public boolean checkRestriction(String propertyValue)
64: throws PortalException;
65:
66: /**
67: * Checks the relative restriction on a given node
68: * @param node a <code>ILayoutNode</code> node
69: * @return a boolean value
70: * @exception PortalException
71: */
72: public boolean checkRestriction(ILayoutNode node)
73: throws PortalException;
74:
75: /**
76: * Sets the restriction expression
77: * @param restrictionExpression a <code>String</code> expression
78: */
79: public void setRestrictionExpression(String restrictionExpression);
80:
81: /**
82: * Gets the restriction expression
83: * @return a <code>String</code> expression
84: */
85: public String getRestrictionExpression();
86:
87: /**
88: * Sets the restriction path
89: * @param restrictionPath a <code>String</code> path
90: */
91: public void setRestrictionPath(String restrictionPath);
92:
93: /**
94: * Gets the tree path for the current restriction
95: * @return a <code>String</code> tree path
96: */
97: public String getRestrictionPath();
98:
99: }
|