| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.datadictionary; |
| 17 | |
|
| 18 | |
import org.kuali.rice.kns.datadictionary.AttributeDefinition; |
| 19 | |
import org.kuali.student.datadictionary.dto.AttributeDefinitionInfo; |
| 20 | |
import org.kuali.student.datadictionary.dto.ValidCharactersConstraintInfo; |
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | 42 | public class Rice2AttributeDefinitionConverter { |
| 27 | |
|
| 28 | 1 | private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Rice2AttributeDefinitionConverter.class); |
| 29 | |
|
| 30 | |
public AttributeDefinitionInfo convert(AttributeDefinition rice) { |
| 31 | 42 | AttributeDefinitionInfo.Builder bldr = new AttributeDefinitionInfo.Builder(); |
| 32 | 42 | bldr.setName (rice.getName()); |
| 33 | 42 | bldr.setChildEntryName (rice.getChildEntryName()); |
| 34 | 42 | bldr.setDataType (rice.getDataType()); |
| 35 | 42 | bldr.setRequired (rice.isRequired()); |
| 36 | 42 | bldr.setMinOccurs (rice.getMinimumNumberOfElements()); |
| 37 | 42 | bldr.setMaxOccurs (rice.getMaximumNumberOfElements()); |
| 38 | 42 | bldr.setMinLength (rice.getMinLength()); |
| 39 | 42 | bldr.setMaxLength (rice.getMaxLength()); |
| 40 | 42 | bldr.setForceUppercase (rice.getForceUppercase()); |
| 41 | 42 | bldr.setShortLabel (rice.getShortLabel()); |
| 42 | 42 | bldr.setSummary (rice.getSummary()); |
| 43 | 42 | bldr.setLabel (rice.getLabel()); |
| 44 | 42 | bldr.setDescription (rice.getDescription()); |
| 45 | 42 | bldr.setExclusiveMin (rice.getExclusiveMin()); |
| 46 | 42 | bldr.setInclusiveMax (rice.getInclusiveMax()); |
| 47 | 42 | bldr.setDisplayLabelAttribute (rice.getDisplayLabelAttribute()); |
| 48 | 42 | bldr.setUnique (rice.getUnique()); |
| 49 | 42 | bldr.setCustomValidatorClass (rice.getCustomValidatorClass()); |
| 50 | 42 | bldr.setFormatterClass (rice.getFormatterClass()); |
| 51 | 42 | if (rice.getValidCharactersConstraint() != null) { |
| 52 | 30 | bldr.setValidCharactersConstraint (new Rice2ValidCharactersConstraintConverter ().convert(rice.getValidCharactersConstraint())); |
| 53 | |
} |
| 54 | 42 | return bldr.build(); |
| 55 | |
} |
| 56 | |
} |