Skip to content

Commit

Permalink
DASH-256 merged in Longsight's patch
Browse files Browse the repository at this point in the history
git-svn-id: https://source.sakaiproject.org/svn/dashboard/trunk@313461 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
zqian committed Jul 26, 2013
1 parent 3d43cf7 commit 6c3b198
Show file tree
Hide file tree
Showing 12 changed files with 1,647 additions and 166 deletions.
59 changes: 59 additions & 0 deletions dashboard/api/src/java/org/sakaiproject/dash/model/JobRun.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* $URL: https://source.sakaiproject.org/svn/sitestats/trunk/sitestats-api/src/java/org/sakaiproject/sitestats/api/JobRun.java $
* $Id: JobRun.java 105078 2012-02-24 23:00:38Z [email protected] $
*
* Copyright (c) 2006-2009 The Sakai Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ECL-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.sakaiproject.dash.model;

import java.util.Date;

public interface JobRun {
/** Get the db row id. */
public long getId();

/** Set the db row id. */
public void setId(long id);

/** Get the first event id processed by this job run. */
public long getStartEventId();

/** Set the first event id processed by this job run. */
public void setStartEventId(long startEventId);

/** Get the last event id processed by this job run. */
public long getEndEventId();

/** Set the last event id processed by this job run. */
public void setEndEventId(long endEventId);

/** Get the date this job run started. */
public Date getJobStartDate();

/** Set the date this job run started. */
public void setJobStartDate(Date jobStartDate);

/** Get the date this job run finished. */
public Date getJobEndDate();

/** Set the date this job run finished. */
public void setJobEndDate(Date jobEndDate);

/** Get the date of the last event processed by this job run. */
public Date getLastEventDate();

/** Set the date of the last event processed by this job run. */
public void setLastEventDate(Date lastEventDate);
}
66 changes: 66 additions & 0 deletions dashboard/hbm/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.sakaiproject.dash</groupId>
<artifactId>dashboard</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<name>sakai-dashboard-hbm</name>
<groupId>org.sakaiproject.dash</groupId>
<artifactId>dashboard-hbm</artifactId>
<packaging>jar</packaging>

<properties>
<deploy.target>shared</deploy.target>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dashboard-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-component-manager</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>

<!--
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy todir="../tool/src/ddl/">
<fileset file="src/java/org/sakaiproject/lessonbuildertool/simplepageitem.hbm.xml" />
<fileset file="src/java/org/sakaiproject/lessonbuildertool/simplepage.hbm.xml" />
<fileset file="src/java/org/sakaiproject/lessonbuildertool/simplepagelogentry.hbm.xml" />
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
-->
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.sakaiproject.dash.dao.JobRunImpl"
table="DASH_JOB_RUN"
lazy="true">
<id name="id" type="long" column="ID" unsaved-value="0">
<generator class="native">
<param name="sequence">DASH_JOB_RUN_ID</param>
</generator>
</id>
<property name="jobStartDate" column="JOB_START_DATE" type="timestamp" not-null="false" />
<property name="jobEndDate" column="JOB_END_DATE" type="timestamp" not-null="false" />
<property name="startEventId" column="START_EVENT_ID" type="long" not-null="false" />
<property name="endEventId" column="END_EVENT_ID" type="long" not-null="false" />
<property name="lastEventDate" column="LAST_EVENT_DATE" type="timestamp" not-null="false" />
</class>
</hibernate-mapping>
150 changes: 150 additions & 0 deletions dashboard/hbm/src/java/org/sakaiproject/dash/dao/JobRunImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/**
* $URL: https://source.sakaiproject.org/svn/sitestats/trunk/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/JobRunImpl.java $
* $Id: JobRunImpl.java 105078 2012-02-24 23:00:38Z [email protected] $
*
* Copyright (c) 2006-2013 The Sakai Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ECL-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.sakaiproject.dash.dao;

import java.io.Serializable;
import java.util.Date;

import org.sakaiproject.dash.model.JobRun;

/**
* @author Nuno Fernandes
*
*/
public class JobRunImpl implements JobRun, Serializable {
private static final long serialVersionUID = 1L;
private long id;
private long startEventId;
private long endEventId;
private Date jobStartDate;
private Date jobEndDate;
private Date lastEventDate;

public boolean equals(Object o) {
if(o == null) return false;
if(!(o instanceof JobRunImpl)) return false;
JobRunImpl other = (JobRunImpl) o;
return id == other.getId()
&& getStartEventId() == other.getStartEventId()
&& getEndEventId() == other.getEndEventId()
&& getJobStartDate().equals(other.getJobStartDate())
&& getJobEndDate().equals(other.getJobEndDate())
&& getLastEventDate().equals(other.getLastEventDate());
}

public int hashCode() {
if(getStartEventId() == 0 || getEndEventId() == 0
|| getJobStartDate() == null || getJobEndDate() == null){
return Integer.MIN_VALUE;
}
String hashStr = this.getClass().getName() + ":"
+ this.getId()
+ this.getStartEventId()
+ this.getEndEventId()
+ this.getJobStartDate().hashCode()
+ this.getJobEndDate().hashCode()
+ this.getLastEventDate().hashCode();
return hashStr.hashCode();
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#getJobEndDate()
*/
public Date getJobEndDate() {
return jobEndDate;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#getEndEventId()
*/
public long getEndEventId() {
return endEventId;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#getId()
*/
public long getId() {
return id;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#getJobStartDate()
*/
public Date getJobStartDate() {
return jobStartDate;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#getStartEventId()
*/
public long getStartEventId() {
return startEventId;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#setJobEndDate(java.util.Date)
*/
public void setJobEndDate(Date jobEndDate) {
this.jobEndDate = jobEndDate;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#setEndEventId(long)
*/
public void setEndEventId(long endEventId) {
this.endEventId = endEventId;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#setId(long)
*/
public void setId(long id) {
this.id = id;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#setJobStartDate(java.util.Date)
*/
public void setJobStartDate(Date jobStartDate) {
this.jobStartDate = jobStartDate;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#setStartEventId(long)
*/
public void setStartEventId(long startEventId) {
this.startEventId = startEventId;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#getLastEventDate()
*/
public Date getLastEventDate(){
return lastEventDate;
}

/* (non-Javadoc)
* @see org.sakaiproject.sitestats.api.JobRun#setLastEventDate(java.util.Date)
*/
public void setLastEventDate(Date lastEventDate){
this.lastEventDate = lastEventDate;
}

}
Loading

0 comments on commit 6c3b198

Please sign in to comment.