001/* 002 * (C) Copyright 2007-2010 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Florent Guillaume 016 */ 017package org.nuxeo.ecm.core.scheduler; 018 019import org.nuxeo.common.xmap.annotation.XNode; 020import org.nuxeo.common.xmap.annotation.XObject; 021 022/** 023 * ScheduleImpl extension definition. 024 */ 025@XObject("schedule") 026public class ScheduleImpl implements Schedule { 027 028 private static final long serialVersionUID = 1L; 029 030 @XNode("@id") 031 public String id; 032 033 @XNode("event") 034 public String eventId; 035 036 // BBB compat with old descriptors. use <event> now for consistency with 037 // EventListenerDescriptor 038 @XNode("eventId") 039 public void setEventId(String eventId) { 040 this.eventId = eventId; 041 } 042 043 @XNode("eventCategory") 044 public String eventCategory; 045 046 @XNode("cronExpression") 047 public String cronExpression; 048 049 @XNode("username") 050 public String username; 051 052 /** 053 * @since 5.7.3 054 */ 055 @XNode("@enabled") 056 public boolean enabled = true; 057 058 @Override 059 public String getId() { 060 return id; 061 } 062 063 @Override 064 public String getEventId() { 065 return eventId; 066 } 067 068 @Override 069 public String getEventCategory() { 070 return eventCategory; 071 } 072 073 @Override 074 public String getCronExpression() { 075 return cronExpression; 076 } 077 078 @Override 079 public String getUsername() { 080 return username; 081 } 082 083 @Override 084 public String toString() { 085 return "Schedule " + id + " (cron=" + cronExpression + ')'; 086 } 087 088 @Override 089 public boolean equals(Object obj) { 090 if (obj == null) { 091 return false; 092 } 093 if (!(obj instanceof Schedule)) { 094 return false; 095 } 096 return id.equals(((Schedule) obj).getId()); 097 } 098 099 @Override 100 public int hashCode() { 101 return id.hashCode(); 102 } 103 104 @Override 105 public boolean isEnabled() { 106 return enabled; 107 } 108}