use of com.emc.storageos.db.client.impl.DataObjectType in project coprhd-controller by CoprHD.
the class BourneDbClient method findByAlternateId.
public <T extends DataObject> List<NamedElement> findByAlternateId(Class<T> clazz, String columnField, String value) throws DataAccessException {
LOG.debug("findByAlternateId(class={}, columnField={}, value={})", new Object[] { clazz, columnField, value });
DataObjectType doType = TypeMap.getDoType(clazz);
AlternateIdConstraint constraint = new AlternateIdConstraintImpl(doType.getColumnField(columnField), value);
return queryNamedElementsByConstraint(constraint);
}
use of com.emc.storageos.db.client.impl.DataObjectType in project coprhd-controller by CoprHD.
the class BourneDbClient method findByContainmentAndPrefix.
public <T extends DataObject> List<NamedElement> findByContainmentAndPrefix(Class<T> clazz, String columnField, URI id, String labelPrefix) throws DataAccessException {
LOG.debug("findByContainmentAndPrefix({}, {}, {}, {})", new Object[] { clazz, columnField, id, labelPrefix });
DataObjectType doType = TypeMap.getDoType(clazz);
ContainmentPrefixConstraint constraint = new ContainmentPrefixConstraintImpl(id, labelPrefix, doType.getColumnField(columnField));
return queryNamedElementsByConstraint(constraint);
}
use of com.emc.storageos.db.client.impl.DataObjectType in project coprhd-controller by CoprHD.
the class ConstraintDescriptor method toConstraint.
public Constraint toConstraint() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
log.info("ConstraintDescriptor {}", this);
Class type = Class.forName(dataObjectClassName);
DataObjectType doType = TypeMap.getDoType(type);
ColumnField field = doType.getColumnField(columnFieldName);
Class constraintClass = Class.forName(constraintClassName);
List<Class> parameterTypes = new ArrayList(arguments.size() + 1);
List<Object> args = new ArrayList(arguments.size() + 1);
int i = 1;
for (Object arg : arguments) {
if (i == columnFieldPosition) {
parameterTypes.add(ColumnField.class);
args.add(field);
}
i++;
parameterTypes.add(arg.getClass());
args.add(arg);
}
if (i == columnFieldPosition) {
parameterTypes.add(ColumnField.class);
args.add(field);
}
Constructor constructor = constraintClass.getConstructor(parameterTypes.toArray(new Class[0]));
Constraint constraint = (Constraint) constructor.newInstance(args.toArray());
return constraint;
}
Aggregations