Skip to Content
0
Former Member
Oct 21, 2005 at 07:22 AM

Implementing Property Filter

18 Views

I am trying to implement a property filter that changes the resource type property of xml documents in KM repository.

I have followed the SimplePropertyFilter example provided by sdn and deployed the par, but still I cannot see the property change.

Here is my Code.

public class CorpNewsPropertyFilter implements IPropertyFilter {

private final IPropertyFilter predecessorFilter;

private static Location trace = Location.getLocation(CorpNewsPropertyFilter.class);

CorpNewsPropertyFilter(IPropertyFilter predecessorFilter) {

this.predecessorFilter = predecessorFilter;

}

public Properties getFilterContext() {

return this.predecessorFilter.getFilterContext();

}

public IResource getResource() throws WcmException {

return this.predecessorFilter.getResource();

}

public URI getURI() throws WcmException {

return this.predecessorFilter.getURI();

}

public IRepositoryManager getRepositoryManager() throws WcmException {

return this.predecessorFilter.getRepositoryManager();

}

public PropertyFilterMode getFilterMode() throws WcmException {

return PropertyFilterMode.ALL_PROPERTIES;

}

public IPropertyNameList getPropertyNameList() throws WcmException {

return this.predecessorFilter.getPropertyNameList();

}

public IPropertyMap filter() throws WcmException {

IPropertyMap map = this.predecessorFilter.filter();

IPropertyName resTypeProp = new PropertyName(IWcmConst.SAP_WCM_NAMESPACE, IWcmConst.PROP_RESOURCE_TYPE);

if(map.containsProperty(resTypeProp)) {

IMutableProperty resType = new MutableProperty(resTypeProp, "http://sap.com/xmlns/cm/app/xmlforms/CorporateNews");

IMutablePropertyMap mutableMap = map.getMutable();

mutableMap.put(resType);

return mutableMap;

}

return map;

}

}

public class CorpNewsPropertyFilterManager extends AbstractPropertyFilterManager {

public CorpNewsPropertyFilterManager() {

super();

// Do not add code here. Add it to startUpImpl() instead !

}

public IPropertyFilter getFilterForRead(IPropertyFilter predecessorFilter) throws WcmException {

return new CorpNewsPropertyFilter(predecessorFilter);

}

public IPropertyFilter getFilterForWrite(IPropertyFilter predecessorFilter) throws WcmException {

return new CorpNewsPropertyFilter(predecessorFilter);

}

protected void startUpImpl() throws ConfigurationException, StartupException {

// TODO implement this method

/*

try {

}

catch (Exception e) {

throw new StartupException(e.getMessage(), e);

}

*/

}

protected void shutDownImpl() { }

}

Is there anything I am missing??