KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbcore > ui > logicalview > ejb > entity > MethodChildren


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.entity;
21
22 import java.util.Collection JavaDoc;
23 import org.netbeans.modules.j2ee.dd.api.ejb.Entity;
24 import org.netbeans.modules.j2ee.ejbcore.api.methodcontroller.EntityMethodController;
25 import org.openide.filesystems.FileObject;
26
27 /**
28  *
29  * @author Chris Webster
30  * @author Martin Adamek
31  */

32
33 //TODO: RETOUCHE
34

35 public class MethodChildren /*extends ComponentMethodModel*/ {
36 // private ComponentMethodViewStrategy mvs;
37
private final EntityMethodController controller;
38     private final boolean local;
39     private final FileObject ddFile;
40     private final Entity entity;
41     
42     public MethodChildren(EntityMethodController smc, Entity model, Collection JavaDoc interfaces, boolean local, FileObject ddFile) {
43 // super(smc.getBeanClass(), interfaces);
44
controller = smc;
45         this.local = local;
46         this.ddFile = ddFile;
47         this.entity = model;
48 // mvs = new EntityStrategy();
49
}
50
51     protected Collection JavaDoc getInterfaces() {
52         if (local) {
53             return controller.getLocalInterfaces();
54         } else {
55             return controller.getRemoteInterfaces();
56         }
57     }
58
59 // public ComponentMethodViewStrategy createViewStrategy() {
60
// return mvs;
61
// }
62
//
63
// private class EntityStrategy implements ComponentMethodViewStrategy {
64
//
65
// public void deleteImplMethod(Method me, JavaClass implClass, Collection interfaces) throws java.io.IOException {
66
// String methodName = me.getName();
67
// if (methodName.startsWith("find") || //NOI18N
68
// methodName.startsWith("ejbSelect")) { //NOI18N
69
// controller.deleteQueryMapping(me, ddFile);
70
// }
71
// controller.delete(me,local);
72
// }
73
//
74
// public Image getBadge(Method me, Collection interfaces) {
75
// return null;
76
// }
77
//
78
// public Image getIcon(Method me, java.util.Collection interfaces) {
79
// IconVisitor iv = new IconVisitor();
80
// return Utilities.loadImage(iv.getIconUrl(controller.getMethodTypeFromInterface(me)));
81
// }
82
//
83
// public OpenCookie getOpenCookie(Method me, JavaClass implClass, Collection interfaces) {
84
// if (controller.getMethodTypeFromInterface(me).getKind() == MethodType.Kind.FINDER) {
85
// return new FinderOpenCookie(me);
86
// }
87
// Method impl = controller.getPrimaryImplementation(me);
88
// return (OpenCookie) JMIUtils.getCookie(impl, OpenCookie.class);
89
// }
90
// }
91
//
92
// private class FinderOpenCookie implements OpenCookie {
93
//
94
// private Method me;
95
//
96
// public FinderOpenCookie(Method me) {
97
// this.me = me;
98
// }
99
//
100
// public void open() {
101
// try {
102
// DataObject ddFileDO = DataObject.find(ddFile);
103
// Object c = ddFileDO.getCookie(DDEditorNavigator.class);
104
// if (c != null) {
105
// Query[] queries = entity.getQuery();
106
// for (int i = 0; i < queries.length; i++) {
107
// String methodName = queries[i].getQueryMethod().getMethodName();
108
// if (methodName.equals(me.getName())) {
109
// ((DDEditorNavigator) c).showElement(queries[i]);
110
// }
111
// }
112
// }
113
// } catch (DataObjectNotFoundException donf) {
114
// // do nothing
115
// }
116
// }
117
// }
118

119 }
120
Popular Tags