public class DeletePropertyFilter extends AbstractDocumentFilter
Document
filter that removes the specified
Properties
from the document.
The deleted properties are not fed to the GSA and do not
appear in the set of properties available from the document.
Example documentFilters.xml
Configuration:
The following example filters out the Department
and Section
properties from the document.
<!-- Remove Department and Section properties. -->
<bean id="DeleteDeptAndSect"
class="com.google.enterprise.connector.util.filter.DeletePropertyFilter">
<property name="propertyNames">
<set>
<value>Department</value>
<value>Section</value>
</set>
</property>
</bean>
Constructor and Description |
---|
DeletePropertyFilter() |
Modifier and Type | Method and Description |
---|---|
Property |
findProperty(Document source,
java.lang.String name)
Finds a
Property by name . |
java.util.Set<java.lang.String> |
getPropertyNames(Document source)
Gets the set of names of all
Properties in the
Document , removing the names of deleted Properties from
the Set returned by the source Document . |
void |
setPropertyName(java.lang.String propertyName)
Sets the the name of the
Property to remove. |
void |
setPropertyNames(java.util.Set<java.lang.String> propertyNames)
Sets the the names of the
Properties to remove. |
java.lang.String |
toString() |
getPropertyValues, newDocumentFilter
public void setPropertyName(java.lang.String propertyName)
Property
to remove.propertyName
- the name of the Property
to removejava.lang.IllegalArgumentException
- if propertyName
is null
or emptypublic void setPropertyNames(java.util.Set<java.lang.String> propertyNames)
Properties
to remove.propertyNames
- a Set
of names of the
Properties
to removejava.lang.NullPointerException
- if propertyNames
is null
public Property findProperty(Document source, java.lang.String name) throws RepositoryException
Property
by name
. If the Document
has a
property of that name, and that property has not been deleted, then the
property is returned.findProperty
in class AbstractDocumentFilter
source
- the source Document
for this filtername
- the name of the property to findnull
otherwiseRepositoryException
- if a repository access error occursRepositoryDocumentException
- if a document has fatal
processing errorspublic java.util.Set<java.lang.String> getPropertyNames(Document source) throws RepositoryException
Properties
in the
Document
, removing the names of deleted Properties from
the Set returned by the source
Document
.getPropertyNames
in class AbstractDocumentFilter
source
- the source Document
for this filterRepositoryException
- if a repository access error occursRepositoryDocumentException
- if a document has fatal
processing errorspublic java.lang.String toString()
toString
in class AbstractDocumentFilter