forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DASH-324 setup cron job to sync dashboard users with current sakai si…
…te users git-svn-id: https://source.sakaiproject.org/svn/dashboard/trunk@314882 66ffb92e-73f9-0310-93c1-f5514f145a0a
- Loading branch information
Showing
11 changed files
with
455 additions
and
1 deletion.
There are no files selected for viewing
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
52 changes: 52 additions & 0 deletions
52
dashboard/impl/src/java/org/sakaiproject/dash/dao/mapper/ContextUserMapper.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,52 @@ | ||
/********************************************************************************** | ||
* $URL: $ | ||
* $Id: $ | ||
*********************************************************************************** | ||
* | ||
* Copyright (c) 2011 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.osedu.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.mapper; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
import org.sakaiproject.dash.model.Context; | ||
import org.springframework.jdbc.core.RowMapper; | ||
|
||
/** | ||
* Mapper for the "context_users" string returned | ||
*/ | ||
public class ContextUserMapper implements RowMapper | ||
{ | ||
|
||
public String mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
String rv = ""; | ||
try { | ||
rv = rs.getString("context_users"); | ||
} catch (Exception e) { | ||
System.out.println(this + " =============== " + e + " ==============="); | ||
e.printStackTrace(System.out); | ||
if(e instanceof SQLException) { | ||
throw (SQLException) e; | ||
} | ||
} | ||
return rv; | ||
} | ||
|
||
|
||
|
||
} |
65 changes: 65 additions & 0 deletions
65
dashboard/impl/src/java/org/sakaiproject/dash/jobs/DashSyncUserSitesJob.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,65 @@ | ||
/** | ||
* $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.dash.jobs; | ||
|
||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.quartz.JobExecutionContext; | ||
import org.quartz.JobExecutionException; | ||
|
||
/** | ||
* this job is to find out the up-to-date user enrolled sites | ||
* remove site dashboard items if the user no longer belongs to the site | ||
* or add site dashboard items if the user is added to the site | ||
* @author zqian | ||
* | ||
*/ | ||
public class DashSyncUserSitesJob extends DashQuartzJob { | ||
private Log logger = LogFactory.getLog(DashSyncUserSitesJob.class); | ||
|
||
//Matches the bean id | ||
final static String beanId = "dashSyncUserSitesJob"; | ||
|
||
//Matches the jobName | ||
final static String jobName = "Dashboard Synchronize Dashboard Link Users with Site Users Job"; | ||
|
||
public void init() { | ||
super.init(); | ||
logger.info(this + " init()"); | ||
} | ||
|
||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { | ||
String quartzServer = sakaiProxy.getConfigParam("dashboard_quartzServer", null); | ||
String serverName = sakaiProxy.getServerId(); | ||
if (quartzServer != null && serverName != null && quartzServer.equals(serverName)) | ||
{ | ||
logger.info(this + " execute: " + getConfigMessage()); | ||
|
||
try { | ||
dashboardCommonLogic.syncDashboardUsersWithSiteUsers(); | ||
} catch (Exception e) { | ||
logger.warn(this + "execute error: " , e); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
|
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.