mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
126098 amukha: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 126058 jkaabimofrad: ACE-5001: Added a utility class to calculate the number of days between the start and end dates, so we could have a single source when dealing with such functionality. Also, changed the RepoUsageComponentImpl class to use this util class. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127841 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -52,7 +52,8 @@ import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.DateUtil;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -512,24 +513,23 @@ public class RepoUsageComponentImpl implements RepoUsageComponent
|
||||
Long licenseExpiryDate = restrictions.getLicenseExpiryDate();
|
||||
if (licenseExpiryDate != null)
|
||||
{
|
||||
long remainingMs = licenseExpiryDate - System.currentTimeMillis();
|
||||
double remainingDays = (double) remainingMs / (double)(24*3600000);
|
||||
if (remainingDays <= 0.0)
|
||||
int remainingDays = DateUtil.calculateDays(System.currentTimeMillis(), licenseExpiryDate);
|
||||
if (remainingDays <= 0)
|
||||
{
|
||||
errors.add(I18NUtil.getMessage("system.usage.err.limit_license_expired"));
|
||||
level = RepoUsageLevel.LOCKED_DOWN;
|
||||
}
|
||||
else if (remainingDays <= 7.0)
|
||||
else if (remainingDays <= 7)
|
||||
{
|
||||
warnings.add(I18NUtil.getMessage("system.usage.err.limit_license_expiring", (int)remainingDays));
|
||||
warnings.add(I18NUtil.getMessage("system.usage.err.limit_license_expiring", remainingDays));
|
||||
if (level.ordinal() < RepoUsageLevel.WARN_ADMIN.ordinal())
|
||||
{
|
||||
level = RepoUsageLevel.WARN_ALL;
|
||||
}
|
||||
}
|
||||
else if (remainingDays <= 21.0)
|
||||
else if (remainingDays <= 21)
|
||||
{
|
||||
warnings.add(I18NUtil.getMessage("system.usage.err.limit_license_expiring", (int)remainingDays));
|
||||
warnings.add(I18NUtil.getMessage("system.usage.err.limit_license_expiring", remainingDays));
|
||||
if (level.ordinal() < RepoUsageLevel.WARN_ALL.ordinal())
|
||||
{
|
||||
level = RepoUsageLevel.WARN_ADMIN;
|
||||
|
Reference in New Issue
Block a user