Index: lams_admin/.classpath =================================================================== diff -u -r0fdf00ad8ffebc0cc6d79de96a216c08ce0d4cdf -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_admin/.classpath (.../.classpath) (revision 0fdf00ad8ffebc0cc6d79de96a216c08ce0d4cdf) +++ lams_admin/.classpath (.../.classpath) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -13,7 +13,8 @@ - + + Index: lams_admin/conf/xdoclet/struts-forms.xml =================================================================== diff -u -rcf655d5d4ab3f7e0036816b678d39e18d284bfa3 -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_admin/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision cf655d5d4ab3f7e0036816b678d39e18d284bfa3) +++ lams_admin/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -84,6 +84,7 @@ + Index: lams_admin/web/servermaintain.jsp =================================================================== diff -u -rac174824b862fb7976c0b767a16232106c5a5373 -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_admin/web/servermaintain.jsp (.../servermaintain.jsp) (revision ac174824b862fb7976c0b767a16232106c5a5373) +++ lams_admin/web/servermaintain.jsp (.../servermaintain.jsp) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -88,6 +88,10 @@ : + + : + +
@@ -130,7 +134,6 @@ prefix: "${namev}", userinfoUrl: "${namev}", timeoutUrl: "${namev}", - timeoutUrl: "${namev}", timeToLiveLoginRequest: { required: "${namev}", min: "" Index: lams_central/.classpath =================================================================== diff -u -r8482164570cc9e8db87a1419dc6944c58553b327 -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_central/.classpath (.../.classpath) (revision 8482164570cc9e8db87a1419dc6944c58553b327) +++ lams_central/.classpath (.../.classpath) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -39,5 +39,6 @@ + Index: lams_central/src/java/org/lamsfoundation/lams/web/OrganisationGroupAction.java =================================================================== diff -u -r4ab4ba6ef63a831648ca63ca4d91edd4c0fba55f -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_central/src/java/org/lamsfoundation/lams/web/OrganisationGroupAction.java (.../OrganisationGroupAction.java) (revision 4ab4ba6ef63a831648ca63ca4d91edd4c0fba55f) +++ lams_central/src/java/org/lamsfoundation/lams/web/OrganisationGroupAction.java (.../OrganisationGroupAction.java) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -24,6 +24,7 @@ package org.lamsfoundation.lams.web; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -39,6 +40,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.commons.collections.CollectionUtils; import org.apache.log4j.Logger; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; @@ -48,6 +50,8 @@ import org.apache.tomcat.util.json.JSONException; import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.contentrepository.InvalidParameterException; +import org.lamsfoundation.lams.integration.dto.ExtGroupDTO; +import org.lamsfoundation.lams.integration.service.IIntegrationService; import org.lamsfoundation.lams.learningdesign.Group; import org.lamsfoundation.lams.learningdesign.GroupComparator; import org.lamsfoundation.lams.learningdesign.Grouping; @@ -73,6 +77,7 @@ * @struts.action path = "/OrganisationGroup" parameter = "method" validate = "false" * @struts.action-forward name = "viewGroupings" path = "/orgGrouping.jsp" * @struts.action-forward name = "viewGroups" path = "/orgGroup.jsp" + * @struts.action-forward name = "viewExtGroups" path = "/extGroups.jsp" */ public class OrganisationGroupAction extends DispatchAction { /** @@ -141,18 +146,19 @@ private static IUserManagementService userManagementService; private static ILessonService lessonService; private static ISecurityService securityService; + private static IIntegrationService integrationService; private static final String MAPPING_VIEW_GROUPINGS = "viewGroupings"; private static final String MAPPING_VIEW_GROUPS = "viewGroups"; + private static final String MAPPING_VIEW_EXT_GROUPS = "viewExtGroups"; /** * Shows course grouping list or redirects to groups if a grouping was already chosen. - * - * @throws IOException + * @throws Exception */ @SuppressWarnings("unchecked") public ActionForward viewGroupings(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws JSONException, IOException { + HttpServletResponse response) throws Exception { Long activityID = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID, true); boolean lessonGroupsExist = getLessonGrouping(request, activityID, false) != null; if (lessonGroupsExist) { @@ -162,9 +168,9 @@ Integer userId = getUserDTO().getUserID(); Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); + Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID, true); if (organisationId == null) { // read organisation ID from lesson - Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); organisationId = ((Lesson) getUserManagementService().findById(Lesson.class, lessonId)).getOrganisation() .getOrganisationId(); } @@ -177,35 +183,46 @@ return null; } - boolean isGroupSuperuser = getUserManagementService().isUserInRole(userId, organisationId, Role.GROUP_ADMIN) - || getUserManagementService().isUserInRole(userId, organisationId, Role.GROUP_MANAGER); - if (OrganisationGroupAction.log.isDebugEnabled()) { OrganisationGroupAction.log.debug("Displaying course groupings for user " + userId + " and organisation " + organisationId); } request.setAttribute(AttributeNames.PARAM_ORGANISATION_ID, organisationId); - request.setAttribute("canEdit", isGroupSuperuser || (activityID != null)); - Set orgGroupingDTOs = new TreeSet(); - List orgGroupings = getUserManagementService().findByProperty(OrganisationGrouping.class, - "organisationId", organisationId); - for (OrganisationGrouping orgGrouping : orgGroupings) { - orgGroupingDTOs.add(new OrganisationGroupingDTO(orgGrouping)); + // if this is a chosen group and lesson is created using integrations - show groups received from LMS instead of actual LAMS ones + if (lessonId != null && getIntegrationService().isIntegratedServerGroupFetchingAvailable(lessonId)) { + List extGroups = getIntegrationService().getExtGroups(lessonId, null); + request.setAttribute("extGroups", extGroups); + // TODO ? show only with user number >0 + return mapping.findForward(OrganisationGroupAction.MAPPING_VIEW_EXT_GROUPS); + + } else { + + boolean isGroupSuperuser = getUserManagementService() + .isUserInRole(userId, organisationId, Role.GROUP_ADMIN) + || getUserManagementService().isUserInRole(userId, organisationId, Role.GROUP_MANAGER); + request.setAttribute("canEdit", isGroupSuperuser || (activityID != null)); + + Set orgGroupingDTOs = new TreeSet(); + List orgGroupings = getUserManagementService().findByProperty( + OrganisationGrouping.class, "organisationId", organisationId); + for (OrganisationGrouping orgGrouping : orgGroupings) { + orgGroupingDTOs.add(new OrganisationGroupingDTO(orgGrouping)); + } + request.setAttribute("groupings", orgGroupingDTOs); + + return mapping.findForward(OrganisationGroupAction.MAPPING_VIEW_GROUPINGS); } - request.setAttribute("groupings", orgGroupingDTOs); - return mapping.findForward(OrganisationGroupAction.MAPPING_VIEW_GROUPINGS); } /** * View groups of the given grouping. - * - * @throws IOException + * @throws Exception */ @SuppressWarnings("unchecked") public ActionForward viewGroups(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws JSONException, IOException { + HttpServletResponse response) throws Exception { Integer userId = getUserDTO().getUserID(); Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true); Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID, true); @@ -248,11 +265,16 @@ orgGroupingJSON.put("name", orgGrouping.getName()); } } + + //selected groups from integrated server + String[] extGroupIds = request.getParameterValues("extGroupIds"); + boolean isExternalGroupsSelected = extGroupIds != null && extGroupIds.length > 0; // check if any groups already exist in this grouping Grouping lessonGrouping = getLessonGrouping(request, activityId, true); Set lessonGroups = lessonGrouping == null ? null : lessonGrouping.getGroups(); - if ((activityId != null) && (orgGroupingId != null) && isDefaultChosenGrouping(lessonGrouping)) { + if ((activityId != null) && (lessonGrouping != null) && (isExternalGroupsSelected || (orgGroupingId != null)) + && isDefaultChosenGrouping(lessonGrouping)) { if (OrganisationGroupAction.log.isDebugEnabled()) { OrganisationGroupAction.log.debug("Removing default groups for grouping " + orgGroupingId); } @@ -268,16 +290,73 @@ lessonGroups = null; } - JSONArray orgGroupsJSON = null; + JSONArray orgGroupsJSON = new JSONArray(); Collection learners = null; - // select source for groups (course or lesson) - if ((lessonGroups == null) || lessonGroups.isEmpty()) { + // if teacher selected groups from integrated server - show them + if (isExternalGroupsSelected) { + + if (lesson == null) { + lesson = (Lesson) getUserManagementService().findById(Lesson.class, lessonId); + } + learners = lesson.getLessonClass().getLearners(); + + //request all users from selected groups from integrated server + List extGroups = getIntegrationService().getExtGroups(lessonId, extGroupIds); + + // serialize database group objects into JSON + if (extGroups != null) { + + //if there are duplicate users - put them into unassigned column + List allDuplicates = new ArrayList(); + for (ExtGroupDTO groupA : extGroups) { + for (ExtGroupDTO groupB : extGroups) { + List usersA = groupA.getUsers(); + List usersB = groupB.getUsers(); + + //proceed for non empty and different groups + if ((usersA != null) && (usersB != null) && !groupA.getGroupId().equals(groupB.getGroupId())) { + + Collection duplicates = CollectionUtils.intersection(usersA, usersB); + allDuplicates.addAll(duplicates); + + usersA.removeAll(duplicates); + usersB.removeAll(duplicates); + } + + } + } + + // sort groups by their name + Collections.sort(extGroups); + for (ExtGroupDTO extGroup : extGroups) { + JSONObject groupJSON = new JSONObject(); + groupJSON.put("name", extGroup.getGroupName()); + groupJSON.put("groupId", extGroup.getGroupId()); + if (extGroup.getUsers() != null) { + for (User groupUser : (List) extGroup.getUsers()) { + JSONObject groupUserJSON = WebUtil.userToJSON(groupUser); + groupJSON.append("users", groupUserJSON); + + // remove the user who is already assigned to a group + learners.remove(groupUser); + } + } + orgGroupsJSON.put(groupJSON); + } + } + + // if groups haven't been selected yet - show all available groups in organisation + } else if ((lessonGroups == null) || lessonGroups.isEmpty()) { + learners = getUserManagementService().getUsersFromOrganisationByRole(organisationId, Role.LEARNER, false, true); Set orgGroups = orgGrouping == null ? null : orgGrouping.getGroups(); orgGroupsJSON = getOrgGroupsDetails(orgGroups, learners); + + // show already selected groups } else { + if (lesson == null) { lesson = (Lesson) getUserManagementService().findById(Lesson.class, lessonId); } @@ -394,11 +473,10 @@ /** * Deletes course grouping with the given ID. - * - * @throws IOException + * @throws Exception */ public ActionForward removeGrouping(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws JSONException, IOException { + HttpServletResponse response) throws Exception { // check if user is allowed to edit groups Integer userId = getUserDTO().getUserID(); int organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); @@ -557,4 +635,13 @@ } return OrganisationGroupAction.securityService; } + + private IIntegrationService getIntegrationService() { + if (OrganisationGroupAction.integrationService == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + OrganisationGroupAction.integrationService = (IIntegrationService) ctx.getBean("integrationService"); + } + return OrganisationGroupAction.integrationService; + } } \ No newline at end of file Index: lams_central/web/extGroups.jsp =================================================================== diff -u --- lams_central/web/extGroups.jsp (revision 0) +++ lams_central/web/extGroups.jsp (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -0,0 +1,43 @@ +<%@ page contentType="text/html; charset=utf-8" language="java"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-core" prefix="c"%> + + + + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + + + + ( ${group.numberUsers}) + +
+
+ + + +
+ +
\ No newline at end of file Index: lams_common/.classpath =================================================================== diff -u -r9a097b9b5569beca5152ad9bf5d94212ba148611 -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_common/.classpath (.../.classpath) (revision 9a097b9b5569beca5152ad9bf5d94212ba148611) +++ lams_common/.classpath (.../.classpath) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -26,7 +26,7 @@ - + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml =================================================================== diff -u -rac174824b862fb7976c0b767a16232106c5a5373 -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml (.../ExtServerOrgMap.hbm.xml) (revision ac174824b862fb7976c0b767a16232106c5a5373) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/integration/ExtServerOrgMap.hbm.xml (.../ExtServerOrgMap.hbm.xml) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -115,6 +115,16 @@ length="65535" not-null="false" /> + + getExtGroups(Long lessonId, String[] extGroupIds) throws Exception; } Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java =================================================================== diff -u -ra939bcf145b0e4deab5838f87b047df5ca48c92d -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision a939bcf145b0e4deab5838f87b047df5ca48c92d) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -34,23 +34,29 @@ import java.net.URLConnection; import java.net.URLEncoder; import java.text.ParseException; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.apache.tomcat.util.json.JSONArray; +import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.integration.ExtCourseClassMap; import org.lamsfoundation.lams.integration.ExtServerLessonMap; import org.lamsfoundation.lams.integration.ExtServerOrgMap; import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.integration.ExtUserUseridMap; import org.lamsfoundation.lams.integration.UserInfoFetchException; import org.lamsfoundation.lams.integration.UserInfoValidationException; +import org.lamsfoundation.lams.integration.dto.ExtGroupDTO; import org.lamsfoundation.lams.integration.security.RandomPasswordGenerator; +import org.lamsfoundation.lams.integration.util.GroupInfoFetchException; import org.lamsfoundation.lams.integration.util.LoginRequestDispatcher; import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.service.ILessonService; import org.lamsfoundation.lams.usermanagement.AuthenticationMethod; import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.OrganisationState; @@ -64,6 +70,7 @@ import org.lamsfoundation.lams.util.HashUtil; import org.lamsfoundation.lams.util.LanguageUtil; import org.lamsfoundation.lams.util.ValidationUtil; +import org.lamsfoundation.lams.util.WebUtil; /** *

@@ -77,15 +84,8 @@ private static Logger log = Logger.getLogger(IntegrationService.class); private IUserManagementService service; + private ILessonService lessonService; - public IUserManagementService getService() { - return service; - } - - public void setService(IUserManagementService service) { - this.service = service; - } - @Override public ExtServerOrgMap getExtServerOrgMap(String serverId) { List list = service.findByProperty(ExtServerOrgMap.class, "serverid", serverId); @@ -561,7 +561,7 @@ @Override public String getLessonFinishCallbackUrl(User user, Lesson lesson) throws UnsupportedEncodingException { // the callback url must contain %username%, %lessonid%, %timestamp% and %hash% eg: - // "http://test100.ics.mq.edu.au/webapps/lams-plglamscontent-bb_bb60/UserData?uid=%username%&lessonid=%lessonid%&ts=%timestamp%&hash=%hash%"; + // "http://server.com/lams--bb/UserData?uid=%username%&lessonid=%lessonid%&ts=%timestamp%&hash=%hash%"; // where %username%, %lessonid%, %timestamp% and %hash% will be replaced with their real values String lessonFinishCallbackUrl = null; @@ -594,7 +594,151 @@ return lessonFinishCallbackUrl; } + + @Override + public boolean isIntegratedServerGroupFetchingAvailable(Long lessonId) { + boolean isIntegratedServerGroupFetchingAvailable = false; + if (lessonId != null) { + ExtServerLessonMap extServerLesson = getExtServerLessonMap(lessonId); + isIntegratedServerGroupFetchingAvailable = (extServerLesson != null) + && StringUtils.isNotBlank(extServerLesson.getExtServer().getExtGroupsUrl()); + } + + return isIntegratedServerGroupFetchingAvailable; + } + + @Override + public List getExtGroups(Long lessonId, String[] extGroupIds) throws Exception { + // the callback url must contain %username%, %lessonid%, %timestamp% and %hash% eg: + // "http://server.org/lams-bb/UserData?uid=%username%&lessonid=%lessonid%&ts=%timestamp%&hash=%hash%"; + // where %username%, %lessonid%, %timestamp% and %hash% will be replaced with their real values + + if (lessonId == null) { + throw new GroupInfoFetchException("Fail to fetch group data from external server:" + + " specified lessonId is null"); + } + + Lesson lesson = (Lesson) service.findById(Lesson.class, lessonId); + if (lesson == null) { + throw new GroupInfoFetchException("Fail to fetch group data from external server:" + + " specified lesson is null"); + } + Organisation organisation = lesson.getOrganisation(); + Integer organisationId = lesson.getOrganisation().getOrganisationId(); + + ExtServerLessonMap extServerLesson = getExtServerLessonMap(lessonId); + ExtCourseClassMap extCourse = getExtCourseClassMap(organisationId); + + // checks whether the lesson was created from extServer and whether it has lessonFinishCallbackUrl setting + if (extServerLesson == null) { + throw new GroupInfoFetchException("Fail to fetch group data from external server:" + + " there is no corresponding ExtServerLessonMap for lessonId " + lessonId); + } + + if (StringUtils.isBlank(extServerLesson.getExtServer().getExtGroupsUrl())) { + throw new GroupInfoFetchException("Fail to fetch group data from external server:" + + " corresponding ExtCourseClassMap doesn't have extGroupsUrl specified."); + } + + if (extCourse == null) { + throw new GroupInfoFetchException("Fail to fetch group data from external server:" + + " there is no corresponding ExtCourseClassMap for lessonId " + lessonId); + } + + ExtServerOrgMap serverMap = extServerLesson.getExtServer(); + + // construct real lessonFinishCallbackUrl + String lmsGroupsUrl = serverMap.getExtGroupsUrl(); + + //in case group info is also requested - provide selected groups' ids + if (extGroupIds != null && extGroupIds.length > 0) { + + if (!lmsGroupsUrl.contains("?")) { + lmsGroupsUrl += "?"; + } + String extGroupIdsParam = ""; + for (String extGroupId : extGroupIds) { + extGroupIdsParam += "&extGroupIds=" + extGroupId; + } + lmsGroupsUrl += extGroupIdsParam; + } + + String timestamp = Long.toString(new Date().getTime()); + String hashUsername = "username"; + String hash = hash(serverMap, hashUsername, timestamp); + + // set values for the parameters + HashMap params = new HashMap(); + params.put("uid", hashUsername); + params.put("ts", timestamp); + params.put("hash", hash); + params.put("course_id", extCourse.getCourseid()); + + // send the request to the external server + InputStream is = WebUtil.getResponseInputStreamFromExternalServer(lmsGroupsUrl, params); + BufferedReader isReader = new BufferedReader(new InputStreamReader(is)); + String str = isReader.readLine(); + + JSONArray jsonGroups = new JSONArray(str); + List extGroups = new ArrayList(); + for (int i = 0; i < jsonGroups.length(); i++) { + JSONObject jsonGroup = jsonGroups.getJSONObject(i); + ExtGroupDTO group = new ExtGroupDTO(); + group.setGroupName(jsonGroup.getString("groupName")); + group.setGroupId(jsonGroup.getString("groupId")); + extGroups.add(group); + + // in case group info is also requested - provide selected groups' ids + if (extGroupIds != null && extGroupIds.length > 0) { + ArrayList users = new ArrayList(); + + JSONArray jsonUsers = jsonGroup.getJSONArray("users"); + for (int j = 0; j < jsonUsers.length(); j++) { + JSONObject jsonUser = jsonUsers.getJSONObject(j); + + String extUsername = jsonUser.getString("userName"); + + ExtUserUseridMap extUserUseridMap = getExistingExtUserUseridMap(serverMap, extUsername); + + //create extUserUseridMap if it's not available + if (extUserUseridMap == null) { + // User properties list format: ,<First name>,<Last name>,<Address>,<City>,<State>, + // <Postcode>,<Country>,<Day time number>,<Mobile number>,<Fax number>,<Email>,<Locale + // language>,<Locale country> + String[] userData = new String[14]; + for (int k=1; k <= 14; k++) { + String userProperty = jsonUser.getString("" + k); + userData[k-1] = userProperty; + } + String salt = HashUtil.salt(); + String password = HashUtil.sha1(RandomPasswordGenerator.nextPassword(10)); + extUserUseridMap = createExtUserUseridMap(serverMap, extUsername, password, salt, userData, true); + } + User user = extUserUseridMap.getUser(); + Integer userId = extUserUseridMap.getUser().getUserId(); + + //add user to organisation if it's not there + updateUserRoles(user, organisation, false); + + //check if user belong to the lesson. and if not - add it + if (!lesson.getLessonClass().getLearnersGroup().hasLearner(user)) { + lessonService.addLearner(lessonId, userId); + } + + users.add(user); + } + + group.setUsers(users); + } else { + group.setNumberUsers(jsonGroup.getInt("groupSize")); + } + + } + + return extGroups; + } + private ExtServerLessonMap getExtServerLessonMap(Long lessonId) { List list = service.findByProperty(ExtServerLessonMap.class, "lessonId", lessonId); if ((list == null) || (list.size() == 0)) { @@ -615,4 +759,21 @@ return (ExtUserUseridMap) list.get(0); } } + + private ExtCourseClassMap getExtCourseClassMap(Integer organisationId) { + List list = service.findByProperty(ExtCourseClassMap.class, "organisation.organisationId", organisationId); + if (list == null || list.size() == 0) { + return null; + } else { + return (ExtCourseClassMap) list.get(0); + } + } + + public void setService(IUserManagementService service) { + this.service = service; + } + + public void setLessonService(ILessonService lessonService) { + this.lessonService = lessonService; + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/integration/util/GroupInfoFetchException.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/integration/util/GroupInfoFetchException.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/integration/util/GroupInfoFetchException.java (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -0,0 +1,61 @@ +/**************************************************************** + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.integration.util; + +/** + * <p> + * <a href="GroupInfoFetchException.java.html"><i>View Source</i><a> + * </p> + * + * @author Andrey Balan + */ +@SuppressWarnings("serial") +public class GroupInfoFetchException extends Exception { + + public GroupInfoFetchException() { + } + + /** + * @param message + */ + public GroupInfoFetchException(String message) { + super(message); + } + + /** + * @param cause + */ + public GroupInfoFetchException(Throwable cause) { + super(cause); + } + + /** + * @param message + * @param cause + */ + public GroupInfoFetchException(String message, Throwable cause) { + super(message, cause); + } + +} Index: lams_common/src/java/org/lamsfoundation/lams/integrationContext.xml =================================================================== diff -u -ra6641bf9262a01d07740a517643f8fe187ec5b1f -rd0a703641dee45b84a2cd9a011376a8f0d72c9fb --- lams_common/src/java/org/lamsfoundation/lams/integrationContext.xml (.../integrationContext.xml) (revision a6641bf9262a01d07740a517643f8fe187ec5b1f) +++ lams_common/src/java/org/lamsfoundation/lams/integrationContext.xml (.../integrationContext.xml) (revision d0a703641dee45b84a2cd9a011376a8f0d72c9fb) @@ -7,6 +7,7 @@ <bean id="integrationServiceTarget" class="org.lamsfoundation.lams.integration.service.IntegrationService"> <property name="service"><ref bean="userManagementService"/></property> + <property name="lessonService"><ref bean="lessonService"/></property> </bean> <bean id="integrationService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">