Skip to content
Browse files

NOJIRA Initial import.

git-svn-id: https://source.jasig.org/sandbox/CoursesPortlet/trunk@23323 f5dbab47-78f9-eb45-b975-e544023573eb
  • Loading branch information...
1 parent b513a32 commit 57a734f0499ab7aa282a0fce1f716b8aa4d7acc6 @bourey bourey committed Apr 6, 2011
Showing with 1,456 additions and 0 deletions.
  1. +22 −0 LICENSE
  2. +47 −0 NOTICE
  3. +43 −0 docs/import/courses.portlet.xml
  4. +283 −0 pom.xml
  5. +31 −0 src/main/binding/bindings.xjb
  6. +30 −0 src/main/java/org/jasig/portlet/courses/dao/ICoursesDao.java
  7. +70 −0 src/main/java/org/jasig/portlet/courses/dao/xml/MockCoursesDaoImpl.java
  8. +29 −0 src/main/java/org/jasig/portlet/courses/model/wrapper/AnnouncementWrapper.java
  9. +37 −0 src/main/java/org/jasig/portlet/courses/model/wrapper/CourseSummaryWrapper.java
  10. +37 −0 src/main/java/org/jasig/portlet/courses/model/wrapper/CourseWrapper.java
  11. +42 −0 src/main/java/org/jasig/portlet/courses/model/wrapper/ObjectFactoryWrapper.java
  12. +49 −0 src/main/java/org/jasig/portlet/courses/mvc/MinimizedStateHandlerInterceptor.java
  13. +74 −0 src/main/java/org/jasig/portlet/courses/mvc/portlet/CoursesPortletController.java
  14. +20 −0 src/main/resources/log4j.properties
  15. +133 −0 src/main/resources/mock-data/mock-course-summary.xml
  16. +82 −0 src/main/resources/xsd/course-summary.xsd
  17. +39 −0 src/main/webapp/WEB-INF/context/applicationContext.xml
  18. +37 −0 src/main/webapp/WEB-INF/context/portlet/courses.xml
  19. +62 −0 src/main/webapp/WEB-INF/jsp/courseDetail.jsp
  20. +53 −0 src/main/webapp/WEB-INF/jsp/courseList.jsp
  21. +34 −0 src/main/webapp/WEB-INF/jsp/include.jsp
  22. +46 −0 src/main/webapp/WEB-INF/portlet.xml
  23. +61 −0 src/main/webapp/WEB-INF/web.xml
  24. BIN src/main/webapp/notepad.png
  25. +62 −0 src/test/java/org/jasig/portlet/courses/dao/xml/XMLCoursesDaoImplTest.java
  26. +33 −0 src/test/resources/testContext.xml
