You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/04/24 09:36:00 UTC

[jira] [Commented] (CLOUDSTACK-10363) Inconsistent "getXXX" and "listXXX" method names.

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16449533#comment-16449533 ] 

ASF GitHub Bot commented on CLOUDSTACK-10363:
---------------------------------------------

BruceKuiLiu opened a new pull request #2599: CLOUDSTACK-10363: Change the "getXXX" and "listXXX" method names to "…
URL: https://github.com/apache/cloudstack/pull/2599
 
 
   …findXXX".
   
   These three methods are not direct getter or list.
   They try to find the target objects with the related arguments.
   So that, renaming them as "findXXX" should be more intuitive.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Inconsistent "getXXX" and "listXXX" method names.
> -------------------------------------------------
>
>                 Key: CLOUDSTACK-10363
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10363
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: KuiLIU
>            Priority: Major
>
> The following methods are not direct getter or list.
> They try to find the target objects with the related arguments.
> So that, renaming them as "findXXX" should be more intuitive.
> {code:java}
> //cloudstack/plugins/network-elements/ovs/src/main/java/com/cloud/network/ovs/dao/OvsTunnelInterfaceDaoImpl.java
>     @Override
>     public OvsTunnelInterfaceVO getByHostAndLabel(long hostId, String label) {
>         SearchCriteria<OvsTunnelInterfaceVO> sc = hostAndLabelSearch.create();
>         sc.setParameters("host_id", hostId);
>         sc.setParameters("label", label);
>         return findOneBy(sc);
>     }
> //cloudstack/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/PremiumSecondaryStorageManagerImpl.java
>     private List<CommandExecLogVO> listActiveCommands(long dcId, Date cutTime) {
>         SearchCriteria<CommandExecLogVO> sc = activeCommandSearch.create();
>         sc.setParameters("created", cutTime);
>         sc.setJoinParameters("hostSearch", "dc", dcId);
>         sc.setJoinParameters("hostSearch", "status", Status.Up);
>         return _cmdExecLogDao.search(sc, null);
>     }
> //cloudstack/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
>     private AsyncJobDispatcher getWakeupDispatcher(AsyncJob job) {
>         if (_jobDispatchers != null) {
>             List<AsyncJobJoinMapVO> joinRecords = _joinMapDao.listJoinRecords(job.getId());
>             if (joinRecords.size() > 0) {
>                 AsyncJobJoinMapVO joinRecord = joinRecords.get(0);
>                 for (AsyncJobDispatcher dispatcher : _jobDispatchers) {
>                     if (dispatcher.getName().equals(joinRecord.getWakeupDispatcher()))
>                         return dispatcher;
>                 }
>             } else {
>                 s_logger.warn("job-" + job.getId() + " is scheduled for wakeup run, but there is no joining info anymore");
>             }
>         }
>         return null;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)