use of org.talend.mdm.commmon.metadata.SoftFieldRef in project tmdm-common by Talend.
the class PermissionValidationRule method getFieldMetadata.
private FieldMetadata getFieldMetadata(Element appInfo, String fieldName) {
FieldMetadata fieldMetadata = new SoftFieldRef(null, fieldName, "");
fieldMetadata.setData(MetadataRepository.XSD_LINE_NUMBER, XSDParser.getStartLine(appInfo));
fieldMetadata.setData(MetadataRepository.XSD_COLUMN_NUMBER, XSDParser.getStartColumn(appInfo));
fieldMetadata.setData(MetadataRepository.XSD_DOM_ELEMENT, appInfo);
return fieldMetadata;
}
use of org.talend.mdm.commmon.metadata.SoftFieldRef in project tmdm-common by Talend.
the class ForeignKeyProcessor method getFieldMetadata.
private static FieldMetadata getFieldMetadata(MetadataRepository repository, ComplexTypeMetadata type, Element appInfo, String path, boolean isFKInfo) {
String typeName = getTypeName(type, path);
// $NON-NLS-1$
String fieldPath = StringUtils.substringAfter(path, "/").trim();
FieldMetadata fieldMetadata;
if (!fieldPath.isEmpty() && isFKInfo) {
fieldMetadata = new SoftFieldRef(repository, fieldPath, typeName);
} else {
if (!fieldPath.isEmpty() && (repository.getComplexType(typeName) == null || repository.getComplexType(typeName).getKeyFields().size() == 1)) {
fieldMetadata = new SoftFieldRef(repository, fieldPath, typeName);
} else {
// If the reference entity has composite key, the foreign key field should be set as entity not its ID.
fieldMetadata = new SoftIdFieldRef(repository, typeName);
}
}
fieldMetadata.setData(MetadataRepository.XSD_LINE_NUMBER, XSDParser.getStartLine(appInfo));
fieldMetadata.setData(MetadataRepository.XSD_COLUMN_NUMBER, XSDParser.getStartColumn(appInfo));
fieldMetadata.setData(MetadataRepository.XSD_DOM_ELEMENT, appInfo);
return fieldMetadata;
}
Aggregations