/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.web.historicaltimeseries; import java.util.Map; import org.joda.beans.Bean; import org.joda.beans.BeanBuilder; import org.joda.beans.BeanDefinition; import org.joda.beans.JodaBeanUtils; import org.joda.beans.MetaProperty; import org.joda.beans.Property; import org.joda.beans.PropertyDefinition; import org.joda.beans.impl.direct.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.core.config.ConfigSource; import com.opengamma.id.UniqueId; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesInfoDocument; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesLoader; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesMaster; import com.opengamma.master.historicaltimeseries.ManageableHistoricalTimeSeries; import com.opengamma.web.WebPerRequestData; /** * Data class for web-based historical time-series. */ @BeanDefinition public class WebHistoricalTimeSeriesData extends WebPerRequestData { /** * The historical time-series master. */ @PropertyDefinition private HistoricalTimeSeriesMaster _historicalTimeSeriesMaster; /** * The historical time-series loader. */ @PropertyDefinition private HistoricalTimeSeriesLoader _historicalTimeSeriesLoader; /** * The config source */ @PropertyDefinition private ConfigSource _configSource; /** * The historical time-series id from the input URI. */ @PropertyDefinition private String _uriHistoricalTimeSeriesId; /** * The loaded historical time-series info. */ @PropertyDefinition private HistoricalTimeSeriesInfoDocument _info; /** * The loaded historical time-series data points. */ @PropertyDefinition private ManageableHistoricalTimeSeries _timeSeries; /** * Gets the best available id. * @param overrideId the override id, null derives the result from the data * @return the id, may be null */ public String getBestHistoricalTimeSeriesUriId(final UniqueId overrideId) { if (overrideId != null) { return overrideId.toLatest().toString(); } return getInfo() != null ? getInfo().getUniqueId().toLatest().toString() : getUriHistoricalTimeSeriesId(); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code WebHistoricalTimeSeriesData}. * @return the meta-bean, not null */ public static WebHistoricalTimeSeriesData.Meta meta() { return WebHistoricalTimeSeriesData.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(WebHistoricalTimeSeriesData.Meta.INSTANCE); } @Override public WebHistoricalTimeSeriesData.Meta metaBean() { return WebHistoricalTimeSeriesData.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the historical time-series master. * @return the value of the property */ public HistoricalTimeSeriesMaster getHistoricalTimeSeriesMaster() { return _historicalTimeSeriesMaster; } /** * Sets the historical time-series master. * @param historicalTimeSeriesMaster the new value of the property */ public void setHistoricalTimeSeriesMaster(HistoricalTimeSeriesMaster historicalTimeSeriesMaster) { this._historicalTimeSeriesMaster = historicalTimeSeriesMaster; } /** * Gets the the {@code historicalTimeSeriesMaster} property. * @return the property, not null */ public final Property<HistoricalTimeSeriesMaster> historicalTimeSeriesMaster() { return metaBean().historicalTimeSeriesMaster().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the historical time-series loader. * @return the value of the property */ public HistoricalTimeSeriesLoader getHistoricalTimeSeriesLoader() { return _historicalTimeSeriesLoader; } /** * Sets the historical time-series loader. * @param historicalTimeSeriesLoader the new value of the property */ public void setHistoricalTimeSeriesLoader(HistoricalTimeSeriesLoader historicalTimeSeriesLoader) { this._historicalTimeSeriesLoader = historicalTimeSeriesLoader; } /** * Gets the the {@code historicalTimeSeriesLoader} property. * @return the property, not null */ public final Property<HistoricalTimeSeriesLoader> historicalTimeSeriesLoader() { return metaBean().historicalTimeSeriesLoader().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the config source * @return the value of the property */ public ConfigSource getConfigSource() { return _configSource; } /** * Sets the config source * @param configSource the new value of the property */ public void setConfigSource(ConfigSource configSource) { this._configSource = configSource; } /** * Gets the the {@code configSource} property. * @return the property, not null */ public final Property<ConfigSource> configSource() { return metaBean().configSource().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the historical time-series id from the input URI. * @return the value of the property */ public String getUriHistoricalTimeSeriesId() { return _uriHistoricalTimeSeriesId; } /** * Sets the historical time-series id from the input URI. * @param uriHistoricalTimeSeriesId the new value of the property */ public void setUriHistoricalTimeSeriesId(String uriHistoricalTimeSeriesId) { this._uriHistoricalTimeSeriesId = uriHistoricalTimeSeriesId; } /** * Gets the the {@code uriHistoricalTimeSeriesId} property. * @return the property, not null */ public final Property<String> uriHistoricalTimeSeriesId() { return metaBean().uriHistoricalTimeSeriesId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the loaded historical time-series info. * @return the value of the property */ public HistoricalTimeSeriesInfoDocument getInfo() { return _info; } /** * Sets the loaded historical time-series info. * @param info the new value of the property */ public void setInfo(HistoricalTimeSeriesInfoDocument info) { this._info = info; } /** * Gets the the {@code info} property. * @return the property, not null */ public final Property<HistoricalTimeSeriesInfoDocument> info() { return metaBean().info().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the loaded historical time-series data points. * @return the value of the property */ public ManageableHistoricalTimeSeries getTimeSeries() { return _timeSeries; } /** * Sets the loaded historical time-series data points. * @param timeSeries the new value of the property */ public void setTimeSeries(ManageableHistoricalTimeSeries timeSeries) { this._timeSeries = timeSeries; } /** * Gets the the {@code timeSeries} property. * @return the property, not null */ public final Property<ManageableHistoricalTimeSeries> timeSeries() { return metaBean().timeSeries().createProperty(this); } //----------------------------------------------------------------------- @Override public WebHistoricalTimeSeriesData clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { WebHistoricalTimeSeriesData other = (WebHistoricalTimeSeriesData) obj; return JodaBeanUtils.equal(getHistoricalTimeSeriesMaster(), other.getHistoricalTimeSeriesMaster()) && JodaBeanUtils.equal(getHistoricalTimeSeriesLoader(), other.getHistoricalTimeSeriesLoader()) && JodaBeanUtils.equal(getConfigSource(), other.getConfigSource()) && JodaBeanUtils.equal(getUriHistoricalTimeSeriesId(), other.getUriHistoricalTimeSeriesId()) && JodaBeanUtils.equal(getInfo(), other.getInfo()) && JodaBeanUtils.equal(getTimeSeries(), other.getTimeSeries()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getHistoricalTimeSeriesMaster()); hash = hash * 31 + JodaBeanUtils.hashCode(getHistoricalTimeSeriesLoader()); hash = hash * 31 + JodaBeanUtils.hashCode(getConfigSource()); hash = hash * 31 + JodaBeanUtils.hashCode(getUriHistoricalTimeSeriesId()); hash = hash * 31 + JodaBeanUtils.hashCode(getInfo()); hash = hash * 31 + JodaBeanUtils.hashCode(getTimeSeries()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(224); buf.append("WebHistoricalTimeSeriesData{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } @Override protected void toString(StringBuilder buf) { super.toString(buf); buf.append("historicalTimeSeriesMaster").append('=').append(JodaBeanUtils.toString(getHistoricalTimeSeriesMaster())).append(',').append(' '); buf.append("historicalTimeSeriesLoader").append('=').append(JodaBeanUtils.toString(getHistoricalTimeSeriesLoader())).append(',').append(' '); buf.append("configSource").append('=').append(JodaBeanUtils.toString(getConfigSource())).append(',').append(' '); buf.append("uriHistoricalTimeSeriesId").append('=').append(JodaBeanUtils.toString(getUriHistoricalTimeSeriesId())).append(',').append(' '); buf.append("info").append('=').append(JodaBeanUtils.toString(getInfo())).append(',').append(' '); buf.append("timeSeries").append('=').append(JodaBeanUtils.toString(getTimeSeries())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code WebHistoricalTimeSeriesData}. */ public static class Meta extends WebPerRequestData.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code historicalTimeSeriesMaster} property. */ private final MetaProperty<HistoricalTimeSeriesMaster> _historicalTimeSeriesMaster = DirectMetaProperty.ofReadWrite( this, "historicalTimeSeriesMaster", WebHistoricalTimeSeriesData.class, HistoricalTimeSeriesMaster.class); /** * The meta-property for the {@code historicalTimeSeriesLoader} property. */ private final MetaProperty<HistoricalTimeSeriesLoader> _historicalTimeSeriesLoader = DirectMetaProperty.ofReadWrite( this, "historicalTimeSeriesLoader", WebHistoricalTimeSeriesData.class, HistoricalTimeSeriesLoader.class); /** * The meta-property for the {@code configSource} property. */ private final MetaProperty<ConfigSource> _configSource = DirectMetaProperty.ofReadWrite( this, "configSource", WebHistoricalTimeSeriesData.class, ConfigSource.class); /** * The meta-property for the {@code uriHistoricalTimeSeriesId} property. */ private final MetaProperty<String> _uriHistoricalTimeSeriesId = DirectMetaProperty.ofReadWrite( this, "uriHistoricalTimeSeriesId", WebHistoricalTimeSeriesData.class, String.class); /** * The meta-property for the {@code info} property. */ private final MetaProperty<HistoricalTimeSeriesInfoDocument> _info = DirectMetaProperty.ofReadWrite( this, "info", WebHistoricalTimeSeriesData.class, HistoricalTimeSeriesInfoDocument.class); /** * The meta-property for the {@code timeSeries} property. */ private final MetaProperty<ManageableHistoricalTimeSeries> _timeSeries = DirectMetaProperty.ofReadWrite( this, "timeSeries", WebHistoricalTimeSeriesData.class, ManageableHistoricalTimeSeries.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "historicalTimeSeriesMaster", "historicalTimeSeriesLoader", "configSource", "uriHistoricalTimeSeriesId", "info", "timeSeries"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 173967376: // historicalTimeSeriesMaster return _historicalTimeSeriesMaster; case 157715905: // historicalTimeSeriesLoader return _historicalTimeSeriesLoader; case 195157501: // configSource return _configSource; case 1609878101: // uriHistoricalTimeSeriesId return _uriHistoricalTimeSeriesId; case 3237038: // info return _info; case 779431844: // timeSeries return _timeSeries; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends WebHistoricalTimeSeriesData> builder() { return new DirectBeanBuilder<WebHistoricalTimeSeriesData>(new WebHistoricalTimeSeriesData()); } @Override public Class<? extends WebHistoricalTimeSeriesData> beanType() { return WebHistoricalTimeSeriesData.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code historicalTimeSeriesMaster} property. * @return the meta-property, not null */ public final MetaProperty<HistoricalTimeSeriesMaster> historicalTimeSeriesMaster() { return _historicalTimeSeriesMaster; } /** * The meta-property for the {@code historicalTimeSeriesLoader} property. * @return the meta-property, not null */ public final MetaProperty<HistoricalTimeSeriesLoader> historicalTimeSeriesLoader() { return _historicalTimeSeriesLoader; } /** * The meta-property for the {@code configSource} property. * @return the meta-property, not null */ public final MetaProperty<ConfigSource> configSource() { return _configSource; } /** * The meta-property for the {@code uriHistoricalTimeSeriesId} property. * @return the meta-property, not null */ public final MetaProperty<String> uriHistoricalTimeSeriesId() { return _uriHistoricalTimeSeriesId; } /** * The meta-property for the {@code info} property. * @return the meta-property, not null */ public final MetaProperty<HistoricalTimeSeriesInfoDocument> info() { return _info; } /** * The meta-property for the {@code timeSeries} property. * @return the meta-property, not null */ public final MetaProperty<ManageableHistoricalTimeSeries> timeSeries() { return _timeSeries; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 173967376: // historicalTimeSeriesMaster return ((WebHistoricalTimeSeriesData) bean).getHistoricalTimeSeriesMaster(); case 157715905: // historicalTimeSeriesLoader return ((WebHistoricalTimeSeriesData) bean).getHistoricalTimeSeriesLoader(); case 195157501: // configSource return ((WebHistoricalTimeSeriesData) bean).getConfigSource(); case 1609878101: // uriHistoricalTimeSeriesId return ((WebHistoricalTimeSeriesData) bean).getUriHistoricalTimeSeriesId(); case 3237038: // info return ((WebHistoricalTimeSeriesData) bean).getInfo(); case 779431844: // timeSeries return ((WebHistoricalTimeSeriesData) bean).getTimeSeries(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 173967376: // historicalTimeSeriesMaster ((WebHistoricalTimeSeriesData) bean).setHistoricalTimeSeriesMaster((HistoricalTimeSeriesMaster) newValue); return; case 157715905: // historicalTimeSeriesLoader ((WebHistoricalTimeSeriesData) bean).setHistoricalTimeSeriesLoader((HistoricalTimeSeriesLoader) newValue); return; case 195157501: // configSource ((WebHistoricalTimeSeriesData) bean).setConfigSource((ConfigSource) newValue); return; case 1609878101: // uriHistoricalTimeSeriesId ((WebHistoricalTimeSeriesData) bean).setUriHistoricalTimeSeriesId((String) newValue); return; case 3237038: // info ((WebHistoricalTimeSeriesData) bean).setInfo((HistoricalTimeSeriesInfoDocument) newValue); return; case 779431844: // timeSeries ((WebHistoricalTimeSeriesData) bean).setTimeSeries((ManageableHistoricalTimeSeries) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }