001: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012: // POSSIBILITY OF SUCH DAMAGE.
013: //
014: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015: package com.metaboss.sdlctools.models.modelassistant.metabossmodel.domainsupport;
016:
017: import com.metaboss.util.StringUtils;
018:
019: /** Implementation of the simple stylesheet class, which is
020: * responsible for creation of derived names */
021: public class StylesheetImpl {
022: // Helper. Returns the name of the domain support servicemodule
023: static String getDomainSupportServicemoduleName(String pDomainName) {
024: // Use normalised name here
025: return StringUtils.suggestName(pDomainName, true, false)
026: + "DomainSupport";
027: }
028:
029: // Helper. Returns the name of the domain support servicemodule
030: static String getDomainSupportServicemoduleDescription(
031: String pDomainName) {
032: return "This module offers basic administration features for the "
033: + pDomainName + " domain";
034: }
035:
036: // Helper. Returns the name of the data management service
037: static String getDataManagementServiceName(String pDomainName) {
038: return "DataManagement";
039: }
040:
041: // Helper. Returns the name of the domain support servicemodule
042: static String getDataManagementServiceDescription(String pDomainName) {
043: return "This service provides basic data management features (create, get, update, delete) for the entities from the "
044: + pDomainName + " domain";
045: }
046:
047: // Helper. Returns the name of the entity key structure
048: static String getEntityKeyStructureName(String pEntityName) {
049: // Use normalised name here
050: return StringUtils.suggestName(pEntityName, true, false)
051: + "Key";
052: }
053:
054: // Helper. Returns the name of the entity key structure validation constraint
055: static String getEntityKeyStructureValidationConstraintName() {
056: return "EntityKeyStructureValidityConstraint";
057: }
058:
059: // Helper. Returns the description of the entity key structure validation constraint
060: static String getEntityKeyStructureValidationConstraintDescription(
061: String pEntityName) {
062: return "This constraint ensures the "
063: + getEntityKeyStructureName(pEntityName)
064: + " structure contains enough data to uniquely identify the instance of the "
065: + pEntityName;
066: }
067:
068: // Helper. Returns the name of the input parameter containing entity key
069: static String getEntityKeyOperationInputParameterName(
070: String pEntityName) {
071: return StringUtils.suggestName(pEntityName, true, false)
072: + "Key";
073: }
074:
075: // Helper. Returns the description of the entity key structure
076: static String getEntityKeyStructureDescription(String pEntityName) {
077: return "This structure is used to uniquely identify the instance of the '"
078: + pEntityName
079: + "' entity in inputs to or outputs from various operations.";
080: }
081:
082: // Helper. Returns the name of the entity details structure
083: static String getEntityDetailsStructureName(String pEntityName) {
084: // Use normalised name here
085: return StringUtils.suggestName(pEntityName, true, false)
086: + "Details";
087: }
088:
089: // Helper. Returns the message name
090: static String getEntityInstanceNotFoundMessageName(
091: String pEntityName) {
092: // Use normalised name here
093: return StringUtils.suggestName(pEntityName, true, false)
094: + "InstanceNotFoundError";
095: }
096:
097: // Helper. Returns the message name
098: static String getEntityVersionIdMismatchMessageName(
099: String pEntityName) {
100: // Use normalised name here
101: return StringUtils.suggestName(pEntityName, true, false)
102: + "VersionMismatchError";
103: }
104:
105: // Helper. Returns the message name
106: static String getDuplicateCreateFailedMessageName(String pEntityName) {
107: // Use normalised name here
108: return StringUtils.suggestName(pEntityName, true, false)
109: + "CreationDuplicateKeyError";
110: }
111:
112: // Helper. Returns the description of the entity details structure
113: static String getEntityDetailsStructureDescription(
114: String pEntityName) {
115: return "This structure is used to carry details of the instance of the '"
116: + pEntityName
117: + "' entity in inputs to or outputs from various administraton operations.";
118: }
119:
120: // Helper. Returns the name of the entity instance id field
121: static String getEntityInstanceIdStructureFieldName(
122: String pEntityName, String pInstanceIdAttributeNameOverride) {
123: return (pInstanceIdAttributeNameOverride != null && pInstanceIdAttributeNameOverride
124: .length() > 0) ? pInstanceIdAttributeNameOverride
125: : "InstanceId";
126: }
127:
128: // Helper. Returns the description of the entity instance id field
129: static String getEntityInstanceIdStructureFieldDescription(
130: String pEntityName) {
131: return pEntityName
132: + " instance identifier. At most one instance can have the particular value";
133: }
134:
135: // Helper. Returns the name of the entity version id field
136: static String getEntityVersionIdStructureFieldName(
137: String pEntityName, String pVersionIdAttributeNameOverride) {
138: return (pVersionIdAttributeNameOverride != null && pVersionIdAttributeNameOverride
139: .length() > 0) ? pVersionIdAttributeNameOverride
140: : "VersionId";
141: }
142:
143: // Helper. Returns the description of the version instance id field
144: static String getEntityVersionIdStructureFieldDescription(
145: String pEntityName) {
146: return pEntityName
147: + " version identifier. Every successfull update of the instance increments this version identifier";
148: }
149:
150: // Helper. Returns the name of the entity state field
151: static String getEntityStateStructureFieldName(String pEntityName,
152: String pStateAttributeNameOverride) {
153: return (pStateAttributeNameOverride != null && pStateAttributeNameOverride
154: .length() > 0) ? pStateAttributeNameOverride : "State";
155: }
156:
157: // Helper. Returns the description of the entity state field
158: static String getEntityStateStructureFieldDescription(
159: String pEntityName) {
160: return pEntityName
161: + " state identifier. Part of the instance lifecycle management";
162: }
163:
164: // Helper. Returns the name of the entity attribute field
165: static String getEntityAttributeStructureFieldName(
166: String pAttributeName) {
167: return StringUtils.suggestName(pAttributeName, true, false);
168: }
169:
170: // Helper. Returns the name of the entity attribute field
171: static String getEntityReferenceStructureFieldName(
172: String pReferenceName) {
173: return StringUtils.suggestName(pReferenceName, true, false);
174: }
175:
176: // Helper. Returns the description of the version instance id field
177: static String getEntityAttributeStructureFieldDescription(
178: String pAttributeName, String pAttributeDescription) {
179: return pAttributeDescription;
180: }
181:
182: // Helper. Returns the description of the reference field
183: static String getEntityReferenceStructureFieldDescription(
184: String pReferenceName, String pReferenceDescription) {
185: return pReferenceDescription;
186: }
187:
188: // Helper. Returns the message name
189: static String getEntityNotFoundOperationOutputMessageName(
190: String pEntityName) {
191: // Use normalised name here
192: return StringUtils.suggestName(pEntityName, true, false)
193: + "NotFoundError";
194: }
195:
196: // Helper. Returns the message description
197: static String getEntityNotFoundOperationOutputMessageDescription(
198: String pEntityName) {
199: // Use name 'as is' here
200: return "Error message in case of failure or null if this error has not occurred.";
201: }
202:
203: // Helper. Returns the message name
204: static String getEmptyMandatoryReferenceOperationOutputMessageName(
205: String pReferenceName) {
206: // Use normalised name here
207: return "Empty"
208: + StringUtils.suggestName(pReferenceName, true, false)
209: + "Error";
210: }
211:
212: // Helper. Returns the message description
213: static String getEmptyMandatoryReferenceOperationOutputMessageDescription(
214: String pReferenceName) {
215: // Use name 'as is' here
216: return "Error message in case when " + pReferenceName
217: + " is not defined in the input to the operation.";
218: }
219:
220: }
|