Change the period of validity for a subscription.

@param subscription the subscription.
@param newValidity the new validity.
@return the updated subscription.
176409
public Subscription limitValidity( Subscription subscription, Interval.Period newValidity ) {
    ParameterMap<String, String> params = new ParameterMap<String, String>();
    ValidationUtils.validatesIntervalPeriod( newValidity );
    params.add( "period_of_validity", newValidity.toString() );
    return RestfulUtils.update( SubscriptionService.PATH, subscription, params, false, Subscription.class, super.httpClient );
  }
695413
protected void buildRequiredValidUntilFilterIfNeeded(final SamlRegisteredService service, final List<MetadataFilter> metadataFilterList) {
        if (service.getMetadataMaxValidity() > 0) {
            val requiredValidUntilFilter = new RequiredValidUntilFilter(service.getMetadataMaxValidity());
            metadataFilterList.add(requiredValidUntilFilter);
            LOGGER.debug("Added metadata RequiredValidUntilFilter with max validity of [{}]", service.getMetadataMaxValidity());
        } else {
            LOGGER.debug("No metadata maximum validity criteria is defined for [{}], so RequiredValidUntilFilter will not be invoked",
                service.getMetadataLocation());
        }
    }
1069382
public static PeriodDuration of(Period period) {
        Objects.requireNonNull(period, "The period must not be null");
        return new PeriodDuration(period, Duration.ZERO);
    }
1325167
@Override
    public boolean checkSessionStillValid(ISession s, long accessedTime) {
        final String methodName = "checkSessionStillValid";
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[CHECK_SESSION_STILL_VALID]);
        }
        long nowTime = System.currentTimeMillis();
        boolean rc = true;
        synchronized (s) {
            if (s.isValid()) {
                if (s.getMaxInactiveInterval() != -1) {
                    long maxinact = 1000 * (long) s.getMaxInactiveInterval();
                    boolean active = s.getRefCount() > 0;
                    if (_isApplicationSessionStore) {
                        //the RefCount is not correct when dealing with an applicationSessionStore
                        s.setRefCount(0);
                        active = false;
                    }
                    boolean timedOut = (accessedTime <= nowTime - maxinact);
                    /*
                     * invalidate if:
                     * session has timedOut AND (is not active OR (the Invalidation Multiple has not been set to 0
                     * and the session is that many times the invalidation interval)
                     * 
                     * The default value for the invalidation interval is 3.
                     * 
                     * PK03711 removed check for active and always invalidated timedout sessions for v6.1 and earlier
                     * v7 CTS defect 391577 forced us to put this code back, so we introduced the InvalidateIfActive property
                     * In the service stream, the ForceSessionInvalidationMultiple was used, so we are using the same property
                     */
                    if ((timedOut) && ((!active) ||
                            ((_smc.getForceSessionInvalidationMultiple() != 0) &&
                                    (accessedTime <= nowTime - (_smc.getForceSessionInvalidationMultiple() * maxinact))))) {
                        if (maxinact != 0) {
                            _storeCallback.sessionInvalidatedByTimeout(s);
                        }
                        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
                            String message = "Going to invalidate session with id=" + s.getId();
                            LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[CHECK_SESSION_STILL_VALID], message);
                        }
                        s.invalidate();
                        rc = false;
                    }
                }
            } else { //isValid
                rc = false;
            }
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[CHECK_SESSION_STILL_VALID]);
        }
        return rc;
    }
274021
public Subscription postponeSubscription(final Subscription subscription, final DateTime renewaldate) {
        return doPUT(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscription.getUuid() + "/postpone?next_renewal_date=" + renewaldate,
                     subscription, Subscription.class);
    }
1127261
public SubscriptionUsageInArrearItemsAndNextNotificationDate computeMissingUsageInvoiceItems(final List<InvoiceItem> existingUsage, final InvoiceItemGeneratorLogger invoiceItemGeneratorLogger) throws CatalogApiException, InvoiceApiException {
        final SubscriptionUsageInArrearItemsAndNextNotificationDate result = new SubscriptionUsageInArrearItemsAndNextNotificationDate();
        final List<ContiguousIntervalUsageInArrear> billingEventTransitionTimePeriods = computeInArrearUsageInterval();
        for (final ContiguousIntervalUsageInArrear usageInterval : billingEventTransitionTimePeriods) {
            final UsageInArrearItemsAndNextNotificationDate newItemsWithDetailsAndDate = usageInterval.computeMissingItemsAndNextNotificationDate(existingUsage);

            // For debugging purposes
            invoiceItemGeneratorLogger.append(usageInterval, newItemsWithDetailsAndDate.getInvoiceItems());

            result.addUsageInArrearItemsAndNextNotificationDate(usageInterval.getUsage().getName(), newItemsWithDetailsAndDate);
            result.addTrackingIds(newItemsWithDetailsAndDate.getTrackingIds());
        }
        return result;
    }
