Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from raydavis/raywip

CLC-90 Add department code to class page feed
  • Loading branch information...
commit 4d1a6253c77de0e94e8d610ed8d23935d3f3a86e 2 parents 17f0473 + dccd60e
@raydavis raydavis authored
View
1  src/main/java/edu/berkeley/calcentral/daos/ClassPagesDao.java
@@ -26,6 +26,7 @@ public ClassPage getBaseClassPage(int year, String term, String courseID) {
+ " bci.TERM_YR || bci.TERM_CD || bci.COURSE_CNTL_NUM classid, " //ignoring course control num permissions issues for now.
+ " '' info_last_updated, "
+ " bci.COURSE_TITLE classtitle, "
+ + " bci.DEPT_NAME department, "
+ " bci.CATALOG_DESCRIPTION description "
+ " FROM BSPACE_COURSE_INFO_VW bci "
+ " WHERE bci.TERM_YR = :year AND bci.TERM_CD = :term AND bci.COURSE_CNTL_NUM = :courseID";
View
13 src/main/java/edu/berkeley/calcentral/domain/ClassPage.java
@@ -10,11 +10,12 @@
private String info_last_updated;
private ClassPageCourseInfo courseinfo;
private String classtitle;
+ private String department;
private String description;
- private List<ClassPageInstructor> instructors;
+ private List<ClassPageInstructor> instructors;
private List<ClassPageSchedule> schedule;
- private List<ClassPageSection> sections;
-
+ private List<ClassPageSection> sections;
+
public String getClassId() {
return classid;
}
@@ -27,6 +28,9 @@ public ClassPageCourseInfo getCourseinfo() {
public String getClasstitle() {
return classtitle;
}
+ public String getDepartment() {
+ return department;
+ }
public String getDescription() {
return description;
}
@@ -51,6 +55,9 @@ public void setCourseinfo(ClassPageCourseInfo courseinfo) {
public void setClasstitle(String classtitle) {
this.classtitle = classtitle;
}
+ public void setDepartment(String department) {
+ this.department = department;
+ }
public void setDescription(String description) {
this.description = description;
}
View
4 src/main/java/edu/berkeley/calcentral/services/ClassPagesService.java
@@ -45,7 +45,6 @@
@Produces({MediaType.APPLICATION_JSON})
@Path("{ccc}")
public Map<String, Object> getClassInfoMap(@PathParam("ccc") String ccc) {
-
ClassPage classPage;
Map<String, Object> returnObject = Maps.newHashMap();
try {
@@ -54,13 +53,14 @@
returnObject.put("info_last_updated", classPage.getInfo_last_updated());
returnObject.put("courseinfo", classPage.getCourseinfo());
returnObject.put("classtitle", classPage.getClasstitle());
+ returnObject.put("department", classPage.getDepartment());
returnObject.put("description", classPage.getDescription());
returnObject.put("instructors", classPage.getInstructors());
returnObject.put("schedule", classPage.getSchedule());
returnObject.put("sections", classPage.getSections());
} catch (Exception e) {
//TODO: Change this to use whatever final exception handling scheme, instead of swallowing the exception.
- LOGGER.error(Throwables.getStackTraceAsString(e));
+ LOGGER.error(e.getMessage(), e);
}
return returnObject;
}
View
35 src/test/java/edu/berkeley/calcentral/services/ClassPagesServiceTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Sakai Foundation (SF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The SF 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 edu.berkeley.calcentral.services;
+
+import edu.berkeley.calcentral.DatabaseAwareTest;
+import edu.berkeley.calcentral.domain.ClassPage;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ClassPagesServiceTest extends DatabaseAwareTest {
+ @Autowired
+ private ClassPagesService classPagesService;
+
+ @Test
+ public void getDepartment() throws Exception {
+ ClassPage classPage = classPagesService.getClassInfo("2012D7308");
+ assertNotNull(classPage);
+ assertEquals("BIOLOGY", classPage.getDepartment());
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.