コード例 #1
0
  public static licenceDetails getFullFeatureDetails() {
    if (featman == null) {
      Debug.out("featman null");
      return null;
    }

    FeatureDetails[] featureDetails = featman.getFeatureDetails("dvdburn");
    // if any of the feature details are still valid, we have a full
    for (FeatureDetails fd : featureDetails) {
      long now = SystemTime.getCurrentTime();
      Long lValidUntil = (Long) fd.getProperty(FeatureDetails.PR_VALID_UNTIL);
      if (lValidUntil != null && lValidUntil.longValue() >= now) {
        return new licenceDetails(
            lValidUntil.longValue(), fd.getLicence().getKey(), fd.getLicence().getState());
      }
      Long lValidOfflineUntil = (Long) fd.getProperty(FeatureDetails.PR_OFFLINE_VALID_UNTIL);
      if (lValidOfflineUntil != null && lValidOfflineUntil.longValue() >= now) {
        return new licenceDetails(
            lValidOfflineUntil.longValue(), fd.getLicence().getKey(), fd.getLicence().getState());
      }
    }

    Licence bestLicence = null;
    Licence[] licences = featman.getLicences();
    for (Licence licence : licences) {
      FeatureDetails[] details = licence.getFeatures();
      boolean isTrial = false;
      for (FeatureDetails fd : details) {
        Object property = fd.getProperty(FeatureDetails.PR_IS_TRIAL);
        if ((property instanceof Number) && ((Number) property).intValue() == 1) {
          isTrial = true;
          break;
        }
      }
      if (isTrial) {
        continue;
      }
      int state = licence.getState();
      if (state == Licence.LS_AUTHENTICATED) {
        bestLicence = licence;
        break;
      } else {
        bestLicence = licence;
      }
    }

    if (bestLicence != null) {
      return new licenceDetails(0, bestLicence.getKey(), bestLicence.getState());
    }

    return null;
  }
コード例 #2
0
 public String getRenewalKey() {
   FeatureDetails[] features = licence.getFeatures();
   if (features == null) {
     return null;
   }
   for (FeatureDetails fd : features) {
     Object property = fd.getProperty(FeatureDetails.PR_RENEWAL_KEY);
     if (property instanceof String) {
       return (String) property;
     }
   }
   return null;
 }
コード例 #3
0
  public static boolean isTrialLicence(Licence licence) {
    if (featman == null) {
      return false;
    }

    // if any of the FeatureDetails is a trial, return true

    boolean trial = false;
    FeatureDetails[] featureDetails = licence.getFeatures();
    for (FeatureDetails fd : featureDetails) {
      trial = isTrial(fd);
      if (trial) {
        break;
      }
    }

    return trial;
  }