KuiLIU created CLOUDSTACK-10363:
-----------------------------------

             Summary: 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


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)

Reply via email to