mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-06-19 08:40:50 +02:00
added google analytics support to plugin backend
This commit is contained in:
@@ -116,6 +116,17 @@ public class BackendConfiguration
|
||||
return scannInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTrackingCode()
|
||||
{
|
||||
return trackingCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -195,6 +206,17 @@ public class BackendConfiguration
|
||||
this.scannInterval = scannInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param trackingCode
|
||||
*/
|
||||
public void setTrackingCode(String trackingCode)
|
||||
{
|
||||
this.trackingCode = trackingCode;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -211,7 +233,7 @@ public class BackendConfiguration
|
||||
private boolean multithreaded = true;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name= "news-url")
|
||||
@XmlElement(name = "news-url")
|
||||
private URL newsUrl;
|
||||
|
||||
/** Field description */
|
||||
@@ -223,4 +245,8 @@ public class BackendConfiguration
|
||||
@XmlElement(name = "scann-interval")
|
||||
@XmlJavaTypeAdapter(XmlIntervalAdapter.class)
|
||||
private Long scannInterval;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "tracking-code")
|
||||
private String trackingCode;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ package sonia.scm.plugin.rest;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.plugin.BackendConfiguration;
|
||||
import sonia.scm.plugin.PluginBackend;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.plugin.PluginUtil;
|
||||
@@ -74,11 +75,13 @@ public class DetailResource extends ViewableResource
|
||||
*
|
||||
* @param context
|
||||
* @param backend
|
||||
* @param configuration
|
||||
*/
|
||||
@Inject
|
||||
public DetailResource(ServletContext context, PluginBackend backend)
|
||||
public DetailResource(ServletContext context, PluginBackend backend,
|
||||
BackendConfiguration configuration)
|
||||
{
|
||||
super(context);
|
||||
super(context, configuration);
|
||||
this.backend = backend;
|
||||
}
|
||||
|
||||
@@ -100,10 +103,10 @@ public class DetailResource extends ViewableResource
|
||||
@DefaultValue("false")
|
||||
@QueryParam("snapshot") boolean snapshot)
|
||||
{
|
||||
List<PluginInformation> pluginVersions = PluginUtil.getFilteredPluginVersions(
|
||||
backend, groupId, artifactId);
|
||||
|
||||
if (Util.isEmpty(pluginVersions))
|
||||
List<PluginInformation> pluginVersions =
|
||||
PluginUtil.getFilteredPluginVersions(backend, groupId, artifactId);
|
||||
|
||||
if (Util.isEmpty(pluginVersions))
|
||||
{
|
||||
throw new WebApplicationException(Status.NOT_FOUND);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ package sonia.scm.plugin.rest;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.plugin.BackendConfiguration;
|
||||
import sonia.scm.plugin.Category;
|
||||
import sonia.scm.plugin.CategoryNameComaparator;
|
||||
import sonia.scm.plugin.PluginBackend;
|
||||
@@ -78,11 +79,13 @@ public class OverviewResource extends ViewableResource
|
||||
*
|
||||
* @param context
|
||||
* @param backend
|
||||
* @param configuration
|
||||
*/
|
||||
@Inject
|
||||
public OverviewResource(ServletContext context, PluginBackend backend)
|
||||
public OverviewResource(ServletContext context, PluginBackend backend,
|
||||
BackendConfiguration configuration)
|
||||
{
|
||||
super(context);
|
||||
super(context, configuration);
|
||||
this.backend = backend;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import sonia.scm.plugin.BackendConfiguration;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -53,10 +54,13 @@ public class ViewableResource
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public ViewableResource(ServletContext context)
|
||||
public ViewableResource(ServletContext context, BackendConfiguration configuration)
|
||||
{
|
||||
this.contextPath = context.getContextPath();
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
private BackendConfiguration configuration;
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@@ -73,6 +77,7 @@ public class ViewableResource
|
||||
Map<String, Object> vars = new HashMap<String, Object>();
|
||||
|
||||
vars.put("contextPath", contextPath);
|
||||
vars.put("configuration", configuration);
|
||||
vars.put("title", title);
|
||||
|
||||
return vars;
|
||||
|
||||
Reference in New Issue
Block a user