All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.feature.dashboard.index.DashboardIndexContentProviderFactory Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package com.sap.cds.feature.dashboard.index;

import java.io.PrintWriter;

import com.sap.cds.adapter.IndexContentProvider;
import com.sap.cds.adapter.IndexContentProviderFactory;
import com.sap.cds.services.runtime.CdsRuntime;
import com.sap.cds.services.runtime.CdsRuntimeAware;

/**
 * Explicitly adds links to UI resources provided by this application to the index page
 */
public class DashboardIndexContentProviderFactory implements IndexContentProviderFactory, CdsRuntimeAware {

	private CdsRuntime runtime;

	@Override
	public void setCdsRuntime(CdsRuntime runtime) {
		this.runtime = runtime;
	}

	@Override
	public IndexContentProvider create() {
		return new UiIndexContentProvider();
	}

	@Override
	public boolean isEnabled() {
		return runtime.getEnvironment().getCdsProperties().getIndexPage().isEnabled();
	}

	private static class UiIndexContentProvider implements IndexContentProvider {

		private static final String ENDPOINT_START = "" +
				"                
    \n"; private static final String ENDPOINT = "" + "
  • \n" + " %s\n" + "
  • \n"; private static final String ENDPOINT_END = "" + "
\n"; @Override public int order() { return -100; } @Override public String getSectionTitle() { return "CAP Developer Dashboard"; } @Override public void writeContent(PrintWriter writer, String contextPath) { writer.print(ENDPOINT_START); writer.printf(ENDPOINT, contextPath + "dashboard", "Dashboard UI"); writer.print(ENDPOINT_END); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy