Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java,v diff -u -r1.47 -r1.48 --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java 15 Aug 2007 01:53:15 -0000 1.47 +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java 20 Aug 2007 02:20:21 -0000 1.48 @@ -75,11 +75,14 @@ import org.lamsfoundation.lams.lesson.service.ILessonService; import org.lamsfoundation.lams.monitoring.service.IMonitoringService; import org.lamsfoundation.lams.monitoring.service.MonitoringServiceException; +import org.lamsfoundation.lams.tool.OutputType; import org.lamsfoundation.lams.tool.SystemTool; import org.lamsfoundation.lams.tool.Tool; import org.lamsfoundation.lams.tool.ToolContentIDGenerator; +import org.lamsfoundation.lams.tool.ToolOutputDefinition; import org.lamsfoundation.lams.tool.dao.hibernate.SystemToolDAO; import org.lamsfoundation.lams.tool.dao.hibernate.ToolDAO; +import org.lamsfoundation.lams.tool.dto.ToolOutputDefinitionDTO; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.service.ILamsCoreToolService; @@ -281,6 +284,29 @@ * Utility/Service Methods * *******************************************/ + /** + * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolOutputDefinitions(java.lang.Long) + */ + public String getToolOutputDefinitions(Long toolContentID)throws IOException{ + // create dummy wddx packet to return + FlashMessage flashMessage = null; + + ToolOutputDefinition definition = new ToolOutputDefinition(); + definition.setName("USERS_MARK"); + definition.setDescription("User's mark from a Quiz"); + definition.setType(OutputType.OUTPUT_LONG); + definition.setStartValue(new Long(0)); + definition.setEndValue(new Long(10)); + + ToolOutputDefinitionDTO dto = new ToolOutputDefinitionDTO(definition); + + if(dto != null) { + flashMessage = new FlashMessage("getToolOutputDefinitions", dto); + } + + return flashMessage.serializeMessage(); + } + /** * @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getLearningDesignDetails(java.lang.Long) */ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java,v diff -u -r1.20 -r1.21 --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java 9 May 2007 01:03:36 -0000 1.20 +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/IAuthoringService.java 20 Aug 2007 02:20:21 -0000 1.21 @@ -161,6 +161,15 @@ public Vector getToolActivities(Long learningDesignId); /** + * This method returns a output definitions of the Tool + * in WDDX format. + * + * @return String The required definitions in WDDX format + * @throws IOException + */ + public String getToolOutputDefinitions(Long toolContentID)throws IOException; + + /** * This method returns a list of all available Learning Designs * in WDDX format. * Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java,v diff -u -r1.20 -r1.21 --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java 28 Jun 2007 01:54:26 -0000 1.20 +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringAction.java 20 Aug 2007 02:20:22 -0000 1.21 @@ -92,6 +92,23 @@ return null; } + public ActionForward getToolOutputDefinitions(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + String wddxPacket; + IAuthoringService authoringService = getAuthoringService(); + try { + Long toolContentID = new Long(WebUtil.readLongParam(request,"toolContentID")); + + wddxPacket = authoringService.getToolOutputDefinitions(toolContentID); + + } catch (Exception e) { + wddxPacket = handleException(e, "getLearningDesignDetails", authoringService).serializeMessage(); + } + return outputPacket(mapping, request, response, wddxPacket, "definitions"); + } + public ActionForward getLearningDesignDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, Index: lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolOutputDefinitionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolOutputDefinitionDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/tool/dto/ToolOutputDefinitionDTO.java 20 Aug 2007 02:20:22 -0000 1.1 @@ -0,0 +1,113 @@ +/**************************************************************** + * 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: ToolOutputDefinitionDTO.java,v 1.1 2007/08/20 02:20:22 mseaton Exp $$ */ +package org.lamsfoundation.lams.tool.dto; + +import org.lamsfoundation.lams.tool.ToolOutputDefinition; + +/** + * @author Mitchell Seaton + * + * This class acts as a data transfer object for + * transferring information between FLASH and the core module. + * + * This class is required in the authoring enviornment to pass + * information about the ToolOutput for a ToolActivity + */ +public class ToolOutputDefinitionDTO { + + private String name; + private String description; + private String type; + private String startValue; + private String endValue; + private String complexDefinition; + + public ToolOutputDefinitionDTO(String name, String description, String type, String startValue, String endValue, String complexDefinition) { + super(); + this.name = name; + this.description = description; + this.type = type; + this.startValue = startValue; + this.endValue = endValue; + this.complexDefinition = complexDefinition; + } + + public ToolOutputDefinitionDTO(ToolOutputDefinition definition) { + super(); + this.name = definition.getName(); + this.description = definition.getDescription(); + this.type = (definition.getType() != null)? definition.getType().toString() : null; + this.startValue = (definition.getStartValue() != null) ? definition.getStartValue().toString() : null; + this.endValue = (definition.getEndValue() != null) ? definition.getEndValue().toString() : null; + this.complexDefinition = (definition.getComplexDefinition() != null) ? definition.getComplexDefinition().toString() : null; + } + + /** + * Returns the name. + * @return + */ + public String getName() { + return name; + } + + /** + * Returns the description. + * @return + */ + public String getDescription() { + return description; + } + + /** + * Returns the output type. + * @return + */ + public String getType() { + return type; + } + + /** + * Returns the start value. + * @return + */ + public String getStartValue() { + return startValue; + } + + /** + * Returns the end value. + * @return + */ + public String getEndValue() { + return endValue; + } + + /** + * Returns the complex definition. + * @return + */ + public String getComplexDefinition() { + return complexDefinition; + } +}