...
The explanation above only describes how to create a Monitoring Dashboard plugin but does not cover how to develop your own indicator set(s). That is done entirely in Java. See the wmaxmfindicators
bundle for an example of how to create your own custom indicators. As a starting point you should implement an XMFIndicatorProvider
that enables the registration of your custom indicators. See the file DefaultIndicatorsServiceImpl.java
in wmaxmfindicators
. Refer to the Javadoc for wmaxmfapi
in the wm-addon-monitoring
package for the interfaces offered by the framework.
Panel | ||||
---|---|---|---|---|
| ||||
The following applies to XperienCentral versions R43 and higher. |
Creating a Custom Media Feed Listener
The Media Feed functionality is a simple mechanism to prresent a list of content items to a website visitor. In some XperienCentral projects it is desirable to have a mechanism that overrides and or improves the basic mechanism. By adding a listener mechanism you can implement a specific interface and take control over the Media Feed output. The listener makes it possible to
- Overrule the method that retrieves the content items from XperienCentral.
- Overrule the
MediaItemFilter
instance that is used for default retrieval of items. - Overrule the
MediaItemSortOptions
instance that is used for default sorting of items. - Perform custom filtering on the retrieved items (given the items, filter options and sort options).
- Determine which
queryString
parameters should be passed on to the Media Feed JSP.
The following is an example listener that overrides the default Media Feed functionality.
Code Block | ||
---|---|---|
| ||
/*
* Copyright (C) 1998 - 2020 GX Software B.V. All rights reserved. The contents of this
* work is confidential. It is prohibited to copy, duplicate or alter this work in any
* manner without the express prior written approval of GX Software B.V.
*/
package com.gxwebmanager.solutions.examplepresentation.service;
import nl.gx.product.wmpmediafeed.api.FeedListenerBase;
import nl.gx.webmanager.cms.mediarepository.*;
import nl.gx.webmanager.foundation.Session;
import nl.gx.webmanager.services.contentapi.MediaRepositoryManagementService;
import nl.gx.webmanager.services.sessionmanager.SessionManager;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.logging.Logger;
/**
*
* ExampleFeedListener
*
*/
public class ExampleFeedListener extends FeedListenerBase {
private static final Logger LOG = Logger.getLogger(ExampleFeedListener.class.getName());
private MediaRepositoryManagementService myMediaRepositoryManagementService;
private SessionManager mySessionManager;
/**
* {@inheritDoc}
*/
public String getIdentifier() {
return "Example Feed listener";
}
/**
* {@inheritDoc}
*/
public List<MediaItem> getMediaItems(HttpServletRequest request, MediaItemFilter filter, MediaItemSortOptions sortOptions) {
LOG.warning("getMediaItems from ExampleFeedListener: return only first 3 items");
List<MediaItem> items = new ArrayList<>();
Session session = mySessionManager.getActiveSession();
boolean sessionCreated = false;
if (session == null) {
session = mySessionManager.createSession(request, null);
sessionCreated = false;
}
try {
//We should ignore the existing items but do a proper query ourselves
int from = filter.getResultFrom();
int to = filter.getResultTo();
// retrieve everything
filter.setResultRange(0,3);
MediaSearchResult searchResult = myMediaRepositoryManagementService.getMediaItems(session.getContext().getWebsite(), filter, sortOptions);
LOG.warning("getMediaItems from ExampleFeedListener: query returned "+searchResult.getCount()+" items, but we only use first 3 items");
MediaItem[] allitems = searchResult.getResults(0, 3);
if (allitems != null) {
for (MediaItem item : allitems) {
items.add(item);
}
}
return items;
} finally {
if (sessionCreated && session != null) {
session.close();
}
}
}
public List<MediaItem> filterMediaItems(HttpServletRequest request, List<MediaItem> items, MediaItemFilter filter, MediaItemSortOptions sortOptions) {
LOG.warning("filterMediaItems from ExampleFeedListener: do nothing, but here you could filter the returned items");
return null;
}
public MediaItemFilter overruleFilter(HttpServletRequest request, MediaItemFilter filter) {
LOG.warning("overruleFilter from ExampleFeedListener: do nothing, but here you could overrule the filter");
return null;
}
public MediaItemSortOptions overruleSortOptions(HttpServletRequest request, MediaItemSortOptions sortOptions) {
LOG.warning("overruleSortOptions from ExampleFeedListener: do nothing, but here you could overrule the sort options");
return null;
}
public List<String> getAllowedParameters(HttpServletRequest request) {
LOG.warning("getAllowedParameters from ExampleFeedListener: do nothing, but here you could overrule the allowed parameters");
return null;
}
} |
...
Custom Content and the Is Used in Widget
Anchor | ||||
---|---|---|---|---|
|
...