Skip to content

Commit

Permalink
CLOUDSTACK-10365: Change the "getXXX" boolean method names to "isXXX" (
Browse files Browse the repository at this point in the history
…#2847)

These boolean-return methods are named as "getXXX".
Other boolean-return methods are named as "isXXX".
Considering there methods will return boolean values, it should be more clear and consistent to rename them as "isXXX".
(rebase #2602 and #2816)
  • Loading branch information
Kui-Liu authored and DaanHoogland committed Sep 22, 2018
1 parent 9c14059 commit d53fc94
Show file tree
Hide file tree
Showing 77 changed files with 239 additions and 239 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/com/cloud/agent/api/to/S3TO.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public DataStoreRole getRole() {
return DataStoreRole.Image;
}

public boolean getEnableRRS() {
public boolean isEnableRRS() {
return enableRRS;
}

Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/com/cloud/offering/DiskOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public String toString() {

String getUniqueName();

boolean getUseLocalStorage();
boolean isUseLocalStorage();

Long getDomainId();

String getName();

boolean getSystemUse();
boolean isSystemUse();

String getDisplayText();

Expand Down
30 changes: 15 additions & 15 deletions api/src/main/java/com/cloud/offering/NetworkOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public enum Detail {
*/
Integer getMulticastRateMbps();

boolean getForVpc();
boolean isForVpc();

TrafficType getTrafficType();

boolean getSpecifyVlan();
boolean isSpecifyVlan();

String getTags();

Expand All @@ -106,39 +106,39 @@ public enum Detail {

Long getServiceOfferingId();

boolean getDedicatedLB();
boolean isDedicatedLB();

boolean getSharedSourceNat();
boolean isSharedSourceNat();

boolean getRedundantRouter();
boolean isRedundantRouter();

boolean isConserveMode();

boolean getElasticIp();
boolean isElasticIp();

boolean getAssociatePublicIP();
boolean isAssociatePublicIP();

boolean getElasticLb();
boolean isElasticLb();

boolean getSpecifyIpRanges();
boolean isSpecifyIpRanges();

boolean isInline();

boolean getIsPersistent();
boolean isPersistent();

boolean getInternalLb();
boolean isInternalLb();

boolean getPublicLb();
boolean isPublicLb();

boolean getEgressDefaultPolicy();
boolean isEgressDefaultPolicy();

Integer getConcurrentConnections();

boolean isKeepAliveEnabled();

boolean getSupportsStrechedL2();
boolean isSupportingStrechedL2();

boolean getSupportsPublicAccess();
boolean isSupportingPublicAccess();

String getServicePackage();
}
8 changes: 4 additions & 4 deletions api/src/main/java/com/cloud/offering/ServiceOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public enum StorageType {
* @return is this a system service offering
*/
@Override
boolean getSystemUse();
boolean isSystemUse();

/**
* @return # of cpu.
Expand All @@ -76,7 +76,7 @@ public enum StorageType {
/**
* @return Does this service plan offer HA?
*/
boolean getOfferHA();
boolean isOfferHA();

/**
* @return Does this service plan offer VM to use CPU resources beyond the service offering limits?
Expand All @@ -86,7 +86,7 @@ public enum StorageType {
/**
* @return Does this service plan support Volatile VM that is, discard VM's root disk and create a new one on reboot?
*/
boolean getVolatileVm();
boolean isVolatileVm();

/**
* @return the rate in megabits per sec to which a VM's network interface is throttled to
Expand All @@ -102,7 +102,7 @@ public enum StorageType {
* @return whether or not the service offering requires local storage
*/
@Override
boolean getUseLocalStorage();
boolean isUseLocalStorage();

@Override
Long getDomainId();
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/com/cloud/storage/GuestOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ public interface GuestOS extends InternalIdentity, Identity {

Date getRemoved();

boolean getIsUserDefined();
boolean isUserDefined();
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public enum TemplateFilter {

String getDisplayText();

boolean getEnablePassword();
boolean isEnablePassword();

boolean getEnableSshKey();
boolean isEnableSshKey();

boolean isCrossZones();

Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/com/cloud/vm/DiskProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public DiskProfile(Volume vol, DiskOffering offering, HypervisorType hyperType)
offering.getId(),
vol.getSize(),
offering.getTagsArray(),
offering.getUseLocalStorage(),
offering.isUseLocalStorage(),
offering.isCustomized(),
null);
this.hyperType = hyperType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public long getEntityOwnerId() {
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());

DataCenter zone = _entityMgr.findById(DataCenter.class, network.getDataCenterId());
if (zone.getNetworkType() == NetworkType.Basic && offering.getElasticIp() && offering.getElasticLb()) {
if (zone.getNetworkType() == NetworkType.Basic && offering.isElasticIp() && offering.isElasticLb()) {
// Since the basic zone network is owned by 'Root' domain, domain access checkers will fail for the
// accounts in non-root domains while acquiring public IP. So add an exception for the 'Basic' zone
// shared network with EIP/ELB service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Long getSize() {
return size;
}

public boolean getShrinkOk() {
public boolean isShrinkOk() {
return shrinkOk;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public long download(boolean resume, DownloadCompleteCallback callback) {
PutObjectRequest putObjectRequest = new PutObjectRequest(s3TO.getBucketName(), s3Key, inputStream, objectMetadata);

// If reduced redundancy is enabled, set it.
if (s3TO.getEnableRRS()) {
if (s3TO.isEnableRRS()) {
putObjectRequest.withStorageClass(StorageClass.ReducedRedundancy);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3214,14 +3214,14 @@ public void checkIfCanUpgrade(final VirtualMachine vmInstance, final ServiceOffe

// Check that the service offering being upgraded to has the same storage pool preference as the VM's current service
// offering
if (currentServiceOffering.getUseLocalStorage() != newServiceOffering.getUseLocalStorage()) {
if (currentServiceOffering.isUseLocalStorage() != newServiceOffering.isUseLocalStorage()) {
throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() +
", cannot switch between local storage and shared storage service offerings. Current offering " + "useLocalStorage=" +
currentServiceOffering.getUseLocalStorage() + ", target offering useLocalStorage=" + newServiceOffering.getUseLocalStorage());
currentServiceOffering.isUseLocalStorage() + ", target offering useLocalStorage=" + newServiceOffering.isUseLocalStorage());
}

// if vm is a system vm, check if it is a system service offering, if yes return with error as it cannot be used for user vms
if (currentServiceOffering.getSystemUse() != newServiceOffering.getSystemUse()) {
if (currentServiceOffering.isSystemUse() != newServiceOffering.isSystemUse()) {
throw new InvalidParameterValueException("isSystem property is different for current service offering and new service offering");
}

Expand All @@ -3245,7 +3245,7 @@ public boolean upgradeVmDb(final long vmId, final long serviceOfferingId) {
final VMInstanceVO vmForUpdate = _vmDao.createForUpdate();
vmForUpdate.setServiceOfferingId(serviceOfferingId);
final ServiceOffering newSvcOff = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
vmForUpdate.setHaEnabled(newSvcOff.getOfferHA());
vmForUpdate.setHaEnabled(newSvcOff.isOfferHA());
vmForUpdate.setLimitCpuUse(newSvcOff.getLimitCpuUse());
vmForUpdate.setServiceOfferingId(newSvcOff.getId());
return _vmDao.update(vmId, vmForUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ public List<? extends Network> setupNetwork(final Account owner, final NetworkOf
@Override
public void doInTransactionWithoutResult(final TransactionStatus status) {
final NetworkVO vo = new NetworkVO(id, network, offering.getId(), guru.getName(), owner.getDomainId(), owner.getId(), relatedFile, name, displayText, predefined
.getNetworkDomain(), offering.getGuestType(), plan.getDataCenterId(), plan.getPhysicalNetworkId(), aclType, offering.getSpecifyIpRanges(),
vpcId, offering.getRedundantRouter(), predefined.getExternalId());
.getNetworkDomain(), offering.getGuestType(), plan.getDataCenterId(), plan.getPhysicalNetworkId(), aclType, offering.isSpecifyIpRanges(),
vpcId, offering.isRedundantRouter(), predefined.getExternalId());
vo.setDisplayNetwork(isDisplayNetworkEnabled == null ? true : isDisplayNetworkEnabled);
vo.setStrechedL2Network(offering.getSupportsStrechedL2());
vo.setStrechedL2Network(offering.isSupportingStrechedL2());
final NetworkVO networkPersisted = _networksDao.persist(vo, vo.getGuestType() == Network.GuestType.Isolated,
finalizeServicesAndProvidersForNetwork(offering, plan.getPhysicalNetworkId()));
networks.add(networkPersisted);
Expand Down Expand Up @@ -1110,7 +1110,7 @@ public void implementNetworkElementsAndResources(final DeployDestination dest, f
// 2) network has sourceNat service
// 3) network offering does not support a shared source NAT rule

final boolean sharedSourceNat = offering.getSharedSourceNat();
final boolean sharedSourceNat = offering.isSharedSourceNat();
final DataCenter zone = _dcDao.findById(network.getDataCenterId());

if (!sharedSourceNat && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.SourceNat)
Expand Down Expand Up @@ -1220,7 +1220,7 @@ protected boolean reprogramNetworkRules(final long networkId, final Account call
if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall) && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
&& (network.getGuestType() == Network.GuestType.Isolated || network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced)) {
// add default egress rule to accept the traffic
_firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.getEgressDefaultPolicy(), true);
_firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.isEgressDefaultPolicy(), true);
}
if (!_firewallMgr.applyFirewallRules(firewallEgressRulesToApply, false, caller)) {
s_logger.warn("Failed to reapply firewall Egress rule(s) as a part of network id=" + networkId + " restart");
Expand Down Expand Up @@ -2171,7 +2171,7 @@ public Network createGuestNetwork(final long networkOfferingId, final String nam
}

//don't allow eip/elb networks in Advance zone
if (ntwkOff.getElasticIp() || ntwkOff.getElasticLb()) {
if (ntwkOff.isElasticIp() || ntwkOff.isElasticLb()) {
throw new InvalidParameterValueException("Elastic IP and Elastic LB services are supported in zone of type " + NetworkType.Basic);
}
}
Expand All @@ -2183,7 +2183,7 @@ public Network createGuestNetwork(final long networkOfferingId, final String nam
//TODO(VXLAN): Support VNI specified
// VlanId can be specified only when network offering supports it
final boolean vlanSpecified = vlanId != null;
if (vlanSpecified != ntwkOff.getSpecifyVlan()) {
if (vlanSpecified != ntwkOff.isSpecifyVlan()) {
if (vlanSpecified) {
throw new InvalidParameterValueException("Can't specify vlan; corresponding offering says specifyVlan=false");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPool
// Find a destination storage pool with the specified criteria
DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, volume.getDiskOfferingId());
DiskProfile dskCh = new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), diskOffering.getDiskSize(), diskOffering.getTagsArray(),
diskOffering.getUseLocalStorage(), diskOffering.isRecreatable(), null);
diskOffering.isUseLocalStorage(), diskOffering.isRecreatable(), null);
dskCh.setHyperType(dataDiskHyperType);
storageMgr.setDiskProfileThrottling(dskCh, null, diskOffering);

Expand Down Expand Up @@ -469,11 +469,11 @@ protected DiskProfile createDiskCharacteristics(VolumeInfo volume, VirtualMachin
throw new CloudRuntimeException("Template " + template.getName() + " has not been completely downloaded to zone " + dc.getId());
}

return new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), ss.getSize(), diskOffering.getTagsArray(), diskOffering.getUseLocalStorage(),
return new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), ss.getSize(), diskOffering.getTagsArray(), diskOffering.isUseLocalStorage(),
diskOffering.isRecreatable(), Storage.ImageFormat.ISO != template.getFormat() ? template.getId() : null);
} else {
return new DiskProfile(volume.getId(), volume.getVolumeType(), volume.getName(), diskOffering.getId(), diskOffering.getDiskSize(), diskOffering.getTagsArray(),
diskOffering.getUseLocalStorage(), diskOffering.isRecreatable(), null);
diskOffering.isUseLocalStorage(), diskOffering.isRecreatable(), null);
}
}

Expand Down Expand Up @@ -648,7 +648,7 @@ public boolean validateVolumeSizeRange(long size) {
}

protected DiskProfile toDiskProfile(Volume vol, DiskOffering offering) {
return new DiskProfile(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isRecreatable(),
return new DiskProfile(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.isUseLocalStorage(), offering.isRecreatable(),
vol.getTemplateId());
}

Expand Down Expand Up @@ -1174,7 +1174,7 @@ private List<VolumeTask> getTasks(List<VolumeVO> vols, Map<Volume, StoragePool>
s_logger.debug("Mismatch in storage pool " + assignedPool + " assigned by deploymentPlanner and the one associated with volume " + vol);
}
DiskOffering diskOffering = _entityMgr.findById(DiskOffering.class, vol.getDiskOfferingId());
if (diskOffering.getUseLocalStorage()) {
if (diskOffering.isUseLocalStorage()) {
// Currently migration of local volume is not supported so bail out
if (s_logger.isDebugEnabled()) {
s_logger.debug("Local volume " + vol + " cannot be recreated on storagepool " + assignedPool + " assigned by deploymentPlanner");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ public void testCheckIfCanUpgrade() throws Exception {
ServiceOfferingVO mockCurrentServiceOffering = mock(ServiceOfferingVO.class);

when(serviceOfferingDaoMock.findByIdIncludingRemoved(anyLong(), anyLong())).thenReturn(mockCurrentServiceOffering);
when(mockCurrentServiceOffering.getUseLocalStorage()).thenReturn(true);
when(serviceOfferingMock.getUseLocalStorage()).thenReturn(true);
when(mockCurrentServiceOffering.getSystemUse()).thenReturn(true);
when(serviceOfferingMock.getSystemUse()).thenReturn(true);
when(mockCurrentServiceOffering.isUseLocalStorage()).thenReturn(true);
when(serviceOfferingMock.isUseLocalStorage()).thenReturn(true);
when(mockCurrentServiceOffering.isSystemUse()).thenReturn(true);
when(serviceOfferingMock.isSystemUse()).thenReturn(true);
when(mockCurrentServiceOffering.getTags()).thenReturn("x,y");
when(serviceOfferingMock.getTags()).thenReturn("z,x,y");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected void init() {
AllFieldsSearch.and("redundant", AllFieldsSearch.entity().isRedundant(), Op.EQ);
final SearchBuilder<NetworkOfferingVO> join1 = _ntwkOffDao.createSearchBuilder();
join1.and("isSystem", join1.entity().isSystemOnly(), Op.EQ);
join1.and("isRedundant", join1.entity().getRedundantRouter(), Op.EQ);
join1.and("isRedundant", join1.entity().isRedundantRouter(), Op.EQ);
AllFieldsSearch.join("offerings", join1, AllFieldsSearch.entity().getNetworkOfferingId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
AllFieldsSearch.done();

Expand Down Expand Up @@ -196,7 +196,7 @@ protected void init() {
NetworksRegularUserCanCreateSearch.join("accounts", join4, NetworksRegularUserCanCreateSearch.entity().getId(), join4.entity().getNetworkId(),
JoinBuilder.JoinType.INNER);
final SearchBuilder<NetworkOfferingVO> join5 = _ntwkOffDao.createSearchBuilder();
join5.and("specifyVlan", join5.entity().getSpecifyVlan(), Op.EQ);
join5.and("specifyVlan", join5.entity().isSpecifyVlan(), Op.EQ);
NetworksRegularUserCanCreateSearch.join("ntwkOff", join5, NetworksRegularUserCanCreateSearch.entity().getNetworkOfferingId(), join5.entity().getId(),
JoinBuilder.JoinType.INNER);
NetworksRegularUserCanCreateSearch.done();
Expand Down Expand Up @@ -242,7 +242,7 @@ protected void init() {
join7.and("check", join7.entity().isCheckForGc(), Op.EQ);
GarbageCollectedSearch.join("ntwkOpGC", join7, GarbageCollectedSearch.entity().getId(), join7.entity().getId(), JoinBuilder.JoinType.INNER);
final SearchBuilder<NetworkOfferingVO> join8 = _ntwkOffDao.createSearchBuilder();
join8.and("isPersistent", join8.entity().getIsPersistent(), Op.EQ);
join8.and("isPersistent", join8.entity().isPersistent(), Op.EQ);
GarbageCollectedSearch.join("ntwkOffGC", join8, GarbageCollectedSearch.entity().getNetworkOfferingId(), join8.entity().getId(), JoinBuilder.JoinType.INNER);
GarbageCollectedSearch.done();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Long getVpcId() {
return vpcId;
}

public boolean getSourceNat() {
public boolean isSourceNat() {
return sourceNat;
}

Expand Down
Loading

0 comments on commit d53fc94

Please sign in to comment.