Search in sources :

Example 1 with EditableVdsField

use of org.ovirt.engine.core.common.businessentities.EditableVdsField in project ovirt-engine by oVirt.

the class VdsHandler method init.

/**
 * Initialize list containers, for identity and permission check. The initialization should be executed
 * before calling ObjectIdentityChecker.
 *
 * @see Backend#initHandlers
 */
@PostConstruct
public void init() {
    Class<?>[] inspectedClasses = new Class<?>[] { VDS.class, VdsStatic.class, VdsDynamic.class };
    updateVdsStatic = new ObjectIdentityChecker(VdsHandler.class, Arrays.asList(inspectedClasses));
    updateVdsStatic.setContainer(this);
    for (Pair<EditableVdsField, Field> pair : extractAnnotatedFields(EditableVdsField.class, inspectedClasses)) {
        List<VDSStatus> statusList = Arrays.asList(pair.getFirst().onStatuses());
        String fieldName = pair.getSecond().getName();
        if (statusList.isEmpty()) {
            updateVdsStatic.addPermittedFields(fieldName);
        } else {
            updateVdsStatic.addField(statusList, fieldName);
        }
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) VDS(org.ovirt.engine.core.common.businessentities.VDS) EditableVdsField(org.ovirt.engine.core.common.businessentities.EditableVdsField) Field(java.lang.reflect.Field) EditableVdsField(org.ovirt.engine.core.common.businessentities.EditableVdsField) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) ObjectIdentityChecker(org.ovirt.engine.core.utils.ObjectIdentityChecker) PostConstruct(javax.annotation.PostConstruct)

Aggregations

Field (java.lang.reflect.Field)1 PostConstruct (javax.annotation.PostConstruct)1 EditableVdsField (org.ovirt.engine.core.common.businessentities.EditableVdsField)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 ObjectIdentityChecker (org.ovirt.engine.core.utils.ObjectIdentityChecker)1