KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > map > event > DomainEvent


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20 package org.apache.cayenne.map.event;
21
22 import org.apache.cayenne.access.DataDomain;
23
24 /**
25  * Represents events resulted from DataDomain changes
26  * in CayenneModeler.
27  *
28  * @author Misha Shengaout
29  * @author Andrus Adamchik
30  */

31 public class DomainEvent extends MapEvent {
32     protected DataDomain domain;
33
34     /** Creates a domain change event. */
35     public DomainEvent(Object JavaDoc src, DataDomain domain) {
36         super(src);
37         this.domain = domain;
38     }
39
40     /** Creates a domain event of a specified type. */
41     public DomainEvent(Object JavaDoc src, DataDomain domain, int id) {
42         this(src, domain);
43         setId(id);
44     }
45
46     /** Creates a domain name change event.*/
47     public DomainEvent(Object JavaDoc src, DataDomain domain, String JavaDoc oldName) {
48         this(src, domain);
49         setOldName(oldName);
50     }
51
52     /** Returns domain object associated with this event. */
53     public DataDomain getDomain() {
54         return domain;
55     }
56
57     /**
58      * Sets domain object associated with this event.
59      *
60      * @param domain The domain to set
61      */

62     public void setDomain(DataDomain domain) {
63         this.domain = domain;
64     }
65     
66     public String JavaDoc getNewName() {
67         return (domain != null) ? domain.getName() : null;
68     }
69 }
70
Popular Tags