forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sakaiproject#1254 from adrianfish/SAK-29709
SAK-29709 Added lessons ribbon to SiteStats
- Loading branch information
Showing
25 changed files
with
1,771 additions
and
96 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
sitestats/sitestats-api/src/java/org/sakaiproject/sitestats/api/LessonBuilderStat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* $URL$ | ||
* $Id$ | ||
* | ||
* 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.sitestats.api; | ||
|
||
|
||
/** | ||
* Represents a record from the SST_LESSONBULDER table. | ||
* | ||
* This must be {@link java.lang.Comparable} so that the updates can be sorted before being inserted into the database | ||
* to avoid deadlocks. | ||
* | ||
* @author Adrian Fish <[email protected]> | ||
*/ | ||
public interface LessonBuilderStat extends Stat, Comparable<LessonBuilderStat> { | ||
|
||
/** Get the the page reference (eg. '/lessonbuilder/page/2') this record refers to. */ | ||
public String getPageRef(); | ||
|
||
/** Set the the page reference (eg. '/lessonbuilder/page/2') this record refers to. */ | ||
public void setPageRef(String pageRef); | ||
|
||
/** Get the the page action (one of 'create','read' ...) this record refers to. */ | ||
public String getPageAction(); | ||
|
||
/** Set the the page action (one of 'create','read' ...) this record refers to. */ | ||
public void setPageAction(String pageAction); | ||
|
||
/** Get the the page title */ | ||
public String getPageTitle(); | ||
|
||
/** Get the the page title */ | ||
public void setPageTitle(String pageTitle); | ||
|
||
/** Get the the page id */ | ||
public long getPageId(); | ||
|
||
/** Set the the page id */ | ||
public void setPageId(long pageId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
...ts/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/LessonBuilderStatImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/** | ||
* $URL$ | ||
* $Id$ | ||
* | ||
* 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.sitestats.impl; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
import org.sakaiproject.sitestats.api.LessonBuilderStat; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
/** | ||
* @author Adrian Fish <[email protected]> | ||
*/ | ||
@Getter @Setter | ||
public class LessonBuilderStatImpl implements LessonBuilderStat, Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private long id; | ||
private String userId; | ||
private String siteId; | ||
private String pageRef; | ||
private String pageAction; | ||
private String pageTitle; | ||
private long pageId; | ||
private long count; | ||
private Date date; | ||
|
||
public boolean equals(Object o) { | ||
|
||
if(o == null) return false; | ||
if(!(o instanceof LessonBuilderStatImpl)) return false; | ||
LessonBuilderStatImpl other = (LessonBuilderStatImpl) o; | ||
return id == other.getId() | ||
&& siteId.equals(other.getSiteId()) | ||
&& userId.equals(other.getUserId()) | ||
&& pageRef.equals(other.getPageRef()) | ||
&& pageAction.equals(other.getPageAction()) | ||
&& pageTitle.equals(other.getPageTitle()) | ||
&& pageId == other.getPageId() | ||
&& count == other.getCount() | ||
&& date.equals(other.getDate()); | ||
} | ||
|
||
@Override | ||
public int compareTo(LessonBuilderStat other) { | ||
|
||
int val = siteId.compareTo(other.getSiteId()); | ||
if (val != 0) return val; | ||
val = userId.compareTo(other.getUserId()); | ||
if (val != 0) return val; | ||
val = pageRef.compareTo(other.getPageRef()); | ||
if (val != 0) return val; | ||
val = pageAction.compareTo(other.getPageAction()); | ||
if (val != 0) return val; | ||
val = pageTitle.compareTo(other.getPageTitle()); | ||
if (val != 0) return val; | ||
val = Long.signum(pageId - other.getPageId()); | ||
if (val != 0) return val; | ||
val = date.compareTo(other.getDate()); | ||
if (val != 0) return val; | ||
val = Long.signum(count - other.getCount()); | ||
if (val != 0) return val; | ||
val = Long.signum(id - other.getId()); | ||
return val; | ||
} | ||
|
||
public int hashCode() { | ||
|
||
if (siteId == null) return Integer.MIN_VALUE; | ||
String hashStr = this.getClass().getName() + ":" | ||
+ id | ||
+ userId.hashCode() | ||
+ siteId.hashCode() | ||
+ pageRef.hashCode() | ||
+ pageAction.hashCode() | ||
+ pageTitle.hashCode() | ||
+ pageId | ||
+ count | ||
+ date.hashCode(); | ||
return hashStr.hashCode(); | ||
} | ||
|
||
public String toString() { | ||
|
||
return siteId + " : " + userId + " : " + pageRef + " : " | ||
+ pageAction + ":" + pageTitle + " : " + pageId + ":" + count + " : " + date; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...stats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/LessonBuilderStatImpl.hbm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE hibernate-mapping | ||
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" | ||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> | ||
<hibernate-mapping> | ||
<class name="org.sakaiproject.sitestats.impl.LessonBuilderStatImpl" | ||
table="SST_LESSONBUILDER" | ||
lazy="true"> | ||
<id name="id" type="long" column="ID" unsaved-value="0"> | ||
<generator class="native"> | ||
<param name="sequence">SST_LESSONBUILDER_ID</param> | ||
</generator> | ||
</id> | ||
<property name="userId" column="USER_ID" type="string" length="99" not-null="true" index="SST_LESSONBUILDER_USER_ID_IX" /> | ||
<property name="siteId" column="SITE_ID" type="string" length="99" not-null="true" index="SST_LESSONBUILDER_SITE_ID_IX" /> | ||
<property name="pageRef" column="PAGE_REF" type="string" length="255" not-null="true" /> | ||
<property name="pageId" column="PAGE_ID" type="long" not-null="true" /> | ||
<property name="pageAction" column="PAGE_ACTION" type="string" length="12" not-null="true" index="SST_LESSONBUILDER_PAGE_ACT_IDX"/> | ||
<property name="date" column="PAGE_DATE" type="date" not-null="true" index="SST_LESSONBUILDER_DATE_IX" /> | ||
<property name="count" column="PAGE_COUNT" type="long" not-null="true" /> | ||
</class> | ||
</hibernate-mapping> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.