Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/768#discussion_r39471718
  
    --- Diff: 
plugins/database/quota/src/org/apache/cloudstack/quota/QuotaServiceImpl.java ---
    @@ -0,0 +1,304 @@
    +//Licensed to the Apache Software Foundation (ASF) under one
    +//or more contributor license agreements.  See the NOTICE file
    +//distributed with this work for additional information
    +//regarding copyright ownership.  The ASF licenses this file
    +//to you under the Apache License, Version 2.0 (the
    +//"License"); you may not use this file except in compliance
    +//with the License.  You may obtain a copy of the License at
    +//
    +//http://www.apache.org/licenses/LICENSE-2.0
    +//
    +//Unless required by applicable law or agreed to in writing,
    +//software distributed under the License is distributed on an
    +//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +//KIND, either express or implied.  See the License for the
    +//specific language governing permissions and limitations
    +//under the License.
    +package org.apache.cloudstack.quota;
    +
    +import com.cloud.configuration.Config;
    +import com.cloud.domain.dao.DomainDao;
    +import com.cloud.exception.InvalidParameterValueException;
    +import com.cloud.exception.PermissionDeniedException;
    +import com.cloud.user.Account;
    +import com.cloud.user.AccountVO;
    +import com.cloud.user.dao.AccountDao;
    +import com.cloud.utils.component.ManagerBase;
    +import com.cloud.utils.db.Filter;
    +import com.cloud.utils.db.TransactionLegacy;
    +
    +import org.apache.cloudstack.api.command.QuotaBalanceCmd;
    +import org.apache.cloudstack.api.command.QuotaCreditsCmd;
    +import org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd;
    +import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
    +import org.apache.cloudstack.api.command.QuotaStatementCmd;
    +import org.apache.cloudstack.api.command.QuotaTariffListCmd;
    +import org.apache.cloudstack.api.command.QuotaTariffUpdateCmd;
    +import org.apache.cloudstack.api.response.QuotaResponseBuilder;
    +import org.apache.cloudstack.context.CallContext;
    +import org.apache.cloudstack.framework.config.ConfigKey;
    +import org.apache.cloudstack.framework.config.Configurable;
    +import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
    +import org.apache.cloudstack.quota.constant.QuotaConfig;
    +import org.apache.cloudstack.quota.dao.QuotaAccountDao;
    +import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
    +import org.apache.cloudstack.quota.dao.QuotaUsageDao;
    +import org.apache.cloudstack.quota.vo.QuotaAccountVO;
    +import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
    +import org.apache.cloudstack.quota.vo.QuotaUsageVO;
    +import org.apache.cloudstack.utils.usage.UsageUtils;
    +import org.apache.log4j.Logger;
    +import org.springframework.stereotype.Component;
    +
    +import javax.ejb.Local;
    +import javax.inject.Inject;
    +import javax.naming.ConfigurationException;
    +
    +import java.math.BigDecimal;
    +import java.util.ArrayList;
    +import java.util.Calendar;
    +import java.util.Date;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.TimeZone;
    +
    +@Component
    +@Local(value = QuotaService.class)
    +public class QuotaServiceImpl extends ManagerBase implements QuotaService, 
Configurable, QuotaConfig {
    +    private static final Logger s_logger = 
Logger.getLogger(QuotaServiceImpl.class.getName());
    +
    +    @Inject
    +    private AccountDao _accountDao;
    +    @Inject
    +    private QuotaAccountDao _quotaAcc;
    +    @Inject
    +    private QuotaUsageDao _quotaUsageDao;
    +    @Inject
    +    private DomainDao _domainDao;
    +    @Inject
    +    private ConfigurationDao _configDao;
    +    @Inject
    +    private QuotaBalanceDao _quotaBalanceDao;
    +    @Inject
    +    private QuotaResponseBuilder _respBldr;
    +
    +    private TimeZone _usageTimezone;
    +    private int _aggregationDuration = 0;
    +
    +    final static BigDecimal s_hoursInMonth = new BigDecimal(30 * 24);
    +    final static BigDecimal s_minutesInMonth = new BigDecimal(30 * 24 * 
60);
    +    final static BigDecimal s_gb = new BigDecimal(1024 * 1024 * 1024);
    --- End diff --
    
    Why use a ``BigDecimal`` instead of a ``long`` for these values?  Since 
these are whole numbers, the ``BigDecimal`` overhead seems unnecessary.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to