dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22717
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11009: Appstore code style
------------------------------------------------------------
revno: 11009
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-05-27 09:31:56 +0200
message:
Appstore code style
modified:
dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java
dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppListAction.java
dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java
dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppStoreAction.java
dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/DeleteAppAction.java
dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/struts.xml
--
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-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java 2013-05-26 15:07:15 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java 2013-05-27 07:31:56 +0000
@@ -122,6 +122,7 @@
{
ZipFile zip = new ZipFile( file );
ZipEntry entry = zip.getEntry( "manifest.webapp" );
+
if ( null != entry )
{
InputStream inputStream = zip.getInputStream( entry );
@@ -129,7 +130,7 @@
ObjectMapper mapper = new ObjectMapper();
mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false );
App app = mapper.readValue( appManifest, App.class );
-
+
// Delete if app is already installed
if ( appManagerService.getInstalledApps().contains( app ) )
{
@@ -144,23 +145,24 @@
unzip.setSrc( file );
unzip.setDest( new File( dest ) );
unzip.execute();
-
- //Updating Dhis Server Location
- File updateManifest = new File(dest + File.separator + "manifest.webapp");
- App installedApp = mapper.readValue(updateManifest, App.class);
-
- if(installedApp.getActivities().getDhis().getHref().equals("*"))
+
+ // Updating Dhis Server Location
+ File updateManifest = new File( dest + File.separator + "manifest.webapp" );
+ App installedApp = mapper.readValue( updateManifest, App.class );
+
+ if ( installedApp.getActivities().getDhis().getHref().equals( "*" ) )
{
- //TODO: Check why ContextUtils.getContextPath is not working
- //String rootPath = ContextUtils.getContextPath(ServletActionContext.getRequest());
+ // TODO: Check why ContextUtils.getContextPath is not working
+ // String rootPath = ContextUtils.getContextPath(ServletActionContext.getRequest());
HttpServletRequest req = ServletActionContext.getRequest();
StringBuffer fullUrl = req.getRequestURL();
- String baseUrl = ContextUtils.getBaseUrl(req);
- String rootPath = fullUrl.substring(0,fullUrl.indexOf("/", baseUrl.length()));
-
- installedApp.getActivities().getDhis().setHref(rootPath);
- mapper.writeValue(updateManifest, installedApp);
+ String baseUrl = ContextUtils.getBaseUrl( req );
+ String rootPath = fullUrl.substring( 0, fullUrl.indexOf( "/", baseUrl.length() ) );
+
+ installedApp.getActivities().getDhis().setHref( rootPath );
+ mapper.writeValue( updateManifest, installedApp );
}
+
zip.close();
message = i18n.getString( "appmanager_install_success" );
}
=== modified file 'dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppListAction.java'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppListAction.java 2013-05-24 12:05:28 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppListAction.java 2013-05-27 07:31:56 +0000
@@ -27,13 +27,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.opensymphony.xwork2.Action;
import java.util.ArrayList;
import java.util.List;
+
import org.hisp.dhis.appmanager.App;
import org.hisp.dhis.appmanager.AppManagerService;
import org.springframework.beans.factory.annotation.Autowired;
+import com.opensymphony.xwork2.Action;
+
/**
* @author Saptarshi Purkayastha
*/
@@ -74,10 +76,12 @@
throws Exception
{
appFolderNames = new ArrayList<String>();
+
for ( App app : getAppList() )
{
appFolderNames.add( appManagerService.getAppFolderName( app ) );
}
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java 2013-05-25 16:25:22 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java 2013-05-27 07:31:56 +0000
@@ -27,15 +27,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.opensymphony.xwork2.Action;
import java.io.File;
import java.util.List;
+
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.appmanager.App;
import org.hisp.dhis.appmanager.AppManagerService;
import org.hisp.dhis.i18n.I18n;
import org.springframework.beans.factory.annotation.Autowired;
+import com.opensymphony.xwork2.Action;
+
/**
* @author Saptarshi Purkayastha
*/
=== modified file 'dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppStoreAction.java'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppStoreAction.java 2013-05-24 12:05:28 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppStoreAction.java 2013-05-27 07:31:56 +0000
@@ -34,7 +34,6 @@
/**
* @author Saptarshi Purkayastha
- * @version $Id
*/
public class AppStoreAction
implements Action
=== modified file 'dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/DeleteAppAction.java'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/DeleteAppAction.java 2013-05-25 16:25:22 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/java/org/hisp/dhis/appmanager/action/DeleteAppAction.java 2013-05-27 07:31:56 +0000
@@ -39,7 +39,6 @@
/**
* @author Saptarshi Purkayastha
- * @version $Id$
*/
public class DeleteAppAction
implements Action
@@ -60,6 +59,7 @@
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
+
private I18n i18n;
public void setI18n( I18n i18n )
@@ -83,6 +83,7 @@
throws Exception
{
String appName = ServletActionContext.getRequest().getParameter( "appName" );
+
if ( null != appName )
{
// TODO: Move to AppManagerService
@@ -97,6 +98,7 @@
}
}
}
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/META-INF/dhis/beans.xml 2013-05-23 00:18:55 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/META-INF/dhis/beans.xml 2013-05-27 07:31:56 +0000
@@ -4,9 +4,7 @@
<bean id="org.hisp.dhis.appmanager.action.NoAction" class="org.hisp.dhis.appmanager.action.NoAction" scope="prototype" />
- <!-- AppManager -->
- <bean id="org.hisp.dhis.appmanager.action.AddAppAction" class="org.hisp.dhis.appmanager.action.AddAppAction"
- scope="prototype">
+ <bean id="org.hisp.dhis.appmanager.action.AddAppAction" class="org.hisp.dhis.appmanager.action.AddAppAction" scope="prototype">
<property name="authoritiesProvider" ref="org.hisp.dhis.security.authority.SystemAuthoritiesProvider" />
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/struts.xml 2013-05-24 12:05:28 +0000
+++ dhis-2/dhis-web/dhis-web-appmanager/src/main/resources/struts.xml 2013-05-27 07:31:56 +0000
@@ -9,6 +9,7 @@
<package name="dhis-web-appmanager" extends="dhis-web-commons" namespace="/dhis-web-appmanager">
<!-- AppManager -->
+
<action name="index" class="org.hisp.dhis.appmanager.action.NoAction">
<result name="success" type="redirect">appList.action</result>
</action>