dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04486
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1501: Codestyle and minor fixes
------------------------------------------------------------
revno: 1501
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-02-25 13:09:35 +0100
message:
Codestyle and minor fixes
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormPopulator.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/hibernate/HibernateDataEntryFormAssociationStore.java
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.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.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormDeletionHandler.java 2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormDeletionHandler.java 2010-02-25 12:09:35 +0000
@@ -52,20 +52,20 @@
{
this.dataEntryFormService = dataEntryFormService;
}
-
+
private DeletionManager deletionManager;
public void setDeletionManager( DeletionManager deletionManager )
{
this.deletionManager = deletionManager;
}
-
+
private DataEntryFormAssociationService dataEntryFormAssociationService;
-
- public void setDataEntryFormAssociationService(
- DataEntryFormAssociationService dataEntryFormAssociationService) {
- this.dataEntryFormAssociationService = dataEntryFormAssociationService;
- }
+
+ public void setDataEntryFormAssociationService( DataEntryFormAssociationService dataEntryFormAssociationService )
+ {
+ this.dataEntryFormAssociationService = dataEntryFormAssociationService;
+ }
// -------------------------------------------------------------------------
// DeletionHandler implementation
@@ -76,38 +76,23 @@
{
return DataEntryForm.class.getSimpleName();
}
-
-// @Override
-// public void deleteDataSet( DataSet dataSet )
-// {
-// for ( DataEntryForm form : dataEntryFormService.getAllDataEntryForms() )
-// {
-// if ( form.getDataSet().equals( dataSet ) )
-// {
-// deletionManager.execute( form );
-//
-// dataEntryFormService.deleteDataEntryForm( form );
-// }
-// }
-// }
-//
+
@Override
public void deleteDataSet( DataSet dataSet )
{
- DataEntryFormAssociation dataEntryFormAssociation =
- dataEntryFormAssociationService.getDataEntryFormAssociation(
- DataEntryFormAssociation.DATAENTRY_ASSOCIATE_DATASET, dataSet.getId());
-
- if( dataEntryFormAssociation != null )
- {
- DataEntryForm dataEntryForm = dataEntryFormAssociation.getDataEntryForm();
-
- if( dataEntryForm != null )
- {
- deletionManager.execute( dataEntryForm );
-
- dataEntryFormService.deleteDataEntryForm( dataEntryForm );
- }
- }
- }
+ DataEntryFormAssociation dataEntryFormAssociation = dataEntryFormAssociationService
+ .getDataEntryFormAssociation( DataEntryFormAssociation.DATAENTRY_ASSOCIATE_DATASET, dataSet.getId() );
+
+ if ( dataEntryFormAssociation != null )
+ {
+ DataEntryForm dataEntryForm = dataEntryFormAssociation.getDataEntryForm();
+
+ if ( dataEntryForm != null )
+ {
+ deletionManager.execute( dataEntryForm );
+
+ dataEntryFormService.deleteDataEntryForm( dataEntryForm );
+ }
+ }
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormPopulator.java 2010-02-25 06:50:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormPopulator.java 2010-02-25 12:09:35 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.dataentryform;
+/*
+ * Copyright (c) 2004-2007, 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 org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.jdbc.StatementBuilder;
@@ -7,7 +34,9 @@
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;
-@Transactional
+/**
+ * @author Viet
+ */
public class DataEntryFormPopulator
extends AbstractStartupRoutine
{
@@ -35,27 +64,21 @@
// Execute
// -------------------------------------------------------------------------
+ @Transactional
public void execute()
throws Exception
{
- log.info( "Remove datasetid column from dataentryform table" );
+ log.info( "Removing datasetid column from dataentryform table" );
+
try
{
- executeTransactional();
+ jdbcTemplate.execute( "INSERT INTO dataentryformassociation SELECT 'dataset', datasetid, dataentryformid FROM dataentryform;" );
+ jdbcTemplate.execute( statementBuilder.getDropDatasetForeignKeyForDataEntryFormTable() );
+ jdbcTemplate.execute( "ALTER TABLE dataentryform DROP COLUMN datasetid;" );
}
catch ( Exception ex )
{
log.debug( ex );
}
}
-
- @Transactional( rollbackFor = Exception.class )
- public void executeTransactional()
- throws Exception
- {
- jdbcTemplate.execute( "INSERT INTO dataentryformassociation SELECT 'dataset', datasetid, dataentryformid FROM dataentryform;" );
- jdbcTemplate.execute( statementBuilder.getDropDatasetForeignKeyForDataEntryFormTable() );
- jdbcTemplate.execute( "ALTER TABLE dataentryform DROP COLUMN datasetid;" );
- }
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2010-02-25 12:09:35 +0000
@@ -56,31 +56,30 @@
{
this.dataEntryFormStore = dataEntryFormStore;
}
-
+
private DataEntryFormAssociationService dataEntryFormAssociationService;
-
- public void setDataEntryFormAssociationService(
- DataEntryFormAssociationService dataEntryFormAssociationService )
+
+ public void setDataEntryFormAssociationService( DataEntryFormAssociationService dataEntryFormAssociationService )
{
this.dataEntryFormAssociationService = dataEntryFormAssociationService;
}
-
+
// ------------------------------------------------------------------------
// Implemented Methods
// ------------------------------------------------------------------------
public int addDataEntryForm( DataEntryForm dataEntryForm, String associationTableName, int associationId )
{
- int dataEntryFormId = dataEntryFormStore.addDataEntryForm( dataEntryForm );
-
- DataEntryForm dataEF = dataEntryFormStore.getDataEntryForm( dataEntryFormId );
-
- DataEntryFormAssociation dataAssociation = new DataEntryFormAssociation(associationTableName, associationId, dataEF);
-
+ int dataEntryFormId = dataEntryFormStore.addDataEntryForm( dataEntryForm );
+
+ DataEntryForm form = dataEntryFormStore.getDataEntryForm( dataEntryFormId );
+
+ DataEntryFormAssociation dataAssociation = new DataEntryFormAssociation( associationTableName, associationId, form );
+
dataEntryFormAssociationService.addDataEntryFormAssociation( dataAssociation );
-
+
return dataEntryFormId;
-
+
}
public void updateDataEntryForm( DataEntryForm dataEntryForm )
@@ -90,16 +89,15 @@
public void deleteDataEntryForm( DataEntryForm dataEntryForm )
{
-
- DataEntryFormAssociation entryFormAssociation = dataEntryFormAssociationService.
- getDataEntryFormAssociationByDataEntryForm(dataEntryForm);
-
- if( entryFormAssociation != null )
+ DataEntryFormAssociation entryFormAssociation = dataEntryFormAssociationService
+ .getDataEntryFormAssociationByDataEntryForm( dataEntryForm );
+
+ if ( entryFormAssociation != null )
{
- dataEntryFormAssociationService.deleteDataEntryFormAssociation(entryFormAssociation);
+ dataEntryFormAssociationService.deleteDataEntryFormAssociation( entryFormAssociation );
}
-
- dataEntryFormStore.deleteDataEntryForm( dataEntryForm );
+
+ dataEntryFormStore.deleteDataEntryForm( dataEntryForm );
}
public DataEntryForm getDataEntryForm( int id )
@@ -114,36 +112,35 @@
public DataEntryForm getDataEntryFormByDataSet( DataSet dataSet )
{
- if( dataSet != null )
+ if ( dataSet != null )
{
-
- DataEntryFormAssociation dataAssociation = dataEntryFormAssociationService.getDataEntryFormAssociation(
- DataEntryFormAssociation.DATAENTRY_ASSOCIATE_DATASET, dataSet.getId());
- if( dataAssociation != null )
- {
- return dataAssociation.getDataEntryForm();
- }
-
+ DataEntryFormAssociation dataAssociation = dataEntryFormAssociationService.getDataEntryFormAssociation(
+ DataEntryFormAssociation.DATAENTRY_ASSOCIATE_DATASET, dataSet.getId() );
+
+ if ( dataAssociation != null )
+ {
+ return dataAssociation.getDataEntryForm();
+ }
}
-
- return null;
+
+ return null;
}
-
+
public DataEntryForm getDataEntryFormByProgramStage( ProgramStage programStage )
{
- if( programStage != null )
+ if ( programStage != null )
{
- DataEntryFormAssociation dataAssociation = dataEntryFormAssociationService.getDataEntryFormAssociation(
- DataEntryFormAssociation.DATAENTRY_ASSOCIATE_PROGRAMSTAGE, programStage.getId());
- if( dataAssociation != null )
- {
- return dataAssociation.getDataEntryForm();
- }
-
+ DataEntryFormAssociation dataAssociation = dataEntryFormAssociationService.getDataEntryFormAssociation(
+ DataEntryFormAssociation.DATAENTRY_ASSOCIATE_PROGRAMSTAGE, programStage.getId() );
+ if ( dataAssociation != null )
+ {
+ return dataAssociation.getDataEntryForm();
+ }
+
}
-
- return null;
+
+ return null;
}
public Collection<DataEntryForm> getAllDataEntryForms()
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/hibernate/HibernateDataEntryFormAssociationStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/hibernate/HibernateDataEntryFormAssociationStore.java 2010-02-22 15:25:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/hibernate/HibernateDataEntryFormAssociationStore.java 2010-02-25 12:09:35 +0000
@@ -38,7 +38,6 @@
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.dataentryform.DataEntryFormAssociation;
import org.hisp.dhis.dataentryform.DataEntryFormAssociationStore;
-import org.springframework.orm.hibernate3.HibernateQueryException;
/**
* @author Viet
@@ -64,14 +63,8 @@
public void addDataEntryFormAssociation( DataEntryFormAssociation dataEntryFormAssociation )
{
Session session = sessionFactory.getCurrentSession();
-
- try {
- System.out.println("save ne");
- session.save( dataEntryFormAssociation );
- }catch (HibernateQueryException e) {
- e.printStackTrace();
- }
+ session.save( dataEntryFormAssociation );
}
public void deleteDataEntryFormAssociation( DataEntryFormAssociation dataEntryFormAssociation )
@@ -93,6 +86,7 @@
Criteria criteria = session.createCriteria( DataEntryFormAssociation.class );
criteria.add( Restrictions.eq( "associationTableName", associationTableName ) ).add(
Restrictions.eq( "associationId", associationId ) );
+
return (DataEntryFormAssociation) criteria.uniqueResult();
}
@@ -110,15 +104,18 @@
return (DataEntryFormAssociation) criteria.uniqueResult();
}
-
+
@SuppressWarnings( "unchecked" )
- public Collection<DataEntryForm> listDisctinctDataEntryFormByAssociationIds(String associationName, List<Integer> associationIds )
+ public Collection<DataEntryForm> listDisctinctDataEntryFormByAssociationIds( String associationName,
+ List<Integer> associationIds )
{
Session session = sessionFactory.getCurrentSession();
- Criteria criteria = session.createCriteria( DataEntryFormAssociation.class )
- .add( Restrictions.eq( "associationTableName", associationName ) )
- .add( Restrictions.in( "associationId", associationIds ) )
- .setProjection( Projections.distinct( Projections.property( "dataEntryForm" ) ) );
+
+ Criteria criteria = session.createCriteria( DataEntryFormAssociation.class ).add(
+ Restrictions.eq( "associationTableName", associationName ) ).add(
+ Restrictions.in( "associationId", associationIds ) ).setProjection(
+ Projections.distinct( Projections.property( "dataEntryForm" ) ) );
+
return criteria.list();
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java 2009-11-11 04:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java 2010-02-25 12:09:35 +0000
@@ -39,98 +39,111 @@
*/
@Transactional
-public class DefaultExcelItemService implements ExcelItemService {
-
- // -------------------------------------------------
- // Dependency
- // -------------------------------------------------
-
- private ExcelItemStore excelItemStore;
-
- public void setExcelItemStore(ExcelItemStore excelItemStore) {
- this.excelItemStore = excelItemStore;
- }
-
- // --------------------------------------
- // Excelitem group Services
- // --------------------------------------
-
- public int addExcelItemGroup(ExcelItemGroup excelItemGroup) {
-
- return excelItemStore.addExcelItemGroup(excelItemGroup);
- }
-
- public void deleteExcelItemGroup(int id) {
-
- excelItemStore.deleteExcelItemGroup(id);
- }
-
- public Collection<ExcelItemGroup> getAllExcelItemGroup() {
-
- return excelItemStore.getAllExcelItemGroup();
- }
-
- public ExcelItemGroup getExcelItemGroup(int id) {
-
- return excelItemStore.getExcelItemGroup(id);
- }
-
- public void updateExcelItemGroup(ExcelItemGroup excelItemGroup) {
-
- excelItemStore.updateExcelItemGroup(excelItemGroup);
- }
-
- public Collection<ExcelItemGroup> getExcelItemGroupsByOrganisationUnit(
- OrganisationUnit organisationUnit) {
-
- return excelItemStore
- .getExcelItemGroupsByOrganisationUnit(organisationUnit);
- }
-
- // --------------------------------------
- // Excelitem Services
- // --------------------------------------
-
- public int addExcelItem(ExcelItem excelItem) {
-
- return excelItemStore.addExcelItem(excelItem);
- }
-
- public void deleteExcelItem(int id) {
-
- excelItemStore.deleteExcelItem(id);
- }
-
- public Collection<ExcelItem> getAllExcelItem() {
-
- return excelItemStore.getAllExcelItem();
- }
-
- public void updateExcelItem(ExcelItem excelItem) {
-
- excelItemStore.updateExcelItem(excelItem);
- }
-
- public ExcelItem getExcelItem(int id) {
-
- return excelItemStore.getExcelItem(id);
- }
-
- // --------------------------------------
- // DataElement Order
- // --------------------------------------
-
- public DataElementGroupOrder getDataElementGroupOrder(Integer id) {
- return excelItemStore.getDataElementGroupOrder(id);
- }
-
- public void updateDataElementGroupOrder(
- DataElementGroupOrder dataElementGroupOrder) {
- excelItemStore.updateDataElementGroupOrder(dataElementGroupOrder);
- }
-
- public void deleteDataElementGroupOrder(Integer id) {
- excelItemStore.deleteDataElementGroupOrder(id);
- }
+public class DefaultExcelItemService
+ implements ExcelItemService
+{
+ // -------------------------------------------------
+ // Dependency
+ // -------------------------------------------------
+
+ private ExcelItemStore excelItemStore;
+
+ public void setExcelItemStore( ExcelItemStore excelItemStore )
+ {
+ this.excelItemStore = excelItemStore;
+ }
+
+ // --------------------------------------
+ // Excelitem group Services
+ // --------------------------------------
+
+ public int addExcelItemGroup( ExcelItemGroup excelItemGroup )
+ {
+
+ return excelItemStore.addExcelItemGroup( excelItemGroup );
+ }
+
+ public void deleteExcelItemGroup( int id )
+ {
+
+ excelItemStore.deleteExcelItemGroup( id );
+ }
+
+ public Collection<ExcelItemGroup> getAllExcelItemGroup()
+ {
+
+ return excelItemStore.getAllExcelItemGroup();
+ }
+
+ public ExcelItemGroup getExcelItemGroup( int id )
+ {
+
+ return excelItemStore.getExcelItemGroup( id );
+ }
+
+ public void updateExcelItemGroup( ExcelItemGroup excelItemGroup )
+ {
+
+ excelItemStore.updateExcelItemGroup( excelItemGroup );
+ }
+
+ public Collection<ExcelItemGroup> getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+
+ return excelItemStore.getExcelItemGroupsByOrganisationUnit( organisationUnit );
+ }
+
+ // --------------------------------------
+ // Excelitem Services
+ // --------------------------------------
+
+ public int addExcelItem( ExcelItem excelItem )
+ {
+
+ return excelItemStore.addExcelItem( excelItem );
+ }
+
+ public void deleteExcelItem( int id )
+ {
+
+ excelItemStore.deleteExcelItem( id );
+ }
+
+ public Collection<ExcelItem> getAllExcelItem()
+ {
+
+ return excelItemStore.getAllExcelItem();
+ }
+
+ public void updateExcelItem( ExcelItem excelItem )
+ {
+
+ excelItemStore.updateExcelItem( excelItem );
+ }
+
+ public ExcelItem getExcelItem( int id )
+ {
+
+ return excelItemStore.getExcelItem( id );
+ }
+
+ // --------------------------------------
+ // DataElement Order
+ // --------------------------------------
+
+ public DataElementGroupOrder getDataElementGroupOrder( Integer id )
+ {
+ return excelItemStore.getDataElementGroupOrder( id );
+ }
+
+ public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder )
+ {
+ excelItemStore.updateDataElementGroupOrder( dataElementGroupOrder );
+ }
+
+ public void deleteDataElementGroupOrder( Integer id )
+ {
+ excelItemStore.deleteDataElementGroupOrder( id );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java 2009-11-11 04:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java 2010-02-25 12:09:35 +0000
@@ -46,157 +46,161 @@
* @version $Id$
*/
-public class HibernateExcelItemStore implements ExcelItemStore {
-
- // ----------------------------------------------------------------------
- // Dependencies
- // ----------------------------------------------------------------------
-
- private SessionFactory sessionFactory;
-
- public void setSessionFactory(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
-
- private PeriodStore periodStore;
+public class HibernateExcelItemStore
+ implements ExcelItemStore
+{
+ // ----------------------------------------------------------------------
+ // Dependencies
+ // ----------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+ private PeriodStore periodStore;
public void setPeriodStore( PeriodStore periodStore )
{
this.periodStore = periodStore;
}
- // ----------------------------------------------------------------------
- // ExcelItemStore implementation
- // ----------------------------------------------------------------------
-
- public int addExcelItem(ExcelItem excelItem) {
-
- Session session = sessionFactory.getCurrentSession();
+ // ----------------------------------------------------------------------
+ // ExcelItemStore implementation
+ // ----------------------------------------------------------------------
+
+ public int addExcelItem( ExcelItem excelItem )
+ {
+ Session session = sessionFactory.getCurrentSession();
return (Integer) session.save( excelItem );
- }
-
- public void deleteExcelItem(int id) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.delete(getExcelItem(id));
- }
-
- @SuppressWarnings("unchecked")
- public Collection<ExcelItem> getAllExcelItem() {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(ExcelItem.class);
-
- return criteria.list();
- }
-
- public void updateExcelItem(ExcelItem excelItem) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.saveOrUpdate(excelItem);
- }
-
- public ExcelItem getExcelItem(int id) {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(ExcelItem.class);
-
- criteria.add(Restrictions.eq("id", id));
-
- return (ExcelItem) criteria.uniqueResult();
- }
-
- public int addExcelItemGroup(ExcelItemGroup excelItemGroup) {
-
- PeriodType periodType = periodStore.getPeriodType( excelItemGroup.getPeriodType().getClass() );
-
- excelItemGroup.setPeriodType( periodType );
+ }
+
+ public void deleteExcelItem( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete( getExcelItem( id ) );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<ExcelItem> getAllExcelItem()
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ExcelItem.class );
+
+ return criteria.list();
+ }
+
+ public void updateExcelItem( ExcelItem excelItem )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.saveOrUpdate( excelItem );
+ }
+
+ public ExcelItem getExcelItem( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ExcelItem.class );
+
+ criteria.add( Restrictions.eq( "id", id ) );
+
+ return (ExcelItem) criteria.uniqueResult();
+ }
+
+ public int addExcelItemGroup( ExcelItemGroup excelItemGroup )
+ {
+ PeriodType periodType = periodStore.getPeriodType( excelItemGroup.getPeriodType().getClass() );
+
+ excelItemGroup.setPeriodType( periodType );
Session session = sessionFactory.getCurrentSession();
return (Integer) session.save( excelItemGroup );
- }
-
- public void deleteExcelItemGroup(int id) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.delete(getExcelItemGroup(id));
- }
-
- @SuppressWarnings("unchecked")
- public Collection<ExcelItemGroup> getAllExcelItemGroup() {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(ExcelItemGroup.class);
-
- return criteria.list();
- }
-
- public ExcelItemGroup getExcelItemGroup(int id) {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(ExcelItemGroup.class);
-
- criteria.add(Restrictions.eq("id", id));
-
- return (ExcelItemGroup) criteria.uniqueResult();
- }
-
- public void updateExcelItemGroup(ExcelItemGroup excelItemGroup) {
-
- PeriodType periodType = periodStore.getPeriodType( excelItemGroup.getPeriodType().getClass() );
-
- excelItemGroup.setPeriodType( periodType );
+ }
+
+ public void deleteExcelItemGroup( int id )
+ {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete( getExcelItemGroup( id ) );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<ExcelItemGroup> getAllExcelItemGroup()
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ExcelItemGroup.class );
+
+ return criteria.list();
+ }
+
+ public ExcelItemGroup getExcelItemGroup( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ExcelItemGroup.class );
+
+ criteria.add( Restrictions.eq( "id", id ) );
+
+ return (ExcelItemGroup) criteria.uniqueResult();
+ }
+
+ public void updateExcelItemGroup( ExcelItemGroup excelItemGroup )
+ {
+ PeriodType periodType = periodStore.getPeriodType( excelItemGroup.getPeriodType().getClass() );
+
+ excelItemGroup.setPeriodType( periodType );
Session session = sessionFactory.getCurrentSession();
session.update( excelItemGroup );
- }
-
- @SuppressWarnings("unchecked")
- public Collection<ExcelItemGroup> getExcelItemGroupsByOrganisationUnit(
- OrganisationUnit organisationUnit) {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(ExcelItemGroup.class);
-
- criteria.createAlias("organisationAssocitions", "o");
-
- criteria.add(Restrictions.eq("o.id", organisationUnit.getId()));
-
- return criteria.list();
- }
-
- public DataElementGroupOrder getDataElementGroupOrder(Integer id) {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(DataElementGroupOrder.class);
-
- criteria.add(Restrictions.eq("id", id.intValue()));
-
- return (DataElementGroupOrder) criteria.uniqueResult();
- }
-
- public void updateDataElementGroupOrder(
- DataElementGroupOrder dataElementGroupOrder) {
- Session session = sessionFactory.getCurrentSession();
- session.update(dataElementGroupOrder);
- }
-
- public void deleteDataElementGroupOrder(Integer id) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.delete(getDataElementGroupOrder(id));
- }
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<ExcelItemGroup> getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ExcelItemGroup.class );
+
+ criteria.createAlias( "organisationAssocitions", "o" );
+
+ criteria.add( Restrictions.eq( "o.id", organisationUnit.getId() ) );
+
+ return criteria.list();
+ }
+
+ public DataElementGroupOrder getDataElementGroupOrder( Integer id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( DataElementGroupOrder.class );
+
+ criteria.add( Restrictions.eq( "id", id.intValue() ) );
+
+ return (DataElementGroupOrder) criteria.uniqueResult();
+ }
+
+ public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ session.update( dataElementGroupOrder );
+ }
+
+ public void deleteDataElementGroupOrder( Integer id )
+ {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete( getDataElementGroupOrder( id ) );
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java 2009-12-21 08:11:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java 2010-02-25 12:09:35 +0000
@@ -136,11 +136,11 @@
group.getReportExcels().add( reportExcel );
}
-
- group.getAuthorities().addAll( selectedListAuthority );
-
- userStore.addUserAuthorityGroup( group );
-
+
+ group.getAuthorities().addAll( selectedListAuthority );
+
+ userStore.addUserAuthorityGroup( group );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java 2010-02-25 03:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java 2010-02-25 12:09:35 +0000
@@ -71,7 +71,6 @@
public String execute()
throws Exception
{
-
userAuthorityGroups = new ArrayList<UserAuthorityGroup>( userStore.getAllUserAuthorityGroups() );
return SUCCESS;
=== 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 2010-02-25 03:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java 2010-02-25 12:09:35 +0000
@@ -117,6 +117,7 @@
}
UserCredentials userCredentials = userStore.getUserCredentials( user );
+
if ( userService.isLastSuperUser( userCredentials ) )
{
message = i18n.getString( "can_not_remove_last_super_user" );