01: /*
02: * Copyright 2006 Giordano Maestro (giordano.maestro@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: package org.romaframework.module.designer.view.domain.radpage.aspect;
17:
18: import java.lang.reflect.Field;
19: import java.util.ArrayList;
20: import java.util.Collections;
21: import java.util.HashMap;
22: import java.util.HashSet;
23: import java.util.LinkedHashSet;
24: import java.util.LinkedList;
25: import java.util.List;
26: import java.util.Map;
27: import java.util.Set;
28: import java.util.Map.Entry;
29:
30: import org.romaframework.aspect.persistence.PersistenceAspect;
31: import org.romaframework.aspect.persistence.PersistenceConstants;
32: import org.romaframework.aspect.persistence.feature.PersistenceFeatures;
33: import org.romaframework.aspect.view.ViewAspect;
34: import org.romaframework.aspect.view.ViewConstants;
35: import org.romaframework.core.schema.SchemaFeatures;
36: import org.romaframework.module.designer.DesignerHelper;
37: import org.romaframework.module.designer.view.domain.FeatureListable;
38:
39: public class PersistenceAspectPage extends FeatureAspectPage {
40:
41: public PersistenceAspectPage(SchemaFeatures iActualFeature) {
42: super (PersistenceAspect.ASPECT_NAME, iActualFeature
43: .getFeatures(PersistenceAspect.ASPECT_NAME));
44: }
45:
46: @Override
47: protected List<FeatureListable> fillConfigurable() {
48: List<FeatureListable> result = new ArrayList<FeatureListable>();
49: if (actualFeature.getAttributes() != null) {
50: for (Entry<String, Object> entry : actualFeature
51: .getAttributes().entrySet()) {
52: if (entry.getKey().equals(PersistenceFeatures.MODE)) {
53: try {
54: result
55: .add(new FeatureListable(
56: entry.getKey(),
57: DesignerHelper
58: .getSelectableFeatureWrapper(
59: PersistenceAspect.ASPECT_NAME,
60: entry.getKey(),
61: entry
62: .getValue())));
63: } catch (ClassNotFoundException e) {
64: throw new RuntimeException(e);
65: }
66: }
67: }
68: }
69: return result;
70: }
71:
72: @Override
73: public Map<String, Object> getDefaultValues() {
74: return new HashMap<String, Object>();
75: }
76:
77: }
|