List of incidents

REST: GET /xdsl/incidents
@param creationDate [required] Filter the value of creationDate property (>)
@param endDate [required] Filter the value of endDate property (<)
352258
public ArrayList<Long> incidents_GET(Date creationDate, Date endDate) throws IOException {
		String qPath = "/xdsl/incidents";
		StringBuilder sb = path(qPath);
		query(sb, "creationDate", creationDate);
		query(sb, "endDate", endDate);
		String resp = execN(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t15);
	}
669161
public static long between(Date beginDate, Date endDate, DateUnit unit) {
		return between(beginDate, endDate, unit, true);
	}
894252
public function during($startDate, $endDate)
    {
        $validationResult = QueryValidator::validateCustomDateRange(
            $startDate,
            $endDate
        );
        if ($validationResult->isFailed()) {
            throw new InvalidArgumentException('The start or end date is' .
                ' invalid. Validation fail reasons: ' .
                $validationResult->getFailReason());
        }

        $this->duringStartDate = $startDate;
        $this->duringEndDate = $endDate;
    }
12103
private void logSummary(final List<IncidentImpl> incidents) {
        if (incidents.isEmpty())
            return;

        // summaryFile can be replaced so hold on to a local copy
        File outFile = summaryFile;

        if (outFile == null) {
            outFile = summaryFile = createNewSummaryFile();
        }

        // outFile can still be null, the create above can still fail
        if (outFile != null) {
            synchronized (outFile) {
                OutputStream os = null;
                try {
                    os = createSummaryStream(outFile);
                    new IncidentSummaryLogger().logIncidentSummary(os, incidents);
                } catch (FileNotFoundException e) {
                    // This is FFDC not being able to find itself... we're in bad
                    // shape if this doesn't work.. 
                    e.printStackTrace();
                } catch (IOException e) {
                } finally {
                    LoggingFileUtils.tryToClose(os);
                }
            }
        }
    }
561305
public static function monthListBetweenDate($startDate, $endDate)
    {
		$output = [];
		$time   = strtotime($startDate);
		$last   = date('m-Y', strtotime($endDate));

		do {
		    $month = date('m-Y', $time);
		    $total = date('t', $time);

		    $output[] = [
		        'month' => $month,
		        'total' => $total,
		    ];

		    $time = strtotime('+1 month', $time);
		} while ($month != $last);
    }
166419
def list_calendar_events(self, all_events=None, context_codes=None, end_date=None, excludes=None, start_date=None, type=None, undated=None):
        
        path = {}
        data = {}
        params = {}

        # OPTIONAL - type
        """Defaults to "event""""
        if type is not None:
            self._validate_enum(type, ["event", "assignment"])
            params["type"] = type

        # OPTIONAL - start_date
        """Only return events since the start_date (inclusive).
        Defaults to today. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ."""
        if start_date is not None:
            params["start_date"] = start_date

        # OPTIONAL - end_date
        """Only return events before the end_date (inclusive).
        Defaults to start_date. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.
        If end_date is the same as start_date, then only events on that day are
        returned."""
        if end_date is not None:
            params["end_date"] = end_date

        # OPTIONAL - undated
        """Defaults to false (dated events only).
        If true, only return undated events and ignore start_date and end_date."""
        if undated is not None:
            params["undated"] = undated

        # OPTIONAL - all_events
        """Defaults to false (uses start_date, end_date, and undated criteria).
        If true, all events are returned, ignoring start_date, end_date, and undated criteria."""
        if all_events is not None:
            params["all_events"] = all_events

        # OPTIONAL - context_codes
        """List of context codes of courses/groups/users whose events you want to see.
        If not specified, defaults to the current user (i.e personal calendar,
        no course/group events). Limited to 10 context codes, additional ones are
        ignored. The format of this field is the context type, followed by an
        underscore, followed by the context id. For example: course_42"""
        if context_codes is not None:
            params["context_codes"] = context_codes

        # OPTIONAL - excludes
        """Array of attributes to exclude. Possible values are "description", "child_events" and "assignment""""
        if excludes is not None:
            params["excludes"] = excludes

        self.logger.debug("GET /api/v1/calendar_events with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("GET", "/api/v1/calendar_events".format(**path), data=data, params=params, all_pages=True)
1325990
public static List<LocalDate> untilDays(String startDate, String endDate) {
        return untilDays(parse(startDate, DEFAULT_PATTERN), parse(endDate, DEFAULT_PATTERN));
    }
625616
public List<O> createdInPeriod(Date start, Date end, int numObjects) {
        return findByDate("creationDate", start, end, numObjects, true);
    }
343764
public function getListUserCountByRangeDate($types, $startDate = '', $endDate = '')
    {
        if (empty($types)) {
            return array();
        }
        $em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');

        $now = new \DateTime("now");
        // $now->format('Y-m-d') . ' 23:59:59';
        $startDateTime = \DateTime::createFromFormat('d/m/Y', $startDate);
        $endDateTime = \DateTime::createFromFormat('d/m/Y', $endDate);

        $rsm = new \Doctrine\ORM\Query\ResultSetMapping;

        $select = array();
        $i = 0;

        foreach ($types as $type) {
            switch ($type) {
                case 'validatedMembers':
                    $filter = "u.state IS NOT NULL";
                    break;
                case 'activeMembers':
                    $filter = "u.state=1";
                    break;
                case 'optin':
                    $filter = "u.optin=1";
                    break;
                case 'optinPartners':
                    $filter = "u.optin_partner=1";
                    break;
                case 'unregistered':
                    $filter = "u.state IS NULL";
                    break;
                case 'suspended':
                    $filter = "u.state=2";
                    break;
                default:
                case 'members':
                    $filter = "u.user_id";
                    break;
            }

            $rsm->addScalarResult('c'.$i, 'c'.$i);
            $select[] = 'SUM(CASE WHEN '.$filter.' THEN 1 ELSE 0 END) AS c'.$i;
            $rsm->addScalarResult('c'.$i.'_male', 'c'.$i.'_male');
            $select[] = 'SUM(CASE WHEN '.$filter.' AND (u.title=\'M\' OR u.title IS NULL) THEN 1 ELSE 0 END) AS c'.$i.'_male';
            $rsm->addScalarResult('c'.$i.'_female', 'c'.$i.'_female');
            $select[] = 'SUM(CASE WHEN '.$filter.' AND u.title=\'Me\' THEN 1 ELSE 0 END) AS c'.$i++.'_female';
        }

        if ($startDate != '' && $endDate != '') {
            $dateRange = "(u.created_at >='" . $startDateTime->format('Y-m-d') . " 0:0:0' AND u.created_at <= '" . $endDateTime->format('Y-m-d') . " 0:0:0')";
        } elseif ($startDate == '' && $endDate != '') {
            $dateRange = "u.created_at <= '" . $endDateTime->format('Y-m-d') . " 0:0:0'";
        } elseif ($startDate != '' && $endDate == '') {
            $dateRange = "u.created_at >='" . $startDateTime->format('Y-m-d') . " 0:0:0'";
        } else {
            $dateRange = "u.created_at IS NOT NULL";
        }
        $query = $em->createNativeQuery('
			SELECT '.implode(',', $select).' FROM user AS u
			WHERE ' . $dateRange, $rsm);
        return array_values($query->getSingleResult());
    }
1345101
public GetUserReadResponse getUserRead(Date beginDate, Date endDate) {
        BeanUtil.requireNonNull(beginDate, "beginDate is null");
        BeanUtil.requireNonNull(endDate, "endDate is null");
        GetUserReadResponse response = null;
        String url = BASE_API_URL + "datacube/getuserread?access_token=#";
        Map<String, String> param = new HashMap<String, String>();
        param.put("begin_date", DATE_FORMAT.format(beginDate));
        param.put("end_date", DATE_FORMAT.format(endDate));
        String json = JSONUtil.toJson(param);
        BaseResponse r = executePost(url, json);
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, GetUserReadResponse.class);
        return response;
    }
459714
public ArrayList<net.minidev.ovh.api.me.consumption.OvhTransaction> consumption_usage_history_GET(Date beginDate, Date endDate) throws IOException {
		String qPath = "/me/consumption/usage/history";
		StringBuilder sb = path(qPath);
		query(sb, "beginDate", beginDate);
		query(sb, "endDate", endDate);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t7);
	}
256952
public Subscription endTrialAt( Subscription subscription, Date date ) {
    ParameterMap<String, String> params = new ParameterMap<String, String>();
    params.add( "trial_end", String.valueOf( date.getTime() / 1000 ) );
    return RestfulUtils.update( SubscriptionService.PATH, subscription, params, false, Subscription.class, super.httpClient );
  }
1171985
public Subscription endTrialAt( String subscription, Date date ) {
    return this.endTrialAt( new Subscription( subscription ), date );
  }
139317
def occurs_on?(date)
      date = TimeUtil.ensure_date(date)
      begin_time = TimeUtil.beginning_of_date(date, start_time)
      closing_time = TimeUtil.end_of_date(date, start_time)
      occurs_between?(begin_time, closing_time)
    end
994073
public List<UserSummary> getUserSummary(Date start, Date end) {
        if(diffThan6Days(start, end)) {
            throw new IllegalArgumentException("start和end相差不能超过6天以上");
        }

        String url = WxEndpoint.get("url.stats.user.summary");
        String json = "{\"begin_date\":\"%s\",\"end_date\":\"%s\"}";

        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String body = String.format(json, dateFormat.format(start), dateFormat.format(end));
        logger.debug("stats: get user summary: {}", body);
        String response = wxClient.post(url, body);
        UserSummaryWrapper userSummaryWrapper = JsonMapper.defaultMapper().fromJson(response, UserSummaryWrapper.class);
        return userSummaryWrapper.getList();
    }
926612
public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {

        String sStartTime = null;
        String sEndTime = null;

        // Convert startTime to ISO 8601 format
        if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
            sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
        }

        // Convert endTime to ISO 8601 format
        if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
            sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
        }

        // Build Solr range string
        final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);

        // Build Solr filter string
        return String.format("%s:%s", searchField, rangeString);
    }
593275
public static List<Date> matchedDates(String patternStr, Date start, Date end, int count, boolean isMatchSecond) {
		return matchedDates(patternStr, start.getTime(), end.getTime(), count, isMatchSecond);
	}