dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25324
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12531: Made list of installed apps availabe in web api at api/apps.json
------------------------------------------------------------
revno: 12531
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-09 19:16:20 +0200
message:
Made list of installed apps availabe in web api at api/apps.json
added:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/App.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppActivities.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppIcons.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.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/appmanager/App.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/App.java 2013-09-29 19:31:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/App.java 2013-10-09 17:16:20 +0000
@@ -29,6 +29,8 @@
*/
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.File;
import java.io.Serializable;
/**
@@ -37,7 +39,6 @@
public class App
implements Serializable
{
-
/**
* Determines if a de-serialized file is compatible with this class.
*/
@@ -46,8 +47,10 @@
/**
* Required.
*/
+ @JsonProperty
private String version;
+ @JsonProperty
private String name;
@JsonProperty( "launch_path" )
@@ -86,6 +89,12 @@
// Logic
// -------------------------------------------------------------------------
+ @JsonProperty
+ public String getLaunchUrl()
+ {
+ return getBaseUrl() + File.separator + getFolderName() + File.separator + getLaunchPath();
+ }
+
public String getVersion()
{
return version;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppActivities.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppActivities.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppActivities.java 2013-10-09 17:16:20 +0000
@@ -41,15 +41,17 @@
* Determines if a de-serialized file is compatible with this class.
*/
private static final long serialVersionUID = 7530768303537807631L;
-
- @JsonProperty("dhis")
+
+ @JsonProperty( "dhis" )
private AppDhis dhis;
- public AppDhis getDhis() {
+ public AppDhis getDhis()
+ {
return dhis;
}
- public void setDhis(AppDhis dhis) {
+ public void setDhis( AppDhis dhis )
+ {
this.dhis = dhis;
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java 2013-10-09 17:16:20 +0000
@@ -42,7 +42,7 @@
*/
private static final long serialVersionUID = -8854371580010728182L;
- @JsonProperty("href")
+ @JsonProperty( "href" )
private String href;
public String getHref()
@@ -50,7 +50,8 @@
return href;
}
- public void setHref(String href) {
+ public void setHref( String href )
+ {
this.href = href;
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppIcons.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppIcons.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppIcons.java 2013-10-09 17:16:20 +0000
@@ -83,5 +83,4 @@
{
this.icon128 = icon128;
}
-
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java 2013-09-26 18:17:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java 2013-10-09 17:16:20 +0000
@@ -103,5 +103,4 @@
* @param appBaseUrl
*/
void setAppBaseUrl( String appBaseUrl );
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java 2013-09-29 19:31:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java 2013-10-09 17:16:20 +0000
@@ -70,7 +70,7 @@
log.info( "Detecting apps: " + apps );
}
-
+
@Autowired
private SystemSettingManager appSettingManager;
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java 2013-10-09 17:16:20 +0000
@@ -0,0 +1,62 @@
+package org.hisp.dhis.api.controller;
+
+/*
+ * Copyright (c) 2004-2013, 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.List;
+
+import org.hisp.dhis.appmanager.App;
+import org.hisp.dhis.appmanager.AppManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ * @author Lars Helge Overland
+ */
+@Controller
+@RequestMapping( value = AppController.RESOURCE_PATH )
+public class AppController
+{
+ public static final String RESOURCE_PATH = "/apps";
+
+ @Autowired
+ private AppManager appManager;
+
+ @RequestMapping( method = RequestMethod.GET )
+ public String getApps( Model model )
+ {
+ List<App> apps = appManager.getInstalledApps();
+
+ model.addAttribute( "model", apps );
+
+ return "apps";
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.java 2013-09-29 19:31:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.java 2013-10-09 17:16:20 +0000
@@ -82,7 +82,7 @@
public static Module getModule( App app )
{
- String defaultAction = app.getBaseUrl() + File.separator + app.getFolderName() + File.separator + app.getLaunchPath();
+ String defaultAction = app.getLaunchUrl();
String icon = app.getFolderName() + File.separator + app.getIcons().getIcon48();
String description = TextUtils.subString( app.getDescription(), 0, 80 );