BaseAnalyticalObject extends BaseNameableObject implements AnalyticalObject { @Override public boolean removeDataDimensionItem( DimensionalItemObject object ) { if ( object != null && DataDimensionItem.DATA_DIMENSION_CLASSES.contains( object.getClass() ) ) { return dataDimensionItems .removeAll( DataDimensionItem.createWithDependencies( object, dataDimensionItems ) ); } return false; }  abstract void init( User user, Date date, OrganisationUnit organisationUnit,
        List<OrganisationUnit> organisationUnitsAtLevel, List<OrganisationUnit> organisationUnitsInGroups,
        I18nFormat format ); @Override abstract void populateAnalyticalProperties(); @Override boolean hasUserOrgUnit(); boolean hasRelativePeriods(); boolean hasOrganisationUnitLevels(); boolean hasItemOrganisationUnitGroups(); boolean hasSortOrder(); boolean hasTitle(); List<DimensionalItemObject> getDataDimensionNameableObjects(); @Override boolean addDataDimensionItem( DimensionalItemObject object ); @Override boolean removeDataDimensionItem( DimensionalItemObject object ); @Override void addDataElementGroupSetDimension( DataElementGroupSetDimension dimension ); @Override void addOrganisationUnitGroupSetDimension( OrganisationUnitGroupSetDimension dimension ); void addCategoryDimension( CategoryDimension dimension ); @Override void addCategoryOptionGroupSetDimension( CategoryOptionGroupSetDimension dimension ); @Override void addTrackedEntityDataElementDimension( TrackedEntityDataElementDimension dimension ); @Override void clearTransientState(); void addAllDataDimensionItems( Collection<? extends DimensionalItemObject> objects ); @JsonIgnore List<DataElement> getDataElements(); @JsonIgnore List<Indicator> getIndicators(); Map<String, String> getMetaData(); void clear(); @JsonProperty @JacksonXmlElementWrapper( localName = "dataDimensionItems", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "dataDimensionItem", namespace = DxfNamespaces.DXF_2_0 ) List<DataDimensionItem> getDataDimensionItems(); void setDataDimensionItems( List<DataDimensionItem> dataDimensionItems ); @Override @JsonProperty @JsonSerialize( contentAs = BaseNameableObject.class ) @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 ) List<OrganisationUnit> getOrganisationUnits(); void setOrganisationUnits( List<OrganisationUnit> organisationUnits ); @Override @JsonProperty @JsonSerialize( contentUsing = JacksonPeriodSerializer.class ) @JsonDeserialize( contentUsing = JacksonPeriodDeserializer.class ) @JacksonXmlElementWrapper( localName = "periods", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "period", namespace = DxfNamespaces.DXF_2_0 ) List<Period> getPeriods(); void setPeriods( List<Period> periods ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) Date getStartDate(); void setStartDate( Date startDate ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) Date getEndDate(); void setEndDate( Date endDate ); @JsonProperty( value = "relativePeriods" ) @JacksonXmlProperty( localName = "relativePeriods", namespace = DxfNamespaces.DXF_2_0 ) RelativePeriods getRelatives(); void setRelatives( RelativePeriods relatives ); @JsonProperty @JacksonXmlElementWrapper( localName = "dataElementGroupSetDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "dataElementGroupSetDimension", namespace = DxfNamespaces.DXF_2_0 ) List<DataElementGroupSetDimension> getDataElementGroupSetDimensions(); void setDataElementGroupSetDimensions( List<DataElementGroupSetDimension> dataElementGroupSetDimensions ); @JsonProperty @JacksonXmlElementWrapper( localName = "organisationUnitGroupSetDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "organisationUnitGroupSetDimension", namespace = DxfNamespaces.DXF_2_0 ) List<OrganisationUnitGroupSetDimension> getOrganisationUnitGroupSetDimensions(); void setOrganisationUnitGroupSetDimensions(
        List<OrganisationUnitGroupSetDimension> organisationUnitGroupSetDimensions ); @JsonProperty @JacksonXmlElementWrapper( localName = "organisationUnitLevels", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "organisationUnitLevel", namespace = DxfNamespaces.DXF_2_0 ) List<Integer> getOrganisationUnitLevels(); void setOrganisationUnitLevels( List<Integer> organisationUnitLevels ); @JsonProperty @JacksonXmlElementWrapper( localName = "categoryDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "categoryDimension", namespace = DxfNamespaces.DXF_2_0 ) List<CategoryDimension> getCategoryDimensions(); void setCategoryDimensions( List<CategoryDimension> categoryDimensions ); @JsonProperty @JacksonXmlElementWrapper( localName = "categoryOptionGroupSetDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "categoryOptionGroupSetDimension", namespace = DxfNamespaces.DXF_2_0 ) List<CategoryOptionGroupSetDimension> getCategoryOptionGroupSetDimensions(); void setCategoryOptionGroupSetDimensions(
        List<CategoryOptionGroupSetDimension> categoryOptionGroupSetDimensions ); @JsonProperty @JacksonXmlElementWrapper( localName = "attributeDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "attributeDimension", namespace = DxfNamespaces.DXF_2_0 ) List<TrackedEntityAttributeDimension> getAttributeDimensions(); void setAttributeDimensions( List<TrackedEntityAttributeDimension> attributeDimensions ); @JsonProperty @JacksonXmlElementWrapper( localName = "dataElementDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "dataElementDimension", namespace = DxfNamespaces.DXF_2_0 ) List<TrackedEntityDataElementDimension> getDataElementDimensions(); void setDataElementDimensions( List<TrackedEntityDataElementDimension> dataElementDimensions ); @JsonProperty @JacksonXmlElementWrapper( localName = "programIndicatorDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "programIndicatorDimension", namespace = DxfNamespaces.DXF_2_0 ) List<TrackedEntityProgramIndicatorDimension> getProgramIndicatorDimensions(); void setProgramIndicatorDimensions( List<TrackedEntityProgramIndicatorDimension> programIndicatorDimensions ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isUserOrganisationUnit(); void setUserOrganisationUnit( boolean userOrganisationUnit ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isUserOrganisationUnitChildren(); void setUserOrganisationUnitChildren( boolean userOrganisationUnitChildren ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isUserOrganisationUnitGrandChildren(); void setUserOrganisationUnitGrandChildren( boolean userOrganisationUnitGrandChildren ); @JsonProperty @JacksonXmlElementWrapper( localName = "itemOrganisationUnitGroups", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "itemOrganisationUnitGroup", namespace = DxfNamespaces.DXF_2_0 ) List<OrganisationUnitGroup> getItemOrganisationUnitGroups(); void setItemOrganisationUnitGroups( List<OrganisationUnitGroup> itemOrganisationUnitGroups ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) DigitGroupSeparator getDigitGroupSeparator(); void setDigitGroupSeparator( DigitGroupSeparator digitGroupSeparator ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) @PropertyRange( min = Integer.MIN_VALUE ) int getSortOrder(); void setSortOrder( int sortOrder ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) int getTopLimit(); void setTopLimit( int topLimit ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AggregationType getAggregationType(); void setAggregationType( AggregationType aggregationType ); @Override @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isCompletedOnly(); void setCompletedOnly( boolean completedOnly ); @Override @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getTimeField(); void setTimeField( String timeField ); @Override @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getOrgUnitField(); void setOrgUnitField( String orgUnitField ); @Override @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getTitle(); void setTitle( String title ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getSubtitle(); void setSubtitle( String subtitle ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isHideTitle(); void setHideTitle( boolean hideTitle ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isHideSubtitle(); void setHideSubtitle( boolean hideSubtitle ); @Override @JsonProperty @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JacksonXmlElementWrapper( localName = "interpretations", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "interpretation", namespace = DxfNamespaces.DXF_2_0 ) Set<Interpretation> getInterpretations(); void setInterpretations( Set<Interpretation> interpretations ); @JsonIgnore List<OrganisationUnit> getTransientOrganisationUnits(); @Override @JsonIgnore Date getRelativePeriodDate(); @Override @JsonIgnore OrganisationUnit getRelativeOrganisationUnit(); @Override @JsonProperty @JsonDeserialize( contentAs = BaseDimensionalObject.class ) @JacksonXmlElementWrapper( localName = "columns", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "column", namespace = DxfNamespaces.DXF_2_0 ) List<DimensionalObject> getColumns(); void setColumns( List<DimensionalObject> columns ); @Override @JsonProperty @JsonDeserialize( contentAs = BaseDimensionalObject.class ) @JacksonXmlElementWrapper( localName = "rows", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "row", namespace = DxfNamespaces.DXF_2_0 ) List<DimensionalObject> getRows(); void setRows( List<DimensionalObject> rows ); @Override @JsonProperty @JsonDeserialize( contentAs = BaseDimensionalObject.class ) @JacksonXmlElementWrapper( localName = "filters", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "filter", namespace = DxfNamespaces.DXF_2_0 ) List<DimensionalObject> getFilters(); void setFilters( List<DimensionalObject> filters ); @Override @JsonProperty( access = JsonProperty.Access.READ_ONLY ) @JacksonXmlProperty( localName = "parentGraphMap", namespace = DxfNamespaces.DXF_2_0 ) Map<String, String> getParentGraphMap(); void setParentGraphMap( Map<String, String> parentGraphMap ); @Override @JsonProperty @JacksonXmlElementWrapper( localName = "subscribers", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "subscriber", namespace = DxfNamespaces.DXF_2_0 ) Set<String> getSubscribers(); void setSubscribers( Set<String> subscribers ); @Override @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) boolean isSubscribed(); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) UserOrgUnitType getUserOrgUnitType(); void setUserOrgUnitType( UserOrgUnitType userOrgUnitType ); @Override boolean subscribe( User user ); @Override boolean unsubscribe( User user ); static final int ASC; static final int DESC; static final int NONE; }
@Test public void testRemoveDataDimensionItem() { DataElement deA = new DataElement(); DataElement deB = new DataElement(); deA.setAutoFields(); deB.setAutoFields(); MapView mv = new MapView( MapView.LAYER_THEMATIC1 ); mv.addDataDimensionItem( deA ); mv.addDataDimensionItem( deB ); assertEquals( 2, mv.getDataDimensionItems().size() ); mv.removeDataDimensionItem( deA ); assertEquals( 1, mv.getDataDimensionItems().size() ); assertEquals( deB, mv.getDataDimensionItems().get( 0 ).getDataElement() ); }