bug 11899: Added events for Zone create, update and delete

status 11899: resolved fixed
reviewed-by: Nitin
This commit is contained in:
kishan 2011-12-13 19:29:10 +05:30
parent e4d94650ea
commit f3cd93f835
4 changed files with 12 additions and 3 deletions

View File

@ -29,6 +29,7 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.ZoneResponse;
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Creates a Zone.", responseObject=ZoneResponse.class)
public class CreateZoneCmd extends BaseCmd {
@ -140,7 +141,8 @@ public class CreateZoneCmd extends BaseCmd {
@Override
public void execute(){
DataCenter result = _configService.createZone(this);
UserContext.current().setEventDetails("Zone Name: "+getZoneName());
DataCenter result = _configService.createZone(this);
if (result != null){
ZoneResponse response = _responseGenerator.createZoneResponse(result,false);
response.setResponseName(getCommandName());

View File

@ -28,6 +28,7 @@ import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Deletes a Zone.", responseObject=SuccessResponse.class)
public class DeleteZoneCmd extends BaseCmd {
@ -69,7 +70,8 @@ public class DeleteZoneCmd extends BaseCmd {
@Override
public void execute(){
boolean result = _configService.deleteZone(this);
UserContext.current().setEventDetails("Zone Id: "+getId());
boolean result = _configService.deleteZone(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);

View File

@ -32,6 +32,7 @@ import com.cloud.api.ServerApiException;
import com.cloud.api.response.ZoneResponse;
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@Implementation(description="Updates a Zone.", responseObject=ZoneResponse.class)
public class UpdateZoneCmd extends BaseCmd {
@ -154,7 +155,8 @@ public class UpdateZoneCmd extends BaseCmd {
@Override
public void execute(){
DataCenter result = _configService.editZone(this);
UserContext.current().setEventDetails("Zone Id: "+getId());
DataCenter result = _configService.editZone(this);
if (result != null) {
ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
response.setResponseName(getCommandName());

View File

@ -1151,6 +1151,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_ZONE_DELETE, eventDescription = "deleting zone", async = false)
public boolean deleteZone(DeleteZoneCmd cmd) {
Transaction txn = Transaction.currentTxn();
@ -1269,6 +1270,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_ZONE_EDIT, eventDescription = "editing zone", async = false)
public DataCenter editZone(UpdateZoneCmd cmd) {
// Parameter validation as from execute() method in V1
Long zoneId = cmd.getId();
@ -1543,6 +1545,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_ZONE_CREATE, eventDescription = "creating zone", async = false)
public DataCenter createZone(CreateZoneCmd cmd) {
// grab parameters from the command
Long userId = UserContext.current().getCallerUserId();