Examples of HolidayDocument


Examples of com.opengamma.master.holiday.HolidayDocument

   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    HolidayDocument doc = data().getHoliday();
    out.put("holidayDoc", doc);
    out.put("holiday", doc.getHoliday());
    out.put("deleted", !doc.isLatest());
    return out;
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

  //-------------------------------------------------------------------------
  @Path("{versionId}")
  public WebHolidayVersionResource findVersion(@PathParam("versionId") String idStr) {
    data().setUriVersionId(idStr);
    HolidayDocument doc = data().getHoliday();
    UniqueId combined = doc.getUniqueId().withVersion(idStr);
    if (doc.getUniqueId().equals(combined) == false) {
      HolidayDocument versioned = data().getHolidayMaster().get(combined);
      data().setVersioned(versioned);
    } else {
      data().setVersioned(doc);
    }
    return new WebHolidayVersionResource(this);
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

  @Path("{holidayId}")
  public WebHolidayResource findHoliday(@PathParam("holidayId") String idStr) {
    data().setUriHolidayId(idStr);
    UniqueId oid = UniqueId.parse(idStr);
    try {
      HolidayDocument doc = data().getHolidayMaster().get(oid);
      data().setHoliday(doc);
    } catch (DataNotFoundException ex) {
      HolidayHistoryRequest historyRequest = new HolidayHistoryRequest(oid);
      historyRequest.setPagingRequest(PagingRequest.ONE);
      HolidayHistoryResult historyResult = data().getHolidayMaster().history(historyRequest);
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    HolidayDocument latestDoc = data().getHoliday();
    HolidayDocument versionedHoliday = data().getVersioned();
    out.put("latestHolidayDoc", latestDoc);
    out.put("latestHoliday", latestDoc.getHoliday());
    out.put("holidayDoc", versionedHoliday);
    out.put("holiday", versionedHoliday.getHoliday());
    out.put("deleted", !latestDoc.isLatest());
    List<Pair<Year, List<LocalDate>>> map = new ArrayList<Pair<Year, List<LocalDate>>>();
    List<LocalDate> dates = versionedHoliday.getHoliday().getHolidayDates();
    if (dates.size() > 0) {
      int year = dates.get(0).getYear();
      int start = 0;
      int pos = 0;
      for ( ; pos < dates.size(); pos++) {
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    HolidayDocument doc = data().getHoliday();
    out.put("holidayDoc", doc);
    out.put("holiday", doc.getHoliday());
    out.put("deleted", !doc.isLatest());
    List<Pair<Year, List<LocalDate>>> map = new ArrayList<Pair<Year, List<LocalDate>>>();
    List<LocalDate> dates = doc.getHoliday().getHolidayDates();
    if (dates.size() > 0) {
      int year = dates.get(0).getYear();
      int start = 0;
      int pos = 0;
      for ( ; pos < dates.size(); pos++) {
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

  }

  @POST
  @Path("holidays")
  public Response add(@Context UriInfo uriInfo, HolidayDocument request) {
    HolidayDocument result = getHolidayMaster().add(request);
    URI createdUri = (new DataHolidayResource()).uriVersion(uriInfo.getBaseUri(), result.getUniqueId());
    return responseCreatedFudge(createdUri, result);
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

  //-------------------------------------------------------------------------
  @Override
  public HolidayDocument get(final ObjectIdentifiable objectId, VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(objectId, "objectId");
    ArgumentChecker.notNull(versionCorrection, "versionCorrection");
    final HolidayDocument document = _store.get(objectId.getObjectId());
    if (document == null) {
      throw new DataNotFoundException("Holiday not found: " + objectId);
    }
    return document;
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

    ArgumentChecker.notNull(document.getName(), "document.name");
    ArgumentChecker.notNull(document.getHoliday(), "document.holiday");

    final UniqueId uniqueId = document.getUniqueId();
    final Instant now = Instant.now();
    final HolidayDocument storedDocument = _store.get(uniqueId.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Holiday not found: " + uniqueId);
    }
    document.setVersionFromInstant(now);
    document.setVersionToInstant(null);
    document.setCorrectionFromInstant(now);
    document.setCorrectionToInstant(null);
    if (_store.replace(uniqueId.getObjectId(), storedDocument, document) == false) {
      throw new IllegalArgumentException("Concurrent modification");
    }
    _changeManager.entityChanged(ChangeType.CHANGED, document.getObjectId(), storedDocument.getVersionFromInstant(), document.getVersionToInstant(), now);
    return document;
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

  public HolidayHistoryResult history(final HolidayHistoryRequest request) {
    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(request.getObjectId(), "request.objectId");

    final HolidayHistoryResult result = new HolidayHistoryResult();
    final HolidayDocument doc = get(request.getObjectId(), VersionCorrection.LATEST);
    if (doc != null) {
      result.getDocuments().add(doc);
    }
    result.setPaging(Paging.ofAll(result.getDocuments()));
    return result;
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayDocument

    if (isWeekend(dateToCheck)) {
      return true;
    }
    Element e = _holidayCache.get(request);
    if (e != null) {
      HolidayDocument doc = (HolidayDocument) e.getObjectValue();
      return isHoliday(doc, dateToCheck);
    } else {
      HolidayDocument doc = getMaster().search(request).getFirstDocument();
     
      Element element = new Element(request, doc);
      element.setTimeToLive(10); // TODO PLAT-1308: I've set TTL short to hide the fact that we return stale data
      _holidayCache.put(element);
      return isHoliday(doc, dateToCheck);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.