use of org.datanucleus.metadata.IndexMetaData in project datanucleus-api-jdo by datanucleus.
the class JoinMetadataImpl method getIndexMetadata.
/* (non-Javadoc)
* @see javax.jdo.metadata.JoinMetadata#getIndexMetadata()
*/
public IndexMetadata getIndexMetadata() {
IndexMetaData internalIdxmd = getInternal().getIndexMetaData();
if (internalIdxmd == null) {
return null;
}
IndexMetadataImpl idxmd = new IndexMetadataImpl(internalIdxmd);
idxmd.parent = this;
return idxmd;
}
use of org.datanucleus.metadata.IndexMetaData in project datanucleus-api-jdo by datanucleus.
the class JDOAnnotationUtils method getIndexMetaData.
/**
* Convenience method to create an IndexMetaData from the annotations data.
* @param name Name of the constraint
* @param table Name of the table (optional)
* @param unique Whether the constraint is unique
* @param fields Fields to apply the constraint across (optional)
* @param columns Columns to apply the constraint across (optional)
* @return The IndexMetaData
*/
public static IndexMetaData getIndexMetaData(String name, String table, String unique, String[] fields, Column[] columns) {
IndexMetaData idxmd = new IndexMetaData();
idxmd.setName(name);
idxmd.setTable(table);
if (!StringUtils.isWhitespace(unique)) {
idxmd.setUnique(Boolean.valueOf(unique));
}
if (fields != null && fields.length > 0) {
for (int j = 0; j < fields.length; j++) {
idxmd.addMember(fields[j]);
}
}
if (idxmd.getNumberOfMembers() == 0 && columns != null && columns.length > 0) {
for (int j = 0; j < columns.length; j++) {
idxmd.addColumn(columns[j].name());
}
}
return idxmd;
}
Aggregations