Author: evenisse Date: Fri Jan 6 00:17:41 2006 New Revision: 366450 URL: http://svn.apache.org/viewcvs?rev=366450&view=rev Log: Add schedule screens PR: CONTINUUM-175 Submitted by: Nick Gonzalez Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java (with props) maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java (with props) maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java (with props) maven/continuum/trunk/continuum-webapp/src/main/webapp/addSchedule.jsp (with props) maven/continuum/trunk/continuum-webapp/src/main/webapp/editSchedule.jsp (with props) maven/continuum/trunk/continuum-webapp/src/main/webapp/schedules.jsp (with props) Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java?rev=366450&view=auto ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java (added) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java Fri Jan 6 00:17:41 2006 @@ -0,0 +1,106 @@ +package org.apache.maven.continuum.web.action; + +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * 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. + */ + +import org.apache.maven.continuum.Continuum; +import org.apache.maven.continuum.ContinuumException; +import org.apache.maven.continuum.model.project.Schedule; + +import com.opensymphony.xwork.ActionSupport; + +/** + * @author Nik Gonzalez + */ +public class AddScheduleAction + extends ActionSupport +{ + private Continuum continuum; + + private int scheduleId; + + private boolean active; + + private String cronExpression; + + private int delay; + + private String description; + + private String name; + + public String execute() + throws Exception + { + try + { + Schedule schedule = new Schedule(); + schedule.setActive( active ); + schedule.setCronExpression( cronExpression ); + schedule.setDelay( delay ); + schedule.setDescription( description ); + schedule.setName( name ); + + continuum.addSchedule( schedule ); + } + catch ( ContinuumException e ) + { + e.printStackTrace(); + } + return SUCCESS; + } + + public String doDefault() + { + return INPUT; + } + + public void setActive( boolean active ) + { + this.active = active; + } + + public void setContinuum( Continuum continuum ) + { + this.continuum = continuum; + } + + public void setCronExpression( String cronExpression ) + { + this.cronExpression = cronExpression; + } + + public void setDelay( int delay ) + { + this.delay = delay; + } + + public void setDescription( String description ) + { + this.description = description; + } + + public void setName( String name ) + { + this.name = name; + } + + public void setScheduleId( int scheduleId ) + { + this.scheduleId = scheduleId; + } + +} Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java?rev=366450&view=auto ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java (added) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java Fri Jan 6 00:17:41 2006 @@ -0,0 +1,179 @@ +package org.apache.maven.continuum.web.action; + +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * 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. + */ + +import org.apache.maven.continuum.Continuum; +import org.apache.maven.continuum.ContinuumException; +import org.apache.maven.continuum.model.project.Schedule; + +import com.opensymphony.xwork.ActionSupport; + +/** + * @author Nik Gonzalez + */ +public class EditScheduleAction + extends ActionSupport +{ + + private Continuum continuum; + + private Schedule schedule; + + private int id; + + private boolean active; + + private String cronExpression; + + private int delay; + + private String description; + + private String name; + + public String execute() + throws Exception + { + try + { + schedule = continuum.getSchedule( id ); + + } + catch ( ContinuumException e ) + { + e.printStackTrace(); + } + schedule.setActive( active ); + schedule.setCronExpression( cronExpression ); + schedule.setDelay( delay ); + schedule.setDescription( description ); + schedule.setName( name ); + + try + { + continuum.updateSchedule( schedule ); + } + catch ( ContinuumException e ) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return SUCCESS; + } + + public String doEdit() + throws Exception + { + try + { + schedule = continuum.getSchedule( id ); + } + catch ( ContinuumException e ) + { + e.printStackTrace(); + } + + active = schedule.isActive(); + cronExpression = schedule.getCronExpression(); + delay = schedule.getDelay(); + description = schedule.getDescription(); + name = schedule.getName(); + + return INPUT; + } + + public void setActive( boolean active ) + { + this.active = active; + } + + public void setCronExpression( String cronExpression ) + { + this.cronExpression = cronExpression; + } + + public void setDelay( int delay ) + { + this.delay = delay; + } + + public void setDescription( String description ) + { + this.description = description; + } + + public void setName( String name ) + { + this.name = name; + } + + public void setId( int id ) + { + this.id = id; + } + + public Continuum getContinuum() + { + return continuum; + } + + public void setContinuum( Continuum continuum ) + { + this.continuum = continuum; + } + + public Schedule getSchedule() + { + return schedule; + } + + public void setSchedule( Schedule schedule ) + { + this.schedule = schedule; + } + + public boolean isActive() + { + return active; + } + + public String getCronExpression() + { + return cronExpression; + } + + public int getDelay() + { + return delay; + } + + public String getDescription() + { + return description; + } + + public String getName() + { + return name; + } + + public int getId() + { + return id; + } + +} Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=366450&view=auto ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java (added) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java Fri Jan 6 00:17:41 2006 @@ -0,0 +1,57 @@ +package org.apache.maven.continuum.web.action; + +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * 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. + */ + +import java.util.Collection; + +import org.apache.maven.continuum.Continuum; +import org.apache.maven.continuum.ContinuumException; + +import com.opensymphony.xwork.ActionSupport; + +/** + * @author Nik Gonzalez + */ +public class ScheduleAction + extends ActionSupport +{ + + private Continuum continuum; + + private Collection schedules; + + public String execute() + throws Exception + { + try + { + schedules = continuum.getSchedules(); + } + catch ( ContinuumException e ) + { + e.printStackTrace(); + } + + return SUCCESS; + } + + public Collection getSchedules() + { + return schedules; + } + +} Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml?rev=366450&r1=366449&r2=366450&view=diff ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml (original) +++ maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml Fri Jan 6 00:17:41 2006 @@ -252,6 +252,39 @@ + + com.opensymphony.xwork.Action + schedules + org.apache.maven.continuum.web.action.ScheduleAction + per-lookup + + + org.apache.maven.continuum.Continuum + + + + + com.opensymphony.xwork.Action + addSchedule + org.apache.maven.continuum.web.action.AddScheduleAction + per-lookup + + + org.apache.maven.continuum.Continuum + + + + + com.opensymphony.xwork.Action + editSchedule + org.apache.maven.continuum.web.action.EditScheduleAction + per-lookup + + + org.apache.maven.continuum.Continuum + + +