public Date getNextPickupDateByWasteTypeLabel(String wasteTypeLabel) {
   Pickup pickup = getPickupByWasteTypeLabel(wasteTypeLabel);
   if (pickup == null) return null;
   List<String> dates = pickup.getDates();
   if (dates.isEmpty()) return null;
   for (int i = 0; i <= 32; i++) {
     Date date = Date.inDays(i);
     String dateAsString = date.toString();
     if (dates.contains(dateAsString)) return date;
   }
   return null;
 }
 public void removePickupDatesBefore(Date minDate) {
   List<String> dates = getDates();
   boolean dateRemoved = false;
   for (String dateS : new ArrayList<String>(dates)) {
     Date date = new Date(dateS);
     if (date == null) continue;
     if (date.isBefore(minDate)) {
       dates.remove(dateS);
       dateRemoved = true;
     }
   }
   if (dateRemoved) json.put("dates", dates);
 }
예제 #3
0
 public Release createNewRelease(Release parentRelease) {
   Release release = new Release(this);
   Date date = Date.today();
   if (parentRelease != null) {
     release.setParentRelease(parentRelease);
     release.setLabel(
         parentRelease.getLabel() + " Bugfix " + (parentRelease.getBugfixReleases().size() + 1));
     Date parentDate = parentRelease.getReleaseDate();
     if (parentDate != null && parentDate.isAfter(date)) date = parentDate;
   }
   release.setReleaseDate(date);
   getDao().createRelease(release);
   return release;
 }
예제 #4
0
 @Override
 protected void onExecute() {
   Date previousDate = release.getReleaseDate();
   release.setScriptOutput(null);
   release.setReleaseDate(Date.today());
   release.setReleased(false);
   addUndo(new Undo(previousDate));
 }
 @Override
 protected String getFilename() {
   return "kunagi-sprint-story-cards_"
       + project.getCurrentSprint().getReference()
       + "_"
       + Date.today().toString()
       + "_"
       + Str.toFileCompatibleString(project.getLabel());
 }
예제 #6
0
  public List<ProjectEvent> getLatestProjectEvents(int min) {
    List<ProjectEvent> events = getProjectEvents();
    Collections.sort(events, ProjectEvent.DATE_AND_TIME_COMPARATOR);

    DateAndTime deadline = new DateAndTime(Date.today().prevDay(), Time.now());
    List<ProjectEvent> ret = new ArrayList<ProjectEvent>();
    int count = 0;
    for (ProjectEvent event : events) {
      ret.add(event);
      count++;
      DateAndTime dateAndTime = event.getDateAndTime();
      if (count > min && dateAndTime.isBefore(deadline)) break;
    }
    return ret;
  }
 @Override
 public int compareTo(PickupDate another) {
   return date.compareTo(another.date);
 }
 public void addDate(Date date) {
   Set<String> dates = new HashSet<String>(getDates());
   dates.add(date.toString());
   json.put("dates", Utl.sort(dates));
 }
예제 #9
0
 public void reject() {
   setRejectDate(Date.today());
 }