1216611
function interval(period, scheduler) {
    if (period === void 0) {
        period = 0;
    }
    if (scheduler === void 0) {
        scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
    }
    if (!Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(period) || period < 0) {
        period = 0;
    }
    if (!scheduler || typeof scheduler.schedule !== 'function') {
        scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
    }
    return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
        subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period }));
        return subscriber;
    });
}
1220112
public function setSubscriptionId($subscriptionId)
    {
        if (strlen($subscriptionId) > 50) {
            throw new InvalidArgumentException("Subscription id cannot be longer than 50 characters");
        }
        if (preg_match('/[^a-zA-Z0-9_-]/', $subscriptionId)) {
            throw new InvalidArgumentException("Subscription id cannot contain special characters");
        }
        $this->parameters['subscription_id'] = $subscriptionId;
    }
330733
public static void validatePeriod(Duration period) {
		if(period.equals(Duration.ZERO)) {
			String message = "The period must be nonzero";
			throw new IllegalArgumentException(message);
		}
	}
703342
private void setPeriodInternal(ReadablePeriod period) {
        int[] newValues = new int[size()];
        for (int i = 0, isize = period.size(); i < isize; i++) {
            DurationFieldType type = period.getFieldType(i);
            int value = period.getValue(i);
            checkAndUpdate(type, newValues, value);
        }
        setValues(newValues);
    }
1276273
public Conditions newConditions(final ZonedDateTime issuedAt, final String audienceUri, final long issueLength) {
        val conditions = newSamlObject(Conditions.class);
        conditions.setNotBefore(DateTimeUtils.dateTimeOf(issuedAt));
        conditions.setNotOnOrAfter(DateTimeUtils.dateTimeOf(issuedAt.plus(issueLength, ChronoUnit.SECONDS)));
        val audienceRestriction = newSamlObject(AudienceRestrictionCondition.class);
        val audience = newSamlObject(Audience.class);
        audience.setUri(audienceUri);
        audienceRestriction.getAudiences().add(audience);
        conditions.getAudienceRestrictionConditions().add(audienceRestriction);
        return conditions;
    }
275140
public Observable<ServiceResponse<UserInner>> updatePublishingUserWithServiceResponseAsync(UserInner userDetails) {
        if (userDetails == null) {
            throw new IllegalArgumentException("Parameter userDetails is required and cannot be null.");
        }
        if (this.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
        }
        Validator.validate(userDetails);
        return service.updatePublishingUser(userDetails, this.apiVersion(), this.acceptLanguage(), this.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<UserInner>>>() {
                @Override
                public Observable<ServiceResponse<UserInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<UserInner> clientResponse = updatePublishingUserDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
1096176
@Override
    public void renew(IEntityLock lock, int duration) throws LockingException {
        if (isValid(lock)) {
            Date newExpiration = getNewExpiration(duration);
            getLockStore().update(lock, newExpiration);
            ((EntityLockImpl) lock).setExpirationTime(newExpiration);
        } else {
            throw new LockingException("Could not renew " + lock + " : lock is invalid.");
        }
    }
80298
public Subscription pause( Subscription subscription ) {
    ParameterMap<String, String> params = new ParameterMap<String, String>();
    params.add( "pause", String.valueOf( true ) );
    return RestfulUtils.update( SubscriptionService.PATH, subscription, params, false, Subscription.class, super.httpClient );
  }
362140
public static PeriodDuration of(Duration duration) {
        Objects.requireNonNull(duration, "The duration must not be null");
        return new PeriodDuration(Period.ZERO, duration);
    }
426814
function valErrsChanged(newValue) {

                    // HTML5 custom validity
                    // http://dev.w3.org/html5/spec-preview/constraints.html#the-constraint-validation-api
                    if (domEl.setCustomValidity) {
                        /* only works in HTML 5. Maybe should throw if not available. */
                        domEl.setCustomValidity(newValue || '');
                    }

                    var errorHtml = newValue ? valTemplate.replace(/%error%/, newValue) : "";
                    var isRequired = info.getIsRequired();
                    var requiredHtml = isRequired ? requiredTemplate : '';
                    decorator.innerHTML = (isRequired || !!errorHtml) ? requiredHtml + errorHtml : "";
                }
245998
def delete_subscription(self, subscription_id):
        
        self._validate_uuid(subscription_id)

        url = "/notification/v1/subscription/{}".format(subscription_id)
        response = NWS_DAO().deleteURL(url, self._write_headers())

        if response.status != 204:
            raise DataFailureException(url, response.status, response.data)

        return response.status