use of org.ovirt.engine.core.common.businessentities.EditableVmField in project ovirt-engine by oVirt.
the class VmHandler 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<?>[] inspectedClassNames = new Class<?>[] { VmBase.class, VM.class, VmStatic.class, VmDynamic.class, VmManagementParametersBase.class };
updateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(inspectedClassNames));
for (Pair<EditableDeviceOnVmStatusField, Field> pair : BaseHandler.extractAnnotatedFields(EditableDeviceOnVmStatusField.class, inspectedClassNames)) {
updateVmsStatic.addField(Arrays.asList(pair.getFirst().statuses()), pair.getSecond().getName());
}
for (Pair<TransientField, Field> pair : BaseHandler.extractAnnotatedFields(TransientField.class, inspectedClassNames)) {
updateVmsStatic.addTransientFields(pair.getSecond().getName());
}
for (Pair<EditableVmField, Field> pair : BaseHandler.extractAnnotatedFields(EditableVmField.class, inspectedClassNames)) {
EditableVmField annotation = pair.getFirst();
List<VMStatus> statusList = Arrays.asList(annotation.onStatuses());
String fieldName = pair.getSecond().getName();
if (statusList.isEmpty()) {
updateVmsStatic.addPermittedFields(fieldName);
} else {
updateVmsStatic.addField(statusList, fieldName);
if (!annotation.hotSettableOnStatus().getStates().isEmpty()) {
updateVmsStatic.addHotsetField(fieldName, annotation.hotSettableOnStatus().getStates());
}
}
if (annotation.onHostedEngine()) {
updateVmsStatic.addHostedEngineFields(fieldName);
}
}
}
use of org.ovirt.engine.core.common.businessentities.EditableVmField in project ovirt-engine by oVirt.
the class VmTemplateHandler 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() {
final Class<?>[] inspectedClassNames = new Class<?>[] { VmBase.class, VmTemplate.class };
updateVmTemplate = new ObjectIdentityChecker(VmTemplateHandler.class);
for (Pair<EditableVmTemplateField, Field> pair : BaseHandler.extractAnnotatedFields(EditableVmTemplateField.class, inspectedClassNames)) {
String fieldName = pair.getSecond().getName();
updateVmTemplate.addPermittedFields(fieldName);
}
for (Pair<EditableVmField, Field> pair : BaseHandler.extractAnnotatedFields(EditableVmField.class, inspectedClassNames)) {
EditableVmField annotation = pair.getFirst();
List<VMStatus> statusList = Arrays.asList(annotation.onStatuses());
String fieldName = pair.getSecond().getName();
if (statusList.isEmpty()) {
updateVmTemplate.addPermittedFields(fieldName);
}
}
}
Aggregations