dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18083
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7476: local/in Fixed Bug in global config service
------------------------------------------------------------
revno: 7476
committer: Gaurav <gaurav08021@xxxxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-07-02 12:42:06 +0530
message:
local/in Fixed Bug in global config service
modified:
local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.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 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java 2012-06-30 10:19:34 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java 2012-07-02 07:12:06 +0000
@@ -27,7 +27,7 @@
/**
- * <Gaurav & Mohit>,Date: 6/25/12, Time: 12:42 PM
+ * <gaurav>,Date: 6/25/12, Time: 12:42 PM
*/
public class DefaultGlobalConfigService implements GlobalConfigService {
@@ -37,8 +37,6 @@
// INPUT-OUTPUT FOLDER PATHS
//----------------------------------------------------------------------------------------------
- private static final String OUTPUT_FOLDER = "/home/gaurav/dhis2/dhis/home/ra_punjab_new";
-
private static final String SETTINGS_XML = "globalsettings.xml";
private static Map<String, String> globalValueMap = new HashMap<String, String>();
@@ -88,6 +86,9 @@
public void updateDecodeFiles() {
+ String OUTPUT_FOLDER = System.getenv("DHIS2_HOME") + File.separator + configurationService.getConfigurationByKey(Configuration_IN.KEY_REPORTFOLDER)
+ .getValue() + "_new";
+
Integer globalID = 1;
File[] files = getFileNames();
@@ -146,6 +147,13 @@
e.printStackTrace();
}
DOMSource source = new DOMSource(doc);
+
+ File newRAFolder = new File(OUTPUT_FOLDER);
+
+ if (newRAFolder.exists() == false) {
+ newRAFolder.mkdir();
+ }
+
File newOutFile = new File(OUTPUT_FOLDER + "/" + file.getName());
if (!newOutFile.exists()) {
@@ -186,6 +194,10 @@
public void writeGlobalSettings(Map<String, String> globalValueMap) {
+
+ String OUTPUT_FOLDER = System.getenv("DHIS2_HOME") + File.separator + configurationService.getConfigurationByKey(Configuration_IN.KEY_REPORTFOLDER)
+ .getValue() + "_new";
+
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java 2012-06-30 10:19:34 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java 2012-07-02 07:12:06 +0000
@@ -21,8 +21,7 @@
private ConfigurationService configurationService;
- public void setConfigurationService( ConfigurationService configurationService )
- {
+ public void setConfigurationService(ConfigurationService configurationService) {
this.configurationService = configurationService;
}
@@ -32,29 +31,25 @@
private InputStream inputStream;
- public InputStream getInputStream()
- {
+ public InputStream getInputStream() {
return inputStream;
}
private String fileName;
- public String getFileName()
- {
+ public String getFileName() {
return fileName;
}
private String selectedButton;
- public void setSelectedButton( String selectedButton )
- {
+ public void setSelectedButton(String selectedButton) {
this.selectedButton = selectedButton;
}
private String statusMessage;
- public String getStatusMessage()
- {
+ public String getStatusMessage() {
return statusMessage;
}
@@ -63,22 +58,19 @@
public String execute() throws Exception {
- String raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER).getValue();
-
- String raPath = configurationService.backupFolder( System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName+"_new" );
-
- if( raPath.equalsIgnoreCase( "INPUT" ) )
- {
- statusMessage = "Problem while taking backup for reports folder, please see the log";
- }
- else
- {
- fileName = raFolderName+".zip";
-
- inputStream = new BufferedInputStream( new FileInputStream( raPath ), 1024 );
-
- return "download";
- }
+ String raFolderName = configurationService.getConfigurationByKey(Configuration_IN.KEY_REPORTFOLDER).getValue();
+
+ String raPath = configurationService.backupFolder(System.getenv("DHIS2_HOME") + File.separator + raFolderName + "_new");
+
+ if (raPath.equalsIgnoreCase("INPUT")) {
+ statusMessage = "Problem while taking backup for reports folder, please see the log";
+ } else {
+ fileName = raFolderName + ".zip";
+
+ inputStream = new BufferedInputStream(new FileInputStream(raPath), 1024);
+
+ return "download";
+ }
return SUCCESS;
}
}