Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-10363

Inconsistent "getXXX" and "listXXX" method names.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Description

      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.

      //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;
          }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              BruceKuiLIU KuiLIU
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: