dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26252
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13005: remove codes, special characters when update sms commands
------------------------------------------------------------
revno: 13005
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-11-22 11:59:36 +0700
message:
remove codes, special characters when update sms commands
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.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/smscommand/DefaultSMSCommandService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.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/SMSCommandService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java 2013-11-20 04:03:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java 2013-11-22 04:59:36 +0000
@@ -52,4 +52,8 @@
SMSCommand getSMSCommand( String commandName, ParserType parserType );
void saveSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters );
+
+ void deleteSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters );
+
+ void deleteCodeSet( Set<SMSCode> codes );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java 2013-11-20 04:03:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java 2013-11-22 04:59:36 +0000
@@ -50,4 +50,8 @@
SMSCommand getSMSCommand( String commandName, ParserType parserType );
void saveSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters );
+
+ void deleteSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters );
+
+ void deleteCodeSet( Set<SMSCode> codes );
}
=== 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-11-20 04:03:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java 2013-11-22 04:59:36 +0000
@@ -148,4 +148,27 @@
session.saveOrUpdate( x );
}
}
+
+
+ @Override
+ public void deleteCodeSet( Set<SMSCode> codes )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ for ( SMSCode x : codes )
+ {
+ session.delete( x );
+ }
+ }
+
+ @Override
+ public void deleteSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ for ( SMSSpecialCharacter x : specialCharacters )
+ {
+ session.delete( x );
+ }
+ }
}
=== 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-11-20 04:03:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java 2013-11-22 04:59:36 +0000
@@ -92,4 +92,18 @@
{
smsCommandStore.saveSpecialCharacterSet( specialCharacters );
}
+
+ @Override
+ public void deleteCodeSet( Set<SMSCode> codes )
+ {
+ smsCommandStore.deleteCodeSet( codes );
+
+ }
+
+ @Override
+ public void deleteSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters )
+ {
+ smsCommandStore.deleteSpecialCharacterSet( specialCharacters );
+
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java 2013-11-20 04:03:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java 2013-11-22 04:59:36 +0000
@@ -147,11 +147,21 @@
}
SMSCommand c = getSMSCommand();
+
if ( selectedDataSetID > -1 && c != null )
{
c.setCurrentPeriodUsedForReporting( currentPeriodUsedForReporting );
c.setName( name );
c.setSeparator( separator );
+
+ //remove codes
+ Set<SMSCode> toRemoveCodes = c.getCodes();
+ smsCommandService.deleteCodeSet( toRemoveCodes );
+
+ //remove special characters
+ Set<SMSSpecialCharacter> toRemoveCharacters = c.getSpecialCharacters();
+ smsCommandService.deleteSpecialCharacterSet( toRemoveCharacters );
+
c.setCodes( codeSet );
c.setDefaultMessage( defaultMessage );
c.setReceivedMessage( receivedMessage );
@@ -159,7 +169,6 @@
{
c.setUserGroup( userGroupService.getUserGroup( userGroupID ) );
}
- c.getSpecialCharacters().removeAll( c.getSpecialCharacters() );
c.setSpecialCharacters( specialCharacterSet );
smsCommandService.save( c );
}