`AbstractMVCHandler.java`
`001 /* 002 * Copyright 2010-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.codehaus.griffon.runtime.core; 018 019 import griffon.core.*; 020 import griffon.util.ApplicationHolder; 021 import groovy.lang.Closure; 022 023 import java.util.Collections; 024 import java.util.List; 025 import java.util.Map; 026 027 /** 028 * Base implementation of the MVCHandler interface. 029 * 030 * @author Andres Almiray 031 * @since 0.9.3 032 */ 033 public abstract class AbstractMVCHandler implements MVCHandler { 034 protected GriffonApplication getApp() { 035 return ApplicationHolder.getApplication(); 036 } 037 038 public MVCGroup buildMVCGroup(String mvcType) { 039 return getApp().getMvcGroupManager().buildMVCGroup(mvcType, null, Collections.<String, Object>emptyMap()); 040 } 041 042 public MVCGroup buildMVCGroup(String mvcType, String mvcName) { 043 return getApp().getMvcGroupManager().buildMVCGroup(mvcType, mvcName, Collections.<String, Object>emptyMap()); 044 } 045 046 public MVCGroup buildMVCGroup(Map<String, Object> args, String mvcType) { 047 return getApp().getMvcGroupManager().buildMVCGroup(mvcType, null, args); 048 } 049 050 public MVCGroup buildMVCGroup(String mvcType, Map<String, Object> args) { 051 return getApp().getMvcGroupManager().buildMVCGroup(mvcType, null, args); 052 } 053 054 public MVCGroup buildMVCGroup(Map<String, Object> args, String mvcType, String mvcName) { 055 return getApp().getMvcGroupManager().buildMVCGroup(mvcType, mvcName, args); 056 } 057 058 public MVCGroup buildMVCGroup(String mvcType, String mvcName, Map<String, Object> args) { 059 return getApp().getMvcGroupManager().buildMVCGroup(mvcType, mvcName, args); 060 } 061 062 public List<? extends GriffonMvcArtifact> createMVCGroup(String mvcType) { 063 return getApp().getMvcGroupManager().createMVCGroup(mvcType, null, Collections.<String, Object>emptyMap()); 064 } 065 066 public List<? extends GriffonMvcArtifact> createMVCGroup(Map<String, Object> args, String mvcType) { 067 return getApp().getMvcGroupManager().createMVCGroup(mvcType, null, args); 068 } 069 070 public List<? extends GriffonMvcArtifact> createMVCGroup(String mvcType, Map<String, Object> args) { 071 return getApp().getMvcGroupManager().createMVCGroup(mvcType, null, args); 072 } 073 074 public List<? extends GriffonMvcArtifact> createMVCGroup(String mvcType, String mvcName) { 075 return getApp().getMvcGroupManager().createMVCGroup(mvcType, mvcName, Collections.<String, Object>emptyMap()); 076 } 077 078 public List<? extends GriffonMvcArtifact> createMVCGroup(Map<String, Object> args, String mvcType, String mvcName) { 079 return getApp().getMvcGroupManager().createMVCGroup(mvcType, mvcName, args); 080 } 081 082 public List<? extends GriffonMvcArtifact> createMVCGroup(String mvcType, String mvcName, Map<String, Object> args) { 083 return getApp().getMvcGroupManager().createMVCGroup(mvcType, mvcName, args); 084 } 085 086 public void destroyMVCGroup(String mvcName) { 087 getApp().getMvcGroupManager().destroyMVCGroup(mvcName); 088 } 089 090 public void withMVCGroup(String mvcType, Closure handler) { 091 getApp().getMvcGroupManager().withMVCGroup(mvcType, null, Collections.<String, Object>emptyMap(), handler); 092 } 093 094 public void withMVCGroup(String mvcType, String mvcName, Closure handler) { 095 getApp().getMvcGroupManager().withMVCGroup(mvcType, mvcName, Collections.<String, Object>emptyMap(), handler); 096 } 097 098 public void withMVCGroup(String mvcType, Map<String, Object> args, Closure handler) { 099 getApp().getMvcGroupManager().withMVCGroup(mvcType, null, args, handler); 100 } 101 102 public void withMVCGroup(Map<String, Object> args, String mvcType, Closure handler) { 103 getApp().getMvcGroupManager().withMVCGroup(mvcType, null, args, handler); 104 } 105 106 public void withMVCGroup(String mvcType, String mvcName, Map<String, Object> args, Closure handler) { 107 getApp().getMvcGroupManager().withMVCGroup(mvcType, mvcName, args, handler); 108 } 109 110 public void withMVCGroup(Map<String, Object> args, String mvcType, String mvcName, Closure handler) { 111 getApp().getMvcGroupManager().withMVCGroup(mvcType, mvcName, args, handler); 112 } 113 114 public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVCGroup(String mvcType, MVCClosure<M, V, C> handler) { 115 getApp().getMvcGroupManager().withMVCGroup(mvcType, null, Collections.<String, Object>emptyMap(), handler); 116 } 117 118 public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVCGroup(String mvcType, String mvcName, MVCClosure<M, V, C> handler) { 119 getApp().getMvcGroupManager().withMVCGroup(mvcType, mvcName, Collections.<String, Object>emptyMap(), handler); 120 } 121 122 public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVCGroup(String mvcType, Map<String, Object> args, MVCClosure<M, V, C> handler) { 123 getApp().getMvcGroupManager().withMVCGroup(mvcType, null, args, handler); 124 } 125 126 public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVCGroup(Map<String, Object> args, String mvcType, MVCClosure<M, V, C> handler) { 127 getApp().getMvcGroupManager().withMVCGroup(mvcType, null, args, handler); 128 } 129 130 public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVCGroup(String mvcType, String mvcName, Map<String, Object> args, MVCClosure<M, V, C> handler) { 131 getApp().getMvcGroupManager().withMVCGroup(mvcType, mvcName, args, handler); 132 } 133 134 public <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVCGroup(Map<String, Object> args, String mvcType, String mvcName, MVCClosure<M, V, C> handler) { 135 getApp().getMvcGroupManager().withMVCGroup(mvcType, mvcName, args, handler); 136 } 137 }`