Implement toString for the API domain implementation classes
[smart-dao.git] / smart-exim / smart-exim-api / src / main / java / com / smartitengineering / exim / impl / EximResourceConfigImpl.java
blob76c5600f377ceda605048beb12ccf105fbc96785
1 /*
2 * This is a common dao with basic CRUD operations and is not limited to any
3 * persistent layer implementation
4 *
5 * Copyright (C) 2008 Imran M Yousuf (imyousuf@smartitengineering.com)
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 package com.smartitengineering.exim.impl;
21 import com.smartitengineering.exim.AssociationConfig;
22 import com.smartitengineering.exim.EximResourceConfig;
23 import java.util.HashMap;
24 import java.util.Map;
26 /**
27 * This implementation represents the configuration of a class. 2 configuration
28 * objects are considered to be equal if they represent the same class.
29 * @author imyousuf
30 * @since 0.4
32 public class EximResourceConfigImpl
33 implements EximResourceConfig {
35 private boolean associateExportPolicyAsUri;
36 private boolean accessByPropertyEnabled;
37 private boolean identityCustomizerImplemented;
38 private boolean exporterImplemented;
39 private boolean importerImplemented;
40 private Class domainClass;
41 private String pathToResource;
42 private String idPrefix;
43 private String idPropertyName;
44 private String name;
45 private Map<String, AssociationConfig> associationConfigs;
47 public void setAccessByPropertyEnabled(boolean accessByPropertyEnabled) {
48 this.accessByPropertyEnabled = accessByPropertyEnabled;
51 public void setAssociateExportPolicyAsUri(boolean associateExportPolicyAsUri) {
52 this.associateExportPolicyAsUri = associateExportPolicyAsUri;
55 public void setAssociationConfigs(
56 Map<String, AssociationConfig> associationConfigs) {
57 this.associationConfigs = associationConfigs;
60 public void setDomainClass(Class domainClass) {
61 this.domainClass = domainClass;
64 public void setExporterImplemented(boolean exporterImplemented) {
65 this.exporterImplemented = exporterImplemented;
68 public void setIdPropertyName(String idPropertyName) {
69 this.idPropertyName = idPropertyName;
72 public void setIdPrefix(String idPrefix) {
73 this.idPrefix = idPrefix;
76 public void setIdentityCustomizerImplemented(
77 boolean identityCustomizerImplemented) {
78 this.identityCustomizerImplemented = identityCustomizerImplemented;
81 public void setImporterImplemented(boolean importerImplemented) {
82 this.importerImplemented = importerImplemented;
85 public void setPathToResource(String pathToResource) {
86 this.pathToResource = pathToResource;
89 public void setName(String name) {
90 this.name = name;
93 public boolean isAccessByPropertyEnabled() {
94 return accessByPropertyEnabled;
97 public boolean isAssociateExportPolicyAsUri() {
98 return associateExportPolicyAsUri;
101 public Map<String, AssociationConfig> getAssociationConfigs() {
102 if(associationConfigs == null) {
103 associationConfigs = new HashMap<String, AssociationConfig>();
105 return associationConfigs;
108 public Class getDomainClass() {
109 return domainClass;
112 public boolean isExporterImplemented() {
113 return exporterImplemented;
116 public String getIdPropertyName() {
117 return idPropertyName;
120 public String getIdPrefix() {
121 return idPrefix;
124 public boolean isIdentityCustomizerImplemented() {
125 return identityCustomizerImplemented;
128 public boolean isImporterImplemented() {
129 return importerImplemented;
132 public String getPathToResource() {
133 return pathToResource;
136 public String getName() {
137 return name;
140 @Override
141 public String toString() {
142 StringBuilder toStringBuilder = new StringBuilder();
143 toStringBuilder.append(super.toString());
144 toStringBuilder.append("\n");
145 toStringBuilder.append("\nassociateExportPolicyAsUri: ");
146 toStringBuilder.append(associateExportPolicyAsUri);
147 toStringBuilder.append("\naccessByPropertyEnabled: ");
148 toStringBuilder.append(accessByPropertyEnabled);
149 toStringBuilder.append("\nidentityCustomizerImplemented: ");
150 toStringBuilder.append(identityCustomizerImplemented);
151 toStringBuilder.append("\nexporterImplemented: ");
152 toStringBuilder.append(exporterImplemented);
153 toStringBuilder.append("\nimporterImplemented: ");
154 toStringBuilder.append(importerImplemented);
155 toStringBuilder.append("\ndomainClass: ");
156 toStringBuilder.append(domainClass);
157 toStringBuilder.append("\npathToResource: ");
158 toStringBuilder.append(pathToResource);
159 toStringBuilder.append("\nidPrefix: ");
160 toStringBuilder.append(idPrefix);
161 toStringBuilder.append("\nidPropertyName: ");
162 toStringBuilder.append(idPropertyName);
163 toStringBuilder.append("\nname: ");
164 toStringBuilder.append(name);
165 toStringBuilder.append("\nassociationConfigs: ");
166 for(Map.Entry<String, AssociationConfig> configEntry : associationConfigs.entrySet()) {
167 toStringBuilder.append("\n\t");
168 toStringBuilder.append(configEntry.getKey());
169 toStringBuilder.append(": ");
170 toStringBuilder.append(configEntry.getValue().toString().replaceAll(
171 "\n", "\n\t\t"));
173 return toStringBuilder.toString();