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.List;
20:
21: import org.romaframework.aspect.scheduler.SchedulerAspect;
22: import org.romaframework.aspect.view.ViewConstants;
23: import org.romaframework.aspect.view.annotation.ViewClass;
24: import org.romaframework.aspect.view.annotation.ViewField;
25: import org.romaframework.core.flow.ObjectContext;
26: import org.romaframework.core.validation.CustomValidation;
27: import org.romaframework.core.validation.ValidationException;
28: import org.romaframework.module.crud.CRUDInstance;
29: import org.romaframework.module.schedulerquartz.domain.QuartzSchedulerEvent;
30:
31: @ViewClass(entity=QuartzSchedulerEvent.class)
32: public class QuartzSchedulerEventInstance extends
33: CRUDInstance<QuartzSchedulerEvent> implements CustomValidation {
34:
35: @ViewField(render=ViewConstants.RENDER_SELECT,label="Implementations",selectionField="entity.implementation")
36: protected List<String> implementations;
37:
38: public List<String> getImplementations() {
39: return implementations;
40: }
41:
42: @Override
43: public void save() {
44: switch (getMode()) {
45:
46: case CRUDInstance.MODE_CREATE:
47: ObjectContext.getInstance().getComponent(
48: SchedulerAspect.class).schedule(getEntity());
49: break;
50:
51: case CRUDInstance.MODE_UPDATE:
52: ObjectContext.getInstance().getComponent(
53: SchedulerAspect.class).unSchedule(getEntity());
54: ObjectContext.getInstance().getComponent(
55: SchedulerAspect.class).schedule(getEntity());
56: break;
57: }
58: super .save();
59: }
60:
61: @Override
62: public void onShow() {
63: implementations = ObjectContext.getInstance().getComponent(
64: SchedulerAspect.class).getImplementationsList();
65:
66: }
67:
68: @Override
69: public void onCreate() {
70: }
71:
72: @Override
73: public void onRead() {
74: }
75:
76: @Override
77: public void onUpdate() {
78: }
79:
80: public void validate() throws ValidationException {
81: }
82: }
|