Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Workspace.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Attic/Workspace.hbm.xml,v diff -u -r1.9 -r1.10 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Workspace.hbm.xml 22 Jun 2006 23:03:29 -0000 1.9 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Workspace.hbm.xml 7 Aug 2006 09:07:40 -0000 1.10 @@ -113,13 +113,16 @@ - - - - + + + @hibernate.set inverse="false" cascade="all-delete-orphan" + @hibernate.collection-key column="workspace_id" + @hibernate.collection-one-to-many class="org.lamsfoundation.lams.usermanagement.WorkspaceWorkspaceFolder" + + + - + - - - - + + + @hibernate.set inverse="false" cascade="all-delete-orphan" + @hibernate.collection-key column="workspace_folder_id" + @hibernate.collection-one-to-many class="org.lamsfoundation.lams.usermanagement.WorkspaceWorkspaceFolder" + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/WorkspaceWorkspaceFolder.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/Attic/WorkspaceWorkspaceFolder.hbm.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/WorkspaceWorkspaceFolder.hbm.xml 7 Aug 2006 09:07:43 -0000 1.1 @@ -0,0 +1,66 @@ + + + + + + + + + @hibernate.class + table="lams_workspace_workspace_folder" + + true + + + + @hibernate.id + generator-class="native" + type="java.lang.Integer" + column="id" + + true + + + + + + + @hibernate.many-to-one + not-null="true" + lazy="false" + @hibernate.column name="workspace_id" + + + + + + + + @hibernate.many-to-one + not-null="true" + lazy="false" + @hibernate.column name="workspace_folder_id" + + + + + + Index: lams_common/db/model/lams_11.clay =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/model/lams_11.clay,v diff -u -r1.58 -r1.59 --- lams_common/db/model/lams_11.clay 2 Aug 2006 06:15:38 -0000 1.58 +++ lams_common/db/model/lams_11.clay 7 Aug 2006 09:07:48 -0000 1.59 @@ -1,2667 +1,2667 @@ - - + + - - + + - - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - + When a lesson is started, the authored design is considered the orginial learning design - - + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - + + + - - - + + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -2670,412 +2670,412 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - + Unique signature for each version of a tool. <organisation><tool><version> - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - + Unique identifier for the tool. This should remain the same for every version of the tool. It will be used for the IMS LD import/export. - - - + + + - + Version of tool. Expected to be in format [major version.minor version] eg 1.2 - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + + @@ -3084,163 +3084,163 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -3249,53 +3249,53 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -3304,53 +3304,53 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -3359,86 +3359,86 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -3447,78 +3447,78 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + @@ -3527,51 +3527,51 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -3580,51 +3580,51 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -3633,309 +3633,309 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- +
There will usually be 0 or 1 workspace for each tool in LAMS, so this should be a pretty small table. The main lookup is done on name, but given the small number of rows a complete table scan should be fine. A name index would probably be about the same size as the table anyway. - + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- +
Like lams_cr_workspace, there will usually be 0 or 1 workspace for each tool in LAMS, so this should be a pretty small table. The main lookup is done on name, but given the small number of rows a complete table scan should be fine. - + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -3944,67 +3944,67 @@
- +
Has a "dummy" id nv_id (node version id) which is unique for all node_id and version_id combinations. It is the node_id and version_id combination that is the "real" key for this table. - + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - + + - - + + @@ -4013,72 +4013,72 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - + + - - + + @@ -4087,104 +4087,104 @@
- +
A node can only belong to one parent - so each time a new version of a package is created, all the nodes are recreated. - + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + @@ -4193,150 +4193,150 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + + @@ -4345,170 +4345,170 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + + @@ -4517,105 +4517,105 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + @@ -4624,79 +4624,79 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - + + - - + + @@ -4705,47 +4705,47 @@
- +
All the lams_css_property values matching this lams_css_style make up the CSSStyleDeclaration for this style. It may be a "base" style for a theme, or it may be for a named visual element. Each style may have a subset of properties, such as "_tf" - + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + @@ -4754,111 +4754,111 @@
- +
Url details for system tools such as gates and grouping - + - - - - + + + + - - - + + + - + Unique signature for each version of a tool. <organisation><tool><version> - - + + - - - + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + @@ -4867,110 +4867,110 @@
- +
Individual permissions, such as read access to a content folder. - + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - + + - - + +
- +
Link table between lams_role and lams_privilege. - + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + @@ -4979,84 +4979,98 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + - - - + + + + - - - - + + + + - - - + + + + + + + + + + + + + + + + - - + + + - - + + - - + + @@ -5065,87 +5079,87 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - + +
- - - +
+ + - - - + + + + - - - - + + + - - - - - + + + + + - - - - - + + + + + - - + + Index: lams_common/db/sql/create_lams_11_tables.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/sql/create_lams_11_tables.sql,v diff -u -r1.71 -r1.72 --- lams_common/db/sql/create_lams_11_tables.sql 2 Aug 2006 06:15:37 -0000 1.71 +++ lams_common/db/sql/create_lams_11_tables.sql 7 Aug 2006 09:07:48 -0000 1.72 @@ -200,8 +200,10 @@ )TYPE=InnoDB; CREATE TABLE lams_workspace_workspace_folder ( - workspace_id BIGINT(20) NOT NULL + id BIGINT(20) NOT NULL AUTO_INCREMENT + , workspace_id BIGINT(20) NOT NULL , workspace_folder_id BIGINT(20) NOT NULL + , PRIMARY KEY (id) , INDEX (workspace_id) , CONSTRAINT FK_lams_workspace_workspace_folder_1 FOREIGN KEY (workspace_id) REFERENCES lams_workspace (workspace_id) Index: lams_common/db/sql/insert_users.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/sql/Attic/insert_users.sql,v diff -u -r1.26 -r1.27 --- lams_common/db/sql/insert_users.sql 6 Jul 2006 06:47:22 -0000 1.26 +++ lams_common/db/sql/insert_users.sql 7 Aug 2006 09:07:48 -0000 1.27 @@ -56,16 +56,16 @@ insert into lams_workspace_folder (workspace_folder_id,parent_folder_id,name,user_id,create_date_time,last_modified_date_time,lams_workspace_folder_type_id) values(8,null,'Four Test Workspace',8,'20041223','20041223',1); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (1,1); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (2,2); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (2,22); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (3,3); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (3,23); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (4,4); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (5,5); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (6,6); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (7,7); -insert into lams_workspace_workspace_folder (workspace_id, workspace_folder_id) values (8,8); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (1, 1,1); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (2, 2,2); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (3, 2,22); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (4, 3,3); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (5, 3,23); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (6, 4,4); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (7, 5,5); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (8, 6,6); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (9, 7,7); +insert into lams_workspace_workspace_folder (id, workspace_id, workspace_folder_id) values (10, 8,8); INSERT INTO lams_organisation (organisation_id, name, code, description, parent_organisation_id, organisation_type_id, create_date, workspace_id, locale_language, locale_country, organisation_state_id) VALUES (1, 'Root', null, 'Root Organisation',null,1,NOW(),1,'en','AU',1); Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/commonContext.xml,v diff -u -r1.39 -r1.40 --- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml 6 Aug 2006 04:24:37 -0000 1.39 +++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml 7 Aug 2006 09:07:48 -0000 1.40 @@ -42,6 +42,7 @@ org/lamsfoundation/lams/usermanagement/UserOrganisationRole.hbm.xml org/lamsfoundation/lams/usermanagement/Workspace.hbm.xml org/lamsfoundation/lams/usermanagement/WorkspaceFolder.hbm.xml + org/lamsfoundation/lams/usermanagement/WorkspaceWorkspaceFolder.hbm.xml org/lamsfoundation/lams/usermanagement/SupportedLocale.hbm.xml Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ImportExportUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ImportExportUtil.java,v diff -u -r1.2 -r1.3 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ImportExportUtil.java 6 Aug 2006 06:08:52 -0000 1.2 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ImportExportUtil.java 7 Aug 2006 09:07:48 -0000 1.3 @@ -113,7 +113,10 @@ } /** - * Method decryptDesign. + * Decrypt Import packet. Exports were encrypted back in LAMS 1.0beta6 and prior but + * encryption is not longer supported. We will not be supporting encryption of exports + * in the future - this code is here only to support the importing of old encrypted designs. + * * @param fileContent * @return String */ Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java,v diff -u -r1.20 -r1.21 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java 1 Aug 2006 07:26:28 -0000 1.20 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java 7 Aug 2006 09:07:48 -0000 1.21 @@ -729,7 +729,7 @@ UserOrganisation userOrganisation = (UserOrganisation)iterator.next(); // not all orgs have a folder Workspace workspace = userOrganisation.getOrganisation().getWorkspace(); - if ( workspace != null && workspace.getFolders() != null ) { + if ( workspace != null ) { foundMemberFolder = checkFolders(workspace.getFolders(),workspaceFolderID); } } Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/Workspace.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/Attic/Workspace.java,v diff -u -r1.12 -r1.13 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/Workspace.java 22 Jun 2006 23:03:29 -0000 1.12 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/Workspace.java 7 Aug 2006 09:07:48 -0000 1.13 @@ -24,6 +24,8 @@ package org.lamsfoundation.lams.usermanagement; import java.io.Serializable; +import java.util.HashSet; +import java.util.Iterator; import java.util.Set; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; @@ -41,7 +43,7 @@ private Integer workspaceId; /** persistent field */ - private Set folders; + private Set workspaceWorkspaceFolders; /** persistent field */ private WorkspaceFolder defaultFolder; @@ -104,20 +106,55 @@ this.defaultFolder = defaultFolder; } - /** - * @hibernate.set role="folders" table="lams_workspace_workspace_folder" cascade="all-delete-orphan" - * @hibernate.collection-key column="workspace_id" - * @hibernate.collection-many-to-manyclass="org.lamsfoundation.lams.usermanagement.WorkspaceFolder" - * column="workspace_folder_id" + /** + * WorkspaceWorkspaceFolder is a join object that links a workspace folder to its workspaces. + * @hibernate.set inverse="false" cascade="all-delete-orphan" + * @hibernate.collection-key column="workspace_id" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.usermanagement.WorkspaceWorkspaceFolder" */ - public Set getFolders() { - return folders; + public Set getWorkspaceWorkspaceFolders() { + return workspaceWorkspaceFolders; } - public void setFolders(Set folders) { - this.folders = folders; + public void setWorkspaceWorkspaceFolders(Set workspaceWorkspaceFolders) { + this.workspaceWorkspaceFolders = workspaceWorkspaceFolders; } + /** Get all the folders for this workspace, based on the lams_workspace_workspace join table. This set is not a persistent + * set so to add a folder use "addFolder(folder)" rather than getFolders().put(folder). */ + public Set getFolders() { + HashSet set = new HashSet(); + if ( getWorkspaceWorkspaceFolders() != null ) { + Iterator iter = getWorkspaceWorkspaceFolders().iterator(); + while ( iter.hasNext() ) { + WorkspaceWorkspaceFolder wwf = (WorkspaceWorkspaceFolder) iter.next(); + set.add(wwf.getWorkspaceFolder()); + } + } + return set; + } + + /** Add a folder to workspace. */ + public void addFolder(WorkspaceFolder folder) { + // check that the folder doesn't already exist + if ( getWorkspaceWorkspaceFolders() != null ) { + Iterator iter = getWorkspaceWorkspaceFolders().iterator(); + while ( iter.hasNext() ) { + WorkspaceWorkspaceFolder wwf = (WorkspaceWorkspaceFolder) iter.next(); + WorkspaceFolder wf = wwf.getWorkspaceFolder(); + if ( wf.equals(folder) ) + return; + } + } + + // not found so add it to the set + WorkspaceWorkspaceFolder wwf = new WorkspaceWorkspaceFolder(null, this, folder); + if ( getWorkspaceWorkspaceFolders() == null ) { + setWorkspaceWorkspaceFolders(new HashSet()); + } + getWorkspaceWorkspaceFolders().add(wwf); + } + /** * @hibernate.many-to-one * not-null="true" Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/WorkspaceFolder.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/WorkspaceFolder.java,v diff -u -r1.13 -r1.14 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/WorkspaceFolder.java 22 Jun 2006 23:03:29 -0000 1.13 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/WorkspaceFolder.java 7 Aug 2006 09:07:48 -0000 1.14 @@ -26,7 +26,9 @@ import java.io.Serializable; import java.util.Date; import java.util.HashSet; +import java.util.Iterator; import java.util.Set; + import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; @@ -64,7 +66,7 @@ private WorkspaceFolder parentWorkspaceFolder; /** persistent field */ - private Set workspaces; + private Set workspaceWorkspaceFolders; /** persistent field */ private Set childWorkspaceFolders; @@ -139,7 +141,7 @@ public WorkspaceFolder(String name, WorkspaceFolder parentWorkspaceFolder, Set workspaces, Set childWorkspaceFolders) { this.name = name; this.parentWorkspaceFolder = parentWorkspaceFolder; - this.workspaces = workspaces; + this.workspaceWorkspaceFolders = workspaces; this.childWorkspaceFolders = childWorkspaceFolders; } @@ -189,20 +191,34 @@ this.parentWorkspaceFolder = parentWorkspaceFolder; } - /** - * @hibernate.set role="workspaces" table="lams_workspace_workspace_folder" cascase="all-delete-orphan" - * @hibernate.collection-key column="workspace_folder_id" - * @hibernate.collection-many-to-manyclass="org.lamsfoundation.lams.usermanagement.Workspace" - * column="workspace_id" + /** + * WorkspaceWorkspaceFolder is a join object that links a workspace folder to its workspaces. + * @hibernate.set inverse="false" cascade="all-delete-orphan" + * @hibernate.collection-key column="workspace_folder" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.usermanagement.WorkspaceWorkspaceFolder" */ - public Set getWorkspaces() { - return workspaces; + protected Set getWorkspaceWorkspaceFolders() { + return workspaceWorkspaceFolders; } - public void setWorkspaces(Set workspaces) { - this.workspaces = workspaces; + protected void setWorkspaceWorkspaceFolders(Set workspaceWorkspaceFolders) { + this.workspaceWorkspaceFolders = workspaceWorkspaceFolders; } + /** Get all the workspaces for this folder, based on the lams_workspace_workspace join table. This set is not a persistent + * set so to add a folder you cannot use "addWorkspace(workspace)". You must go to the Workspace and do workspace.addFolder(folder). */ + public Set getWorkspaces() { + HashSet set = new HashSet(); + if ( getWorkspaceWorkspaceFolders() != null ) { + Iterator iter = getWorkspaceWorkspaceFolders().iterator(); + while ( iter.hasNext() ) { + WorkspaceWorkspaceFolder wwf = (WorkspaceWorkspaceFolder) iter.next(); + set.add(wwf.getWorkspace()); + } + } + return set; + } + /** * @hibernate.set * lazy="true" Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/WorkspaceWorkspaceFolder.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/Attic/WorkspaceWorkspaceFolder.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/WorkspaceWorkspaceFolder.java 7 Aug 2006 09:07:48 -0000 1.1 @@ -0,0 +1,127 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ************************************************************************ + */ +/* $$Id: WorkspaceWorkspaceFolder.java,v 1.1 2006/08/07 09:07:48 fmalikoff Exp $$ */ +package org.lamsfoundation.lams.usermanagement; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Join table that maps workspace to workspace folders. Was having trouble getting Hibernate + * to persist the join table. + * + * @hibernate.class table="lams_workspace_workspace_folder" + * + * @author Fiona Malikoff + * +*/ +public class WorkspaceWorkspaceFolder implements Serializable { + + private static final long serialVersionUID = -2111064926800456263L; + + /** identifier field */ + private Integer id; + + /** identifier field */ + private Workspace workspace; + + /** identifier field */ + private WorkspaceFolder workspaceFolder; + + /** default constructor */ + public WorkspaceWorkspaceFolder() { + } + + public WorkspaceWorkspaceFolder(Integer id, Workspace workspace, WorkspaceFolder workspaceFolder) { + this.id = id; + this.workspace = workspace; + this.workspaceFolder = workspaceFolder; + } + + /** @hibernate.id + * generator-class="native" + * type="java.lang.Integer" + * column="id" + */ + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + /** + * @hibernate.many-to-one + * not-null="true" + * lazy="false" + * @hibernate.column name="workspace_folder_id" + */ + public WorkspaceFolder getWorkspaceFolder() { + return this.workspaceFolder; + } + + public void setWorkspaceFolder(WorkspaceFolder workspaceFolder) { + this.workspaceFolder = workspaceFolder; + } + + /** + * @hibernate.many-to-one + * not-null="true" + * lazy="false" + * @hibernate.column name="workspace_id" + */ + public Workspace getWorkspace() { + return this.workspace; + } + + public void setWorkspace(Workspace workspace) { + this.workspace = workspace; + } + + public String toString() { + return new ToStringBuilder(this) + .append("id", getId()) + .append("workspace", getWorkspace()) + .append("workspaceFolder", getWorkspaceFolder()) + .toString(); + } + + public boolean equals(Object other) { + if ( !(other instanceof WorkspaceWorkspaceFolder) ) return false; + WorkspaceWorkspaceFolder castOther = (WorkspaceWorkspaceFolder) other; + return new EqualsBuilder() + .append(this.getId(), castOther.getId()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getId()) + .toHashCode(); + } + + +} Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java,v diff -u -r1.44 -r1.45 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java 3 Aug 2006 02:50:14 -0000 1.44 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java 7 Aug 2006 09:07:48 -0000 1.45 @@ -45,6 +45,7 @@ import org.lamsfoundation.lams.usermanagement.UserOrganisationRole; import org.lamsfoundation.lams.usermanagement.Workspace; import org.lamsfoundation.lams.usermanagement.WorkspaceFolder; +import org.lamsfoundation.lams.usermanagement.WorkspaceWorkspaceFolder; import org.lamsfoundation.lams.usermanagement.dto.OrganisationDTO; import org.lamsfoundation.lams.usermanagement.dto.OrganisationDTOFactory; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -386,9 +387,7 @@ save(workspace); WorkspaceFolder folder = new WorkspaceFolder(workspace.getName(),user.getUserId(),new Date(),new Date(),WorkspaceFolder.NORMAL); save(folder); - if ( workspace.getFolders() == null ) - workspace.setFolders(new HashSet()); - workspace.getFolders().add(folder); + workspace.addFolder(folder); workspace.setDefaultFolder(folder); user.setWorkspace(workspace); return user; @@ -412,14 +411,10 @@ save(workspaceFolder2); Workspace workspace = new Workspace(workspaceName); - if ( workspace.getFolders() == null ) - workspace.setFolders(new HashSet()); - - workspace.getFolders().add(workspaceFolder); workspace.setDefaultFolder(workspaceFolder); - workspace.getFolders().add(workspaceFolder2); workspace.setDefaultRunSequencesFolder(workspaceFolder2); - + workspace.addFolder(workspaceFolder); + workspace.addFolder(workspaceFolder2); save(workspace); return workspace;