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.3 -r1.4
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java 17 Sep 2006 06:12:05 -0000 1.3
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java 20 Sep 2006 02:30:12 -0000 1.4
@@ -34,5 +34,5 @@
public interface LearningDesignRepository extends Remote {
public String getLearningDesigns(String serverId, String datetime, String hashValue,
- String username, Integer mode) throws RemoteException;
+ String username, String courseId, Integer mode, String country, String lang) throws RemoteException;
}
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.3 -r1.4
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingImpl.java 17 Sep 2006 06:12:05 -0000 1.3
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingImpl.java 20 Sep 2006 02:30:12 -0000 1.4
@@ -29,15 +29,20 @@
import java.util.List;
import java.util.Vector;
+import javax.servlet.http.HttpServlet;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.transport.http.HTTPConstants;
+import org.apache.log4j.Logger;
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.User;
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;
@@ -53,12 +58,14 @@
*/
public class LearningDesignRepositorySoapBindingImpl implements LearningDesignRepository {
- private static IntegrationService integrationService = (IntegrationService) WebApplicationContextUtils
- .getRequiredWebApplicationContext(HttpSessionManager.getInstance().getServletContext())
+ private static Logger log = Logger.getLogger(LearningDesignRepositorySoapBindingImpl.class);
+
+ private static MessageContext context = MessageContext.getCurrentContext();
+
+ private static IntegrationService integrationService = (IntegrationService) WebApplicationContextUtils.getRequiredWebApplicationContext(((HttpServlet)context.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext())
.getBean("integrationService");
- private static IWorkspaceManagementService service = (IWorkspaceManagementService) WebApplicationContextUtils
- .getRequiredWebApplicationContext(HttpSessionManager.getInstance().getServletContext())
+ private static IWorkspaceManagementService service = (IWorkspaceManagementService) WebApplicationContextUtils.getRequiredWebApplicationContext(((HttpServlet)context.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext())
.getBean("workspaceManagementService");
private static MessageService msgService = service.getMessageService();
@@ -96,51 +103,36 @@
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]
- ]
- ]
- ]
- ]
- ]
+ * 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()+']';
+ public String toString() {
+ return '[' + convert() + ']';
}
-
- String 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){
+ if (content.getResourceType().equals(FolderContentDTO.FOLDER)) {
+ sb.append("['");
+ sb.append(content.getName()).append("',").append("null").append(',');
+ if (children.size() == 0) {
sb.append("['',null]");
- }else{
+ } 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 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
- *
+ * - String as return type make webservice client end easier to be
+ * implemented. Some webservice lib in some language(like SOAP::Lite in
+ * Perl) may haven't support for complicated data structure as return type
+ * yet
*
*/
public String getLearningDesigns(String serverId, String datetime, String hashValue,
- String username, Integer mode) throws RemoteException {
+ String username, String courseId, Integer mode, String country, String lang) throws RemoteException {
try {
ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(serverId);
- Authenticator.authenticate(serverMap,datetime,username,hashValue);
+ Authenticator.authenticate(serverMap, datetime, username, hashValue);
ExtUserUseridMap userMap = integrationService.getExtUserUseridMap(serverMap, username);
- return buildContentTree(userMap.getUser().getUserId()).toString();
+ integrationService.getExtCourseClassMap(serverMap, userMap, courseId, country, lang);
+ return buildContentTree(userMap.getUser()).toString();
} catch (Exception e) {
+ log.debug(e.getMessage(),e);
throw new RemoteException(e.getMessage(), e);
}
}
- private ContentTreeNode buildContentTree(Integer userId) throws IOException,
+ private ContentTreeNode buildContentTree(User user) throws IOException,
UserAccessDeniedException, RepositoryCheckedException {
+ log.debug("User Id - "+user.getUserId());
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 userFolder = service.getUserWorkspaceFolder(user.getUserId());
+ root.addChild(buildContentTreeNode(userFolder, user.getUserId()));
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);
+ //tried using service.getAccessibleOrganisationWorkspaceFolders(userId) api,
+ //but it doesn't work, the userOrganisations set of the user
+ // got from workspaceManagementService with the userId supplied is empty, which is not true.
+ Vector orgFolders = service.getAccessibleOrganisationWorkspaceFolders(user);
for (int i = 0; i < orgFolders.size(); i++) {
FolderContentDTO orgFolder = (FolderContentDTO) orgFolders.get(i);
- dummyOrgNode.addChild(buildContentTreeNode(orgFolder, userId));
+ dummyOrgNode.addChild(buildContentTreeNode(orgFolder, user.getUserId()));
}
root.addChild(dummyOrgNode);
return root;
}
private ContentTreeNode buildContentTreeNode(FolderContentDTO folder, Integer userId)
throws UserAccessDeniedException, RepositoryCheckedException {
+ log.debug("build content tree node for folder - "+folder.getName());
ContentTreeNode node = new ContentTreeNode(folder);
if (folder.getResourceType().equals(FolderContentDTO.FOLDER)) {
WorkspaceFolder wsfolder = service
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.3 -r1.4
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingSkeleton.java 17 Sep 2006 06:12:05 -0000 1.3
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingSkeleton.java 20 Sep 2006 02:30:12 -0000 1.4
@@ -77,9 +77,18 @@
new ParameterDesc(new QName("", "username"), ParameterDesc.IN, new QName(
"http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
false, false),
+ new ParameterDesc(new QName("", "courseId"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false),
new ParameterDesc(new QName("", "mode"), ParameterDesc.IN, new QName(
"http://schemas.xmlsoap.org/soap/encoding/", "int"), Integer.class, false,
- false), };
+ false),
+ new ParameterDesc(new QName("", "country"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false),
+ new ParameterDesc(new QName("", "lang"), ParameterDesc.IN, new QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"), String.class,
+ false, false), };
_oper = new OperationDesc("getLearningDesigns", _params, new QName("",
"getLearningDesignsReturn"));
_oper.setReturnType(new QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
@@ -101,8 +110,10 @@
}
public String getLearningDesigns(String serverId, String datetime, String hashValue,
- String username, Integer mode) throws RemoteException {
- String ret = impl.getLearningDesigns(serverId, datetime, hashValue, username, mode);
+ String username, String courseId, Integer mode, String country, String lang)
+ throws RemoteException {
+ String ret = impl.getLearningDesigns(serverId, datetime, hashValue, username, courseId,
+ mode, country, lang);
return ret;
}
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.3 -r1.4
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManager.java 17 Sep 2006 06:12:05 -0000 1.3
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManager.java 20 Sep 2006 02:30:12 -0000 1.4
@@ -40,6 +40,6 @@
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,
+ public boolean deleteLesson(String serverId, String datetime, String hashValue,
String username, long lsId) throws RemoteException;
}
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.3 -r1.4
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingImpl.java 17 Sep 2006 06:12:05 -0000 1.3
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingImpl.java 20 Sep 2006 02:30:12 -0000 1.4
@@ -28,18 +28,20 @@
import java.util.LinkedList;
import java.util.List;
+import javax.servlet.http.HttpServlet;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.transport.http.HTTPConstants;
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;
/**
@@ -50,21 +52,23 @@
* @author Fei Yang
*/
public class LessonManagerSoapBindingImpl implements LessonManager {
- private static IntegrationService service = (IntegrationService) WebApplicationContextUtils
- .getRequiredWebApplicationContext(HttpSessionManager.getInstance().getServletContext())
+
+ private static MessageContext context = MessageContext.getCurrentContext();
+
+ private static IntegrationService integrationService = (IntegrationService) WebApplicationContextUtils.getRequiredWebApplicationContext(((HttpServlet)context.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext())
.getBean("integrationService");
- private static IMonitoringService monitoringService = MonitoringServiceProxy
- .getMonitoringService(HttpSessionManager.getInstance().getServletContext());
+ private static IMonitoringService monitoringService = (IMonitoringService) WebApplicationContextUtils.getRequiredWebApplicationContext(((HttpServlet)context.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext())
+ .getBean("monitoringService");
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,
+ ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap, datetime, username, hashValue);
+ ExtUserUseridMap userMap = integrationService.getExtUserUseridMap(serverMap, username);
+ ExtCourseClassMap orgMap = integrationService.getExtCourseClassMap(serverMap, userMap, courseId,
countryIsoCode, langIsoCode);
// 1. init lesson
Lesson lesson = monitoringService.initializeLesson(title, desc, ldId, orgMap
@@ -83,10 +87,10 @@
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,
+ ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap, datetime, username, hashValue);
+ ExtUserUseridMap userMap = integrationService.getExtUserUseridMap(serverMap, username);
+ ExtCourseClassMap orgMap = integrationService.getExtCourseClassMap(serverMap, userMap, courseId,
countryIsoCode, langIsoCode);
// 1. init lesson
Lesson lesson = monitoringService.initializeLesson(title, desc, ldId, orgMap
@@ -95,34 +99,35 @@
createLessonClass(lesson, orgMap.getOrganisation(), userMap.getUser());
// 3. schedule lesson
Date date = DateUtil.convertFromLAMSFlashFormat(startDate);
- monitoringService.startLessonOnSchedule(lesson.getLessonId(), date, userMap.getUser().getUserId());
+ 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,
+ public boolean deleteLesson(String serverId, String datetime, String hashValue,
String username, long lsId) throws RemoteException {
try {
- ExtServerOrgMap serverMap = service.getExtServerOrgMap(serverId);
- Authenticator.authenticate(serverMap,datetime,username,hashValue);
- ExtUserUseridMap userMap = service.getExtUserUseridMap(serverMap, username);
+ ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(serverId);
+ Authenticator.authenticate(serverMap, datetime, username, hashValue);
+ ExtUserUseridMap userMap = integrationService.getExtUserUseridMap(serverMap, username);
monitoringService.removeLesson(lsId, userMap.getUser().getUserId());
return true;
- }catch(Exception e){
+ } catch (Exception e) {
throw new RemoteException(e.getMessage(), e);
}
}
-
- private void createLessonClass(Lesson lesson, Organisation organisation, User creator){
+
+ 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());
-
+ monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation,
+ organisation.getName() + "Learners", learnerList, organisation.getName() + "Staff",
+ 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.3 -r1.4
--- lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingSkeleton.java 17 Sep 2006 06:12:05 -0000 1.3
+++ lams_central/src/java/org/lamsfoundation/lams/webservice/LessonManagerSoapBindingSkeleton.java 20 Sep 2006 02:30:12 -0000 1.4
@@ -159,16 +159,16 @@
false, false),
new ParameterDesc(new QName("", "lsId"), ParameterDesc.IN, new QName(
"http://www.w3.org/2001/XMLSchema", "long"), long.class, false, false), };
- _oper = new OperationDesc("deleteLearningSession", _params, new QName("",
- "deleteLearningSessionReturn"));
+ _oper = new OperationDesc("deleteLesson", _params, new QName("",
+ "deleteLessonReturn"));
_oper.setReturnType(new QName("http://www.w3.org/2001/XMLSchema", "boolean"));
- _oper.setElementQName(new QName("", "deleteLearningSession"));
+ _oper.setElementQName(new QName("", "deleteLesson"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
- if (_myOperations.get("deleteLearningSession") == null) {
- _myOperations.put("deleteLearningSession", new ArrayList());
+ if (_myOperations.get("deleteLesson") == null) {
+ _myOperations.put("deleteLesson", new ArrayList());
}
- ((List) _myOperations.get("deleteLearningSession")).add(_oper);
+ ((List) _myOperations.get("deleteLesson")).add(_oper);
}
public LessonManagerSoapBindingSkeleton() {
@@ -195,9 +195,9 @@
return ret;
}
- public boolean deleteLearningSession(String serverId, String datetime, String hashValue,
+ public boolean deleteLesson(String serverId, String datetime, String hashValue,
String username, long lsId) throws RemoteException {
- boolean ret = impl.deleteLearningSession(serverId, datetime, hashValue, username, lsId);
+ boolean ret = impl.deleteLesson(serverId, datetime, hashValue, username, lsId);
return ret;
}