View
22 LICENSE
@@ -0,0 +1,22 @@
+
+Copyright (c) 2008, News Reader Portlet Development Team
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+ disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name of the News Reader Portlet Development Team nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
View
47 NOTICE
@@ -0,0 +1,47 @@
+Copyright 2010, JA-SIG, Inc.
+This project includes software developed by Jasig.
+http://www.jasig.org/
+
+Licensed under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+This project includes:
+ AOP alliance under Public Domain
+ Commons Collections under The Apache Software License, Version 2.0
+ Commons Logging under The Apache Software License, Version 2.0
+ CoursePortlet under Apache License Version 2.0
+ Hamcrest Core under BSD style
+ JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0
+ JAXB API bundle for GlassFish V3 under CDDL 1.1 or GPL2 w/ CPE
+ JAXB RI under CDDL 1.1 or GPL2 w/ CPE
+ JAXB2 Basics - Runtime under BSD-Style License
+ jstl under Commons Development and Distribution License, Version 1.0
+ JUnit under Common Public License Version 1.0
+ Lang under The Apache Software License, Version 2.0
+ Log4j under The Apache Software License, Version 2.0
+ Mockito under The MIT License
+ Objenesis under MIT License
+ Portlet API under Commons Development and Distribution License, Version 1.0
+ servlet-api under Commons Development and Distribution License, Version 1.0
+ Spring Framework: AOP under The Apache Software License, Version 2.0
+ Spring Framework: Beans under The Apache Software License, Version 2.0
+ Spring Framework: Context under The Apache Software License, Version 2.0
+ Spring Framework: Context Support under The Apache Software License, Version 2.0
+ Spring Framework: Core under The Apache Software License, Version 2.0
+ Spring Framework: Test under The Apache Software License, Version 2.0
+ Spring Framework: Web under The Apache Software License, Version 2.0
+ Spring Framework: Web MVC under The Apache Software License, Version 2.0
+ Spring Framework: Web MVC Portlet under The Apache Software License, Version 2.0
+ standard under Apache License, Version 2.0
+ Streaming API for XML under GNU General Public Library or COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
View
43 docs/import/courses.portlet.xml
@@ -0,0 +1,43 @@
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<portlet-definition
+ xmlns="https://source.jasig.org/schemas/uportal/io/portlet-definition"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="https://source.jasig.org/schemas/uportal/io/portlet-definition ../../../resources/xsd/io/portlet-definition/portlet-definition-4.0.xsd"
+ version="4.0">
+ <title>Courses</title>
+ <name>Courses</name>
+ <fname>courses</fname>
+ <desc>Course links and announcements</desc>
+ <type>Portlet</type>
+ <timeout>60000</timeout>
+ <portlet-descriptor>
+ <webAppName>/CoursesPortlet</webAppName>
+ <portletName>courses</portletName>
+ </portlet-descriptor>
+ <category>Academics</category>
+ <group>Everyone</group>
+ <parameter>
+ <name>iconUrl</name>
+ <value>/CoursesPortlet/notepad.png</value>
+ </parameter>
+</portlet-definition>
View
283 pom.xml
@@ -0,0 +1,283 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.jasig.parent</groupId>
+ <artifactId>jasig-parent</artifactId>
+ <version>30</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jasig.portlet.courses</groupId>
+ <artifactId>CoursesPortlet</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>CoursePortlet</name>
+
+ <repositories>
+ <repository>
+ <id>java.net repository</id>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <properties>
+ <mockito.version>1.8.4</mockito.version>
+ <spring.version>2.5.6.SEC02</spring.version>
+ <jaxb2basics.version>0.6.0</jaxb2basics.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>jaxb2-basics-runtime</artifactId>
+ <version>${jaxb2basics.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc-portlet</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>jaxb2-basics-runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc-portlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>taglibs</groupId>
+ <artifactId>standard</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Generates JAXB binding classes -->
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.7.4</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <bindingDirectory>src/main/binding</bindingDirectory>
+ <schemaDirectory>src/main/resources/xsd</schemaDirectory>
+ <schemaIncludes>
+ <include>*.xsd</include>
+ </schemaIncludes>
+ <episode>false</episode>
+ <extension>true</extension>
+ <args>
+ <arg>-XtoString</arg>
+ <arg>-Xequals</arg>
+ <arg>-XhashCode</arg>
+ </args>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>jaxb2-basics</artifactId>
+ <version>${jaxb2basics.version}</version>
+ </plugin>
+ </plugins>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>com.mycila.maven-license-plugin</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>target/**</exclude>
+ <exclude>src/main/webapp/rs/**</exclude>
+ </excludes>
+ <mapping>
+ <crn>XML_STYLE</crn>
+ </mapping>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <attachClasses>true</attachClasses>
+ <warName>${artifactId}</warName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
31 src/main/binding/bindings.xjb
@@ -0,0 +1,31 @@
+<jaxb:bindings
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
+ jaxb:version="2.1"
+>
+
+ <jaxb:bindings>
+ <jaxb:globalBindings>
+ <jaxb:serializable/>
+ </jaxb:globalBindings>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="../resources/xsd/course-summary.xsd">
+ <jaxb:bindings node="//xs:element[@name='course']">
+ <jaxb:property name="courses"/>
+ </jaxb:bindings>
+ <jaxb:bindings node="//xs:element[@name='announcement']">
+ <jaxb:property name="announcements"/>
+ </jaxb:bindings>
+ <jaxb:bindings node="//xs:element[@name='instructor']">
+ <jaxb:property name="instructors"/>
+ </jaxb:bindings>
+ <jaxb:schemaBindings>
+ <jaxb:package name="org.jasig.portlet.courses.model.xml" />
+ </jaxb:schemaBindings>
+ </jaxb:bindings>
+
+</jaxb:bindings>
View
30 src/main/java/org/jasig/portlet/courses/dao/ICoursesDao.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.dao;
+
+import javax.portlet.PortletRequest;
+
+import org.jasig.portlet.courses.model.wrapper.CourseSummaryWrapper;
+
+public interface ICoursesDao {
+
+ public CourseSummaryWrapper getSummary(PortletRequest request);
+
+}
View
70 src/main/java/org/jasig/portlet/courses/dao/xml/MockCoursesDaoImpl.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.dao.xml;
+
+import java.io.IOException;
+
+import javax.portlet.PortletRequest;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jasig.portlet.courses.dao.ICoursesDao;
+import org.jasig.portlet.courses.model.wrapper.CourseSummaryWrapper;
+import org.jasig.portlet.courses.model.wrapper.ObjectFactoryWrapper;
+import org.jasig.portlet.courses.model.xml.CourseSummary;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.core.io.Resource;
+
+public class MockCoursesDaoImpl implements ICoursesDao, InitializingBean {
+
+ protected final Log log = LogFactory.getLog(getClass());
+
+ private CourseSummaryWrapper summary;
+
+ private Resource mockData;
+
+ public void setMockData(Resource mockData) {
+ this.mockData = mockData;
+ }
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(CourseSummary.class);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ unmarshaller.setProperty("com.sun.xml.bind.ObjectFactory", new ObjectFactoryWrapper());
+ this.summary = (CourseSummaryWrapper) unmarshaller.unmarshal(mockData.getInputStream());
+ } catch (IOException e) {
+ System.out.println(e);
+ log.error("Failed to read mock data", e);
+ } catch (JAXBException e) {
+ System.out.println(e);
+ log.error("Failed to unmarshall mock data", e);
+ }
+ }
+
+ public CourseSummaryWrapper getSummary(PortletRequest request) {
+ return this.summary;
+ }
+
+}
View
29 src/main/java/org/jasig/portlet/courses/model/wrapper/AnnouncementWrapper.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.model.wrapper;
+
+import org.jasig.portlet.courses.model.xml.Announcement;
+
+public class AnnouncementWrapper extends Announcement {
+
+ public boolean isNew() {
+ return this.isNewAnnouncement().booleanValue();
+ }
+}
View
37 src/main/java/org/jasig/portlet/courses/model/wrapper/CourseSummaryWrapper.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.model.wrapper;
+
+import org.jasig.portlet.courses.model.xml.Course;
+import org.jasig.portlet.courses.model.xml.CourseSummary;
+
+public class CourseSummaryWrapper extends CourseSummary {
+
+ public int getNewAnnouncementCount() {
+ int newCount = 0;
+ for (Course course : this.getCourses()) {
+ CourseWrapper wrappedCourse = (CourseWrapper) course;
+ newCount += wrappedCourse.getNewAnnouncementCount();
+ }
+ return newCount;
+ }
+
+
+}
View
37 src/main/java/org/jasig/portlet/courses/model/wrapper/CourseWrapper.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.model.wrapper;
+
+import org.jasig.portlet.courses.model.xml.Announcement;
+import org.jasig.portlet.courses.model.xml.Course;
+
+public class CourseWrapper extends Course {
+
+ public int getNewAnnouncementCount() {
+ int newCount = 0;
+ for (Announcement announcement : this.getAnnouncements()) {
+ if (announcement.isNewAnnouncement()) {
+ newCount++;
+ }
+ }
+ return newCount;
+ }
+
+}
View
42 src/main/java/org/jasig/portlet/courses/model/wrapper/ObjectFactoryWrapper.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.model.wrapper;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactoryWrapper extends org.jasig.portlet.courses.model.xml.ObjectFactory {
+
+ @Override
+ public CourseSummaryWrapper createCourseSummary() {
+ return new CourseSummaryWrapper();
+ }
+
+ @Override
+ public CourseWrapper createCourse() {
+ return new CourseWrapper();
+ }
+
+ @Override
+ public AnnouncementWrapper createAnnouncement() {
+ return new AnnouncementWrapper();
+ }
+
+}
View
49 src/main/java/org/jasig/portlet/courses/mvc/MinimizedStateHandlerInterceptor.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.mvc;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.jasig.portlet.courses.dao.ICoursesDao;
+import org.jasig.portlet.courses.model.wrapper.CourseSummaryWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.portlet.handler.HandlerInterceptorAdapter;
+
+public class MinimizedStateHandlerInterceptor extends HandlerInterceptorAdapter {
+
+ @Autowired(required = true)
+ private ICoursesDao coursesDao;
+
+ @Override
+ public boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler) throws Exception {
+ if (WindowState.MINIMIZED.equals(request.getWindowState())) {
+
+ CourseSummaryWrapper summary = coursesDao.getSummary(request);
+ int newCount = summary.getNewAnnouncementCount();
+ response.setProperty("newItemCount", String.valueOf(newCount));
+
+ return false;
+ }
+
+ return true;
+ }
+}
View
74 src/main/java/org/jasig/portlet/courses/mvc/portlet/CoursesPortletController.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.mvc.portlet;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.portlet.PortletRequest;
+
+import org.jasig.portlet.courses.dao.ICoursesDao;
+import org.jasig.portlet.courses.model.xml.Course;
+import org.jasig.portlet.courses.model.xml.CourseSummary;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.portlet.ModelAndView;
+
+@Controller
+@RequestMapping("VIEW")
+public class CoursesPortletController {
+
+ private ICoursesDao coursesDao;
+
+ @Autowired(required = true)
+ public void setCoursesDao(ICoursesDao coursesDao) {
+ this.coursesDao = coursesDao;
+ }
+
+ @RequestMapping
+ public ModelAndView getCourseList(PortletRequest request) {
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("courseList", coursesDao.getSummary(request));
+
+ return new ModelAndView("courseList", model);
+ }
+
+ @RequestMapping(params = "action=showCourse")
+ public ModelAndView getCourseView(@RequestParam String courseCode, PortletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+
+ // TODO: write a better implementation for locating an individual course
+ CourseSummary summary = coursesDao.getSummary(request);
+ Course selectedCourse = null;
+ for (Course course : summary.getCourses()) {
+ if (courseCode.equals(course.getCode())) {
+ selectedCourse = course;
+ break;
+ }
+ }
+ model.put("course", selectedCourse);
+
+ return new ModelAndView("courseDetail", model);
+ }
+
+}
View
20 src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to Jasig under one or more contributor license
+# agreements. See the NOTICE file distributed with this work
+# for additional information regarding copyright ownership.
+# Jasig licenses this file to you under the Apache License,
+# Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a
+# copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on
+# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+log4j.logger.org.jasig.portlet.courses=DEBUG, R
View
133 src/main/resources/mock-data/mock-course-summary.xml
@@ -0,0 +1,133 @@
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<course-summary
+ xmlns="https://source.jasig.org/schemas/portlet/courses/course-summary"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="https://source.jasig.org/schemas/portlet/courses/course-summary ../xsd/course-summary.xsd">
+
+ <course>
+ <title>Design Awareness</title>
+ <code>DSC 101</code>
+ <school>School of Design</school>
+ <location>
+ <displayName>Design North Building, room 162</displayName>
+ <identifier></identifier>
+ </location>
+ <meetingTimes>M-W-F, 1:30-2:30pm</meetingTimes>
+ <url>http://courses.university.edu/dsc101/s11</url>
+ <instructor>
+ <abbreviation>Cross</abbreviation>
+ <fullName>Jeffery Cross, Phd</fullName>
+ <identifier>jcross</identifier>
+ </instructor>
+ <grade>A</grade>
+ <announcement newAnnouncement="true">
+ <title>Guest Lecture Thursday</title>
+ <description>
+ Don't miss Thursday's guest lecture by Alan Cooper
+ </description>
+ <url>http://courses.university.edu/dsc101/s11/announcements/1.html</url>
+ </announcement>
+ </course>
+
+ <course>
+ <title>Drawing for Industry</title>
+ <code>IND 120</code>
+ <school>School of Design</school>
+ <location>
+ <displayName>Design North Building, room 162</displayName>
+ <identifier></identifier>
+ </location>
+ <meetingTimes>M-W-F, 1:30-2:30pm</meetingTimes>
+ <url>http://courses.university.edu/dsc101/s11</url>
+ <instructor>
+ <abbreviation>Cross</abbreviation>
+ <fullName>Jeffery Cross, Phd</fullName>
+ <identifier>jcross</identifier>
+ </instructor>
+ <grade>A</grade>
+ <announcement newAnnouncement="false">
+ <title>Guest Lecture Thursday</title>
+ <description>
+ Don't miss Thursday's guest lecture by Alan Cooper
+ </description>
+ <url>http://courses.university.edu/dsc101/s11/announcements/1.html</url>
+ </announcement>
+ </course>
+
+ <course>
+ <title>First-Year Composition</title>
+ <code>ENG 101</code>
+ <school>School of Design</school>
+ <location>
+ <displayName>Design North Building, room 162</displayName>
+ <identifier></identifier>
+ </location>
+ <meetingTimes>M-W-F, 1:30-2:30pm</meetingTimes>
+ <url>http://courses.university.edu/dsc101/s11</url>
+ <instructor>
+ <abbreviation>Cross</abbreviation>
+ <fullName>Jeffery Cross, Phd</fullName>
+ <identifier>jcross</identifier>
+ </instructor>
+ <grade>A</grade>
+ </course>
+
+ <course>
+ <title>Precalculus</title>
+ <code>MAT 170</code>
+ <school>School of Design</school>
+ <location>
+ <displayName>Design North Building, room 162</displayName>
+ <identifier></identifier>
+ </location>
+ <meetingTimes>M-W-F, 1:30-2:30pm</meetingTimes>
+ <url>http://courses.university.edu/dsc101/s11</url>
+ <instructor>
+ <abbreviation>Cross</abbreviation>
+ <fullName>Jeffery Cross, Phd</fullName>
+ <identifier>jcross</identifier>
+ </instructor>
+ <grade>C</grade>
+ </course>
+
+ <course>
+ <title>Graphic Design History</title>
+ <code>GRA 111</code>
+ <school>School of Design</school>
+ <location>
+ <displayName>Design North Building, room 162</displayName>
+ <identifier></identifier>
+ </location>
+ <meetingTimes>M-W-F, 1:30-2:30pm</meetingTimes>
+ <url>http://courses.university.edu/dsc101/s11</url>
+ <instructor>
+ <abbreviation>Cross</abbreviation>
+ <fullName>Jeffery Cross, Phd</fullName>
+ <identifier>jcross</identifier>
+ </instructor>
+ <grade>A</grade>
+ </course>
+
+ <gpa>3.25</gpa>
+
+</course-summary>
View
82 src/main/resources/xsd/course-summary.xsd
@@ -0,0 +1,82 @@
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<xs:schema xmlns="https://source.jasig.org/schemas/portlet/courses/course-summary"
+ targetNamespace="https://source.jasig.org/schemas/portlet/courses/course-summary"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
+
+ <xs:element name="course-summary">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="course" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gpa" type="xs:double" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="course">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="xs:string"/>
+ <xs:element name="code" type="xs:string"/>
+ <xs:element name="school" type="xs:string"/>
+ <xs:element ref="location"/>
+ <xs:element name="meetingTimes" type="xs:string"/>
+ <xs:element name="url" type="xs:string"/>
+ <xs:element ref="instructor" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="grade" type="xs:string" minOccurs="0"/>
+ <xs:element ref="announcement" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="instructor">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="abbreviation" type="xs:string"/>
+ <xs:element name="fullName" type="xs:string"/>
+ <xs:element name="identifier" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="location">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="displayName" type="xs:string"/>
+ <xs:element name="identifier" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="announcement">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+ <xs:element name="url" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="newAnnouncement" type="xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
View
39 src/main/webapp/WEB-INF/context/applicationContext.xml
@@ -0,0 +1,39 @@
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <bean class="org.jasig.portlet.courses.dao.xml.MockCoursesDaoImpl"
+ p:mockData="classpath:/mock-data/mock-course-summary.xml"/>
+
+ <bean id="jspViewResolver"
+ class="org.springframework.web.servlet.view.InternalResourceViewResolver"
+ p:order="10" p:cache="true"
+ p:viewClass="org.springframework.web.servlet.view.JstlView"
+ p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
+
+</beans>
View
37 src/main/webapp/WEB-INF/context/portlet/courses.xml
@@ -0,0 +1,37 @@
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:component-scan base-package="org.jasig.portlet.courses.mvc.portlet"/>
+ <context:annotation-config/>
+
+ <bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping">
+ <property name="interceptors"><bean class="org.jasig.portlet.courses.mvc.MinimizedStateHandlerInterceptor"/></property>
+ </bean>
+
+</beans>
View
62 src/main/webapp/WEB-INF/jsp/courseDetail.jsp
@@ -0,0 +1,62 @@
+<%--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+--%>
+
+<jsp:directive.include file="/WEB-INF/jsp/include.jsp"/>
+<portlet:renderURL var="courseListUrl"/>
+
+<div data-role="header" data-theme="b" class="titlebar portlet-titlebar courses-back-div">
+ <a data-role="button" data-icon="back" data-inline="true" class="courses-back-link" href="${ courseListUrl }">Back</a>
+ <h2 class="title course-catalog-name">${ course.code }</h2>
+</div>
+<div class="course-details">
+ <div class="titlebar">
+ <h2 class="title">${ course.title }</h2>
+ <h3 class="subtitle">${ course.school }</h3>
+ <div class="grade"><span>${ course.grade }</span></div>
+ </div>
+ <div>
+ <div class="class-details">
+ <a data-role="button" class="instructor" title="instructor" href="javascript:;">${ course.instructors[0].fullName }</a>
+ <a data-role="button" class="schedule" title="schedule" href="javascript:;">${ course.meetingTimes }</a>
+ <a data-role="button" class="location" title="location" href="javascript:;">${ course.location.displayName }</a>
+ </div>
+ <div class="class-announcements" style="margin-top: 30px;">
+ <div>
+ <c:choose>
+ <c:when test="${ fn:length(course.announcements) == 0 }">
+ <p class="no-data">No announcements</p>
+ </c:when>
+ <c:otherwise>
+ <ul data-role="listview">
+ <li data-role="list-divider">Announcements</li>
+ <c:forEach items="${ course.announcements }" var="announcement">
+ <li>
+ <h4 class="title">${ announcement.title }</h4>
+ <p class="body">${ announcement.description }</p>
+ </li>
+ </c:forEach>
+ </ul>
+ </c:otherwise>
+ </c:choose>
+ </div>
+ </div>
+ </div>
+</div>
View
53 src/main/webapp/WEB-INF/jsp/courseList.jsp
@@ -0,0 +1,53 @@
+<%--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+--%>
+
+<jsp:directive.include file="/WEB-INF/jsp/include.jsp"/>
+
+<c:choose>
+ <c:when test="${ fn:length(courseList.courses) == 0 }">
+ <p>You have no courses. If you are enrolled in courses and they are not showing, please contact University Support.</p>
+ </c:when>
+ <c:otherwise>
+ <ul data-role="listview" class="course-list">
+ <c:forEach items="${ courseList.courses }" var="course">
+ <portlet:renderURL var="courseUrl"><portlet:param name="action" value="showCourse"/><portlet:param name="courseCode" value="${ course.code }"/></portlet:renderURL>
+ <li>
+ <a href="${ courseUrl }">
+ <h3 class="title">${ course.title }</h3>
+ <p>
+ <span class="catalog">${ course.code }</span><span class="separator">, </span>
+ <span class="instructor">${ course.instructors[0].abbreviation }</span>
+ </p>
+ <c:set var="newCount" value="${ course.newAnnouncementCount }"/>
+ <c:if test="${ newCount > 0 }">
+ <span class="ui-li-count badge">${ newCount }</span>
+ </c:if>
+ </a>
+ </li>
+ </c:forEach>
+ </ul>
+ </c:otherwise>
+</c:choose>
+
+<div class="ui-grid-a clearfix utilities" style="margin-top: 15px;">
+ <div class="ui-block-a"><a data-role="button" class="schedule" title="schedule" href="/uPortal/p/calendar-portlet/max/render.uP">Schedule</a></div>
+ <div class="ui-block-b"><a data-role="button" class="grades" title="grades" href="course_grades.html">Grades</a></div>
+</div>
View
34 src/main/webapp/WEB-INF/jsp/include.jsp
@@ -0,0 +1,34 @@
+<%--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+--%>
+
+<%@ page contentType="text/html" isELIgnored="false" %>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet" %>
+<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<%@ taglib prefix="html" tagdir="/WEB-INF/tags/html" %>
+
+<%@ taglib prefix="rs" uri="http://www.jasig.org/resource-server" %>
View
46 src/main/webapp/WEB-INF/portlet.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>courses</portlet-name>
+ <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
+ <init-param>
+ <name>contextConfigLocation</name>
+ <value>/WEB-INF/context/portlet/courses.xml</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Courses</title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
View
61 src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<web-app id="jasig-calendar-portlets" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>Courses</display-name>
+ <description>Course summaries and announcements</description>
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/context/applicationContext.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>log4jConfigLocation</param-name>
+ <param-value>/WEB-INF/classes/log4j.properties</param-value>
+ </context-param>
+ <context-param>
+ <param-name>webAppRootKey</param-name>
+ <param-value>courses.root</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+ </listener>
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>ViewRendererServlet</servlet-name>
+ <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ViewRendererServlet</servlet-name>
+ <url-pattern>/WEB-INF/servlet/view</url-pattern>
+ </servlet-mapping>
+
+</web-app>
View
BIN src/main/webapp/notepad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
62 src/test/java/org/jasig/portlet/courses/dao/xml/XMLCoursesDaoImplTest.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to Jasig under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work
+ * for additional information regarding copyright ownership.
+ * Jasig licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a
+ * copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jasig.portlet.courses.dao.xml;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.portlet.PortletRequest;
+
+import org.jasig.portlet.courses.dao.ICoursesDao;
+import org.jasig.portlet.courses.model.wrapper.CourseSummaryWrapper;
+import org.jasig.portlet.courses.model.xml.Course;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = "/testContext.xml")
+public class XMLCoursesDaoImplTest {
+
+ @Autowired ICoursesDao dao;
+
+ @Mock PortletRequest request;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void test() {
+ CourseSummaryWrapper summary = dao.getSummary(request);
+ assertEquals(1, summary.getNewAnnouncementCount());
+ assertEquals(5, summary.getCourses().size());
+ assertEquals(3.25, summary.getGpa().doubleValue(), .01);
+
+ Course course1 = summary.getCourses().get(0);
+ assertEquals("Design Awareness", course1.getTitle());
+ }
+
+}
View
33 src/test/resources/testContext.xml
@@ -0,0 +1,33 @@
+<!--
+
+ Licensed to Jasig under one or more contributor license
+ agreements. See the NOTICE file distributed with this work
+ for additional information regarding copyright ownership.
+ Jasig licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a
+ copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <bean class="org.jasig.portlet.courses.dao.xml.MockCoursesDaoImpl"
+ p:mockData="classpath:/mock-data/mock-course-summary.xml"/>
+
+</beans>

0 comments on commit 57a734f

Please sign in to comment.
Something went wrong with that request. Please try again.