=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2013-03-01 05:40:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2013-03-01 10:18:31 +0000 @@ -424,6 +424,7 @@ ", name='" + name + '\'' + ", created=" + created + ", lastUpdated=" + lastUpdated + + ", class=" + getClass().getSimpleName() + '}'; } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2013-02-25 12:33:35 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2013-03-01 10:18:31 +0000 @@ -177,6 +177,12 @@ // Getters and setters // ------------------------------------------------------------------------ + @Override + public boolean isAutoGenerated() + { + return name != null && name.equals( DEFAULT_NAME ); + } + @JsonProperty @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JsonView( {DetailedView.class, ExportView.class} ) === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2013-02-13 03:57:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2013-03-01 10:18:31 +0000 @@ -41,12 +41,16 @@ import org.hisp.dhis.common.view.DetailedView; import org.hisp.dhis.common.view.ExportView; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; /** * @author Abyot Aselefew */ -@JacksonXmlRootElement( localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0) +@JacksonXmlRootElement(localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0) public class DataElementCategoryCombo extends BaseIdentifiableObject { @@ -70,7 +74,7 @@ private Set optionCombos = new HashSet(); private boolean skipTotal; - + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -161,12 +165,13 @@ CombinationGenerator generator = new CombinationGenerator( getCategoryOptionsAsArray() ); - sortLoop : while ( generator.hasNext() ) + sortLoop: + while ( generator.hasNext() ) { List categoryOptions = generator.getNext(); - + Set categoryOptionSet = new HashSet( categoryOptions ); - + for ( DataElementCategoryOptionCombo optionCombo : optionCombos ) { if ( optionCombo.getCategoryOptions() != null && optionCombo.getCategoryOptions().equals( categoryOptionSet ) ) @@ -177,10 +182,10 @@ } } } - + return list; } - + private String getNameFromCategoryOptions( List categoryOptions ) { StringBuilder name = new StringBuilder(); @@ -201,7 +206,7 @@ return name.toString(); } - + //TODO update category option -> category option combo association public void generateOptionCombos() { @@ -213,6 +218,12 @@ // ------------------------------------------------------------------------- @Override + public boolean isAutoGenerated() + { + return name != null && name.equals( DEFAULT_CATEGORY_COMBO_NAME ); + } + + @Override public int hashCode() { return name.hashCode(); @@ -271,10 +282,10 @@ // ------------------------------------------------------------------------- @JsonProperty - @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlElementWrapper( localName = "categories", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty( localName = "category", namespace = DxfNamespaces.DXF_2_0) + @JsonSerialize(contentAs = BaseIdentifiableObject.class) + @JsonView({ DetailedView.class, ExportView.class }) + @JacksonXmlElementWrapper(localName = "categories", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty(localName = "category", namespace = DxfNamespaces.DXF_2_0) public List getCategories() { return categories; @@ -285,11 +296,11 @@ this.categories = categories; } - @JsonProperty( value = "categoryOptionCombos" ) - @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( {DetailedView.class} ) - @JacksonXmlElementWrapper( localName = "categoryOptionCombos", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty( localName = "categoryOptionCombo", namespace = DxfNamespaces.DXF_2_0) + @JsonProperty(value = "categoryOptionCombos") + @JsonSerialize(contentAs = BaseIdentifiableObject.class) + @JsonView({ DetailedView.class }) + @JacksonXmlElementWrapper(localName = "categoryOptionCombos", namespace = DxfNamespaces.DXF_2_0) + @JacksonXmlProperty(localName = "categoryOptionCombo", namespace = DxfNamespaces.DXF_2_0) public Set getOptionCombos() { return optionCombos; @@ -301,8 +312,8 @@ } @JsonProperty - @JsonView( { DetailedView.class, ExportView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + @JsonView({ DetailedView.class, ExportView.class }) + @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) public boolean isSkipTotal() { return skipTotal; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2013-03-01 05:21:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2013-03-01 10:18:31 +0000 @@ -155,6 +155,12 @@ } @Override + public boolean isAutoGenerated() + { + return name != null && name.equals( DEFAULT_NAME ); + } + + @Override @JsonIgnore public String getShortName() { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2013-03-01 05:40:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2013-03-01 10:18:31 +0000 @@ -302,7 +302,7 @@ @Override public boolean isAutoGenerated() { - return isDefault(); + return name != null && name.equals( DEFAULT_NAME ); } @Override === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2013-02-28 15:20:20 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2013-03-01 10:18:31 +0000 @@ -437,11 +437,9 @@ this.periodType = periodType; } - /* @JsonProperty @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - */ public DataEntryForm getDataEntryForm() { return dataEntryForm; @@ -538,7 +536,7 @@ @JsonProperty @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( { DetailedView.class, ExportView.class } ) + @JsonView( { DetailedView.class } ) @JacksonXmlElementWrapper( localName = "sections", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "section", namespace = DxfNamespaces.DXF_2_0 ) public Set
getSections() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java 2013-02-25 12:33:35 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java 2013-03-01 10:18:31 +0000 @@ -302,8 +302,10 @@ expression = other.getExpression() == null ? expression : other.getExpression(); description = other.getDescription() == null ? description : other.getDescription(); nullIfBlank = other.isNullIfBlank(); + dataElementsInExpression = other.getDataElementsInExpression() == null ? dataElementsInExpression : new HashSet( other.getDataElementsInExpression() ); + optionCombosInExpression = other.getOptionCombosInExpression() == null ? optionCombosInExpression : new HashSet( other.getOptionCombosInExpression() ); } === modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2013-02-28 15:20:20 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2013-03-01 10:18:31 +0000 @@ -176,6 +176,20 @@ { nameMap.put( (Class) clazz, map ); } + else + { + // add an empty map here, since we could still have some auto-generated properties + nameMap.put( (Class) clazz, new HashMap() ); + + // find all auto-generated props and add them + for ( Map.Entry entry : map.entrySet() ) + { + if ( entry.getValue().isAutoGenerated() ) + { + nameMap.get( clazz ).put( entry.getKey(), entry.getValue() ); + } + } + } } catch ( InstantiationException ignored ) { @@ -217,7 +231,7 @@ manager.save( (IdentifiableObject) object ); } - // _updateInternalMaps( object ); + _updateInternalMaps( object ); } else { @@ -350,7 +364,7 @@ } } - if ( identifiableObject.haveUniqueNames() && identifiableObject.getName() != null ) + if ( (identifiableObject.haveUniqueNames() || identifiableObject.isAutoGenerated()) && identifiableObject.getName() != null ) { IdentifiableObject match = getNameMatch( identifiableObject ); @@ -396,7 +410,7 @@ map.put( identifiableObject.getCode(), identifiableObject ); } - if ( identifiableObject.haveUniqueNames() && identifiableObject.getName() != null ) + if ( (identifiableObject.haveUniqueNames() || identifiableObject.isAutoGenerated()) && identifiableObject.getName() != null ) { Map map = nameMap.get( identifiableObject.getClass() ); === modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-02-28 15:20:20 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-03-01 10:18:31 +0000 @@ -158,7 +158,7 @@ deleteAttributeValues( object ); deleteExpression( object, "leftSide" ); deleteExpression( object, "rightSide" ); - // deleteDataEntryForm( object, "dataEntryForm" ); + deleteDataEntryForm( object, "dataEntryForm" ); // deleteDataElementOperands( idObject, "compulsoryDataElementOperands" ); deleteDataElementOperands( object, "greyedFields" ); @@ -171,7 +171,7 @@ saveAttributeValues( object, attributeValues ); saveExpression( object, "leftSide", leftSide ); saveExpression( object, "rightSide", rightSide ); - // saveDataEntryForm( object, "dataEntryForm", dataEntryForm ); + saveDataEntryForm( object, "dataEntryForm", dataEntryForm ); // saveDataElementOperands( idObject, "compulsoryDataElementOperands", compulsoryDataElementOperands ); saveDataElementOperands( object, "greyedFields", greyedFields ); } === modified file 'dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml 2013-02-28 05:17:00 +0000 +++ dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml 2013-03-01 10:18:31 +0000 @@ -1,196 +1,195 @@ - - - - + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> + + + + + class="org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService" /> + class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore" /> + class="org.hisp.dhis.dxf2.metadata.handlers.OrganisationUnitObjectHandler" scope="prototype" /> - + - + - - - - - - - - - - + + + + + + + + + + + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> + value="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" /> - + - + + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> + value="org.hisp.dhis.dataelement.DataElementGroupSet" /> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> - + + value="org.hisp.dhis.organisationunit.OrganisationUnit" /> + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> + value="org.hisp.dhis.organisationunit.OrganisationUnitLevel" /> + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> + value="org.hisp.dhis.organisationunit.OrganisationUnitGroup" /> + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> + value="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" /> - + - + - + - + - + - + - + + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> + class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype"> - === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2013-02-28 15:20:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2013-03-01 10:18:31 +0000 @@ -487,7 +487,7 @@ //-------------------------------------------------------------------------- @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public List getAllAccessible( Class clazz ) { User user = currentUserService.getCurrentUser(); @@ -503,7 +503,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public List getAccessibleLikeName( Class clazz, String name ) { User user = currentUserService.getCurrentUser(); @@ -519,7 +519,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public List getAccessibleBetween( Class clazz, int first, int max ) { User user = currentUserService.getCurrentUser(); @@ -535,7 +535,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public List getAccessibleBetweenLikeName( Class clazz, String name, int first, int max ) { User user = currentUserService.getCurrentUser(); @@ -551,7 +551,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public List getAccessibleByLastUpdated( Class clazz, Date lastUpdated ) { User user = currentUserService.getCurrentUser();