0001: /*
0002: * Copyright 2005-2007 The Kuali Foundation.
0003: *
0004: * Licensed under the Educational Community License, Version 1.0 (the "License");
0005: * you may not use this file except in compliance with the License.
0006: * You may obtain a copy of the License at
0007: *
0008: * http://www.opensource.org/licenses/ecl1.php
0009: *
0010: * Unless required by applicable law or agreed to in writing, software
0011: * distributed under the License is distributed on an "AS IS" BASIS,
0012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013: * See the License for the specific language governing permissions and
0014: * limitations under the License.
0015: */
0016: package org.kuali.core.service.impl;
0017:
0018: import java.math.BigDecimal;
0019: import java.util.ArrayList;
0020: import java.util.HashMap;
0021: import java.util.Iterator;
0022: import java.util.List;
0023: import java.util.Map;
0024: import java.util.regex.Pattern;
0025:
0026: import org.apache.commons.lang.StringUtils;
0027: import org.kuali.core.datadictionary.AttributeDefinition;
0028: import org.kuali.core.datadictionary.BusinessObjectEntry;
0029: import org.kuali.core.datadictionary.CollectionDefinition;
0030: import org.kuali.core.datadictionary.DataDictionary;
0031: import org.kuali.core.datadictionary.DataDictionaryBuilder;
0032: import org.kuali.core.datadictionary.DataDictionaryEntryBase;
0033: import org.kuali.core.datadictionary.DocumentEntry;
0034: import org.kuali.core.datadictionary.PrimitiveAttributeDefinition;
0035: import org.kuali.core.datadictionary.RelationshipDefinition;
0036: import org.kuali.core.datadictionary.ValidationCompletionUtils;
0037: import org.kuali.core.datadictionary.control.ControlDefinition;
0038: import org.kuali.core.datadictionary.exporter.DataDictionaryMap;
0039: import org.kuali.core.datadictionary.mask.Mask;
0040: import org.kuali.core.document.Document;
0041: import org.kuali.core.exceptions.UnknownBusinessClassAttributeException;
0042: import org.kuali.core.service.AuthorizationService;
0043: import org.kuali.core.service.DataDictionaryService;
0044: import org.kuali.core.service.KualiConfigurationService;
0045: import org.kuali.core.service.KualiGroupService;
0046: import org.kuali.core.service.KualiModuleService;
0047:
0048: /**
0049: * This class is the service implementation for a DataDictionary. It is a thin wrapper around creating, initializing, and returning
0050: * a DataDictionary. This is the default, Kuali delivered implementation.
0051: */
0052: public class DataDictionaryServiceImpl implements DataDictionaryService {
0053:
0054: private DataDictionaryBuilder dataDictionaryBuilder;
0055: private DataDictionaryMap dataDictionaryMap = new DataDictionaryMap(
0056: this );
0057:
0058: private KualiConfigurationService kualiConfigurationService;
0059: private KualiGroupService kualiGroupService;
0060: private KualiModuleService kualiModuleService;
0061: private AuthorizationService authorizationService;
0062:
0063: /**
0064: * @see org.kuali.core.service.DataDictionaryService#setBaselinePackages(java.lang.String)
0065: */
0066: public void setBaselinePackages(List baselinePackages) {
0067: this .addDataDictionaryLocations(baselinePackages);
0068: }
0069:
0070: /**
0071: * Default constructor.
0072: */
0073: public DataDictionaryServiceImpl(
0074: ValidationCompletionUtils validationCompletionUtils) {
0075: dataDictionaryBuilder = new DataDictionaryBuilder(
0076: validationCompletionUtils);
0077: }
0078:
0079: /**
0080: * @see org.kuali.core.service.DataDictionaryService#getDataDictionary()
0081: */
0082: public DataDictionary getDataDictionary() {
0083: return dataDictionaryBuilder.getDataDictionary();
0084: }
0085:
0086: /**
0087: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeControlDefinition(java.lang.String)
0088: */
0089: public ControlDefinition getAttributeControlDefinition(
0090: String entryName, String attributeName) {
0091: ControlDefinition controlDefinition = null;
0092:
0093: AttributeDefinition attributeDefinition = getAttributeDefinition(
0094: entryName, attributeName);
0095: if (attributeDefinition != null) {
0096: controlDefinition = attributeDefinition.getControl();
0097: }
0098:
0099: return controlDefinition;
0100: }
0101:
0102: /**
0103: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeSize(java.lang.String)
0104: */
0105: public Integer getAttributeSize(String entryName,
0106: String attributeName) {
0107: Integer size = null;
0108:
0109: AttributeDefinition attributeDefinition = getAttributeDefinition(
0110: entryName, attributeName);
0111: if (attributeDefinition != null) {
0112: ControlDefinition controlDefinition = attributeDefinition
0113: .getControl();
0114: if (controlDefinition.isText()
0115: || controlDefinition.isCurrency()) {
0116: size = controlDefinition.getSize();
0117: }
0118: }
0119:
0120: return size;
0121: }
0122:
0123: /**
0124: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeMaxLength(java.lang.String)
0125: */
0126: public Integer getAttributeMaxLength(String entryName,
0127: String attributeName) {
0128: Integer maxLength = null;
0129:
0130: AttributeDefinition attributeDefinition = getAttributeDefinition(
0131: entryName, attributeName);
0132: if (attributeDefinition != null) {
0133: maxLength = attributeDefinition.getMaxLength();
0134: }
0135:
0136: return maxLength;
0137: }
0138:
0139: /**
0140: * @see org.kuali.core.service.DataDictionaryService#getAttributeExclusiveMin
0141: */
0142: public BigDecimal getAttributeExclusiveMin(String entryName,
0143: String attributeName) {
0144: AttributeDefinition attributeDefinition = getAttributeDefinition(
0145: entryName, attributeName);
0146: return attributeDefinition == null ? null : attributeDefinition
0147: .getExclusiveMin();
0148: }
0149:
0150: /**
0151: * @see org.kuali.core.service.DataDictionaryService#getAttributeInclusiveMax
0152: */
0153: public BigDecimal getAttributeInclusiveMax(String entryName,
0154: String attributeName) {
0155: AttributeDefinition attributeDefinition = getAttributeDefinition(
0156: entryName, attributeName);
0157: return attributeDefinition == null ? null : attributeDefinition
0158: .getInclusiveMax();
0159: }
0160:
0161: /**
0162: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeValidatingExpression(java.lang.String)
0163: */
0164: public Pattern getAttributeValidatingExpression(String entryName,
0165: String attributeName) {
0166: Pattern regex = null;
0167:
0168: AttributeDefinition attributeDefinition = getAttributeDefinition(
0169: entryName, attributeName);
0170: if (attributeDefinition != null) {
0171: if (attributeDefinition.hasValidationPattern()) {
0172: regex = attributeDefinition.getValidationPattern()
0173: .getRegexPattern();
0174: } else {
0175: // workaround for existing calls which don't bother checking for null return values
0176: regex = Pattern.compile(".*");
0177: }
0178: }
0179:
0180: return regex;
0181: }
0182:
0183: /**
0184: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeLabel(java.lang.String)
0185: */
0186: public String getAttributeLabel(String entryName,
0187: String attributeName) {
0188: String label = "";
0189:
0190: AttributeDefinition attributeDefinition = getAttributeDefinition(
0191: entryName, attributeName);
0192: if (attributeDefinition != null) {
0193: if (!StringUtils.isEmpty(attributeDefinition
0194: .getDisplayLabelAttribute())) {
0195: attributeDefinition = getAttributeDefinition(entryName,
0196: attributeDefinition.getDisplayLabelAttribute());
0197: if (attributeDefinition != null) {
0198: label = attributeDefinition.getLabel();
0199: }
0200: }
0201: label = attributeDefinition.getLabel();
0202: }
0203:
0204: return label;
0205: }
0206:
0207: /**
0208: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeShortLabel(java.lang.String)
0209: */
0210: public String getAttributeShortLabel(String entryName,
0211: String attributeName) {
0212: String shortLabel = "";
0213:
0214: AttributeDefinition attributeDefinition = getAttributeDefinition(
0215: entryName, attributeName);
0216: if (attributeDefinition != null) {
0217: if (!StringUtils.isEmpty(attributeDefinition
0218: .getDisplayLabelAttribute())) {
0219: attributeDefinition = getAttributeDefinition(entryName,
0220: attributeDefinition.getDisplayLabelAttribute());
0221: if (attributeDefinition != null) {
0222: shortLabel = attributeDefinition.getShortLabel();
0223: }
0224: } else {
0225: shortLabel = attributeDefinition.getShortLabel();
0226: }
0227: }
0228:
0229: return shortLabel;
0230: }
0231:
0232: /**
0233: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeErrorLabel(java.lang.String)
0234: */
0235: public String getAttributeErrorLabel(String entryName,
0236: String attributeName) {
0237: String longAttributeLabel = this .getAttributeLabel(entryName,
0238: attributeName);
0239: String shortAttributeLabel = this .getAttributeShortLabel(
0240: entryName, attributeName);
0241: return longAttributeLabel + " (" + shortAttributeLabel + ")";
0242: }
0243:
0244: /**
0245: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeFormatter(java.lang.String)
0246: */
0247: public Class getAttributeFormatter(String entryName,
0248: String attributeName) {
0249: Class formatterClass = null;
0250:
0251: AttributeDefinition attributeDefinition = getAttributeDefinition(
0252: entryName, attributeName);
0253: if (attributeDefinition != null) {
0254: if (attributeDefinition.hasFormatterClass()) {
0255: formatterClass = attributeDefinition
0256: .getFormatterClass();
0257: }
0258: }
0259:
0260: return formatterClass;
0261: }
0262:
0263: /**
0264: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeForceUppercase(java.lang.String)
0265: */
0266: public Boolean getAttributeForceUppercase(String entryName,
0267: String attributeName)
0268: throws UnknownBusinessClassAttributeException {
0269: Boolean forceUppercase = null;
0270:
0271: AttributeDefinition attributeDefinition = getAttributeDefinition(
0272: entryName, attributeName);
0273: if (attributeDefinition == null) {
0274: throw new UnknownBusinessClassAttributeException(
0275: "Could not find a matching data dictionary business class attribute entry for "
0276: + entryName + "." + attributeName);
0277: }
0278: forceUppercase = attributeDefinition.getForceUppercase();
0279:
0280: return forceUppercase;
0281: }
0282:
0283: /**
0284: * @see org.kuali.core.service.DataDictionaryService#getAttributeDisplayMask(java.lang.String, java.lang.String)
0285: */
0286: public Mask getAttributeDisplayMask(String entryName,
0287: String attributeName) {
0288: Mask displayMask = null;
0289:
0290: AttributeDefinition attributeDefinition = getAttributeDefinition(
0291: entryName, attributeName);
0292: if (attributeDefinition != null) {
0293: displayMask = attributeDefinition.getDisplayMask();
0294: }
0295:
0296: return displayMask;
0297: }
0298:
0299: /**
0300: * @see org.kuali.core.service.DataDictionaryService#getAttributeDisplayWorkgroup(java.lang.String, java.lang.String)
0301: */
0302: public String getAttributeDisplayWorkgroup(String entryName,
0303: String attributeName) {
0304: String displayWorkgroup = "";
0305:
0306: AttributeDefinition attributeDefinition = getAttributeDefinition(
0307: entryName, attributeName);
0308: if (attributeDefinition != null) {
0309: displayWorkgroup = attributeDefinition
0310: .getDisplayWorkgroup();
0311: }
0312:
0313: return displayWorkgroup;
0314: }
0315:
0316: /**
0317: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeSummary(java.lang.String)
0318: */
0319: public String getAttributeSummary(String entryName,
0320: String attributeName) {
0321: String summary = null;
0322:
0323: AttributeDefinition attributeDefinition = getAttributeDefinition(
0324: entryName, attributeName);
0325: if (attributeDefinition != null) {
0326: summary = attributeDefinition.getSummary();
0327: }
0328:
0329: return summary;
0330: }
0331:
0332: /**
0333: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeDescription(java.lang.String)
0334: */
0335: public String getAttributeDescription(String entryName,
0336: String attributeName) {
0337: String description = null;
0338:
0339: AttributeDefinition attributeDefinition = getAttributeDefinition(
0340: entryName, attributeName);
0341: if (attributeDefinition != null) {
0342: description = attributeDefinition.getDescription();
0343: }
0344:
0345: return description;
0346: }
0347:
0348: /**
0349: * @see org.kuali.core.service.BusinessObjectDictionaryService#isAttributeRequired(java.lang.Class, java.lang.String)
0350: */
0351: public Boolean isAttributeRequired(String entryName,
0352: String attributeName) {
0353: Boolean required = null;
0354:
0355: AttributeDefinition attributeDefinition = getAttributeDefinition(
0356: entryName, attributeName);
0357: if (attributeDefinition != null) {
0358: required = attributeDefinition.isRequired();
0359: }
0360:
0361: return required;
0362: }
0363:
0364: /**
0365: * @see org.kuali.core.service.BusinessObjectDictionaryService#isAttributeDefined(java.lang.Class, java.lang.String)
0366: */
0367: public Boolean isAttributeDefined(String entryName,
0368: String attributeName) {
0369: boolean isDefined = false;
0370:
0371: AttributeDefinition attributeDefinition = getAttributeDefinition(
0372: entryName, attributeName);
0373: if (attributeDefinition != null) {
0374: isDefined = true;
0375: }
0376:
0377: return Boolean.valueOf(isDefined);
0378: }
0379:
0380: /**
0381: * @see org.kuali.core.service.BusinessObjectDictionaryService#getAttributeValuesScopeId(java.lang.Class, java.lang.String)
0382: */
0383: public Class getAttributeValuesFinderClass(String entryName,
0384: String attributeName) {
0385: Class valuesFinderClass = null;
0386:
0387: AttributeDefinition attributeDefinition = getAttributeDefinition(
0388: entryName, attributeName);
0389: if (attributeDefinition != null) {
0390: valuesFinderClass = attributeDefinition.getControl()
0391: .getValuesFinderClass();
0392: }
0393:
0394: return valuesFinderClass;
0395: }
0396:
0397: /**
0398: * @see org.kuali.core.service.BusinessObjectDictionaryService#getCollectionLabel(java.lang.Class, java.lang.String)
0399: */
0400: public String getCollectionLabel(String entryName,
0401: String collectionName) {
0402: String label = "";
0403:
0404: CollectionDefinition collectionDefinition = getCollectionDefinition(
0405: entryName, collectionName);
0406: if (collectionDefinition != null) {
0407: label = collectionDefinition.getLabel();
0408: }
0409:
0410: return label;
0411: }
0412:
0413: /**
0414: * @see org.kuali.core.service.BusinessObjectDictionaryService#getCollectionShortLabel(java.lang.Class, java.lang.String)
0415: */
0416: public String getCollectionShortLabel(String entryName,
0417: String collectionName) {
0418: String shortLabel = "";
0419:
0420: CollectionDefinition collectionDefinition = getCollectionDefinition(
0421: entryName, collectionName);
0422: if (collectionDefinition != null) {
0423: shortLabel = collectionDefinition.getShortLabel();
0424: }
0425:
0426: return shortLabel;
0427: }
0428:
0429: /**
0430: * @see org.kuali.core.service.BusinessObjectDictionaryService#getCollectionElementLabel(java.lang.Class, java.lang.String)
0431: */
0432: public String getCollectionElementLabel(String entryName,
0433: String collectionName, Class businessObjectClass) {
0434: String elementLabel = "";
0435:
0436: CollectionDefinition collectionDefinition = getCollectionDefinition(
0437: entryName, collectionName);
0438: if (collectionDefinition != null) {
0439: elementLabel = collectionDefinition.getElementLabel();
0440: if (StringUtils.isEmpty(elementLabel)) {
0441: BusinessObjectEntry boe = getDataDictionary()
0442: .getBusinessObjectEntry(
0443: businessObjectClass.getName());
0444: if (boe != null) {
0445: elementLabel = boe.getObjectLabel();
0446: }
0447: }
0448: }
0449:
0450: return elementLabel;
0451: }
0452:
0453: /**
0454: * @see org.kuali.core.service.BusinessObjectDictionaryService#getCollectionSummary(java.lang.Class, java.lang.String)
0455: */
0456: public String getCollectionSummary(String entryName,
0457: String collectionName) {
0458: String summary = null;
0459:
0460: CollectionDefinition collectionDefinition = getCollectionDefinition(
0461: entryName, collectionName);
0462: if (collectionDefinition != null) {
0463: summary = collectionDefinition.getSummary();
0464: }
0465:
0466: return summary;
0467: }
0468:
0469: /**
0470: * @see org.kuali.core.service.BusinessObjectDictionaryService#getCollectionDescription(java.lang.Class, java.lang.String)
0471: */
0472: public String getCollectionDescription(String entryName,
0473: String collectionName) {
0474: String description = null;
0475:
0476: CollectionDefinition collectionDefinition = getCollectionDefinition(
0477: entryName, collectionName);
0478: if (collectionDefinition != null) {
0479: description = collectionDefinition.getDescription();
0480: }
0481:
0482: return description;
0483: }
0484:
0485: public Class getRelationshipSourceClass(String entryName,
0486: String relationshipName) {
0487: Class sourceClass = null;
0488:
0489: RelationshipDefinition rd = getRelationshipDefinition(
0490: entryName, relationshipName);
0491: if (rd != null) {
0492: sourceClass = rd.getSourceClass();
0493: }
0494:
0495: return sourceClass;
0496: }
0497:
0498: public Class getRelationshipTargetClass(String entryName,
0499: String relationshipName) {
0500: Class targetClass = null;
0501:
0502: RelationshipDefinition rd = getRelationshipDefinition(
0503: entryName, relationshipName);
0504: if (rd != null) {
0505: targetClass = rd.getTargetClass();
0506: }
0507:
0508: return targetClass;
0509: }
0510:
0511: public List<String> getRelationshipSourceAttributes(
0512: String entryName, String relationshipName) {
0513: List<String> sourceAttributes = null;
0514:
0515: RelationshipDefinition rd = getRelationshipDefinition(
0516: entryName, relationshipName);
0517: if (rd != null) {
0518: sourceAttributes = new ArrayList<String>();
0519:
0520: for (PrimitiveAttributeDefinition pad : rd
0521: .getPrimitiveAttributes()) {
0522: sourceAttributes.add(pad.getSourceName());
0523: }
0524: }
0525:
0526: return sourceAttributes;
0527: }
0528:
0529: public List<String> getRelationshipTargetAttributes(
0530: String entryName, String relationshipName) {
0531: List<String> targetAttributes = null;
0532:
0533: RelationshipDefinition rd = getRelationshipDefinition(
0534: entryName, relationshipName);
0535: if (rd != null) {
0536: targetAttributes = new ArrayList<String>();
0537:
0538: for (PrimitiveAttributeDefinition pad : rd
0539: .getPrimitiveAttributes()) {
0540: targetAttributes.add(pad.getTargetName());
0541: }
0542: }
0543:
0544: return targetAttributes;
0545: }
0546:
0547: public List<String> getRelationshipEntriesForSourceAttribute(
0548: String entryName, String sourceAttributeName) {
0549: List<String> relationships = new ArrayList<String>();
0550:
0551: DataDictionaryEntryBase entry = (DataDictionaryEntryBase) getDataDictionary()
0552: .getDictionaryObjectEntry(entryName);
0553:
0554: for (RelationshipDefinition def : entry.getRelationships()
0555: .values()) {
0556: for (PrimitiveAttributeDefinition pddef : def
0557: .getPrimitiveAttributes()) {
0558: if (StringUtils.equals(sourceAttributeName, pddef
0559: .getSourceName())) {
0560: relationships.add(def.getObjectAttributeName());
0561: break;
0562: }
0563: }
0564: }
0565: return relationships;
0566: }
0567:
0568: public List<String> getRelationshipEntriesForTargetAttribute(
0569: String entryName, String targetAttributeName) {
0570: List<String> relationships = new ArrayList<String>();
0571:
0572: DataDictionaryEntryBase entry = (DataDictionaryEntryBase) getDataDictionary()
0573: .getDictionaryObjectEntry(entryName);
0574:
0575: for (RelationshipDefinition def : entry.getRelationships()
0576: .values()) {
0577: for (PrimitiveAttributeDefinition pddef : def
0578: .getPrimitiveAttributes()) {
0579: if (StringUtils.equals(targetAttributeName, pddef
0580: .getTargetName())) {
0581: relationships.add(def.getObjectAttributeName());
0582: break;
0583: }
0584: }
0585: }
0586: return relationships;
0587: }
0588:
0589: /**
0590: * @param objectClass
0591: * @param attributeName
0592: * @return AttributeDefinition for the given objectClass and attribute name, or null if there is none
0593: * @throws IllegalArgumentException if the given Class is null or is not a BusinessObject class
0594: */
0595: private AttributeDefinition getAttributeDefinition(
0596: String entryName, String attributeName) {
0597: if (StringUtils.isBlank(attributeName)) {
0598: throw new IllegalArgumentException(
0599: "invalid (blank) attributeName");
0600: }
0601: AttributeDefinition attributeDefinition = null;
0602:
0603: DataDictionaryEntryBase entry = (DataDictionaryEntryBase) getDataDictionary()
0604: .getDictionaryObjectEntry(entryName);
0605: if (entry != null) {
0606: attributeDefinition = entry
0607: .getAttributeDefinition(attributeName);
0608: }
0609:
0610: return attributeDefinition;
0611: }
0612:
0613: /**
0614: * @param entryName
0615: * @param collectionName
0616: * @return CollectionDefinition for the given entryName and collectionName, or null if there is none
0617: */
0618: private CollectionDefinition getCollectionDefinition(
0619: String entryName, String collectionName) {
0620: if (StringUtils.isBlank(collectionName)) {
0621: throw new IllegalArgumentException(
0622: "invalid (blank) collectionName");
0623: }
0624: CollectionDefinition collectionDefinition = null;
0625:
0626: DataDictionaryEntryBase entry = (DataDictionaryEntryBase) getDataDictionary()
0627: .getDictionaryObjectEntry(entryName);
0628: if (entry != null) {
0629: collectionDefinition = entry
0630: .getCollectionDefinition(collectionName);
0631: }
0632:
0633: return collectionDefinition;
0634: }
0635:
0636: /**
0637: * @param entryName
0638: * @param relationshipName
0639: * @return RelationshipDefinition for the given entryName and relationshipName, or null if there is none
0640: */
0641: private RelationshipDefinition getRelationshipDefinition(
0642: String entryName, String relationshipName) {
0643: if (StringUtils.isBlank(relationshipName)) {
0644: throw new IllegalArgumentException(
0645: "invalid (blank) relationshipName");
0646: }
0647:
0648: RelationshipDefinition relationshipDefinition = null;
0649:
0650: DataDictionaryEntryBase entry = (DataDictionaryEntryBase) getDataDictionary()
0651: .getDictionaryObjectEntry(entryName);
0652: if (entry != null) {
0653: relationshipDefinition = entry
0654: .getRelationshipDefinition(relationshipName);
0655: }
0656:
0657: return relationshipDefinition;
0658: }
0659:
0660: /**
0661: * @see org.kuali.core.service.DataDictionaryService#getRelationshipAttributeMap(java.lang.String, java.lang.String)
0662: */
0663: public Map<String, String> getRelationshipAttributeMap(
0664: String entryName, String relationshipName) {
0665: Map<String, String> attributeMap = new HashMap<String, String>();
0666: RelationshipDefinition relationshipDefinition = getRelationshipDefinition(
0667: entryName, relationshipName);
0668: for (Iterator iter = relationshipDefinition
0669: .getPrimitiveAttributes().iterator(); iter.hasNext();) {
0670: PrimitiveAttributeDefinition attribute = (PrimitiveAttributeDefinition) iter
0671: .next();
0672: attributeMap.put(attribute.getTargetName(), attribute
0673: .getSourceName());
0674: }
0675: return attributeMap;
0676: }
0677:
0678: public boolean hasRelationship(String entryName,
0679: String relationshipName) {
0680: return getRelationshipDefinition(entryName, relationshipName) != null;
0681: }
0682:
0683: public List<String> getRelationshipNames(String entryName) {
0684: DataDictionaryEntryBase entry = (DataDictionaryEntryBase) getDataDictionary()
0685: .getDictionaryObjectEntry(entryName);
0686:
0687: List<String> relationshipNames = new ArrayList<String>();
0688: for (String relationshipName : entry.getRelationships()
0689: .keySet()) {
0690: relationshipNames.add(relationshipName);
0691: }
0692: return relationshipNames;
0693: }
0694:
0695: /**
0696: * @see org.kuali.core.service.DataDictionaryService#getAttributeControlDefinition(java.lang.String, java.lang.String)
0697: */
0698: public ControlDefinition getAttributeControlDefinition(
0699: Class businessObjectClass, String attributeName) {
0700: return getAttributeControlDefinition(businessObjectClass
0701: .getName(), attributeName);
0702: }
0703:
0704: /**
0705: * @see org.kuali.core.service.DataDictionaryService#getAttributeDescription(java.lang.String, java.lang.String)
0706: */
0707: public String getAttributeDescription(Class businessObjectClass,
0708: String attributeName) {
0709: return getAttributeDescription(businessObjectClass.getName(),
0710: attributeName);
0711: }
0712:
0713: /**
0714: * @see org.kuali.core.service.DataDictionaryService#getAttributeForceUppercase(java.lang.String, java.lang.String)
0715: */
0716: public Boolean getAttributeForceUppercase(
0717: Class businessObjectClass, String attributeName) {
0718: return getAttributeForceUppercase(
0719: businessObjectClass.getName(), attributeName);
0720: }
0721:
0722: /**
0723: * @see org.kuali.core.service.DataDictionaryService#getAttributeFormatter(java.lang.String, java.lang.String)
0724: */
0725: public Class getAttributeFormatter(Class businessObjectClass,
0726: String attributeName) {
0727: return getAttributeFormatter(businessObjectClass.getName(),
0728: attributeName);
0729: }
0730:
0731: /**
0732: * @see org.kuali.core.service.DataDictionaryService#getAttributeLabel(java.lang.String, java.lang.String)
0733: */
0734: public String getAttributeLabel(Class businessObjectClass,
0735: String attributeName) {
0736: return getAttributeLabel(businessObjectClass.getName(),
0737: attributeName);
0738: }
0739:
0740: /**
0741: * @see org.kuali.core.service.DataDictionaryService#getAttributeMaxLength(java.lang.String, java.lang.String)
0742: */
0743: public Integer getAttributeMaxLength(Class businessObjectClass,
0744: String attributeName) {
0745: return getAttributeMaxLength(businessObjectClass.getName(),
0746: attributeName);
0747: }
0748:
0749: /**
0750: * @see org.kuali.core.service.DataDictionaryService#getAttributeShortLabel(java.lang.String, java.lang.String)
0751: */
0752: public String getAttributeShortLabel(Class businessObjectClass,
0753: String attributeName) {
0754: return getAttributeShortLabel(businessObjectClass.getName(),
0755: attributeName);
0756: }
0757:
0758: /**
0759: * @see org.kuali.core.service.DataDictionaryService#getAttributeErrorLabel(java.lang.String, java.lang.String)
0760: */
0761: public String getAttributeErrorLabel(Class businessObjectClass,
0762: String attributeName) {
0763: return getAttributeErrorLabel(businessObjectClass.getName(),
0764: attributeName);
0765: }
0766:
0767: /**
0768: * @see org.kuali.core.service.DataDictionaryService#getAttributeSize(java.lang.String, java.lang.String)
0769: */
0770: public Integer getAttributeSize(Class businessObjectClass,
0771: String attributeName) {
0772: return getAttributeSize(businessObjectClass.getName(),
0773: attributeName);
0774: }
0775:
0776: /**
0777: * @see org.kuali.core.service.DataDictionaryService#getAttributeSummary(java.lang.String, java.lang.String)
0778: */
0779: public String getAttributeSummary(Class businessObjectClass,
0780: String attributeName) {
0781: return getAttributeSummary(businessObjectClass.getName(),
0782: attributeName);
0783: }
0784:
0785: /**
0786: * @see org.kuali.core.service.DataDictionaryService#getAttributeValidatingExpression(java.lang.String, java.lang.String)
0787: */
0788: public Pattern getAttributeValidatingExpression(
0789: Class businessObjectClass, String attributeName) {
0790: return getAttributeValidatingExpression(businessObjectClass
0791: .getName(), attributeName);
0792: }
0793:
0794: /**
0795: * @see org.kuali.core.service.DataDictionaryService#getAttributeValuesFinderClass(java.lang.String, java.lang.String)
0796: */
0797: public Class getAttributeValuesFinderClass(
0798: Class businessObjectClass, String attributeName) {
0799: return getAttributeValuesFinderClass(businessObjectClass
0800: .getName(), attributeName);
0801: }
0802:
0803: /**
0804: * @see org.kuali.core.service.DataDictionaryService#getCollectionDescription(java.lang.String, java.lang.String)
0805: */
0806: public String getCollectionDescription(Class businessObjectClass,
0807: String collectionName) {
0808: return getCollectionDescription(businessObjectClass.getName(),
0809: collectionName);
0810: }
0811:
0812: /**
0813: * @see org.kuali.core.service.DataDictionaryService#getCollectionLabel(java.lang.String, java.lang.String)
0814: */
0815: public String getCollectionLabel(Class businessObjectClass,
0816: String collectionName) {
0817: return getCollectionLabel(businessObjectClass.getName(),
0818: collectionName);
0819: }
0820:
0821: /**
0822: * @see org.kuali.core.service.DataDictionaryService#getCollectionShortLabel(java.lang.String, java.lang.String)
0823: */
0824: public String getCollectionShortLabel(Class businessObjectClass,
0825: String collectionName) {
0826: return getCollectionShortLabel(businessObjectClass.getName(),
0827: collectionName);
0828: }
0829:
0830: /**
0831: * @see org.kuali.core.service.DataDictionaryService#getAttributeDisplayMask(java.lang.Class, java.lang.String)
0832: */
0833: public Mask getAttributeDisplayMask(Class businessObjectClass,
0834: String attributeName) {
0835: return getAttributeDisplayMask(businessObjectClass.getName(),
0836: attributeName);
0837: }
0838:
0839: /**
0840: * @see org.kuali.core.service.DataDictionaryService#getAttributeDisplayWorkgroup(java.lang.Class, java.lang.String)
0841: */
0842: public String getAttributeDisplayWorkgroup(
0843: Class businessObjectClass, String attributeName) {
0844: return getAttributeDisplayWorkgroup(businessObjectClass
0845: .getName(), attributeName);
0846: }
0847:
0848: /**
0849: * @see org.kuali.core.service.DataDictionaryService#getCollectionSummary(java.lang.String, java.lang.String)
0850: */
0851: public String getCollectionSummary(Class businessObjectClass,
0852: String collectionName) {
0853: return getCollectionSummary(businessObjectClass.getName(),
0854: collectionName);
0855: }
0856:
0857: /**
0858: * @see org.kuali.core.service.DataDictionaryService#isAttributeDefined(java.lang.String, java.lang.String)
0859: */
0860: public Boolean isAttributeDefined(Class businessObjectClass,
0861: String attributeName) {
0862: return isAttributeDefined(businessObjectClass.getName(),
0863: attributeName);
0864: }
0865:
0866: /**
0867: * @see org.kuali.core.service.DataDictionaryService#isAttributeRequired(java.lang.String, java.lang.String)
0868: */
0869: public Boolean isAttributeRequired(Class businessObjectClass,
0870: String attributeName) {
0871: return isAttributeRequired(businessObjectClass.getName(),
0872: attributeName);
0873:
0874: }
0875:
0876: /**
0877: * @see org.kuali.core.service.DataDictionaryService#getDocumentLabelByClass(java.lang.Class)
0878: */
0879: public String getDocumentLabelByClass(
0880: Class documentOrBusinessObjectClass) {
0881: String label = null;
0882: DocumentEntry documentEntry = getDataDictionary()
0883: .getDocumentEntry(
0884: documentOrBusinessObjectClass.getName());
0885: if (documentEntry != null) {
0886: label = documentEntry.getLabel();
0887: }
0888: return label;
0889: }
0890:
0891: /**
0892: * @see org.kuali.core.service.DataDictionaryService#getDocumentLabelByTypeName(java.lang.String)
0893: */
0894: public String getDocumentLabelByTypeName(String documentTypeName) {
0895: String label = null;
0896: DocumentEntry documentEntry = getDataDictionary()
0897: .getDocumentEntry(documentTypeName);
0898: if (documentEntry != null) {
0899: label = documentEntry.getLabel();
0900: }
0901: return label;
0902: }
0903:
0904: /**
0905: * @see org.kuali.core.service.DataDictionaryService#getDocumentTypeNameByClass(java.lang.Class)
0906: */
0907: public String getDocumentTypeNameByClass(Class documentClass) {
0908: if (documentClass == null) {
0909: throw new IllegalArgumentException(
0910: "invalid (null) documentClass");
0911: }
0912: if (!Document.class.isAssignableFrom(documentClass)) {
0913: throw new IllegalArgumentException(
0914: "invalid (non-Document) documentClass");
0915: }
0916:
0917: String documentTypeName = null;
0918:
0919: DocumentEntry documentEntry = getDataDictionary()
0920: .getDocumentEntry(documentClass.getName());
0921: if (documentEntry != null) {
0922: documentTypeName = documentEntry.getDocumentTypeName();
0923: }
0924:
0925: return documentTypeName;
0926: }
0927:
0928: /**
0929: * @see org.kuali.core.service.DataDictionaryService#getDocumentClassByTypeName(java.lang.String)
0930: */
0931: public Class getDocumentClassByTypeName(String documentTypeName) {
0932: Class clazz = null;
0933:
0934: DocumentEntry documentEntry = getDataDictionary()
0935: .getDocumentEntry(documentTypeName);
0936: if (documentEntry != null) {
0937: clazz = documentEntry.getDocumentClass();
0938: }
0939:
0940: return clazz;
0941: }
0942:
0943: /**
0944: * @see org.kuali.core.service.DataDictionaryService#getDocumentTypeCodeByTypeName(java.lang.String)
0945: */
0946: public String getDocumentTypeCodeByTypeName(String documentTypeName) {
0947: DocumentEntry documentEntry = getDataDictionary()
0948: .getDocumentEntry(documentTypeName);
0949: if (documentEntry != null) {
0950: return documentEntry.getDocumentTypeCode();
0951: }
0952: return null;
0953: }
0954:
0955: /**
0956: * @see org.kuali.core.service.DataDictionaryService#getPreRulesCheckClass(java.lang.String)
0957: */
0958: public Class getPreRulesCheckClass(String docTypeName) {
0959: Class preRulesCheckClass = null;
0960:
0961: DocumentEntry documentEntry = getDataDictionary()
0962: .getDocumentEntry(docTypeName);
0963: if (documentEntry != null) {
0964: preRulesCheckClass = documentEntry.getPreRulesCheckClass();
0965: }
0966:
0967: return preRulesCheckClass;
0968: }
0969:
0970: public void addDataDictionaryLocation(String location) {
0971: dataDictionaryBuilder.addOverrideEntries(location, true);
0972: }
0973:
0974: public void addDataDictionaryLocations(List<String> locations) {
0975: for (String location : locations) {
0976: addDataDictionaryLocation(location);
0977: }
0978: }
0979:
0980: public void forceCompleteDataDictionaryLoad() {
0981: getDataDictionary().forceCompleteDataDictionaryLoad();
0982: }
0983:
0984: public Map getDataDictionaryMap() {
0985: return dataDictionaryMap;
0986: }
0987:
0988: public void setKualiGroupService(KualiGroupService kualiGroupService) {
0989: this .kualiGroupService = kualiGroupService;
0990: }
0991:
0992: public KualiGroupService getKualiGroupService() {
0993: return kualiGroupService;
0994: }
0995:
0996: public void setKualiConfigurationService(
0997: KualiConfigurationService kualiConfigurationService) {
0998: this .kualiConfigurationService = kualiConfigurationService;
0999: }
1000:
1001: public KualiConfigurationService getKualiConfigurationService() {
1002: return kualiConfigurationService;
1003: }
1004:
1005: public KualiModuleService getKualiModuleService() {
1006: return kualiModuleService;
1007: }
1008:
1009: public void setKualiModuleService(
1010: KualiModuleService kualiModuleService) {
1011: this .kualiModuleService = kualiModuleService;
1012: }
1013:
1014: public AuthorizationService getAuthorizationService() {
1015: return authorizationService;
1016: }
1017:
1018: public void setAuthorizationService(
1019: AuthorizationService authorizationService) {
1020: this.authorizationService = authorizationService;
1021: }
1022: }
|