dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06235
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1956: Codestyle fix
------------------------------------------------------------
revno: 1956
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-06-03 11:22:33 +0200
message:
Codestyle fix
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/SplashUploadAction.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/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2010-06-02 22:52:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2010-06-03 09:22:33 +0000
@@ -156,19 +156,11 @@
{
Set<DataSet> dataSets = new HashSet<DataSet>();
- dataSets: for ( DataSet dataSet : getAllDataSets() )
+ for ( Source source : sources )
{
- for ( Source source : sources )
- {
- if ( dataSet.getSources().contains( source ) )
- {
- dataSets.add( dataSet );
-
- continue dataSets;
- }
- }
+ dataSets.addAll( getDataSetsBySource( source ) );
}
-
+
return dataSets;
}
@@ -268,9 +260,6 @@
for ( DataSet dataSet : dataSetListByPeriodType )
{
- // DataEntryForm dataEntryForm =
- // dataEntryFormService.getDataEntryFormByDataSet( dataSet );
-
if ( dataSet.getSources() != null )
{
assignedDataSetListByPeriodType.add( dataSet );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java 2010-05-28 09:12:03 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java 2010-06-03 09:22:33 +0000
@@ -60,6 +60,7 @@
import org.hisp.dhis.order.manager.DataElementOrderManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.util.TimeUtils;
import com.opensymphony.xwork2.Action;
@@ -308,6 +309,7 @@
public String execute()
throws Exception
{
+ TimeUtils.markHMS( "1" );
zeroValueSaveMode = (Boolean) systemSettingManager.getSystemSetting( KEY_ZERO_VALUE_SAVE_MODE, false );
OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
@@ -316,10 +318,12 @@
customValues = (List<CustomValue>) customValueService.getCustomValuesByDataSet( dataSet );
+ TimeUtils.markHMS( "2" );
Period period = selectedStateManager.getSelectedPeriod();
DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+ TimeUtils.markHMS( "3" );
if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) )
{
disabled = "disabled";
@@ -327,6 +331,7 @@
Collection<DataElement> dataElements = new ArrayList<DataElement>( dataSetService.getDataElements( dataSet ) );
+ TimeUtils.markHMS( "4" );
if ( dataElements.size() == 0 )
{
return SUCCESS;
@@ -336,6 +341,7 @@
optionComboId = defaultOptionCombo.getId();
+ TimeUtils.markHMS( "5" );
// ---------------------------------------------------------------------
// Get the min/max values
// ---------------------------------------------------------------------
@@ -343,6 +349,7 @@
Collection<MinMaxDataElement> minMaxDataElements = minMaxDataElementService.getMinMaxDataElements(
organisationUnit, dataElements );
+ TimeUtils.markHMS( "6" );
minMaxMap = new HashMap<Integer, MinMaxDataElement>( minMaxDataElements.size() );
for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
@@ -354,8 +361,10 @@
// Get the DataValues and create a map
// ---------------------------------------------------------------------
+ TimeUtils.markHMS( "7" );
Collection<DataValue> dataValues = dataValueService.getDataValues( organisationUnit, period, dataElements );
+ TimeUtils.markHMS( "8" );
dataValueMap = new HashMap<Integer, DataValue>( dataValues.size() );
for ( DataValue dataValue : dataValues )
@@ -367,15 +376,18 @@
// Prepare values for unsaved CalculatedDataElements
// ---------------------------------------------------------------------
+ TimeUtils.markHMS( "9" );
calculatedValueMap = dataEntryScreenManager.populateValuesForCalculatedDataElements( organisationUnit, dataSet,
period );
+ TimeUtils.markHMS( "10" );
// ---------------------------------------------------------------------
// Make the standard comments available
// ---------------------------------------------------------------------
standardComments = standardCommentsManager.getStandardComments();
+ TimeUtils.markHMS( "11" );
// ---------------------------------------------------------------------
// Make the DataElement types available
// ---------------------------------------------------------------------
@@ -393,6 +405,7 @@
dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet );
cdeFormExists = (dataEntryForm != null);
+ TimeUtils.markHMS( "12" );
if ( cdeFormExists )
{
customDataEntryFormCode = dataEntryScreenManager.populateCustomDataEntryScreen(
@@ -400,6 +413,7 @@
i18n, dataSet );
}
+ TimeUtils.markHMS( "13" );
// ---------------------------------------------------------------------
// Working on the display of dataelements
// ---------------------------------------------------------------------
@@ -408,6 +422,7 @@
displayPropertyHandler.handle( orderedDataElements );
+ TimeUtils.markHMS( "14" );
return SUCCESS;
}
}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java 2010-06-03 07:25:02 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java 2010-06-03 09:22:33 +0000
@@ -30,7 +30,8 @@
import com.opensymphony.xwork2.Action;
import java.io.File;
-public class MobileHomePageAction implements Action
+public class MobileHomePageAction
+ implements Action
{
@Override
@@ -38,22 +39,22 @@
throws Exception
{
File miFolder = new File( System.getenv( "DHIS2_HOME" ), "mi" );
- if ( !( miFolder.exists() && miFolder.isDirectory() ) )
+ if ( !(miFolder.exists() && miFolder.isDirectory()) )
{
miFolder.mkdir();
}
File pendingFolder = new File( miFolder, "pending" );
- if ( !( pendingFolder.exists() && pendingFolder.isDirectory() ) )
+ if ( !(pendingFolder.exists() && pendingFolder.isDirectory()) )
{
pendingFolder.mkdir();
}
File bouncedFolder = new File( miFolder, "bounced" );
- if ( !( bouncedFolder.exists() && bouncedFolder.isDirectory() ) )
+ if ( !(bouncedFolder.exists() && bouncedFolder.isDirectory()) )
{
bouncedFolder.mkdir();
}
File completedFolder = new File( miFolder, "completed" );
- if ( !( completedFolder.exists() && completedFolder.isDirectory() ) )
+ if ( !(completedFolder.exists() && completedFolder.isDirectory()) )
{
completedFolder.mkdir();
}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java 2010-06-03 07:25:02 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java 2010-06-03 09:22:33 +0000
@@ -29,18 +29,20 @@
import com.opensymphony.xwork2.Action;
import java.io.File;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.hisp.dhis.mobile.SmsService;
import org.hisp.dhis.mobile.api.MobileImportService;
-public class ReceiveImportPageAction implements Action
+public class ReceiveImportPageAction
+ implements Action
{
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
+
SmsService smsService;
public void setSmsService( SmsService smsService )
@@ -80,7 +82,8 @@
if ( statAction.equalsIgnoreCase( "Start" ) )
{
this.result = smsService.startService();
- } else
+ }
+ else
{
this.result = smsService.stopService();
}
@@ -98,11 +101,9 @@
public List<File> getPending()
{
- File pendingFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator + "pending" );
- pending = (List<File>) FileUtils.listFiles( pendingFolder, new String[]
- {
- "xml"
- }, false );
+ File pendingFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator
+ + "pending" );
+ pending = new ArrayList<File>( FileUtils.listFiles( pendingFolder, new String[] { "xml" }, false ) );
return pending;
}
@@ -110,11 +111,9 @@
public List<File> getBounced()
{
- File bouncedFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator + "bounced" );
- bounced = (List<File>) FileUtils.listFiles( bouncedFolder, new String[]
- {
- "xml"
- }, false );
+ File bouncedFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator
+ + "bounced" );
+ bounced = new ArrayList<File>( FileUtils.listFiles( bouncedFolder, new String[] { "xml" }, false ) );
return bounced;
}
@@ -122,11 +121,9 @@
public List<File> getCompleted()
{
- File completedFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator + "completed" );
- completed = (List<File>) FileUtils.listFiles( completedFolder, new String[]
- {
- "xml"
- }, false );
+ File completedFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator
+ + "completed" );
+ completed = new ArrayList<File>( FileUtils.listFiles( completedFolder, new String[] { "xml" }, false ) );
return completed;
}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java 2010-06-03 07:25:02 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/CreateMobileAppAction.java 2010-06-03 09:22:33 +0000
@@ -34,35 +34,48 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.period.PeriodService;
-public class CreateMobileAppAction implements Action {
+public class CreateMobileAppAction
+ implements Action
+{
private String mvnPath;
+
private String mvnStatus;
+
private String[] splashImg;
+
private String[] availableDatasets;
+
private String mobileAppFilename;
- public String getMobileAppFilename() {
- String webappPath = ServletActionContext.getServletContext().getRealPath("/");
+ public String getMobileAppFilename()
+ {
+ String webappPath = ServletActionContext.getServletContext().getRealPath( "/" );
String appPath = webappPath + "/dhis-web-mobile/javame_src/target";
- File appFile = new File(appPath, "dhis-javame-1.0.0-me.jar");
- if (appFile.exists()) {
+ File appFile = new File( appPath, "dhis-javame-1.0.0-me.jar" );
+ if ( appFile.exists() )
+ {
mobileAppFilename = appFile.getName();
}
return mobileAppFilename;
}
- public String[] getSplashImg() {
- String webappPath = ServletActionContext.getServletContext().getRealPath("/");
+ public String[] getSplashImg()
+ {
+ String webappPath = ServletActionContext.getServletContext().getRealPath( "/" );
String imgPath = webappPath + "/dhis-web-mobile/javame_src/src/main/resources/splash";
- File imgFolder = new File(imgPath);
+ File imgFolder = new File( imgPath );
File[] images;
- if (imgFolder.exists()) {
- if (imgFolder.isDirectory()) {
+ if ( imgFolder.exists() )
+ {
+ if ( imgFolder.isDirectory() )
+ {
images = imgFolder.listFiles();
String[] imageNames = new String[images.length];
- for (int i = 0; i < images.length; i++) {
- if (images[i].getName().contains(".png")) {
+ for ( int i = 0; i < images.length; i++ )
+ {
+ if ( images[i].getName().contains( ".png" ) )
+ {
imageNames[i] = images[i].getName();
}
}
@@ -72,18 +85,24 @@
return splashImg;
}
- public String getMvnPath() {
- String PATH = System.getenv("PATH");
+ public String getMvnPath()
+ {
+ String PATH = System.getenv( "PATH" );
String[] locations;
- if (getOSName().equals("win")) {
- locations = PATH.split(";");
- } else {
- locations = PATH.split(":");
- }
- for (String location : locations) {
- File folder = new File(location);
- String filePath = scanPath(getOSName(), folder);
- if (!filePath.equals("")) {
+ if ( getOSName().equals( "win" ) )
+ {
+ locations = PATH.split( ";" );
+ }
+ else
+ {
+ locations = PATH.split( ":" );
+ }
+ for ( String location : locations )
+ {
+ File folder = new File( location );
+ String filePath = scanPath( getOSName(), folder );
+ if ( !filePath.equals( "" ) )
+ {
mvnPath = filePath;
break;
}
@@ -91,48 +110,68 @@
return mvnPath;
}
- public void setMvnPath(String path) {
- File mvnFolder = new File(path);
- String filePath = scanPath(getOSName(), mvnFolder);
- if (!filePath.equals("")) {
+ public void setMvnPath( String path )
+ {
+ File mvnFolder = new File( path );
+ String filePath = scanPath( getOSName(), mvnFolder );
+ if ( !filePath.equals( "" ) )
+ {
this.mvnPath = filePath;
- } else {
+ }
+ else
+ {
mvnStatus = "Could not find mvn.bat at the location you entered";
}
}
- public String getMvnStatus() {
+ public String getMvnStatus()
+ {
return mvnStatus;
}
- public void setMvnStatus(String status) {
+ public void setMvnStatus( String status )
+ {
this.mvnStatus = status;
}
- private String getOSName() {
+ private String getOSName()
+ {
String osName;
- if (System.getProperty("os.name").toLowerCase().contains("windows")) {
+ if ( System.getProperty( "os.name" ).toLowerCase().contains( "windows" ) )
+ {
osName = "win";
- } else {
+ }
+ else
+ {
osName = "nix";
}
return osName;
}
- private String scanPath(String osName, File folder) {
+ private String scanPath( String osName, File folder )
+ {
String filePath = new String();
- if (folder.exists()) {
- if (folder.isDirectory()) {
+ if ( folder.exists() )
+ {
+ if ( folder.isDirectory() )
+ {
File[] files = folder.listFiles();
- for (File file : files) {
- if (osName.equals("win")) {
- if (file.getName().equals("mvn.bat")) {
+ for ( File file : files )
+ {
+ if ( osName.equals( "win" ) )
+ {
+ if ( file.getName().equals( "mvn.bat" ) )
+ {
filePath = file.getAbsolutePath();
break;
}
- } else {
- if (osName.equals("nix")) {
- if (file.getName().equals("mvn")) {
+ }
+ else
+ {
+ if ( osName.equals( "nix" ) )
+ {
+ if ( file.getName().equals( "mvn" ) )
+ {
filePath = file.getAbsolutePath();
break;
}
@@ -143,22 +182,28 @@
}
return filePath;
}
+
private DataSetService dataSetService;
- public void setDataSetService(DataSetService dataSetService) {
+ public void setDataSetService( DataSetService dataSetService )
+ {
this.dataSetService = dataSetService;
}
+
private PeriodService periodService;
- public void setPeriodService(PeriodService periodService) {
+ public void setPeriodService( PeriodService periodService )
+ {
this.periodService = periodService;
}
- public String[] getAvailableDatasets() {
+ public String[] getAvailableDatasets()
+ {
int i = 0;
Collection<DataSet> allDataSets = dataSetService.getAllDataSets();
availableDatasets = new String[allDataSets.size()];
- for (DataSet dataSet : allDataSets) {
+ for ( DataSet dataSet : allDataSets )
+ {
availableDatasets[i] = dataSet.getName();
i++;
}
@@ -167,9 +212,10 @@
@Override
public String execute()
- throws Exception {
- //SMSService service = new SMSService();
- //service.testSMSService();
+ throws Exception
+ {
+ // SMSService service = new SMSService();
+ // service.testSMSService();
return SUCCESS;
}
}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java 2010-06-03 07:25:02 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java 2010-06-03 09:22:33 +0000
@@ -26,14 +26,14 @@
*/
package org.hisp.dhis.mobile.app.action;
-
import com.opensymphony.xwork2.Action;
import java.util.Collection;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
-public class GetDataElementsAction implements Action
+public class GetDataElementsAction
+ implements Action
{
// -------------------------------------------------------------------------
@@ -49,6 +49,7 @@
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
+
private String dataSetName;
public void setDataSetName( String dataSetName )
@@ -56,7 +57,8 @@
this.dataSetName = dataSetName;
}
- public String getDataSetName(){
+ public String getDataSetName()
+ {
return this.dataSetName;
}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java 2010-06-03 07:25:02 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/JarGeneratorAction.java 2010-06-03 09:22:33 +0000
@@ -39,97 +39,129 @@
import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;
-public class JarGeneratorAction implements Action {
+public class JarGeneratorAction
+ implements Action
+{
private String mvnBin;
+
private String splash;
+
private String selectDataSet;
+
private String dataElements;
- public void setDataElements(String dataElements) {
+ public void setDataElements( String dataElements )
+ {
this.dataElements = dataElements;
}
- public void setSelectDataSet(String selectDataSet) {
+ public void setSelectDataSet( String selectDataSet )
+ {
this.selectDataSet = selectDataSet;
}
- public String getMvnBin() {
+ public String getMvnBin()
+ {
return mvnBin;
}
- public void setMvnBin(String mvnBin) {
+ public void setMvnBin( String mvnBin )
+ {
this.mvnBin = mvnBin;
}
- public String getSplash() {
+ public String getSplash()
+ {
return splash;
}
- public void setSplash(String splash) {
+ public void setSplash( String splash )
+ {
this.splash = splash;
}
- private static String readFileAsString(File file) throws java.io.IOException {
+ private static String readFileAsString( File file )
+ throws java.io.IOException
+ {
byte[] buffer = new byte[(int) file.length()];
- BufferedInputStream f = new BufferedInputStream(new FileInputStream(file));
- f.read(buffer);
+ BufferedInputStream f = new BufferedInputStream( new FileInputStream( file ) );
+ f.read( buffer );
f.close();
- return new String(buffer);
+ return new String( buffer );
}
- public void replaceStringInFile(File dir, String fileName, String match, String replacingString) {
- try {
- File srcFile = new File(dir, fileName);
- File destFile = new File(dir, "temp");
- if (srcFile.exists()) {
- String str = readFileAsString(srcFile);
- str = str.replaceFirst(match, replacingString);
- FileWriter fw = new FileWriter(destFile);
- fw.write(str);
+ public void replaceStringInFile( File dir, String fileName, String match, String replacingString )
+ {
+ try
+ {
+ File srcFile = new File( dir, fileName );
+ File destFile = new File( dir, "temp" );
+ if ( srcFile.exists() )
+ {
+ String str = readFileAsString( srcFile );
+ str = str.replaceFirst( match, replacingString );
+ FileWriter fw = new FileWriter( destFile );
+ fw.write( str );
fw.close();
}
- FileUtils.copyFile(destFile, srcFile);
+ FileUtils.copyFile( destFile, srcFile );
destFile.delete();
- } catch (FileNotFoundException ex) {
- ex.printStackTrace();
- } catch (IOException ex) {
- ex.printStackTrace();
- } catch (Exception ex) {
+ }
+ catch ( FileNotFoundException ex )
+ {
+ ex.printStackTrace();
+ }
+ catch ( IOException ex )
+ {
+ ex.printStackTrace();
+ }
+ catch ( Exception ex )
+ {
ex.printStackTrace();
}
}
@Override
- public String execute() throws Exception {
- String webappPath = ServletActionContext.getServletContext().getRealPath("/");
+ public String execute()
+ throws Exception
+ {
+ String webappPath = ServletActionContext.getServletContext().getRealPath( "/" );
String javameSrc = webappPath + "/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile";
- File dir = new File(javameSrc);
-
- //For splash screen
- replaceStringInFile(dir, "DHISMobile.java", "\\w*.png", splash);
-
- //For dataset
- replaceStringInFile(dir, "FormsListPage.java", "formNames\\[].*;", "formNames[] = {\"" + selectDataSet + "\"};");
-
- //For dataElements
- replaceStringInFile(dir, "DHISMobile.java", "dataElements =.*\\},\\{", "dataElements = {{" + dataElements + "},{");
-
- //For language
- //replaceStringInFile(dir, "DHISMobile.java", "", language);
-
- //For patient-program stage
- //replaceStringInFile(dir, "DHISMobile.java", "", patient_program);
-
- ProcessBuilder pb = new ProcessBuilder(mvnBin, "install", "-f", ServletActionContext.getServletContext().getRealPath("/") + "/dhis-web-mobile/javame_src/pom.xml");
- pb.redirectErrorStream(true);
+ File dir = new File( javameSrc );
+
+ // For splash screen
+ replaceStringInFile( dir, "DHISMobile.java", "\\w*.png", splash );
+
+ // For dataset
+ replaceStringInFile( dir, "FormsListPage.java", "formNames\\[].*;", "formNames[] = {\"" + selectDataSet
+ + "\"};" );
+
+ // For dataElements
+ replaceStringInFile( dir, "DHISMobile.java", "dataElements =.*\\},\\{", "dataElements = {{" + dataElements
+ + "},{" );
+
+ // For language
+ // replaceStringInFile(dir, "DHISMobile.java", "", language);
+
+ // For patient-program stage
+ // replaceStringInFile(dir, "DHISMobile.java", "", patient_program);
+
+ ProcessBuilder pb = new ProcessBuilder( mvnBin, "install", "-f", ServletActionContext.getServletContext()
+ .getRealPath( "/" )
+ + "/dhis-web-mobile/javame_src/pom.xml" );
+
+ pb.redirectErrorStream( true );
Process p = pb.start();
InputStream is = p.getInputStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ BufferedReader br = new BufferedReader( new InputStreamReader( is ) );
String str;
- while ((str = br.readLine()) != null) {
- System.out.println(str);
+
+ while ( (str = br.readLine()) != null )
+ {
+ System.out.println( str );
}
+
return SUCCESS;
}
}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/SplashUploadAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/SplashUploadAction.java 2010-06-03 07:25:02 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/SplashUploadAction.java 2010-06-03 09:22:33 +0000
@@ -32,24 +32,34 @@
import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;
-public class SplashUploadAction extends ActionSupport {
+public class SplashUploadAction
+ extends ActionSupport
+{
private File file;
+
private String contentType;
+
private String filename;
+
private String[] splashImg;
- public String[] getSplashImg() {
- String webappPath = ServletActionContext.getServletContext().getRealPath("/");
+ public String[] getSplashImg()
+ {
+ String webappPath = ServletActionContext.getServletContext().getRealPath( "/" );
String imgPath = webappPath + "/dhis-web-mobile/javame_src/src/main/resources/splash";
- File imgFolder = new File(imgPath);
+ File imgFolder = new File( imgPath );
File[] images;
- if (imgFolder.exists()) {
- if (imgFolder.isDirectory()) {
+ if ( imgFolder.exists() )
+ {
+ if ( imgFolder.isDirectory() )
+ {
images = imgFolder.listFiles();
String[] imageNames = new String[images.length];
- for (int i = 0; i < images.length; i++) {
- if (images[i].getName().contains(".png")) {
+ for ( int i = 0; i < images.length; i++ )
+ {
+ if ( images[i].getName().contains( ".png" ) )
+ {
imageNames[i] = images[i].getName();
}
}
@@ -59,26 +69,34 @@
return splashImg;
}
- public void setUpload(File file) {
+ public void setUpload( File file )
+ {
this.file = file;
}
- public void setUploadContentType(String contentType) {
+ public void setUploadContentType( String contentType )
+ {
this.contentType = contentType;
}
- public void setUploadFileName(String filename) {
+ public void setUploadFileName( String filename )
+ {
this.filename = filename;
}
@Override
- public String execute() {
- try {
- String webappPath = ServletActionContext.getServletContext().getRealPath("/");
+ public String execute()
+ {
+ try
+ {
+ String webappPath = ServletActionContext.getServletContext().getRealPath( "/" );
String imgPath = webappPath + "/dhis-web-mobile/javame_src/src/main/resources/splash";
- File imgFolder = new File(imgPath);
- FileUtils.copyFile(file, new File(imgFolder, String.valueOf(imgFolder.listFiles().length + 1) + ".png"));
- } catch (IOException ex) {
+ File imgFolder = new File( imgPath );
+ FileUtils
+ .copyFile( file, new File( imgFolder, String.valueOf( imgFolder.listFiles().length + 1 ) + ".png" ) );
+ }
+ catch ( IOException ex )
+ {
ex.printStackTrace();
}
return SUCCESS;