001/* 002 * (C) Copyright 2007-2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019package org.nuxeo.ecm.core.scheduler; 020 021import org.nuxeo.common.xmap.annotation.XNode; 022import org.nuxeo.common.xmap.annotation.XObject; 023 024/** 025 * ScheduleImpl extension definition. 026 */ 027@XObject("schedule") 028public class ScheduleImpl implements Schedule { 029 030 private static final long serialVersionUID = 1L; 031 032 @XNode("@id") 033 public String id; 034 035 @XNode("event") 036 public String eventId; 037 038 // BBB compat with old descriptors. use <event> now for consistency with 039 // EventListenerDescriptor 040 @XNode("eventId") 041 public void setEventId(String eventId) { 042 this.eventId = eventId; 043 } 044 045 @XNode("eventCategory") 046 public String eventCategory; 047 048 @XNode("cronExpression") 049 public String cronExpression; 050 051 @XNode("username") 052 public String username; 053 054 /** 055 * @since 5.7.3 056 */ 057 @XNode("@enabled") 058 public boolean enabled = true; 059 060 @Override 061 public String getId() { 062 return id; 063 } 064 065 @Override 066 public String getEventId() { 067 return eventId; 068 } 069 070 @Override 071 public String getEventCategory() { 072 return eventCategory; 073 } 074 075 @Override 076 public String getCronExpression() { 077 return cronExpression; 078 } 079 080 @Override 081 public String getUsername() { 082 return username; 083 } 084 085 @Override 086 public String toString() { 087 return "Schedule " + id + " (cron=" + cronExpression + ')'; 088 } 089 090 @Override 091 public boolean equals(Object obj) { 092 if (obj == null) { 093 return false; 094 } 095 if (!(obj instanceof Schedule)) { 096 return false; 097 } 098 return id.equals(((Schedule) obj).getId()); 099 } 100 101 @Override 102 public int hashCode() { 103 return id.hashCode(); 104 } 105 106 @Override 107 public boolean isEnabled() { 108 return enabled; 109 } 110}