dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23876
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11628: Sms, code style
------------------------------------------------------------
revno: 11628
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-08-12 08:51:19 +0200
message:
Sms, code style
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/J2MEDataValueSMSListener.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.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/smscommand/SMSCode.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java 2013-03-09 14:12:57 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java 2013-08-12 06:51:19 +0000
@@ -31,13 +31,13 @@
public class SMSCode
{
- int id;
-
- String code;
-
- DataElement dataElement;
-
- int optionId;
+ private int id;
+
+ private String code;
+
+ private DataElement dataElement;
+
+ private int optionId;
public SMSCode( String code, DataElement dataElement, int optionId )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DataValueSMSListener.java 2013-08-12 06:51:19 +0000
@@ -134,7 +134,6 @@
OrganisationUnit orgUnit = this.selectOrganisationUnit( orgUnits, parsedMessage );
Period period = getPeriod( smsCommand, date );
- // Check if Data Set is locked
if ( dataSetService.isLocked( smsCommand.getDataset(), period, orgUnit, null ) )
{
throw new SMSParserException( "Dataset is locked for the period " + period.getStartDate() + " - "
@@ -142,6 +141,7 @@
}
boolean valueStored = false;
+
for ( SMSCode code : smsCommand.getCodes() )
{
if ( parsedMessage.containsKey( code.getCode().toUpperCase() ) )
@@ -232,6 +232,7 @@
{
// no date found
}
+
return date;
}
@@ -282,15 +283,16 @@
}
throw new SMSParserException( messageListingOrgUnits );
}
+
return orgUnit;
}
private Period getPeriod( SMSCommand command, Date date )
{
-
Period period;
period = command.getDataset().getPeriodType().createPeriod();
CalendarPeriodType cpt = (CalendarPeriodType) period.getPeriodType();
+
if ( command.isCurrentPeriodUsedForReporting() )
{
period = cpt.createPeriod( new Date() );
@@ -363,7 +365,6 @@
{
return false;
}
-
}
dv.setValue( value );
@@ -391,15 +392,14 @@
{
OrganisationUnit ou = u.getOrganisationUnit();
- // Might be undefined if the user has more than one org.units
- // "attached"
+ // Might be undefined if the user has more than one org units
if ( orgunit == null )
{
orgunit = ou;
}
else if ( orgunit.getId() == ou.getId() )
{
- // same orgunit, no problem...
+ // Same org unit
}
else
{
@@ -408,14 +408,13 @@
}
user = u;
}
+
return user;
}
- /* Checks if all defined data codes have values in the database */
private void markCompleteDataSet( String sender, OrganisationUnit orgunit, Map<String, String> parsedMessage,
SMSCommand command, Date date )
{
-
Period period = null;
for ( SMSCode code : command.getCodes() )
@@ -441,10 +440,9 @@
storedBy = "[unknown] from [" + sender + "]";
}
- // if new values are submitted re-register as complete
+ // If new values are submitted re-register as complete
deregisterCompleteDataSet( command.getDataset(), period, orgunit );
registerCompleteDataSet( command.getDataset(), period, orgunit, storedBy );
-
}
protected void sendSuccessFeedback( String sender, SMSCommand command, Map<String, String> parsedMessage,
@@ -621,7 +619,4 @@
{
this.incomingSmsService = incomingSmsService;
}
-
-
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java 2013-08-12 06:51:19 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.sms;
+/*
+ * Copyright (c) 2004-2012, 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.lang.Character.UnicodeBlock;
import java.util.ArrayList;
import java.util.HashSet;
@@ -21,7 +48,6 @@
public class DefaultSmsSender
implements SmsSender
{
-
private static final Log log = LogFactory.getLog( SmsSender.class );
private static int MAX_CHAR = 160;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/J2MEDataValueSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/J2MEDataValueSMSListener.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/J2MEDataValueSMSListener.java 2013-08-12 06:51:19 +0000
@@ -160,7 +160,6 @@
private Map<String, String> parse( String sms, SMSCommand smsCommand )
{
-
String[] keyValuePairs = null;
if ( sms.indexOf( "#" ) > -1 )
@@ -280,6 +279,7 @@
}
throw new SMSParserException( messageListingOrgUnits );
}
+
return orgUnit;
}
@@ -394,7 +394,6 @@
public Period getPeriod( String periodName, PeriodType periodType )
throws IllegalArgumentException
{
-
if ( periodType instanceof DailyPeriodType )
{
String pattern = "yyyy-MM-dd";
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java 2013-08-12 06:51:19 +0000
@@ -148,7 +148,6 @@
public void setListeners( List<IncomingSmsListener> listeners )
{
this.listeners = listeners;
- System.out.println( "Listener: " + listeners );
}
public SmsSender getSmsSender()
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java 2013-08-12 06:51:19 +0000
@@ -162,6 +162,5 @@
public void setMessageService( MessageService messageService )
{
this.messageService = messageService;
- }
-
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java 2013-08-12 06:51:19 +0000
@@ -129,5 +129,4 @@
{
return 0;
}
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java 2013-08-12 06:51:19 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.sms.hibernate;
+/*
+ * Copyright (c) 2004-2012, 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 java.util.Set;
@@ -18,7 +45,6 @@
public class HibernateSMSCommandStore
implements SMSCommandStore
{
-
protected SessionFactory sessionFactory;
@Required
@@ -99,6 +125,7 @@
Criteria criteria = sessionFactory.getCurrentSession().createCriteria( SMSCommand.class );
criteria.add( Restrictions.eq( "parserType", parserType ) );
criteria.add( Restrictions.eq( "name", commandName ) );
+
if ( criteria.list() != null && criteria.list().size() > 0 )
{
return (SMSCommand) criteria.list().get( 0 );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsService.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsService.java 2013-08-12 06:51:19 +0000
@@ -37,7 +37,6 @@
public class DefaultOutboundSmsService
implements OutboundSmsService
{
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java 2013-08-12 04:24:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/outbound/DefaultOutboundSmsTransportService.java 2013-08-12 06:51:19 +0000
@@ -550,5 +550,4 @@
{
this.smsPublisher = smsPublisher;
}
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java 2013-07-16 06:53:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java 2013-08-12 06:51:19 +0000
@@ -1,5 +1,32 @@
package org.hisp.dhis.smscommand;
+/*
+ * Copyright (c) 2004-2012, 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 java.util.Set;
@@ -8,15 +35,12 @@
public class DefaultSMSCommandService
implements SMSCommandService
-{
-
- private SMSCommandStore smsCommandStore;
+{ private SMSCommandStore smsCommandStore;
@Override
public void updateSMSCommand( SMSCommand cmd )
{
- // TODO Auto-generated method stub
-
+ // TODO
}
@Override