01: /*
02: * Copyright 2007 Paolo Spizzirri (paolo.spizzirri@assetdata.it)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.romaframework.module.schedulerquartz.view.domain.quartzschedulerevent;
18:
19: import java.util.Map;
20:
21: import org.romaframework.aspect.core.annotation.CoreClass;
22: import org.romaframework.aspect.scheduler.SchedulerAspect;
23: import org.romaframework.aspect.view.annotation.ViewClass;
24: import org.romaframework.core.entity.ComposedEntityInstance;
25: import org.romaframework.core.flow.ObjectContext;
26: import org.romaframework.module.schedulerquartz.QuartzSchedulerAspect;
27: import org.romaframework.module.schedulerquartz.domain.QuartzSchedulerEvent;
28:
29: @ViewClass(entity=QuartzSchedulerEvent.class)
30: @CoreClass(orderFields="entity status lastExecution nextExecution")
31: public class QuartzSchedulerEventListable extends
32: ComposedEntityInstance<QuartzSchedulerEvent> {
33:
34: private Map<String, Object> jobsImplementation = null;
35:
36: public QuartzSchedulerEventListable(QuartzSchedulerEvent iEntity) {
37: super (iEntity);
38: }
39:
40: // INSERT HERE GETTER METHOD TO VIEW ADDITIONAL FIELDS
41: public String getStatus() {
42: QuartzSchedulerAspect schedulerAspect = (QuartzSchedulerAspect) ObjectContext
43: .getInstance().getComponent(SchedulerAspect.class);
44: return schedulerAspect.getEventState(getEntity().getName());
45: }
46:
47: public String getNextExecution() {
48: SchedulerAspect schedulerAspect = ObjectContext.getInstance()
49: .getComponent(SchedulerAspect.class);
50: return schedulerAspect.getNextEventExcecution(getEntity()
51: .getName());
52: }
53:
54: public String getLastExecution() {
55: SchedulerAspect schedulerAspect = ObjectContext.getInstance()
56: .getComponent(SchedulerAspect.class);
57: return schedulerAspect.getLastEventExcecution(getEntity()
58: .getName());
59:
60: }
61:
62: }
|