Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DEMRegistratorImpl |
|
| 2.25;2,25 |
1 | 0 | /** |
2 | * - Digitalis Internal Framework v2.0 - (C) 2007, Digitalis Informatica. Distribuicao e Gestao de Informatica, Lda. | |
3 | * Estrada de Paco de Arcos num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 | |
4 | * http://www.digitalis.pt | |
5 | */ | |
6 | package pt.digitalis.dif.dem.config; | |
7 | ||
8 | import java.util.ArrayList; | |
9 | import java.util.HashMap; | |
10 | import java.util.List; | |
11 | import java.util.Map; | |
12 | ||
13 | import pt.digitalis.dif.codegen.util.DEMLoaderHelper; | |
14 | import pt.digitalis.dif.dem.Entity; | |
15 | ||
16 | /** | |
17 | * Holds the list of packages that will be searched for Entity classes by the DIFCodeGenerator. Provides methods to add | |
18 | * packages to the list of packages, and to access the list. | |
19 | * | |
20 | * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a> | |
21 | * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a> | |
22 | * @created Jul 23, 2007 | |
23 | */ | |
24 | 0 | final public class DEMRegistratorImpl implements IDEMRegistrator { |
25 | ||
26 | /** The list of entities, by type, to exclude from the load process */ | |
27 | 0 | private final Map<Entity, List<String>> entitiesToExclude = new HashMap<Entity, List<String>>(); |
28 | ||
29 | /** | |
30 | * @see pt.digitalis.dif.dem.config.IDEMRegistrator#excludeEntities(pt.digitalis.dif.dem.Entity, java.util.List) | |
31 | */ | |
32 | public void excludeEntities(Entity entityType, List<String> entities) | |
33 | { | |
34 | 0 | List<String> result = getEntitiesToExclude(entityType); |
35 | 0 | result.addAll(entities); |
36 | ||
37 | 0 | this.entitiesToExclude.put(entityType, result); |
38 | 0 | } |
39 | ||
40 | /** | |
41 | * @see pt.digitalis.dif.dem.config.IDEMRegistrator#getEntitiesToExclude(pt.digitalis.dif.dem.Entity) | |
42 | */ | |
43 | public List<String> getEntitiesToExclude(Entity entityType) | |
44 | { | |
45 | 0 | List<String> result = this.entitiesToExclude.get(entityType); |
46 | ||
47 | 0 | if (result == null) |
48 | { | |
49 | 0 | result = new ArrayList<String>(); |
50 | } | |
51 | 0 | return result; |
52 | } | |
53 | ||
54 | /** | |
55 | * @see pt.digitalis.dif.dem.config.IDEMRegistrator#registerAppSuiteBasePackage(java.lang.String) | |
56 | */ | |
57 | public boolean registerAppSuiteBasePackage(String packageName) | |
58 | { | |
59 | 0 | return (DEMLoaderHelper.addPackage(packageName + "." + DEMLoaderHelper.PROVIDERS_DIR) |
60 | 0 | && DEMLoaderHelper.addPackage(packageName + "." + DEMLoaderHelper.APPLICATIONS_DIR) |
61 | 0 | && DEMLoaderHelper.addPackage(packageName + "." + DEMLoaderHelper.SERVICES_DIR) |
62 | 0 | && DEMLoaderHelper.addPackage(packageName + "." + DEMLoaderHelper.STAGES_DIR) && DEMLoaderHelper |
63 | 0 | .addPackage(packageName + "." + DEMLoaderHelper.VALIDATORS_DIR)); |
64 | } | |
65 | ||
66 | /** | |
67 | * @see pt.digitalis.dif.dem.config.IDEMRegistrator#registerMetaModelPackage(java.lang.String) | |
68 | */ | |
69 | public boolean registerMetaModelPackage(String packageName) | |
70 | { | |
71 | 0 | return (DEMLoaderHelper.addPackage(packageName)); |
72 | } | |
73 | } |