on 05-30-2005 7:29 AM
Hi,
We are creating content using XML forms.Say, we have country/language as fields in the form, Based on the value, i need to filter out content. i.e display only content with language=en.
Thanks
Hi,
you could implement a Namespace Filter, see http://help.sap.com/saphelp_nw04/helpdata/en/c1/902ae120a886459b0e028f2e89ffe1/frameset.htm and
Hope it helps
Detlev
PS: Please consider rewarding points for helpsul answers on SDN! Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
> The filter needs to be based on the content
> of the documents. and not based on the file types
Who says that a namespace filter is only able to filter based on "file types"?! Within the configuration, you declare if you want to restrict the filtering on certain type(s) (and that is what you want here, you want to restrict it on XML forms files).
What you will filter depends on your own implementation; you will have the collection at hand, from this each document, and you can have a look inside the document, to check whether you want to sort it out or not.
A second possibility - faster at runtime - would be to map the field to a property (maybe a custom property) and to implement a property filter.
Hope it helps
Detlev
Hi Srinivasa,
i am not sure, but think you could do this with the ResourceListFilter. the basic idea is the following you get the collection and then render through IResources, as you can see it here:
import com.sapportals.wcm.WcmException;
import com.sapportals.wcm.repository.*;
import com.sapportals.wcm.repository.service.layout.customizing.*;
import com.sapportals.wcm.service.resourcelistfilter.IResourceListFilter;
import java.util.Date;
public class ResourceListFilterExample implements IResourceListFilter {
public void filterResourceList(IResourceList list, IParameters parameters)
throws WcmException
{
boolean remove = false;
IResource currResource = null;
IPropertyName ipn = new PropertyName("http://sapportals.com/xmlns/cm", "created");
IProperty ip = null;
Date thresholdDate = new Date(System.currentTimeMillis()-86400000L);
for(IResourceListIterator it = list.listIterator(); it.hasNext();)
{
remove = false;
currResource = it.next();
ip = currResource.getProperty(ipn);
// remove files which are older than our threshold date
if (ip!=null) if (ip.getDateValue().before(thresholdDate)) remove = true;
// remove hidden files
if(currResource.getName().startsWith(".")) remove = true;
if(remove) it.remove();
}
}
public IResourceListFilter getNewInstance() {
return new ResourceListFilterExample();
}
public ResourceListFilterExample() {
}
}
Here i make use of the properties map, but i suppose you can also getContent() and then parse XML at this point. I will mail you the project (in KM service wrapper add usual
CrtClassLoaderRegistry.addClassLoader(this.getClass().getClassLoader());
line in init() method).
regards,
ds
Hi,
when having some resource (collection / real resource) at hand (which you do when using these filter implementations), you can retrieve the ResourceContext, and from this again the Locale (or the User): resource.getContext().getLocale().
Hope it helps
Detlev
PS: The ResourceListFilter is some filter you can add specifically to a collection renderer, so it does not work in any case. Maybe that's what you can use, too. The NamespaceFilter implementation is more or less equivalent, in addition you have to implement a manager class.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.