protected void addMapping(Descriptor descriptor, DatabaseMapping mapping) {
String target = null;
String collectionName = null;
if (mapping.isCollectionMapping()) {
if (mapping.isEISMapping()) {
EISCompositeCollectionMapping collectionMapping = (EISCompositeCollectionMapping) mapping;
Class collectionClass = collectionMapping.getContainerPolicy().getContainerClass();
String collectionType = getSimplePublicCollectionTypeName(collectionClass);
if (collectionType == null) {
collectionType = collectionClass.getSimpleName();
}
if (collectionMapping.getReferenceClass() != null) {
collectionName = collectionMapping.getReferenceClass().getSimpleName();
}
if ((collectionName == null) && (collectionMapping.getAttributeClassification() != null)) {
collectionName = collectionMapping.getAttributeClassification().getSimpleName();
}
if (collectionMapping.getContainerPolicy().isMapPolicy()) {
String mapKeyType = ((MapContainerPolicy) collectionMapping.getContainerPolicy()).getKeyType().getClass().getSimpleName();
target = collectionType + "<" + mapKeyType + ", " + collectionName + ">";
} else {
target = collectionType + "<" + collectionName + ">";
}
} else {
CollectionMapping collectionMapping = (CollectionMapping) mapping;
Class collectionClass = collectionMapping.getContainerPolicy().getContainerClass();
String collectionType = getSimplePublicCollectionTypeName(collectionClass);
if (collectionType == null) {
collectionType = collectionClass.getSimpleName();
}
if (collectionMapping.getReferenceClass() != null) {
collectionName = collectionMapping.getReferenceClass().getSimpleName();
}
if ((collectionName == null) && (collectionMapping.getAttributeClassification() != null)) {
collectionName = collectionMapping.getAttributeClassification().getSimpleName();
}
if (collectionMapping.getContainerPolicy().isMapPolicy()) {
String mapKeyType = ((MapContainerPolicy) collectionMapping.getContainerPolicy()).getKeyType().getClass().getSimpleName();
target = collectionType + "<" + mapKeyType + ", " + collectionName + ">";
} else {
target = collectionType + "<" + collectionName + ">";
}
}