| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kns.datadictionary; |
| 17 | |
|
| 18 | |
import java.util.Map; |
| 19 | |
|
| 20 | |
import org.apache.commons.lang.ClassUtils; |
| 21 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
| 22 | |
import org.kuali.rice.core.util.ClassLoaderUtils; |
| 23 | |
import org.kuali.rice.kns.bo.BusinessObject; |
| 24 | |
import org.kuali.rice.kns.datadictionary.exception.ClassValidationException; |
| 25 | |
import org.kuali.rice.kns.datadictionary.mask.Mask; |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
public class KimDataDictionaryAttributeDefinition extends KimAttributeDefinition { |
| 31 | |
private static final long serialVersionUID = 7006569761728813805L; |
| 32 | |
|
| 33 | |
protected Mask mask; |
| 34 | |
protected Map<String, String> lookupInputPropertyConversions; |
| 35 | |
protected Map<String, String> lookupReturnPropertyConversions; |
| 36 | |
protected String lookupBoClass; |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | 0 | public KimDataDictionaryAttributeDefinition() { |
| 42 | 0 | } |
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
public Map<String, String> getLookupInputPropertyConversions() { |
| 48 | 0 | return this.lookupInputPropertyConversions; |
| 49 | |
} |
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
public void setLookupInputPropertyConversions(Map<String, String> lookupInputPropertyConversions) { |
| 56 | 0 | this.lookupInputPropertyConversions = lookupInputPropertyConversions; |
| 57 | 0 | } |
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
public Map<String, String> getLookupReturnPropertyConversions() { |
| 63 | 0 | return this.lookupReturnPropertyConversions; |
| 64 | |
} |
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
public void setLookupReturnPropertyConversions(Map<String, String> lookupReturnPropertyConversions) { |
| 71 | 0 | this.lookupReturnPropertyConversions = lookupReturnPropertyConversions; |
| 72 | 0 | } |
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
public String toString() { |
| 78 | 0 | return new ToStringBuilder( this ) |
| 79 | |
.append( "name", getName() ) |
| 80 | |
.append( "label", getLabel() ) |
| 81 | |
.append( "lookupBoClass", this.lookupBoClass ) |
| 82 | |
.append( "required", isRequired() ) |
| 83 | |
.append( "lookupInputPropertyConversions", this.lookupInputPropertyConversions ) |
| 84 | |
.append( "lookupReturnPropertyConversions", this.lookupReturnPropertyConversions ) |
| 85 | |
.toString(); |
| 86 | |
} |
| 87 | |
|
| 88 | |
public String getLookupBoClass() { |
| 89 | 0 | return this.lookupBoClass; |
| 90 | |
} |
| 91 | |
|
| 92 | |
public void setLookupBoClass(String lookupBoClass) { |
| 93 | 0 | this.lookupBoClass = lookupBoClass; |
| 94 | 0 | } |
| 95 | |
|
| 96 | |
@Override |
| 97 | |
public boolean isHasLookupBoDefinition() { |
| 98 | 0 | return true; |
| 99 | |
} |
| 100 | |
|
| 101 | |
|
| 102 | |
@SuppressWarnings("unchecked") |
| 103 | |
@Override |
| 104 | |
public void completeValidation(Class rootObjectClass, Class otherObjectClass) { |
| 105 | 0 | if (lookupBoClass != null) { |
| 106 | |
try { |
| 107 | 0 | Class lookupBoClassObject = ClassUtils.getClass(ClassLoaderUtils.getDefaultClassLoader(), getLookupBoClass()); |
| 108 | 0 | if (!BusinessObject.class.isAssignableFrom(lookupBoClassObject)) { |
| 109 | 0 | throw new ClassValidationException("lookupBoClass is not a valid instance of " + BusinessObject.class.getName() + " instead was: " + lookupBoClassObject.getName()); |
| 110 | |
} |
| 111 | 0 | } catch (ClassNotFoundException e) { |
| 112 | 0 | throw new ClassValidationException("lookupBoClass could not be found: " + getLookupBoClass(), e); |
| 113 | 0 | } |
| 114 | |
} |
| 115 | 0 | super.completeValidation(rootObjectClass, otherObjectClass); |
| 116 | 0 | } |
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
|
| 121 | |
} |