public static boolean isEmpty(org.orcid.jaxb.model.v3.rc2.common.Day day) { if (day==null) return true; return isEmpty(day.getValue()); }
public static FuzzyDate valueOf(Integer year, Integer month, Integer day) { FuzzyDate fuzzyDate = new FuzzyDate(); fuzzyDate.year = year != null ? new Year(year) : null; fuzzyDate.month = month != null ? new Month(month) : null; fuzzyDate.day = day != null ? new Day(day) : null; return fuzzyDate; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FuzzyDate other = (FuzzyDate) obj; if (day == null) { if (other.day != null) return false; } else if (!day.equals(other.day)) return false; if (month == null) { if (other.month != null) return false; } else if (!month.equals(other.month)) return false; if (year == null) { if (other.year != null) return false; } else if (!year.equals(other.year)) return false; return true; }
public FuzzyDate(org.orcid.jaxb.model.message.FuzzyDate other) { if (other == null) throw new IllegalArgumentException("Invalid init parameter"); if (other.getYear() != null) { this.year = new Year(); this.year.setValue(other.getYear().getValue()); } if (other.getMonth() != null) { this.month = new Month(); this.month.setValue(other.getMonth().getValue()); } if (other.getDay() != null) { this.day = new Day(); this.day.setValue(other.getDay().getValue()); } }
/** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = tidyValue(value); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((day == null) ? 0 : day.hashCode()); result = prime * result + ((month == null) ? 0 : month.hashCode()); result = prime * result + ((year == null) ? 0 : year.hashCode()); return result; }
public Day(Integer value) { this.value = tidyValue(value); }
@Override public String toString() { StringBuilder builder = new StringBuilder(year.getValue()); if (month != null) { builder.append("-"); builder.append(month.getValue()); } if (day != null) { builder.append("-"); builder.append(day.getValue()); } return builder.toString(); }
public FuzzyDate toFuzzyDate() { FuzzyDate fd = new FuzzyDate(); if (!PojoUtil.isEmpty(this.getDay())) fd.setDay(new Day(new Integer(this.getDay()))); if (!PojoUtil.isEmpty(this.getMonth())) fd.setMonth(new Month(new Integer(this.getMonth()))); if (!PojoUtil.isEmpty(this.getYear())) fd.setYear(new Year(new Integer(this.getYear()))); return fd; }
private String tidyValue(Integer value) { return tidyValue(Integer.toString(value)); }
private static void populateFromFuzzyDate(FuzzyDateEntity fuzzyDateEntity, FuzzyDate fuzzyDate) { if (fuzzyDate != null) { Year Year = fuzzyDate.getYear(); if (Year != null) { fuzzyDateEntity.setYear(Integer.valueOf(Year.getValue())); } Month month = fuzzyDate.getMonth(); if (month != null) { fuzzyDateEntity.setMonth(Integer.valueOf(month.getValue())); } Day day = fuzzyDate.getDay(); if (day != null) { fuzzyDateEntity.setDay(Integer.valueOf(day.getValue())); } } }
public org.orcid.jaxb.model.v3.rc2.common.FuzzyDate toV3FuzzyDate() { org.orcid.jaxb.model.v3.rc2.common.FuzzyDate fd = new org.orcid.jaxb.model.v3.rc2.common.FuzzyDate(); if (!PojoUtil.isEmpty(this.getDay())) fd.setDay(new org.orcid.jaxb.model.v3.rc2.common.Day(new Integer(this.getDay()))); if (!PojoUtil.isEmpty(this.getMonth())) fd.setMonth(new org.orcid.jaxb.model.v3.rc2.common.Month(new Integer(this.getMonth()))); if (!PojoUtil.isEmpty(this.getYear())) fd.setYear(new org.orcid.jaxb.model.v3.rc2.common.Year(new Integer(this.getYear()))); return fd; }
public static Date convertDate(org.orcid.jaxb.model.v3.rc2.common.FuzzyDate fuzzyDate) { if (fuzzyDate != null) { Integer year = PojoUtil.isEmpty(fuzzyDate.getYear()) ? null : Integer.valueOf(fuzzyDate.getYear().getValue()); Integer month = PojoUtil.isEmpty(fuzzyDate.getMonth()) ? null : Integer.valueOf(fuzzyDate.getMonth().getValue()); Integer day = PojoUtil.isEmpty(fuzzyDate.getDay()) ? null : Integer.valueOf(fuzzyDate.getDay().getValue()); if (year != null && year == 0) { year = null; } if (month != null && month == 0) { month = null; } if (day != null && day == 0) { day = null; } return Date.valueOf(org.orcid.jaxb.model.v3.rc2.common.FuzzyDate.valueOf(year, month, day)); } return null; } }
PublicationDate publicationDate = new PublicationDate(); work.setPublicationDate(publicationDate); publicationDate.setDay(new Day(c.get(Calendar.DAY_OF_MONTH)));
private static Date getCompletionDate(FuzzyDate completionDate) { if (completionDate != null) { Integer year = PojoUtil.isEmpty(completionDate.getYear()) ? null : Integer.valueOf(completionDate.getYear().getValue()); Integer month = PojoUtil.isEmpty(completionDate.getMonth()) ? null : Integer.valueOf(completionDate.getMonth().getValue()); Integer day = PojoUtil.isEmpty(completionDate.getDay()) ? null : Integer.valueOf(completionDate.getDay().getValue()); if (year != null && year == 0) { year = null; } if (month != null && month == 0) { month = null; } if (day != null && day == 0) { day = null; } return Date.valueOf(FuzzyDate.valueOf(year, month, day)); } return null; }
@Override public void mapBtoA(EndDateEntity entity, FuzzyDate fuzzyDate, MappingContext context) { if (entity.getYear() != null) { fuzzyDate.setYear(new Year(entity.getYear())); } else { fuzzyDate.setYear(null); } if (entity.getMonth() != null) { fuzzyDate.setMonth(new Month(entity.getMonth())); } else { fuzzyDate.setMonth(null); } if (entity.getDay() != null) { fuzzyDate.setDay(new Day(entity.getDay())); } else { fuzzyDate.setDay(null); } } }).register();
@Override public void mapAtoB(FuzzyDate fuzzyDate, StartDateEntity entity, MappingContext context) { if (fuzzyDate.getYear() != null) { entity.setYear(Integer.valueOf(fuzzyDate.getYear().getValue())); } else { entity.setYear(null); } if (fuzzyDate.getMonth() != null) { entity.setMonth(Integer.valueOf(fuzzyDate.getMonth().getValue())); } else { entity.setMonth(null); } if (fuzzyDate.getDay() != null) { entity.setDay(Integer.valueOf(fuzzyDate.getDay().getValue())); } else { entity.setDay(null); } }
@Override public void mapBtoA(StartDateEntity entity, FuzzyDate fuzzyDate, MappingContext context) { if (entity.getYear() != null) { fuzzyDate.setYear(new Year(entity.getYear())); } else { fuzzyDate.setYear(null); } if (entity.getMonth() != null) { fuzzyDate.setMonth(new Month(entity.getMonth())); } else { fuzzyDate.setMonth(null); } if (entity.getDay() != null) { fuzzyDate.setDay(new Day(entity.getDay())); } else { fuzzyDate.setDay(null); } } }).register();
@Override public void mapAtoB(FuzzyDate fuzzyDate, EndDateEntity entity, MappingContext context) { if (fuzzyDate.getYear() != null) { entity.setYear(Integer.valueOf(fuzzyDate.getYear().getValue())); } else { entity.setYear(null); } if (fuzzyDate.getMonth() != null) { entity.setMonth(Integer.valueOf(fuzzyDate.getMonth().getValue())); } else { entity.setMonth(null); } if (fuzzyDate.getDay() != null) { entity.setDay(Integer.valueOf(fuzzyDate.getDay().getValue())); } else { entity.setDay(null); } }
PublicationDate publicationDate = new PublicationDate(); work.setPublicationDate(publicationDate); publicationDate.setDay(new Day(c.get(Calendar.DAY_OF_MONTH)));