/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.master.historicaltimeseries; import java.io.Serializable; import java.util.Map; import java.util.Set; import java.util.TreeSet; 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.DirectBean; import org.joda.beans.impl.direct.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaBean; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.core.historicaltimeseries.HistoricalTimeSeriesInfo; import com.opengamma.id.ExternalIdBundleWithDates; import com.opengamma.id.MutableUniqueIdentifiable; import com.opengamma.id.ObjectId; import com.opengamma.id.UniqueId; import com.opengamma.util.PublicSPI; import com.opengamma.util.auth.Permissionable; /** * The information about a historical time-series. * <p> * This is used to hold the information about a time-series in the master. The actual time-series is held separately. * <p> * This class is mutable and not thread-safe. */ @PublicSPI @BeanDefinition public class ManageableHistoricalTimeSeriesInfo extends DirectBean implements HistoricalTimeSeriesInfo, MutableUniqueIdentifiable, Serializable, Permissionable { /** Serialization version. */ private static final long serialVersionUID = 1L; /** * The historical time-series unique identifier. This field is managed by the master but must be set for updates. */ @PropertyDefinition private UniqueId _uniqueId; /** * The external identifier bundle with valid dates if available. The key of the specific series, such as the equity identifiers. */ @PropertyDefinition private ExternalIdBundleWithDates _externalIdBundle; /** * The name of the historical time-series intended for display purposes. This field must not be null for the object to be valid. */ @PropertyDefinition private String _name; /** * The data field. This defines the type of data that the series represents. */ @PropertyDefinition private String _dataField; /** * The data source. The source of the data, typically a major financial data supplier. */ @PropertyDefinition private String _dataSource; /** * The data provider. The underlying data provider, such as an individual exchange. */ @PropertyDefinition private String _dataProvider; /** * The descriptive observation time key. This defines, textually, the time of day, such as LONDON_CLOSE. */ @PropertyDefinition private String _observationTime; /** * The object identifier of the historical time-series data points. This must be separately looked up using the master. */ @PropertyDefinition private ObjectId _timeSeriesObjectId; /** * The set of required permissions. * This is a set of permissions that a user needs to be able to view a time-series. */ @PropertyDefinition(validate = "notNull") private final Set<String> _requiredPermissions = new TreeSet<>(); /** * Creates an instance. */ public ManageableHistoricalTimeSeriesInfo() { } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code ManageableHistoricalTimeSeriesInfo}. * @return the meta-bean, not null */ public static ManageableHistoricalTimeSeriesInfo.Meta meta() { return ManageableHistoricalTimeSeriesInfo.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ManageableHistoricalTimeSeriesInfo.Meta.INSTANCE); } @Override public ManageableHistoricalTimeSeriesInfo.Meta metaBean() { return ManageableHistoricalTimeSeriesInfo.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the historical time-series unique identifier. This field is managed by the master but must be set for updates. * @return the value of the property */ public UniqueId getUniqueId() { return _uniqueId; } /** * Sets the historical time-series unique identifier. This field is managed by the master but must be set for updates. * @param uniqueId the new value of the property */ public void setUniqueId(UniqueId uniqueId) { this._uniqueId = uniqueId; } /** * Gets the the {@code uniqueId} property. * @return the property, not null */ public final Property<UniqueId> uniqueId() { return metaBean().uniqueId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the external identifier bundle with valid dates if available. The key of the specific series, such as the equity identifiers. * @return the value of the property */ public ExternalIdBundleWithDates getExternalIdBundle() { return _externalIdBundle; } /** * Sets the external identifier bundle with valid dates if available. The key of the specific series, such as the equity identifiers. * @param externalIdBundle the new value of the property */ public void setExternalIdBundle(ExternalIdBundleWithDates externalIdBundle) { this._externalIdBundle = externalIdBundle; } /** * Gets the the {@code externalIdBundle} property. * @return the property, not null */ public final Property<ExternalIdBundleWithDates> externalIdBundle() { return metaBean().externalIdBundle().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the name of the historical time-series intended for display purposes. This field must not be null for the object to be valid. * @return the value of the property */ public String getName() { return _name; } /** * Sets the name of the historical time-series intended for display purposes. This field must not be null for the object to be valid. * @param name the new value of the property */ public void setName(String name) { this._name = name; } /** * Gets the the {@code name} property. * @return the property, not null */ public final Property<String> name() { return metaBean().name().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the data field. This defines the type of data that the series represents. * @return the value of the property */ public String getDataField() { return _dataField; } /** * Sets the data field. This defines the type of data that the series represents. * @param dataField the new value of the property */ public void setDataField(String dataField) { this._dataField = dataField; } /** * Gets the the {@code dataField} property. * @return the property, not null */ public final Property<String> dataField() { return metaBean().dataField().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the data source. The source of the data, typically a major financial data supplier. * @return the value of the property */ public String getDataSource() { return _dataSource; } /** * Sets the data source. The source of the data, typically a major financial data supplier. * @param dataSource the new value of the property */ public void setDataSource(String dataSource) { this._dataSource = dataSource; } /** * Gets the the {@code dataSource} property. * @return the property, not null */ public final Property<String> dataSource() { return metaBean().dataSource().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the data provider. The underlying data provider, such as an individual exchange. * @return the value of the property */ public String getDataProvider() { return _dataProvider; } /** * Sets the data provider. The underlying data provider, such as an individual exchange. * @param dataProvider the new value of the property */ public void setDataProvider(String dataProvider) { this._dataProvider = dataProvider; } /** * Gets the the {@code dataProvider} property. * @return the property, not null */ public final Property<String> dataProvider() { return metaBean().dataProvider().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the descriptive observation time key. This defines, textually, the time of day, such as LONDON_CLOSE. * @return the value of the property */ public String getObservationTime() { return _observationTime; } /** * Sets the descriptive observation time key. This defines, textually, the time of day, such as LONDON_CLOSE. * @param observationTime the new value of the property */ public void setObservationTime(String observationTime) { this._observationTime = observationTime; } /** * Gets the the {@code observationTime} property. * @return the property, not null */ public final Property<String> observationTime() { return metaBean().observationTime().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the object identifier of the historical time-series data points. This must be separately looked up using the master. * @return the value of the property */ public ObjectId getTimeSeriesObjectId() { return _timeSeriesObjectId; } /** * Sets the object identifier of the historical time-series data points. This must be separately looked up using the master. * @param timeSeriesObjectId the new value of the property */ public void setTimeSeriesObjectId(ObjectId timeSeriesObjectId) { this._timeSeriesObjectId = timeSeriesObjectId; } /** * Gets the the {@code timeSeriesObjectId} property. * @return the property, not null */ public final Property<ObjectId> timeSeriesObjectId() { return metaBean().timeSeriesObjectId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the set of required permissions. * This is a set of permissions that a user needs to be able to view a time-series. * @return the value of the property, not null */ public Set<String> getRequiredPermissions() { return _requiredPermissions; } /** * Sets the set of required permissions. * This is a set of permissions that a user needs to be able to view a time-series. * @param requiredPermissions the new value of the property, not null */ public void setRequiredPermissions(Set<String> requiredPermissions) { JodaBeanUtils.notNull(requiredPermissions, "requiredPermissions"); this._requiredPermissions.clear(); this._requiredPermissions.addAll(requiredPermissions); } /** * Gets the the {@code requiredPermissions} property. * This is a set of permissions that a user needs to be able to view a time-series. * @return the property, not null */ public final Property<Set<String>> requiredPermissions() { return metaBean().requiredPermissions().createProperty(this); } //----------------------------------------------------------------------- @Override public ManageableHistoricalTimeSeriesInfo clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { ManageableHistoricalTimeSeriesInfo other = (ManageableHistoricalTimeSeriesInfo) obj; return JodaBeanUtils.equal(getUniqueId(), other.getUniqueId()) && JodaBeanUtils.equal(getExternalIdBundle(), other.getExternalIdBundle()) && JodaBeanUtils.equal(getName(), other.getName()) && JodaBeanUtils.equal(getDataField(), other.getDataField()) && JodaBeanUtils.equal(getDataSource(), other.getDataSource()) && JodaBeanUtils.equal(getDataProvider(), other.getDataProvider()) && JodaBeanUtils.equal(getObservationTime(), other.getObservationTime()) && JodaBeanUtils.equal(getTimeSeriesObjectId(), other.getTimeSeriesObjectId()) && JodaBeanUtils.equal(getRequiredPermissions(), other.getRequiredPermissions()); } return false; } @Override public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(getUniqueId()); hash = hash * 31 + JodaBeanUtils.hashCode(getExternalIdBundle()); hash = hash * 31 + JodaBeanUtils.hashCode(getName()); hash = hash * 31 + JodaBeanUtils.hashCode(getDataField()); hash = hash * 31 + JodaBeanUtils.hashCode(getDataSource()); hash = hash * 31 + JodaBeanUtils.hashCode(getDataProvider()); hash = hash * 31 + JodaBeanUtils.hashCode(getObservationTime()); hash = hash * 31 + JodaBeanUtils.hashCode(getTimeSeriesObjectId()); hash = hash * 31 + JodaBeanUtils.hashCode(getRequiredPermissions()); return hash; } @Override public String toString() { StringBuilder buf = new StringBuilder(320); buf.append("ManageableHistoricalTimeSeriesInfo{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } protected void toString(StringBuilder buf) { buf.append("uniqueId").append('=').append(JodaBeanUtils.toString(getUniqueId())).append(',').append(' '); buf.append("externalIdBundle").append('=').append(JodaBeanUtils.toString(getExternalIdBundle())).append(',').append(' '); buf.append("name").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' '); buf.append("dataField").append('=').append(JodaBeanUtils.toString(getDataField())).append(',').append(' '); buf.append("dataSource").append('=').append(JodaBeanUtils.toString(getDataSource())).append(',').append(' '); buf.append("dataProvider").append('=').append(JodaBeanUtils.toString(getDataProvider())).append(',').append(' '); buf.append("observationTime").append('=').append(JodaBeanUtils.toString(getObservationTime())).append(',').append(' '); buf.append("timeSeriesObjectId").append('=').append(JodaBeanUtils.toString(getTimeSeriesObjectId())).append(',').append(' '); buf.append("requiredPermissions").append('=').append(JodaBeanUtils.toString(getRequiredPermissions())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code ManageableHistoricalTimeSeriesInfo}. */ public static class Meta extends DirectMetaBean { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code uniqueId} property. */ private final MetaProperty<UniqueId> _uniqueId = DirectMetaProperty.ofReadWrite( this, "uniqueId", ManageableHistoricalTimeSeriesInfo.class, UniqueId.class); /** * The meta-property for the {@code externalIdBundle} property. */ private final MetaProperty<ExternalIdBundleWithDates> _externalIdBundle = DirectMetaProperty.ofReadWrite( this, "externalIdBundle", ManageableHistoricalTimeSeriesInfo.class, ExternalIdBundleWithDates.class); /** * The meta-property for the {@code name} property. */ private final MetaProperty<String> _name = DirectMetaProperty.ofReadWrite( this, "name", ManageableHistoricalTimeSeriesInfo.class, String.class); /** * The meta-property for the {@code dataField} property. */ private final MetaProperty<String> _dataField = DirectMetaProperty.ofReadWrite( this, "dataField", ManageableHistoricalTimeSeriesInfo.class, String.class); /** * The meta-property for the {@code dataSource} property. */ private final MetaProperty<String> _dataSource = DirectMetaProperty.ofReadWrite( this, "dataSource", ManageableHistoricalTimeSeriesInfo.class, String.class); /** * The meta-property for the {@code dataProvider} property. */ private final MetaProperty<String> _dataProvider = DirectMetaProperty.ofReadWrite( this, "dataProvider", ManageableHistoricalTimeSeriesInfo.class, String.class); /** * The meta-property for the {@code observationTime} property. */ private final MetaProperty<String> _observationTime = DirectMetaProperty.ofReadWrite( this, "observationTime", ManageableHistoricalTimeSeriesInfo.class, String.class); /** * The meta-property for the {@code timeSeriesObjectId} property. */ private final MetaProperty<ObjectId> _timeSeriesObjectId = DirectMetaProperty.ofReadWrite( this, "timeSeriesObjectId", ManageableHistoricalTimeSeriesInfo.class, ObjectId.class); /** * The meta-property for the {@code requiredPermissions} property. */ @SuppressWarnings({"unchecked", "rawtypes" }) private final MetaProperty<Set<String>> _requiredPermissions = DirectMetaProperty.ofReadWrite( this, "requiredPermissions", ManageableHistoricalTimeSeriesInfo.class, (Class) Set.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, null, "uniqueId", "externalIdBundle", "name", "dataField", "dataSource", "dataProvider", "observationTime", "timeSeriesObjectId", "requiredPermissions"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -294460212: // uniqueId return _uniqueId; case -736922008: // externalIdBundle return _externalIdBundle; case 3373707: // name return _name; case -386794640: // dataField return _dataField; case 1272470629: // dataSource return _dataSource; case 339742651: // dataProvider return _dataProvider; case 951232793: // observationTime return _observationTime; case 2129430654: // timeSeriesObjectId return _timeSeriesObjectId; case 132663141: // requiredPermissions return _requiredPermissions; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends ManageableHistoricalTimeSeriesInfo> builder() { return new DirectBeanBuilder<ManageableHistoricalTimeSeriesInfo>(new ManageableHistoricalTimeSeriesInfo()); } @Override public Class<? extends ManageableHistoricalTimeSeriesInfo> beanType() { return ManageableHistoricalTimeSeriesInfo.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code uniqueId} property. * @return the meta-property, not null */ public final MetaProperty<UniqueId> uniqueId() { return _uniqueId; } /** * The meta-property for the {@code externalIdBundle} property. * @return the meta-property, not null */ public final MetaProperty<ExternalIdBundleWithDates> externalIdBundle() { return _externalIdBundle; } /** * The meta-property for the {@code name} property. * @return the meta-property, not null */ public final MetaProperty<String> name() { return _name; } /** * The meta-property for the {@code dataField} property. * @return the meta-property, not null */ public final MetaProperty<String> dataField() { return _dataField; } /** * The meta-property for the {@code dataSource} property. * @return the meta-property, not null */ public final MetaProperty<String> dataSource() { return _dataSource; } /** * The meta-property for the {@code dataProvider} property. * @return the meta-property, not null */ public final MetaProperty<String> dataProvider() { return _dataProvider; } /** * The meta-property for the {@code observationTime} property. * @return the meta-property, not null */ public final MetaProperty<String> observationTime() { return _observationTime; } /** * The meta-property for the {@code timeSeriesObjectId} property. * @return the meta-property, not null */ public final MetaProperty<ObjectId> timeSeriesObjectId() { return _timeSeriesObjectId; } /** * The meta-property for the {@code requiredPermissions} property. * @return the meta-property, not null */ public final MetaProperty<Set<String>> requiredPermissions() { return _requiredPermissions; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -294460212: // uniqueId return ((ManageableHistoricalTimeSeriesInfo) bean).getUniqueId(); case -736922008: // externalIdBundle return ((ManageableHistoricalTimeSeriesInfo) bean).getExternalIdBundle(); case 3373707: // name return ((ManageableHistoricalTimeSeriesInfo) bean).getName(); case -386794640: // dataField return ((ManageableHistoricalTimeSeriesInfo) bean).getDataField(); case 1272470629: // dataSource return ((ManageableHistoricalTimeSeriesInfo) bean).getDataSource(); case 339742651: // dataProvider return ((ManageableHistoricalTimeSeriesInfo) bean).getDataProvider(); case 951232793: // observationTime return ((ManageableHistoricalTimeSeriesInfo) bean).getObservationTime(); case 2129430654: // timeSeriesObjectId return ((ManageableHistoricalTimeSeriesInfo) bean).getTimeSeriesObjectId(); case 132663141: // requiredPermissions return ((ManageableHistoricalTimeSeriesInfo) bean).getRequiredPermissions(); } return super.propertyGet(bean, propertyName, quiet); } @SuppressWarnings("unchecked") @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -294460212: // uniqueId ((ManageableHistoricalTimeSeriesInfo) bean).setUniqueId((UniqueId) newValue); return; case -736922008: // externalIdBundle ((ManageableHistoricalTimeSeriesInfo) bean).setExternalIdBundle((ExternalIdBundleWithDates) newValue); return; case 3373707: // name ((ManageableHistoricalTimeSeriesInfo) bean).setName((String) newValue); return; case -386794640: // dataField ((ManageableHistoricalTimeSeriesInfo) bean).setDataField((String) newValue); return; case 1272470629: // dataSource ((ManageableHistoricalTimeSeriesInfo) bean).setDataSource((String) newValue); return; case 339742651: // dataProvider ((ManageableHistoricalTimeSeriesInfo) bean).setDataProvider((String) newValue); return; case 951232793: // observationTime ((ManageableHistoricalTimeSeriesInfo) bean).setObservationTime((String) newValue); return; case 2129430654: // timeSeriesObjectId ((ManageableHistoricalTimeSeriesInfo) bean).setTimeSeriesObjectId((ObjectId) newValue); return; case 132663141: // requiredPermissions ((ManageableHistoricalTimeSeriesInfo) bean).setRequiredPermissions((Set<String>) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } @Override protected void validate(Bean bean) { JodaBeanUtils.notNull(((ManageableHistoricalTimeSeriesInfo) bean)._requiredPermissions, "requiredPermissions"); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }