Skip to content

Commit

Permalink
[MNT-24807] Additional config to disable property mapper entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
cezary-witkowski committed Jan 16, 2025
1 parent a228bb4 commit 01e2b18
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
public interface PropertyMapper
{
Serializable map(QName propertyQName, Serializable value);

PropertyMapper NO_OP = (propertyQName, value) -> value;

Check warning

Code scanning / PMD

Fields should be declared at the top of the class, before any method declarations, constructors, initializers or inner classes. Warning

Fields should be declared at the top of the class, before any method declarations, constructors, initializers or inner classes.
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ public PropertyMapperFactory(TypeDefExpander typeDefExpander)
this.typeDefExpander = typeDefExpander;
}

public PropertyMapper createReplaceSensitivePropertyWithTextMapper(String userConfiguredSensitiveProperties, String userConfiguredReplacementText)
public PropertyMapper createPropertyMapper(String enabled, String userConfiguredSensitiveProperties, String userConfiguredReplacementText)
{
if ("false".equalsIgnoreCase(enabled))
{
return PropertyMapper.NO_OP;
}
Set<QName> sensitiveProperties = Optional.ofNullable(userConfiguredSensitiveProperties)
.filter(Predicate.not(String::isEmpty))
.map(CSVStringToListParser::parse)
Expand Down
3 changes: 2 additions & 1 deletion repository/src/main/resources/alfresco/events2-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
<constructor-arg ref="event2TypeDefExpander"/>
</bean>

<bean id="event2PropertyMapper" factory-bean="event2PropertyMapperFactory" factory-method="createReplaceSensitivePropertyWithTextMapper">
<bean id="event2PropertyMapper" factory-bean="event2PropertyMapperFactory" factory-method="createPropertyMapper">
<constructor-arg value="${repo.event2.mapper.enabled}"/>
<constructor-arg value="${repo.event2.mapper.overrideDefaultProperties}"/>
<constructor-arg value="${repo.event2.mapper.overrideReplacementText}"/>
</bean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ repo.event2.filter.childAssocTypes=rn:rendition
# Note: username's case-sensitivity depends on the {user.name.caseSensitive} setting
repo.event2.filter.users=
repo.event2.filter.nodeProperties=
repo.event2.mapper.enabled=true
repo.event2.mapper.overrideDefaultProperties=
repo.event2.mapper.overrideReplacementText=
# Topic name
Expand Down

0 comments on commit 01e2b18

Please sign in to comment.