dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14771
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5115: Unused imports
------------------------------------------------------------
revno: 5115
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-11-04 10:34:37 +0100
message:
Unused imports
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.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-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java 2011-11-03 16:01:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java 2011-11-04 09:34:37 +0000
@@ -1,13 +1,5 @@
package org.hisp.dhis.common;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/*
* Copyright (c) 2004-2010, University of Oslo
* All rights reserved.
@@ -35,6 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @author Bob Jolliffe
*/
@@ -78,12 +78,11 @@
*/
private Date lastUpdated;
-
public AbstractIdentifiableObject()
{
}
- public AbstractIdentifiableObject( int id, String uuid, String name)
+ public AbstractIdentifiableObject( int id, String uuid, String name )
{
this.id = id;
this.uuid = uuid;
@@ -157,12 +156,13 @@
/**
* Set autogenerated fields on save or update
- *
+ *
*/
public void setAutoFields()
{
- if (uid == null) {
- setUid(CodeGenerator.generateCode());
+ if ( uid == null )
+ {
+ setUid( CodeGenerator.generateCode() );
}
if ( uuid == null )
@@ -175,7 +175,7 @@
/**
* Get a map of uuids to internal identifiers
- *
+ *
* @param objects the IdentifiableObjects to put in the map
* @return the map
*/
@@ -195,7 +195,7 @@
/**
* Get a map of uids to internal identifiers
- *
+ *
* @param objects the IdentifiableObjects to put in the map
* @return the map
*/
@@ -215,7 +215,7 @@
/**
* Get a map of codes to internal identifiers
- *
+ *
* @param objects the NameableObjects to put in the map
* @return the map
*/
@@ -227,7 +227,8 @@
String code = object.getCode();
int internalId = object.getId();
- if (code == null) continue;
+ if ( code == null )
+ continue;
// NOTE: its really not good that duplicate codes are possible
// Best we can do here is severe log and remove the item
@@ -235,12 +236,12 @@
{
log.warn( object.getClass() + ": Duplicate code " + code );
map.remove( code );
- } else
+ }
+ else
{
map.put( code, internalId );
}
}
return map;
- }
-
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java 2011-11-04 09:34:37 +0000
@@ -26,13 +26,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
/**
* @author Bob Jolliffe
*/
public abstract class AbstractNameableObject
extends AbstractIdentifiableObject implements NameableObject
{
-
/**
* Determines if a de-serialized file is compatible with this class.
*/
@@ -96,5 +96,4 @@
{
this.description = description;
}
-
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-11-04 09:34:37 +0000
@@ -27,9 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -89,6 +87,9 @@
public static final String AGGREGATION_OPERATOR_COUNT = "count";
+ /**
+ * The name to appear in forms.
+ */
private String formName;
/**
@@ -339,11 +340,22 @@
return false;
}
+ /**
+ * Returns the domain type, or the default domain type if it does not exist.
+ */
public String getDomainTypeNullSafe()
{
return domainType != null ? domainType : DOMAIN_TYPE_AGGREGATE;
}
+ /**
+ * Returns the form name, or the name if it does not exist.
+ */
+ public String getFormNameFallback()
+ {
+ return formName != null && !formName.isEmpty() ? formName : name;
+ }
+
public String toJSON()
{
StringBuffer result = new StringBuffer();
@@ -357,11 +369,6 @@
return result.toString();
}
- public String getFormNameFallback()
- {
- return formName != null && !formName.isEmpty() ? formName : name;
- }
-
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2011-11-03 10:48:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2011-11-04 09:34:37 +0000
@@ -1,23 +1,5 @@
package org.hisp.dhis.common;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.amplecode.quick.StatementHolder;
-import org.amplecode.quick.StatementManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.system.startup.AbstractStartupRoutine;
-import org.springframework.transaction.annotation.Transactional;
-
/*
* Copyright (c) 2004-2005, University of Oslo
* All rights reserved.
@@ -44,30 +26,39 @@
* (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.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.UUID;
+
+import org.amplecode.quick.StatementHolder;
+import org.amplecode.quick.StatementManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.system.startup.AbstractStartupRoutine;
+import org.springframework.transaction.annotation.Transactional;
+
/**
- *
* @author bobj
- * @version created 01-Nov-2011
*/
public class IdentityPopulator
extends AbstractStartupRoutine
{
-
private static final Log log = LogFactory.getLog( IdentityPopulator.class );
- private static String[] tables =
- {
- "constant", "attribute", "indicatortype", "indicatorgroupset", "indicator",
- "indicatorgroup", "datadictionary", "validationrulegroup", "validationrule",
- "dataset", "orgunitlevel", "organisationunit", "orgunitgroup",
- "orgunitgroupset", "dataelementcategoryoption", "dataelementgroup",
- "dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo",
- "categoryoptioncombo"
- };
+ private static String[] tables = { "constant", "attribute", "indicatortype", "indicatorgroupset", "indicator",
+ "indicatorgroup", "datadictionary", "validationrulegroup", "validationrule", "dataset", "orgunitlevel",
+ "organisationunit", "orgunitgroup", "orgunitgroupset", "dataelementcategoryoption", "dataelementgroup",
+ "dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo", "categoryoptioncombo" };
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
+
private StatementManager statementManager;
public void setStatementManager( StatementManager statementManager )
@@ -78,9 +69,11 @@
// -------------------------------------------------------------------------
// Execute
// -------------------------------------------------------------------------
+
@Transactional
@Override
- public void execute() throws SQLException
+ public void execute()
+ throws SQLException
{
StatementHolder holder = statementManager.getHolder();
@@ -92,8 +85,7 @@
{
Connection conn = dummyStatement.getConnection();
- statement = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
- ResultSet.CONCUR_UPDATABLE );
+ statement = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
for ( String table : tables )
{
@@ -140,18 +132,19 @@
log.info( count + " timestamps updated on " + table );
}
- } catch ( SQLException ex )
+ }
+ catch ( SQLException ex )
{
log.info( "Problem updating " + table + ": ", ex );
}
}
- } finally
+ }
+ finally
{
if ( statement != null )
{
statement.close();
}
}
-
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java 2011-11-04 09:34:37 +0000
@@ -1,10 +1,5 @@
package org.hisp.dhis.common.hibernate;
-
-import org.hisp.dhis.common.AbstractIdentifiableObject;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
-
/*
* Copyright (c) 2004-2005, University of Oslo
* All rights reserved.
@@ -32,10 +27,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.AbstractIdentifiableObject;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+
/**
- *
* @author bobj
- * @version created 01-Nov-2011
*/
public class HibernateIdentifiableObjectStore<T extends AbstractIdentifiableObject>
extends HibernateGenericStore<T> implements GenericIdentifiableObjectStore<T>
@@ -59,10 +56,8 @@
@Override
public final void saveOrUpdate( T object )
{
-
object.setAutoFields();
sessionFactory.getCurrentSession().saveOrUpdate( object );
}
-
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java 2011-10-18 20:23:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java 2011-11-04 09:34:37 +0000
@@ -371,10 +371,12 @@
props.setProperty( "settings.delete_after_processing", "yes" );
props.setProperty( "settings.send_mode", "async" );
props.store( new FileWriter( configFile ), "SMS Server Configuration" );
- } else
+ }
+ else
{
props.load( new FileReader( configFile ) );
}
+
return SUCCESS;
}
}