Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,15 +1,38 @@
-/**
- * LearningDesignRepository.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
-
package org.lamsfoundation.lams.webservice;
import java.rmi.Remote;
import java.rmi.RemoteException;
+/**
+ * LearningDesignRepository.java
+ *
+ * This file was auto-generated from WSDL by the Apache Axis 1.4 Apr 22, 2006
+ * (06:55:48 PDT) WSDL2Java emitter.
+ */
public interface LearningDesignRepository extends Remote {
- public String getLearningDesigns(String serverId, String datetime, String hashValue, String username, Integer mode) throws RemoteException;
+
+ public String getLearningDesigns(String serverId, String datetime, String hashValue,
+ String username, Integer mode) throws RemoteException;
}
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,8 +1,24 @@
-/**
- * LearningDesignRepositoryService.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
@@ -12,6 +28,12 @@
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
+/**
+ * LearningDesignRepositoryService.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
public interface LearningDesignRepositoryService extends Service {
public String getLearningDesignRepositoryAddress();
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingImpl.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingImpl.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingImpl.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingImpl.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,18 +1,216 @@
-/**
- * LearningDesignRepositorySoapBindingImpl.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
+import java.io.IOException;
import java.rmi.RemoteException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
+import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
+import org.lamsfoundation.lams.integration.ExtServerOrgMap;
+import org.lamsfoundation.lams.integration.ExtUserUseridMap;
+import org.lamsfoundation.lams.integration.security.Authenticator;
+import org.lamsfoundation.lams.integration.service.IntegrationService;
+import org.lamsfoundation.lams.usermanagement.WorkspaceFolder;
+import org.lamsfoundation.lams.usermanagement.exception.UserAccessDeniedException;
+import org.lamsfoundation.lams.util.MessageService;
+import org.lamsfoundation.lams.web.util.HttpSessionManager;
+import org.lamsfoundation.lams.workspace.dto.FolderContentDTO;
+import org.lamsfoundation.lams.workspace.service.IWorkspaceManagementService;
+import org.lamsfoundation.lams.workspace.service.WorkspaceManagementService;
+import org.lamsfoundation.lams.workspace.web.WorkspaceAction;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ *
+ * View Source
+ *
+ *
+ * @author Fei Yang
+ */
public class LearningDesignRepositorySoapBindingImpl implements LearningDesignRepository {
+
+ private static IntegrationService integrationService = (IntegrationService) WebApplicationContextUtils
+ .getRequiredWebApplicationContext(HttpSessionManager.getInstance().getServletContext())
+ .getBean("integrationService");
+
+ private static IWorkspaceManagementService service = (IWorkspaceManagementService) WebApplicationContextUtils
+ .getRequiredWebApplicationContext(HttpSessionManager.getInstance().getServletContext())
+ .getBean("workspaceManagementService");
+
+ private static MessageService msgService = service.getMessageService();
+
+ private static class ContentTreeNode {
+ FolderContentDTO content;
+
+ List children;
+
+ ContentTreeNode(FolderContentDTO content) {
+ this.content = content;
+ children = new LinkedList();
+ }
+
+ List getChildren() {
+ return children;
+ }
+
+ void setChildren(List children) {
+ this.children = children;
+ }
+
+ FolderContentDTO getContent() {
+ return content;
+ }
+
+ void setContent(FolderContentDTO content) {
+ this.content = content;
+ }
+
+ void addChild(FolderContentDTO content) {
+ children.add(new ContentTreeNode(content));
+ }
+
+ void addChild(ContentTreeNode node) {
+ children.add(node);
+ }
+
+ /**
+ * the format should be something like this:
+ [
+ ['My Workspace', null,
+ ['Mary Morgan Folder', null,
+ ['3 activity sequence','1024']
+ ],
+ ['Organisations', null,
+ ['Developers Playpen', null,
+ ['Lesson Sequence Folder', null,
+ ['',null]
+ ]
+ ],
+ ['MATH111', null,
+ ['Lesson Sequence Folder', null,
+ ['',null]
+ ]
+ ]
+ ]
+ ]
+ ]
+ */
+ public String toString(){
+ return '['+convert()+']';
+ }
+
+ String convert(){
+ StringBuilder sb = new StringBuilder();
+ if(content.getResourceType().equals(FolderContentDTO.FOLDER)){
+ sb.append('[');
+ sb.append(content.getName()).append(',').append("null").append(',');
+ if(children.size() == 0){
+ sb.append("['',null]");
+ }else{
+ sb.append(children.get(0).convert());
+ for(int i=1; i
+ * The returned string is formatted this way for convenience of tigra tree menu javascript library.
+ * This is bad design since it make client and server coupled together a bit too tightly. If we change
+ * javascript library on client side. The returned value may be not very easy to parse.
+ *
+ * The main reason is:
+ *
+ * - String as return type make webservice client end easier to implement.
+ * Some webservice lib in some language(like SOAP::Lite in Perl) may haven't support
+ * complicated data structure as return type
+ *
+ *
+ */
public String getLearningDesigns(String serverId, String datetime, String hashValue,
String username, Integer mode) throws RemoteException {
- return null;
+ try {
+ ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap,datetime,username,hashValue);
+ ExtUserUseridMap userMap = integrationService.getExtUserUseridMap(serverMap, username);
+ return buildContentTree(userMap.getUser().getUserId()).toString();
+ } catch (Exception e) {
+ throw new RemoteException(e.getMessage(), e);
+ }
+
}
+ private ContentTreeNode buildContentTree(Integer userId) throws IOException,
+ UserAccessDeniedException, RepositoryCheckedException {
+ FolderContentDTO rootFolder = new FolderContentDTO(msgService
+ .getMessage("label.workspace.root_folder"), msgService.getMessage("folder"), null,
+ null, FolderContentDTO.FOLDER, WorkspaceAction.BOOTSTRAP_FOLDER_ID.longValue(),
+ WorkspaceFolder.READ_ACCESS, null);
+ ContentTreeNode root = new ContentTreeNode(rootFolder);
+ FolderContentDTO userFolder = service.getUserWorkspaceFolder(userId);
+ root.addChild(buildContentTreeNode(userFolder, userId));
+ FolderContentDTO dummyOrgFolder = new FolderContentDTO(msgService
+ .getMessage("organisations"), msgService.getMessage("folder"), null, null,
+ FolderContentDTO.FOLDER, new Long(WorkspaceAction.ORG_FOLDER_ID.longValue()),
+ WorkspaceFolder.READ_ACCESS, null);
+ ContentTreeNode dummyOrgNode = new ContentTreeNode(dummyOrgFolder);
+ Vector orgFolders = service.getAccessibleOrganisationWorkspaceFolders(userId);
+ for (int i = 0; i < orgFolders.size(); i++) {
+ FolderContentDTO orgFolder = (FolderContentDTO) orgFolders.get(i);
+ dummyOrgNode.addChild(buildContentTreeNode(orgFolder, userId));
+ }
+ root.addChild(dummyOrgNode);
+ return root;
+ }
+
+ private ContentTreeNode buildContentTreeNode(FolderContentDTO folder, Integer userId)
+ throws UserAccessDeniedException, RepositoryCheckedException {
+ ContentTreeNode node = new ContentTreeNode(folder);
+ if (folder.getResourceType().equals(FolderContentDTO.FOLDER)) {
+ WorkspaceFolder wsfolder = service
+ .getWorkspaceFolder(folder.getResourceID().intValue());
+ Vector items = service.getFolderContentsExcludeHome(userId, wsfolder,
+ WorkspaceManagementService.MONITORING);
+ for (int i = 0; i < items.size(); i++) {
+ FolderContentDTO content = (FolderContentDTO) items.get(i);
+ node.addChild(buildContentTreeNode(content, userId));
+ }
+ }
+ return node;
+ }
+
}
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingSkeleton.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingSkeleton.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingSkeleton.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingSkeleton.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,8 +1,24 @@
-/**
- * LearningDesignWebServiceSoapBindingSkeleton.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
@@ -14,6 +30,12 @@
import org.apache.axis.wsdl.Skeleton;
import org.apache.axis.description.*;
+/**
+ * LearningDesignWebServiceSoapBindingSkeleton.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
@SuppressWarnings( { "serial", "unchecked" })
public class LearningDesignRepositorySoapBindingSkeleton implements LearningDesignRepository,
Skeleton {
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManager.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManager.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManager.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManager.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,21 +1,43 @@
-/**
- * LessonManager.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
import java.rmi.Remote;
import java.rmi.RemoteException;
+/**
+ * LessonManager.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
public interface LessonManager extends Remote {
- public Integer startLesson(String serverId, String datetime, String hashValue, String username,
- long ldId, String courseId, String title, String desc) throws RemoteException;
+ public Long startLesson(String serverId, String datetime, String hashValue, String username,
+ long ldId, String courseId, String title, String desc, String countryIsoCode, String langIsoCode) throws RemoteException;
- public Integer scheduleLesson(String serverId, String datetime, String hashValue,
- String username, long ldId, String courseId, String title, String desc, String startDate)
+ public Long scheduleLesson(String serverId, String datetime, String hashValue,
+ String username, long ldId, String courseId, String title, String desc, String startDate, String countryIsoCode, String langIsoCode)
throws RemoteException;
public boolean deleteLearningSession(String serverId, String datetime, String hashValue,
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,16 +1,39 @@
-/**
- * LessonWebServiceService.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
+/**
+ * LessonWebServiceService.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
public interface LessonManagerService extends Service {
+
public java.lang.String getLearningServiceAddress();
public LessonManager getLessonManager() throws ServiceException;
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingImpl.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingImpl.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingImpl.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingImpl.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,29 +1,128 @@
-/**
- * LessonManagerSoapBindingImpl.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import org.lamsfoundation.lams.integration.ExtCourseClassMap;
+import org.lamsfoundation.lams.integration.ExtServerOrgMap;
+import org.lamsfoundation.lams.integration.ExtUserUseridMap;
+import org.lamsfoundation.lams.integration.security.Authenticator;
+import org.lamsfoundation.lams.integration.service.IntegrationService;
+import org.lamsfoundation.lams.lesson.Lesson;
+import org.lamsfoundation.lams.monitoring.service.IMonitoringService;
+import org.lamsfoundation.lams.monitoring.service.MonitoringServiceProxy;
+import org.lamsfoundation.lams.usermanagement.Organisation;
+import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.util.DateUtil;
+import org.lamsfoundation.lams.web.util.HttpSessionManager;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ *
+ * View Source
+ *
+ *
+ * @author Fei Yang
+ */
public class LessonManagerSoapBindingImpl implements LessonManager {
- public Integer startLesson(String serverId, String datetime, String hashValue, String username,
- long ldId, String courseId, String title, String desc) throws RemoteException {
- return null;
+ private static IntegrationService service = (IntegrationService) WebApplicationContextUtils
+ .getRequiredWebApplicationContext(HttpSessionManager.getInstance().getServletContext())
+ .getBean("integrationService");
+
+ private static IMonitoringService monitoringService = MonitoringServiceProxy
+ .getMonitoringService(HttpSessionManager.getInstance().getServletContext());
+
+ public Long startLesson(String serverId, String datetime, String hashValue, String username,
+ long ldId, String courseId, String title, String desc, String countryIsoCode,
+ String langIsoCode) throws RemoteException {
+ try {
+ ExtServerOrgMap serverMap = service.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap,datetime,username,hashValue);
+ ExtUserUseridMap userMap = service.getExtUserUseridMap(serverMap, username);
+ ExtCourseClassMap orgMap = service.getExtCourseClassMap(serverMap, userMap, courseId,
+ countryIsoCode, langIsoCode);
+ // 1. init lesson
+ Lesson lesson = monitoringService.initializeLesson(title, desc, ldId, orgMap
+ .getOrganisation().getOrganisationId(), userMap.getUser().getUserId());
+ // 2. create lessonClass for lesson
+ createLessonClass(lesson, orgMap.getOrganisation(), userMap.getUser());
+ // 3. start lesson
+ monitoringService.startLesson(lesson.getLessonId(), userMap.getUser().getUserId());
+ return lesson.getLessonId();
+ } catch (Exception e) {
+ throw new RemoteException(e.getMessage(), e);
+ }
}
- public Integer scheduleLesson(String serverId, String datetime, String hashValue,
- String username, long ldId, String courseId, String title, String desc, String startDate)
- throws RemoteException {
- return null;
+ public Long scheduleLesson(String serverId, String datetime, String hashValue, String username,
+ long ldId, String courseId, String title, String desc, String startDate,
+ String countryIsoCode, String langIsoCode) throws RemoteException {
+ try {
+ ExtServerOrgMap serverMap = service.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap,datetime,username,hashValue);
+ ExtUserUseridMap userMap = service.getExtUserUseridMap(serverMap, username);
+ ExtCourseClassMap orgMap = service.getExtCourseClassMap(serverMap, userMap, courseId,
+ countryIsoCode, langIsoCode);
+ // 1. init lesson
+ Lesson lesson = monitoringService.initializeLesson(title, desc, ldId, orgMap
+ .getOrganisation().getOrganisationId(), userMap.getUser().getUserId());
+ // 2. create lessonClass for lesson
+ createLessonClass(lesson, orgMap.getOrganisation(), userMap.getUser());
+ // 3. schedule lesson
+ Date date = DateUtil.convertFromLAMSFlashFormat(startDate);
+ monitoringService.startLessonOnSchedule(lesson.getLessonId(), date, userMap.getUser().getUserId());
+ return lesson.getLessonId();
+ } catch (Exception e) {
+ throw new RemoteException(e.getMessage(), e);
+ }
}
public boolean deleteLearningSession(String serverId, String datetime, String hashValue,
String username, long lsId) throws RemoteException {
- return false;
+ try {
+ ExtServerOrgMap serverMap = service.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap,datetime,username,hashValue);
+ ExtUserUseridMap userMap = service.getExtUserUseridMap(serverMap, username);
+ monitoringService.removeLesson(lsId, userMap.getUser().getUserId());
+ return true;
+ }catch(Exception e){
+ throw new RemoteException(e.getMessage(), e);
+ }
}
+
+ private void createLessonClass(Lesson lesson, Organisation organisation, User creator){
+ List staffList = new LinkedList();
+ staffList.add(creator);
+ List learnerList = new LinkedList();
+ monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation,
+ "learnerGroup", learnerList, "staffGroup", staffList,
+ creator.getUserId());
+
+ }
}
Index: lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingSkeleton.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingSkeleton.java,v
diff -u -r1.1 -r1.2
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingSkeleton.java 12 Sep 2006 07:17:49 -0000 1.1
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingSkeleton.java 15 Sep 2006 01:03:22 -0000 1.2
@@ -1,8 +1,24 @@
-/**
- * LessonManagerSoapBindingSkeleton.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+/****************************************************************
+ * Copyright (C) 2006 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
+ * ****************************************************************
*/
package org.lamsfoundation.lams.webservice;
@@ -14,6 +30,12 @@
import org.apache.axis.wsdl.Skeleton;
import org.apache.axis.description.*;
+/**
+ * LessonManagerSoapBindingSkeleton.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
+ */
@SuppressWarnings( { "serial", "unchecked" })
public class LessonManagerSoapBindingSkeleton implements LessonManager, Skeleton {
private LessonManager impl;
@@ -64,9 +86,15 @@
false, false),
new ParameterDesc(new QName("", "desc"), ParameterDesc.IN, new QName(
"http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false),
+ new ParameterDesc(new QName("", "countryIsoCode"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false),
+ new ParameterDesc(new QName("", "langIsoCode"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
false, false), };
_oper = new OperationDesc("startLesson", _params, new QName("", "startLessonReturn"));
- _oper.setReturnType(new QName("http://schemas.xmlsoap.org/soap/encoding/", "int"));
+ _oper.setReturnType(new QName("http://schemas.xmlsoap.org/soap/encoding/", "long"));
_oper.setElementQName(new QName("", "startLesson"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
@@ -100,9 +128,15 @@
false, false),
new ParameterDesc(new QName("", "startDate"), ParameterDesc.IN, new QName(
"http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false),
+ new ParameterDesc(new QName("", "countryIsoCode"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false),
+ new ParameterDesc(new QName("", "langIsoCode"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
false, false), };
_oper = new OperationDesc("scheduleLesson", _params, new QName("", "scheduleLessonReturn"));
- _oper.setReturnType(new QName("http://schemas.xmlsoap.org/soap/encoding/", "int"));
+ _oper.setReturnType(new QName("http://schemas.xmlsoap.org/soap/encoding/", "long"));
_oper.setElementQName(new QName("", "scheduleLesson"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
@@ -145,18 +179,19 @@
this.impl = impl;
}
- public Integer startLesson(String serverId, String datetime, String hashValue, String username,
- long ldId, String courseId, String title, String desc) throws RemoteException {
- Integer ret = impl.startLesson(serverId, datetime, hashValue, username, ldId, courseId,
- title, desc);
+ public Long startLesson(String serverId, String datetime, String hashValue, String username,
+ long ldId, String courseId, String title, String desc, String countryIsoCode,
+ String langIsoCode) throws RemoteException {
+ Long ret = impl.startLesson(serverId, datetime, hashValue, username, ldId, courseId, title,
+ desc, countryIsoCode, langIsoCode);
return ret;
}
- public Integer scheduleLesson(String serverId, String datetime, String hashValue,
- String username, long ldId, String courseId, String title, String desc, String startDate)
- throws RemoteException {
- Integer ret = impl.scheduleLesson(serverId, datetime, hashValue, username, ldId, courseId,
- title, desc, startDate);
+ public Long scheduleLesson(String serverId, String datetime, String hashValue, String username,
+ long ldId, String courseId, String title, String desc, String startDate,
+ String countryIsoCode, String langIsoCode) throws RemoteException {
+ Long ret = impl.scheduleLesson(serverId, datetime, hashValue, username, ldId, courseId,
+ title, desc, startDate, countryIsoCode, langIsoCode);
return ret;
}