mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
propogate account changes to other Regions
This commit is contained in:
parent
470cd120d1
commit
4ea36b82e9
@ -358,6 +358,9 @@ public class ApiConstants {
|
|||||||
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
|
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
|
||||||
public static final String ADD_VSM_FLAG = "addvsmflag";
|
public static final String ADD_VSM_FLAG = "addvsmflag";
|
||||||
public static final String END_POINT = "endpoint";
|
public static final String END_POINT = "endpoint";
|
||||||
|
//public static final String REGION_DETAILS = "regiondetails";
|
||||||
|
public static final String REGION_ID = "regionid";
|
||||||
|
public static final String IS_PROPAGATE = "ispropagate";
|
||||||
|
|
||||||
public enum HostDetails {
|
public enum HostDetails {
|
||||||
all, capacity, events, stats, min;
|
all, capacity, events, stats, min;
|
||||||
|
|||||||
@ -76,6 +76,20 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
|
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
|
||||||
private Map<String, String> details;
|
private Map<String, String> details;
|
||||||
|
|
||||||
|
//@Parameter(name = ApiConstants.REGION_DETAILS, type = CommandType.MAP, description = "details for account used to store region specific parameters")
|
||||||
|
//private Map<String, String> regionDetails;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from another Region")
|
||||||
|
private String accountUUID;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region")
|
||||||
|
private String userUUID;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.REGION_ID, type=CommandType.LONG, description="Id of the Region creating the account")
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -130,6 +144,26 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public Map<String, String> getRegionDetails() {
|
||||||
|
if (regionDetails == null || regionDetails.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return regionDetails;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public String getAccountUUID() {
|
||||||
|
return accountUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserUUID() {
|
||||||
|
return userUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRegionId() {
|
||||||
|
return regionId;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -147,7 +181,8 @@ public class CreateAccountCmd extends BaseCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
|
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
|
||||||
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails());
|
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails(),
|
||||||
|
getAccountUUID(), getUserUUID(), getRegionId());
|
||||||
if (userAccount != null) {
|
if (userAccount != null) {
|
||||||
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
|
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
|
|||||||
@ -46,15 +46,21 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
|
|||||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Account id")
|
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Account id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
|
||||||
|
private Boolean isPropagate;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIsPropagate() {
|
||||||
|
return isPropagate;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
@ -93,7 +99,13 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
UserContext.current().setEventDetails("Account Id: "+getId());
|
UserContext.current().setEventDetails("Account Id: "+getId());
|
||||||
boolean result = _accountService.deleteUserAccount(getId());
|
boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
|
||||||
|
boolean result = false;
|
||||||
|
if(isPopagate){
|
||||||
|
result = _accountService.deleteUserAccount(getId());
|
||||||
|
} else {
|
||||||
|
result = _regionService.deleteUserAccount(getId());
|
||||||
|
}
|
||||||
if (result) {
|
if (result) {
|
||||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||||
this.setResponseObject(response);
|
this.setResponseObject(response);
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.cloud.api.IdentityMapper;
|
|||||||
import com.cloud.api.Implementation;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
|
import com.cloud.api.BaseCmd.CommandType;
|
||||||
import com.cloud.api.response.AccountResponse;
|
import com.cloud.api.response.AccountResponse;
|
||||||
import com.cloud.async.AsyncJob;
|
import com.cloud.async.AsyncJob;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
@ -55,6 +56,9 @@ public class DisableAccountCmd extends BaseAsyncCmd {
|
|||||||
@Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
|
@Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
|
||||||
private Boolean lockRequested;
|
private Boolean lockRequested;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
|
||||||
|
private Boolean isPropagate;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -71,6 +75,10 @@ public class DisableAccountCmd extends BaseAsyncCmd {
|
|||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIsPropagate() {
|
||||||
|
return isPropagate;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -109,10 +117,18 @@ public class DisableAccountCmd extends BaseAsyncCmd {
|
|||||||
public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
|
public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
|
||||||
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
|
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
|
||||||
Account result = null;
|
Account result = null;
|
||||||
|
boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
|
||||||
|
if(isPopagate){
|
||||||
if(lockRequested)
|
if(lockRequested)
|
||||||
result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
|
result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
|
||||||
else
|
else
|
||||||
result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
|
result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
|
||||||
|
} else {
|
||||||
|
if(lockRequested)
|
||||||
|
result = _regionService.lockAccount(getAccountName(), getDomainId(), getId());
|
||||||
|
else
|
||||||
|
result = _regionService.disableAccount(getAccountName(), getDomainId(), getId());
|
||||||
|
}
|
||||||
if (result != null){
|
if (result != null){
|
||||||
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import com.cloud.api.IdentityMapper;
|
|||||||
import com.cloud.api.Implementation;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
|
import com.cloud.api.BaseCmd.CommandType;
|
||||||
import com.cloud.api.response.AccountResponse;
|
import com.cloud.api.response.AccountResponse;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
|
|
||||||
@ -46,6 +47,9 @@ public class EnableAccountCmd extends BaseCmd {
|
|||||||
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Enables specified account in this domain.")
|
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Enables specified account in this domain.")
|
||||||
private Long domainId;
|
private Long domainId;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
|
||||||
|
private Boolean isPropagate;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -62,6 +66,10 @@ public class EnableAccountCmd extends BaseCmd {
|
|||||||
return domainId;
|
return domainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIsPropagate() {
|
||||||
|
return isPropagate;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -88,7 +96,13 @@ public class EnableAccountCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
Account result = _accountService.enableAccount(getAccountName(), getDomainId(), getId());
|
boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
|
||||||
|
Account result = null;
|
||||||
|
if(isPopagate){
|
||||||
|
result = _accountService.enableAccount(getAccountName(), getDomainId(), getId());
|
||||||
|
} else {
|
||||||
|
result = _regionService.enableAccount(getAccountName(), getDomainId(), getId());
|
||||||
|
}
|
||||||
if (result != null){
|
if (result != null){
|
||||||
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import com.cloud.api.IdentityMapper;
|
|||||||
import com.cloud.api.Implementation;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
|
import com.cloud.api.BaseCmd.CommandType;
|
||||||
import com.cloud.api.response.AccountResponse;
|
import com.cloud.api.response.AccountResponse;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
|
|
||||||
@ -59,6 +60,9 @@ public class UpdateAccountCmd extends BaseCmd{
|
|||||||
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
|
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
|
||||||
private Map details;
|
private Map details;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
|
||||||
|
private Boolean isPropagate;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -93,6 +97,10 @@ public class UpdateAccountCmd extends BaseCmd{
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIsPropagate() {
|
||||||
|
return isPropagate;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -118,7 +126,13 @@ public class UpdateAccountCmd extends BaseCmd{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
Account result = _accountService.updateAccount(this);
|
boolean isPopagate = (getIsPropagate() != null ) ? getIsPropagate() : false;
|
||||||
|
Account result = null;
|
||||||
|
if(isPopagate){
|
||||||
|
result = _accountService.updateAccount(this);
|
||||||
|
} else {
|
||||||
|
result = _regionService.updateAccount(this);
|
||||||
|
}
|
||||||
if (result != null){
|
if (result != null){
|
||||||
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
AccountResponse response = _responseGenerator.createAccountResponse(result);
|
||||||
response.setResponseName(getCommandName());
|
response.setResponseName(getCommandName());
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package com.cloud.region;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cloud.api.commands.ListRegionsCmd;
|
import com.cloud.api.commands.ListRegionsCmd;
|
||||||
|
import com.cloud.api.commands.UpdateAccountCmd;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
|
|
||||||
|
|
||||||
@ -27,4 +28,9 @@ public interface RegionService {
|
|||||||
public Region updateRegion(long id, String name, String endPoint);
|
public Region updateRegion(long id, String name, String endPoint);
|
||||||
public boolean removeRegion(long id);
|
public boolean removeRegion(long id);
|
||||||
public List<? extends Region> listRegions(ListRegionsCmd cmd);
|
public List<? extends Region> listRegions(ListRegionsCmd cmd);
|
||||||
|
boolean deleteUserAccount(long accountId);
|
||||||
|
Account updateAccount(UpdateAccountCmd cmd);
|
||||||
|
public Account lockAccount(String accountName, Long domainId, Long id);
|
||||||
|
public Account disableAccount(String accountName, Long domainId, Long id);
|
||||||
|
public Account enableAccount(String accountName, Long domainId, Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,4 +61,8 @@ public interface Account extends ControlledEntity {
|
|||||||
public String getNetworkDomain();
|
public String getNetworkDomain();
|
||||||
|
|
||||||
public Long getDefaultZoneId();
|
public Long getDefaultZoneId();
|
||||||
|
|
||||||
|
public long getRegionId();
|
||||||
|
|
||||||
|
public String getUuid();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public interface AccountService {
|
|||||||
* @return the user if created successfully, null otherwise
|
* @return the user if created successfully, null otherwise
|
||||||
*/
|
*/
|
||||||
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
||||||
Map<String, String> details);
|
Map<String, String> details, String accountUUID, String userUUID, Long regionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a user by userId
|
* Deletes a user by userId
|
||||||
|
|||||||
@ -75,12 +75,14 @@ public class AccountVO implements Account, Identity {
|
|||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountVO(String accountName, long domainId, String networkDomain, short type) {
|
public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid, long regionId) {
|
||||||
this.accountName = accountName;
|
this.accountName = accountName;
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
this.networkDomain = networkDomain;
|
this.networkDomain = networkDomain;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.state = State.enabled;
|
this.state = State.enabled;
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.regionId = regionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNeedsCleanup(boolean value) {
|
public void setNeedsCleanup(boolean value) {
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public class UserVO implements User, Identity {
|
|||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone) {
|
public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone, String uuid, long regionId) {
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
@ -110,7 +110,8 @@ public class UserVO implements User, Identity {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
this.timezone = timezone;
|
this.timezone = timezone;
|
||||||
this.state = State.enabled;
|
this.state = State.enabled;
|
||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = uuid;
|
||||||
|
this.regionId = regionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -199,7 +199,7 @@ public class ProjectManagerImpl implements ProjectManager, Manager{
|
|||||||
StringBuilder acctNm = new StringBuilder("PrjAcct-");
|
StringBuilder acctNm = new StringBuilder("PrjAcct-");
|
||||||
acctNm.append(name).append("-").append(owner.getDomainId());
|
acctNm.append(name).append("-").append(owner.getDomainId());
|
||||||
|
|
||||||
Account projectAccount = _accountMgr.createAccount(acctNm.toString(), Account.ACCOUNT_TYPE_PROJECT, domainId, null, null);
|
Account projectAccount = _accountMgr.createAccount(acctNm.toString(), Account.ACCOUNT_TYPE_PROJECT, domainId, null, null, "", 0L);
|
||||||
|
|
||||||
Project project = _projectDao.persist(new ProjectVO(name, displayText, owner.getDomainId(), projectAccount.getId()));
|
Project project = _projectDao.persist(new ProjectVO(name, displayText, owner.getDomainId(), projectAccount.getId()));
|
||||||
|
|
||||||
|
|||||||
@ -16,11 +16,12 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.region;
|
package com.cloud.region;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public interface RegionManager {
|
public interface RegionManager {
|
||||||
public boolean propogateAddResource();
|
public boolean propogateAddAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
||||||
public boolean propogateUpdateResource();
|
Map<String, String> details, String accountUUID, String userUUID, long regionId);
|
||||||
public boolean propogateDeleteResource();
|
|
||||||
public boolean addResource();
|
public boolean addResource();
|
||||||
public boolean updateResource();
|
public boolean updateResource();
|
||||||
public boolean deleteResource();
|
public boolean deleteResource();
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.region;
|
package com.cloud.region;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -23,13 +24,23 @@ import java.util.Map;
|
|||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
|
import org.apache.commons.httpclient.HttpClient;
|
||||||
|
import org.apache.commons.httpclient.HttpException;
|
||||||
|
import org.apache.commons.httpclient.HttpMethod;
|
||||||
|
import org.apache.commons.httpclient.methods.GetMethod;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.commands.ListRegionsCmd;
|
import com.cloud.api.commands.ListRegionsCmd;
|
||||||
|
import com.cloud.api.commands.UpdateAccountCmd;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
import com.cloud.region.dao.RegionDao;
|
import com.cloud.region.dao.RegionDao;
|
||||||
|
import com.cloud.user.Account;
|
||||||
|
import com.cloud.user.AccountManager;
|
||||||
|
import com.cloud.user.AccountVO;
|
||||||
|
import com.cloud.user.dao.AccountDao;
|
||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.utils.component.Manager;
|
import com.cloud.utils.component.Manager;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
@Local(value = { RegionManager.class, RegionService.class })
|
@Local(value = { RegionManager.class, RegionService.class })
|
||||||
public class RegionManagerImpl implements RegionManager, RegionService, Manager{
|
public class RegionManagerImpl implements RegionManager, RegionService, Manager{
|
||||||
@ -37,9 +48,13 @@ public class RegionManagerImpl implements RegionManager, RegionService, Manager{
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RegionDao _regionDao;
|
private RegionDao _regionDao;
|
||||||
|
@Inject
|
||||||
|
private AccountDao _accountDao;
|
||||||
|
@Inject
|
||||||
|
private AccountManager _accountMgr;
|
||||||
|
|
||||||
private String _name;
|
private String _name;
|
||||||
private long _id = 1; //ToDo, get this from config
|
private long _id = 1; //ToDo, get this from config or db.properties
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
|
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
|
||||||
@ -63,22 +78,160 @@ public class RegionManagerImpl implements RegionManager, RegionService, Manager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean propogateAddResource() {
|
public boolean propogateAddAccount(String userName, String password, String firstName, String lastName, String email, String timezone,
|
||||||
// TODO Auto-generated method stub
|
String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, long regionId) {
|
||||||
return false;
|
List<RegionVO> regions = _regionDao.listAll();
|
||||||
|
StringBuffer params = new StringBuffer("/api?command=createAccount");
|
||||||
|
params.append("&username="+userName);
|
||||||
|
params.append("&password="+password);
|
||||||
|
params.append("&firstname="+firstName);
|
||||||
|
params.append("&lastname="+lastName);
|
||||||
|
params.append("&email="+email);
|
||||||
|
if(timezone != null){
|
||||||
|
params.append("&timezone="+timezone);
|
||||||
|
}
|
||||||
|
if(accountName != null){
|
||||||
|
params.append("&account="+accountName);
|
||||||
|
}
|
||||||
|
params.append("&accounttype="+accountType);
|
||||||
|
if(domainId != null){
|
||||||
|
params.append("&domainid="+domainId); //use UUID
|
||||||
|
}
|
||||||
|
if(networkDomain != null){
|
||||||
|
params.append("&networkdomain="+networkDomain);
|
||||||
|
}
|
||||||
|
if(details != null){
|
||||||
|
params.append("&accountdetails="+details); //ToDo change to Map
|
||||||
|
}
|
||||||
|
params.append("&accountid="+accountUUID);
|
||||||
|
params.append("&userid="+userUUID);
|
||||||
|
params.append("®ionid="+regionId);
|
||||||
|
|
||||||
|
for (Region region : regions){
|
||||||
|
if(region.getId() == getId()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
s_logger.debug("Adding account :"+accountName+" to Region: "+region.getId());
|
||||||
|
String url = region.getEndPoint() + params;
|
||||||
|
if (makeAPICall(url)) {
|
||||||
|
s_logger.debug("Successfully added account :"+accountName+" to Region: "+region.getId());
|
||||||
|
} else {
|
||||||
|
s_logger.error("Error while Adding account :"+accountName+" to Region: "+region.getId());
|
||||||
|
//Send Account delete to all Regions where account is added successfully
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean propogateUpdateResource() {
|
public boolean deleteUserAccount(long accountId) {
|
||||||
// TODO Auto-generated method stub
|
AccountVO account = _accountDao.findById(accountId);
|
||||||
|
//Check null account
|
||||||
|
String accountUUID = account.getUuid();
|
||||||
|
long regionId = account.getRegionId();
|
||||||
|
String params = "/api?command=deleteAccount&id="+accountUUID+"&ispropagate=true";
|
||||||
|
if(getId() == regionId){
|
||||||
|
if(_accountMgr.deleteUserAccount(accountId)){
|
||||||
|
List<RegionVO> regions = _regionDao.listAll();
|
||||||
|
for (Region region : regions){
|
||||||
|
if(region.getId() == getId()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String url = region.getEndPoint() + params;
|
||||||
|
if (makeAPICall(url)) {
|
||||||
|
s_logger.debug("Successfully deleted account :"+accountUUID+" in Region: "+region.getId());
|
||||||
|
} else {
|
||||||
|
s_logger.error("Error while deleted account :"+accountUUID+" in Region: "+region.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//First delete in the Region where account is created
|
||||||
|
params = "/api?command=deleteAccount&id="+accountUUID;
|
||||||
|
Region region = _regionDao.findById(regionId);
|
||||||
|
String url = region.getEndPoint() + params;
|
||||||
|
if (makeAPICall(url)) {
|
||||||
|
s_logger.debug("Successfully deleted account :"+accountUUID+" in Region: "+region.getId());
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
s_logger.error("Error while deleted account :"+accountUUID+" in Region: "+region.getId());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean propogateDeleteResource() {
|
public Account updateAccount(UpdateAccountCmd cmd) {
|
||||||
// TODO Auto-generated method stub
|
Long accountId = cmd.getId();
|
||||||
|
Long domainId = cmd.getDomainId();
|
||||||
|
String accountName = cmd.getAccountName();
|
||||||
|
String newAccountName = cmd.getNewName();
|
||||||
|
String networkDomain = cmd.getNetworkDomain();
|
||||||
|
Map<String, String> details = cmd.getDetails();
|
||||||
|
|
||||||
|
AccountVO account = _accountDao.findById(accountId);
|
||||||
|
//Check null account
|
||||||
|
String accountUUID = account.getUuid();
|
||||||
|
long regionId = account.getRegionId();
|
||||||
|
if(getId() == regionId){
|
||||||
|
Account updateAccount = _accountMgr.updateAccount(cmd);
|
||||||
|
if(updateAccount != null){
|
||||||
|
List<RegionVO> regions = _regionDao.listAll();
|
||||||
|
StringBuffer params = new StringBuffer("/api?command=updateAccount"+"&ispropagate=true");
|
||||||
|
for (Region region : regions){
|
||||||
|
if(region.getId() == getId()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String url = region.getEndPoint() + params;
|
||||||
|
if (makeAPICall(url)) {
|
||||||
|
s_logger.debug("Successfully updated account :"+accountUUID+" in Region: "+region.getId());
|
||||||
|
} else {
|
||||||
|
s_logger.error("Error while updated account :"+accountUUID+" in Region: "+region.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return updateAccount;
|
||||||
|
} else {
|
||||||
|
//First update in the Region where account is created
|
||||||
|
StringBuffer params = new StringBuffer("/api?command=updateAccount");
|
||||||
|
//add params
|
||||||
|
Region region = _regionDao.findById(regionId);
|
||||||
|
String url = region.getEndPoint() + params;
|
||||||
|
if (makeAPICall(url)) {
|
||||||
|
s_logger.debug("Successfully updated account :"+accountUUID+" in source Region: "+region.getId());
|
||||||
|
//return Account object
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
s_logger.error("Error while updated account :"+accountUUID+" in source Region: "+region.getId());
|
||||||
|
//throw exception;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean makeAPICall(String url){
|
||||||
|
try {
|
||||||
|
|
||||||
|
HttpClient client = new HttpClient();
|
||||||
|
HttpMethod method = new GetMethod(url);
|
||||||
|
if( client.executeMethod(method) == 200){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} catch (HttpException e) {
|
||||||
|
s_logger.error(e.getMessage());
|
||||||
|
return false;
|
||||||
|
} catch (IOException e) {
|
||||||
|
s_logger.error(e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addResource() {
|
public boolean addResource() {
|
||||||
@ -115,7 +268,8 @@ public class RegionManagerImpl implements RegionManager, RegionService, Manager{
|
|||||||
region.setEndPoint(endPoint);
|
region.setEndPoint(endPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return region;
|
_regionDao.update(id, region);
|
||||||
|
return _regionDao.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -146,4 +300,22 @@ public class RegionManagerImpl implements RegionManager, RegionService, Manager{
|
|||||||
return _regionDao.listAll();
|
return _regionDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Account lockAccount(String accountName, Long domainId, Long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Account disableAccount(String accountName, Long domainId, Long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Account enableAccount(String accountName, Long domainId, Long id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,17 +34,17 @@ public class RegionVO implements Region{
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name="id")
|
@Column(name="id")
|
||||||
long id;
|
private long id;
|
||||||
|
|
||||||
@Column(name="name")
|
@Column(name="name")
|
||||||
String name;
|
private String name;
|
||||||
|
|
||||||
@Column(name="end_point")
|
@Column(name="end_point")
|
||||||
String endPoint;
|
private String endPoint;
|
||||||
|
|
||||||
@Column(name="status")
|
@Column(name="status")
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
Region.State status;
|
private Region.State status;
|
||||||
|
|
||||||
@Column(name=GenericDao.REMOVED_COLUMN)
|
@Column(name=GenericDao.REMOVED_COLUMN)
|
||||||
private Date removed;
|
private Date removed;
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public interface AccountManager extends AccountService {
|
|||||||
|
|
||||||
Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId);
|
Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId);
|
||||||
|
|
||||||
Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map details);
|
Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map details, String uuid, long regionId);
|
||||||
|
|
||||||
UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone);
|
UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone);
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,7 @@ import com.cloud.projects.ProjectManager;
|
|||||||
import com.cloud.projects.ProjectVO;
|
import com.cloud.projects.ProjectVO;
|
||||||
import com.cloud.projects.dao.ProjectAccountDao;
|
import com.cloud.projects.dao.ProjectAccountDao;
|
||||||
import com.cloud.projects.dao.ProjectDao;
|
import com.cloud.projects.dao.ProjectDao;
|
||||||
|
import com.cloud.region.RegionManager;
|
||||||
import com.cloud.server.auth.UserAuthenticator;
|
import com.cloud.server.auth.UserAuthenticator;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
@ -199,8 +200,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
private ProjectAccountDao _projectAccountDao;
|
private ProjectAccountDao _projectAccountDao;
|
||||||
@Inject
|
@Inject
|
||||||
private IPAddressDao _ipAddressDao;
|
private IPAddressDao _ipAddressDao;
|
||||||
//@Inject
|
@Inject
|
||||||
//private RegionManager _regionMgr;
|
private RegionManager _regionMgr;
|
||||||
|
|
||||||
private Adapters<UserAuthenticator> _userAuthenticators;
|
private Adapters<UserAuthenticator> _userAuthenticators;
|
||||||
|
|
||||||
@ -678,7 +679,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
@DB
|
@DB
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_CREATE, eventDescription = "creating Account")
|
@ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_CREATE, eventDescription = "creating Account")
|
||||||
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
|
||||||
Map<String, String> details) {
|
Map<String, String> details, String accountUUID, String userUUID, Long regionId) {
|
||||||
|
|
||||||
if (accountName == null) {
|
if (accountName == null) {
|
||||||
accountName = userName;
|
accountName = userName;
|
||||||
@ -720,11 +721,12 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(regionId == null){
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
|
|
||||||
// create account
|
// create account
|
||||||
Account account = createAccount(accountName, accountType, domainId, networkDomain, details);
|
AccountVO account = createAccount(accountName, accountType, domainId, networkDomain, details, UUID.randomUUID().toString(), _regionMgr.getId());
|
||||||
long accountId = account.getId();
|
long accountId = account.getId();
|
||||||
|
|
||||||
// create the first user for the account
|
// create the first user for the account
|
||||||
@ -736,10 +738,35 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
String registrationToken = UUID.nameUUIDFromBytes(bytes).toString();
|
String registrationToken = UUID.nameUUIDFromBytes(bytes).toString();
|
||||||
user.setRegistrationToken(registrationToken);
|
user.setRegistrationToken(registrationToken);
|
||||||
}
|
}
|
||||||
|
txn.commit();
|
||||||
|
//Propogate Add account to other Regions
|
||||||
|
_regionMgr.propogateAddAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, domainId,
|
||||||
|
networkDomain, details, account.getUuid(), user.getUuid(), _regionMgr.getId());
|
||||||
|
//check success
|
||||||
|
return _userAccountDao.findById(user.getId());
|
||||||
|
} else {
|
||||||
|
// Account is propogated from another Region
|
||||||
|
|
||||||
|
Transaction txn = Transaction.currentTxn();
|
||||||
|
txn.start();
|
||||||
|
|
||||||
|
// create account
|
||||||
|
AccountVO account = createAccount(accountName, accountType, domainId, networkDomain, details, accountUUID, regionId);
|
||||||
|
long accountId = account.getId();
|
||||||
|
|
||||||
|
// create the first user for the account
|
||||||
|
UserVO user = createUser(accountId, userName, password, firstName, lastName, email, timezone, userUUID, regionId);
|
||||||
|
|
||||||
|
if (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) {
|
||||||
|
// set registration token
|
||||||
|
byte[] bytes = (domainId + accountName + userName + System.currentTimeMillis()).getBytes();
|
||||||
|
String registrationToken = UUID.nameUUIDFromBytes(bytes).toString();
|
||||||
|
user.setRegistrationToken(registrationToken);
|
||||||
|
}
|
||||||
txn.commit();
|
txn.commit();
|
||||||
return _userAccountDao.findById(user.getId());
|
return _userAccountDao.findById(user.getId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVO createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId) {
|
public UserVO createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId) {
|
||||||
@ -1061,7 +1088,6 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
|
|
||||||
throw new InvalidParameterValueException("The account id=" + accountId + " manages project(s) with ids " + projectIds + "and can't be removed");
|
throw new InvalidParameterValueException("The account id=" + accountId + " manages project(s) with ids " + projectIds + "and can't be removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return deleteAccount(account, callerUserId, caller);
|
return deleteAccount(account, callerUserId, caller);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1516,7 +1542,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map details) {
|
public AccountVO createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map details, String uuid, long regionId) {
|
||||||
// Validate domain
|
// Validate domain
|
||||||
Domain domain = _domainMgr.getDomain(domainId);
|
Domain domain = _domainMgr.getDomain(domainId);
|
||||||
if (domain == null) {
|
if (domain == null) {
|
||||||
@ -1560,7 +1586,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
|
|
||||||
Account account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType));
|
AccountVO account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType, uuid, regionId));
|
||||||
|
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
throw new CloudRuntimeException("Failed to create account name " + accountName + " in domain id=" + domainId);
|
throw new CloudRuntimeException("Failed to create account name " + accountName + " in domain id=" + domainId);
|
||||||
@ -1589,7 +1615,18 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone);
|
s_logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone);
|
||||||
}
|
}
|
||||||
UserVO user = _userDao.persist(new UserVO(accountId, userName, password, firstName, lastName, email, timezone));
|
|
||||||
|
UserVO user = _userDao.persist(new UserVO(accountId, userName, password, firstName, lastName, email, timezone, UUID.randomUUID().toString(), _regionMgr.getId()));
|
||||||
|
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ToDo Add events??
|
||||||
|
public UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone, String uuid, long regionId) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone);
|
||||||
|
}
|
||||||
|
UserVO user = _userDao.persist(new UserVO(accountId, userName, password, firstName, lastName, email, timezone, uuid, regionId));
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,6 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
protected final SearchBuilder<AccountVO> CleanupForRemovedAccountsSearch;
|
protected final SearchBuilder<AccountVO> CleanupForRemovedAccountsSearch;
|
||||||
protected final SearchBuilder<AccountVO> CleanupForDisabledAccountsSearch;
|
protected final SearchBuilder<AccountVO> CleanupForDisabledAccountsSearch;
|
||||||
protected final SearchBuilder<AccountVO> NonProjectAccountSearch;
|
protected final SearchBuilder<AccountVO> NonProjectAccountSearch;
|
||||||
private final long _regionId = 1;
|
|
||||||
|
|
||||||
protected AccountDaoImpl() {
|
protected AccountDaoImpl() {
|
||||||
AllFieldsSearch = createSearchBuilder();
|
AllFieldsSearch = createSearchBuilder();
|
||||||
@ -260,10 +259,4 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@DB
|
|
||||||
public AccountVO persist(AccountVO account) {
|
|
||||||
account.setRegionId(_regionId);
|
|
||||||
return super.persist(account);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user