dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24581
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12081: Removed old dashboard classes. Merged delete methods for user credentials and user - we need thes...
------------------------------------------------------------
revno: 12081
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-13 15:00:37 +0200
message:
Removed old dashboard classes. Merged delete methods for user credentials and user - we need these operations to run inside one transaction in case the first operation fails.
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardConfiguration.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContentStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/hibernate/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/hibernate/HibernateDashboardContentStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardConfiguration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardConfiguration.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardConfiguration.java 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
-package org.hisp.dhis.dashboard;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-@Deprecated
-public class DashboardConfiguration
- implements Serializable
-{
- private static final long serialVersionUID = 8829362188465214078L;
-
- private Map<String, String> areaItems;
-
- // -------------------------------------------------------------------------
- // Constructor
- // -------------------------------------------------------------------------
-
- public DashboardConfiguration()
- {
- areaItems = new HashMap<String, String>();
- }
-
- // -------------------------------------------------------------------------
- // Logic
- // -------------------------------------------------------------------------
-
- public void setAreaItem( String area, String item )
- {
- areaItems.put( area, item );
- }
-
- public void clearArea( String area )
- {
- areaItems.remove( area );
- }
-
- // -------------------------------------------------------------------------
- // toString
- // -------------------------------------------------------------------------
-
- @Override
- public String toString()
- {
- return areaItems != null ? areaItems.toString() : null;
- }
-
- // -------------------------------------------------------------------------
- // Getters and setters
- // -------------------------------------------------------------------------
-
- public Map<String, String> getAreaItems()
- {
- return areaItems;
- }
-
- public void setAreaItems( Map<String, String> areaItems )
- {
- this.areaItems = areaItems;
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java 1970-01-01 00:00:00 +0000
@@ -1,256 +0,0 @@
-package org.hisp.dhis.dashboard;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.common.view.BasicView;
-import org.hisp.dhis.common.view.DetailedView;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.mapping.Map;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.user.User;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-
-/**
- * it would make sense to make this an idObject, so that we could have nameable (switchable?)
- * dashboards, would be great for default content etc.
- *
- * @author Lars Helge Overland
- */
-@Deprecated
-@JacksonXmlRootElement( localName = "dashboardContent", namespace = DxfNamespaces.DXF_2_0)
-public class DashboardContent
-{
- private final static int MAX_DASHBOARD_ELEMENTS = 6;
-
- private int id;
-
- private User user;
-
- private List<Report> reports = new ArrayList<Report>();
-
- private List<Document> documents = new ArrayList<Document>();
-
- private List<ReportTable> reportTables = new ArrayList<ReportTable>();
-
- private List<Map> maps = new ArrayList<Map>();
-
- public DashboardContent()
- {
- }
-
- public DashboardContent( User user )
- {
- this.user = user;
- }
-
- public int hashCode()
- {
- return user.hashCode();
- }
-
- public boolean equals( Object object )
- {
- if ( this == object )
- {
- return true;
- }
-
- if ( object == null )
- {
- return false;
- }
-
- if ( object.getClass() != getClass() )
- {
- return false;
- }
-
- final DashboardContent other = (DashboardContent) object;
-
- return user.equals( other.user );
- }
-
- // -------------------------------------------------------------------------
- // Logic
- // -------------------------------------------------------------------------
-
- public void addReport( Report report )
- {
- if ( !reports.contains( report ) )
- {
- reports.add( 0, report );
-
- while ( reports.size() > MAX_DASHBOARD_ELEMENTS )
- {
- reports.remove( MAX_DASHBOARD_ELEMENTS );
- }
- }
- }
-
- public void addDocument( Document document )
- {
- if ( !documents.contains( document ) )
- {
- documents.add( 0, document );
-
- while ( documents.size() > MAX_DASHBOARD_ELEMENTS )
- {
- documents.remove( MAX_DASHBOARD_ELEMENTS );
- }
- }
- }
-
- public void addReportTable( ReportTable reportTable )
- {
- if ( !reportTables.contains( reportTable ) )
- {
- reportTables.add( 0, reportTable );
-
- while ( reportTables.size() > MAX_DASHBOARD_ELEMENTS )
- {
- reportTables.remove( MAX_DASHBOARD_ELEMENTS );
- }
- }
- }
-
- public void addMap( Map map )
- {
- if ( !maps.contains( map ) )
- {
- maps.add( 0, map );
-
- while ( maps.size() > MAX_DASHBOARD_ELEMENTS )
- {
- maps.remove( MAX_DASHBOARD_ELEMENTS );
- }
- }
- }
-
- // -------------------------------------------------------------------------
- // Getters & setters
- // -------------------------------------------------------------------------
-
- @JsonProperty( value = "internalId" )
- @JsonView( {BasicView.class} )
- @JacksonXmlProperty( isAttribute = true )
- public int getId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
- @JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
- public User getUser()
- {
- return user;
- }
-
- public void setUser( User user )
- {
- this.user = user;
- }
-
- @JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
- @JacksonXmlElementWrapper( localName = "reports" )
- @JacksonXmlProperty( localName = "report" )
- public List<Report> getReports()
- {
- return reports;
- }
-
- public void setReports( List<Report> reports )
- {
- this.reports = reports;
- }
-
- @JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
- @JacksonXmlElementWrapper( localName = "documents" )
- @JacksonXmlProperty( localName = "document" )
- public List<Document> getDocuments()
- {
- return documents;
- }
-
- public void setDocuments( List<Document> documents )
- {
- this.documents = documents;
- }
-
- @JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
- @JacksonXmlElementWrapper( localName = "reportTables" )
- @JacksonXmlProperty( localName = "reportTable" )
- public List<ReportTable> getReportTables()
- {
- return reportTables;
- }
-
- public void setReportTables( List<ReportTable> reportTables )
- {
- this.reportTables = reportTables;
- }
-
- @JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
- @JacksonXmlElementWrapper( localName = "maps" )
- @JacksonXmlProperty( localName = "map" )
- public List<Map> getMaps()
- {
- return maps;
- }
-
- public void setMaps( List<Map> maps )
- {
- this.maps = maps;
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContentStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContentStore.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContentStore.java 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
-package org.hisp.dhis.dashboard;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-
-import org.hisp.dhis.common.GenericStore;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.mapping.Map;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.reporttable.ReportTable;
-
-/**
- * @author Lars Helge Overland
- */
-@Deprecated
-public interface DashboardContentStore
- extends GenericStore<DashboardContent>
-{
- Collection<DashboardContent> getByDocument( Document document );
-
- Collection<DashboardContent> getByMap( Map map );
-
- Collection<DashboardContent> getByReport( Report report );
-
- Collection<DashboardContent> getByReportTable( ReportTable reportTable );
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java 2013-09-13 12:12:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java 2013-09-13 13:00:37 +0000
@@ -199,13 +199,6 @@
void setLastLogin( String username );
/**
- * Deletes a UserCredentials.
- *
- * @param userCredentials the UserCredentials.
- */
- void deleteUserCredentials( UserCredentials userCredentials );
-
- /**
* Get the UserCredentials with the corresponding identifiers.
*
* @param identifiers the collection of identifiers.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-09-04 07:35:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-09-13 13:00:37 +0000
@@ -630,6 +630,9 @@
executeSql( "ALTER TABLE datavalue ALTER COLUMN lastupdated TYPE timestamp" );
executeSql( "ALTER TABLE message ALTER COLUMN userid DROP NOT NULL" );
+
+ executeSql( "delete from usersetting where name = 'dashboardConfig' or name = 'dashboardConfiguration'" );
+ executeSql( "ALTER TABLE interpretation ALTER COLUMN userid DROP NOT NULL" );
log.info( "Tables updated" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2013-09-13 12:12:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2013-09-13 13:00:37 +0000
@@ -178,6 +178,8 @@
{
AuditLogUtil.infoWrapper( log, currentUserService.getCurrentUsername(), user, AuditLogUtil.ACTION_DELETE );
+ userCredentialsStore.deleteUserCredentials( user.getUserCredentials() );
+
userStore.delete( user );
}
@@ -371,11 +373,6 @@
userCredentialsStore.updateUserCredentials( userCredentials );
}
- public void deleteUserCredentials( UserCredentials userCredentials )
- {
- userCredentialsStore.deleteUserCredentials( userCredentials );
- }
-
public Collection<UserCredentials> getAllUserCredentials()
{
return userCredentialsStore.getAllUserCredentials();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserAuthorityGroupDeletionHandler.java 2013-09-13 13:00:37 +0000
@@ -74,8 +74,10 @@
}
@Override
- public void deleteUserCredentials( UserCredentials credentials )
+ public void deleteUser( User user )
{
+ UserCredentials credentials = user.getUserCredentials();
+
Iterator<UserAuthorityGroup> iterator = credentials.getUserAuthorityGroups().iterator();
while ( iterator.hasNext() )
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserCredentialsDeletionHandler.java 1970-01-01 00:00:00 +0000
@@ -1,74 +0,0 @@
-package org.hisp.dhis.user;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Iterator;
-
-import org.hisp.dhis.system.deletion.DeletionHandler;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class UserCredentialsDeletionHandler
- extends DeletionHandler
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserService userService;
-
- public void setUserService( UserService userService )
- {
- this.userService = userService;
- }
-
- // -------------------------------------------------------------------------
- // DeletionHandler implementation
- // -------------------------------------------------------------------------
-
- public String getClassName()
- {
- return UserCredentials.class.getSimpleName();
- }
-
- @Override
- public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
- {
- Iterator<UserCredentials> iterator = authorityGroup.getMembers().iterator();
-
- while ( iterator.hasNext() )
- {
- UserCredentials credentials = iterator.next();
- credentials.getUserAuthorityGroups().remove( authorityGroup );
- userService.updateUserCredentials( credentials );
- }
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2013-09-13 13:00:37 +0000
@@ -62,6 +62,19 @@
}
@Override
+ public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
+ {
+ Iterator<UserCredentials> iterator = authorityGroup.getMembers().iterator();
+
+ while ( iterator.hasNext() )
+ {
+ UserCredentials credentials = iterator.next();
+ credentials.getUserAuthorityGroups().remove( authorityGroup );
+ userService.updateUserCredentials( credentials );
+ }
+ }
+
+ @Override
public void deleteOrganisationUnit( OrganisationUnit unit )
{
Iterator<User> iterator = unit.getUsers().iterator();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-09-13 12:12:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-09-13 13:00:37 +0000
@@ -1021,10 +1021,6 @@
<property name="userService" ref="org.hisp.dhis.user.UserService" />
</bean>
- <bean id="org.hisp.dhis.user.UserCredentialsDeletionHandler" class="org.hisp.dhis.user.UserCredentialsDeletionHandler">
- <property name="userService" ref="org.hisp.dhis.user.UserService" />
- </bean>
-
<bean id="org.hisp.dhis.user.UserSettingDeletionHandler" class="org.hisp.dhis.user.UserSettingDeletionHandler"/>
<bean id="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler"
@@ -1100,7 +1096,6 @@
<ref local="org.hisp.dhis.user.UserDeletionHandler" />
<ref local="org.hisp.dhis.user.UserGroupDeletionHandler" />
<ref local="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler" />
- <ref local="org.hisp.dhis.user.UserCredentialsDeletionHandler" />
<ref local="org.hisp.dhis.user.UserSettingDeletionHandler" />
<ref local="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler" />
<ref local="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler" />
=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/hibernate/HibernateDashboardContentStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/hibernate/HibernateDashboardContentStore.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/hibernate/HibernateDashboardContentStore.java 1970-01-01 00:00:00 +0000
@@ -1,78 +0,0 @@
-package org.hisp.dhis.dashboard.hibernate;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-
-import org.hisp.dhis.dashboard.DashboardContent;
-import org.hisp.dhis.dashboard.DashboardContentStore;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
-import org.hisp.dhis.mapping.Map;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.reporttable.ReportTable;
-
-/**
- * This class is outdated and kept only for backwards compatibility reasons. Will
- * be removed for 2.14.
- *
- * @author Lars Helge Overland
- */
-@Deprecated
-public class HibernateDashboardContentStore
- extends HibernateGenericStore<DashboardContent> implements DashboardContentStore
-{
- @SuppressWarnings("unchecked")
- public Collection<DashboardContent> getByDocument( Document document )
- {
- String hql = "from DashboardContent dc where :document in elements(dc.documents)";
- return getQuery( hql ).setEntity( "document", document ).list();
- }
-
- @SuppressWarnings("unchecked")
- public Collection<DashboardContent> getByMap( Map map )
- {
- String hql = "from DashboardContent dc where :map in elements(dc.maps)";
- return getQuery( hql ).setEntity( "map", map ).list();
- }
-
- @SuppressWarnings("unchecked")
- public Collection<DashboardContent> getByReport( Report report )
- {
- String hql = "from DashboardContent dc where :report in elements(dc.reports)";
- return getQuery( hql ).setEntity( "report", report ).list();
- }
-
- @SuppressWarnings("unchecked")
- public Collection<DashboardContent> getByReportTable( ReportTable reportTable )
- {
- String hql = "from DashboardContent dc where :reportTable in elements(dc.reportTables)";
- return getQuery( hql ).setEntity( "reportTable", reportTable ).list();
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-09-13 11:51:49 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-09-13 13:00:37 +0000
@@ -131,13 +131,6 @@
<property name="cacheable" value="true" />
</bean>
- <bean id="org.hisp.dhis.dashboard.DashboardContentStore" class="org.hisp.dhis.dashboard.hibernate.HibernateDashboardContentStore">
- <property name="clazz" value="org.hisp.dhis.dashboard.DashboardContent" />
- <property name="sessionFactory" ref="sessionFactory" />
- <property name="jdbcTemplate" ref="jdbcTemplate" />
- <property name="cacheable" value="true" />
- </bean>
-
<bean id="org.hisp.dhis.dashboard.DashboardService" class="org.hisp.dhis.dashboard.impl.DefaultDashboardService">
<property name="dashboardStore" ref="org.hisp.dhis.dashboard.DashboardStore" />
</bean>
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml 2013-08-29 18:09:46 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardContent.hbm.xml 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="org.hisp.dhis.dashboard.DashboardContent" table="dashboardcontent">
-
- <id name="id" column="dashboardcontentid">
- <generator class="foreign">
- <param name="property">user</param>
- </generator>
- </id>
-
- <one-to-one name="user" class="org.hisp.dhis.user.User" constrained="true" foreign-key="fk_dashboardcontent_userinfoid" />
-
- <list name="reports" table="dashboardcontent_reports">
- <key column="userid" foreign-key="fk_dashboardcontent_reports_userid" />
- <list-index column="sort_order" base="0" />
- <many-to-many column="reportid" class="org.hisp.dhis.report.Report" foreign-key="fk_dashboardcontent_reports_reportid" />
- </list>
-
- <list name="documents" table="dashboardcontent_documents">
- <key column="userid" foreign-key="fk_dashboardcontent_documents_userid" />
- <list-index column="sort_order" base="0" />
- <many-to-many column="documentid" class="org.hisp.dhis.document.Document" foreign-key="fk_dashboardcontent_documents_documentid" />
- </list>
-
- <list name="reportTables" table="dashboardcontent_reporttables">
- <key column="userid" foreign-key="fk_dashboardcontent_reporttables_userid" />
- <list-index column="sort_order" base="0" />
- <many-to-many column="reporttableid" class="org.hisp.dhis.reporttable.ReportTable" foreign-key="fk_dashboardcontent_reporttableid" />
- </list>
-
- <list name="maps" table="dashboardcontent_maps">
- <key column="userid" foreign-key="fk_dashboardcontent_maps_userid" />
- <list-index column="sort_order" base="0" />
- <many-to-many column="mapid" class="org.hisp.dhis.mapping.Map" foreign-key="fk_dashboardcontent_maps_mapid" />
- </list>
-
- </class>
-</hibernate-mapping>
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml 2013-08-29 17:10:32 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml 2013-09-13 13:00:37 +0000
@@ -34,7 +34,7 @@
<property name="text" column="interpretationtext" type="text" />
<many-to-one name="user" class="org.hisp.dhis.user.User" column="userid"
- foreign-key="fk_interpretation_userid" not-null="true" />
+ foreign-key="fk_interpretation_userid" />
<property name="created" not-null="true" type="timestamp" />
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java 2013-09-13 13:00:37 +0000
@@ -58,12 +58,14 @@
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.junit.Ignore;
import org.junit.Test;
/**
* @author Lars Helge Overland
* @version $Id$
*/
+@Ignore //TODO this test takes too long to run, reimplement
public class DataSetCompletenessServiceTest
extends DhisTest
{
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2013-09-13 11:51:49 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2013-09-13 13:00:37 +0000
@@ -89,7 +89,6 @@
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserSetting;
import org.hisp.dhis.validation.ValidationCriteria;
@@ -419,15 +418,6 @@
return null;
}
- public void deleteUserCredentials( UserCredentials credentials )
- {
- }
-
- public String allowDeleteUserCredentials( UserCredentials credentials )
- {
- return null;
- }
-
public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
{
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java 2013-09-13 13:00:37 +0000
@@ -146,7 +146,6 @@
}
else
{
- userService.deleteUserCredentials( userService.getUserCredentials( user ) );
userService.deleteUser( user );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java 2013-09-13 13:00:37 +0000
@@ -118,7 +118,6 @@
}
else
{
- userService.deleteUserCredentials( user.getUserCredentials() );
userService.deleteUser( user );
}