Moti Asayag has uploaded a new change for review. Change subject: engine: Add rename logging capability to UpdateVnic ......................................................................
engine: Add rename logging capability to UpdateVnic The patch adds the rename logging capability to the UpdateVnicProfileCommand so each rename will be followed with an event log specifying the old profile name to ease entity tracking. Change-Id: Idad93fb341151ab2b97532ec216e187d5049f415 Signed-off-by: Moti Asayag <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVnicProfileCommand.java 1 file changed, 36 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/90/16890/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVnicProfileCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVnicProfileCommand.java index f86da3f..956aed2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVnicProfileCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVnicProfileCommand.java @@ -2,13 +2,20 @@ import java.util.List; +import org.ovirt.engine.core.bll.RenamedEntityInfoProvider; import org.ovirt.engine.core.bll.validator.VnicProfileValidator; import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.VnicProfileParameters; +import org.ovirt.engine.core.common.businessentities.network.VnicProfile; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.validation.group.UpdateEntity; +import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase; -public class UpdateVnicProfileCommand<T extends VnicProfileParameters> extends VnicProfileCommon<T> { +public class UpdateVnicProfileCommand<T extends VnicProfileParameters> + extends VnicProfileCommon<T> implements RenamedEntityInfoProvider { + + private VnicProfile oldVnicProfile; public UpdateVnicProfileCommand(T parameters) { super(parameters); @@ -26,6 +33,7 @@ @Override protected void executeCommand() { + getOldVnicProfile(); getVnicProfileDao().update(getVnicProfile()); setSucceeded(true); } @@ -47,4 +55,31 @@ return getSucceeded() ? AuditLogType.UPDATE_VNIC_PROFILE : AuditLogType.UPDATE_VNIC_PROFILE_FAILED; } + + @Override + public String getEntityType() { + return VdcObjectType.VnicProfile.getVdcObjectTranslation(); + } + + @Override + public String getEntityOldName() { + return getOldVnicProfile().getName(); + } + + @Override + public String getEntityNewName() { + return getVnicProfile().getName(); + } + + @Override + public void setEntityId(AuditLogableBase logable) { + } + + private VnicProfile getOldVnicProfile() { + if (oldVnicProfile == null) { + oldVnicProfile = getDbFacade().getVnicProfileDao().get(getVnicProfile().getId()); + } + + return oldVnicProfile; + } } -- To view, visit http://gerrit.ovirt.org/16890 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idad93fb341151ab2b97532ec216e187d5049f415 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
