Skip to content

Commit

Permalink
LPS-98835 Support condition field based on organization tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rotty3000 committed Oct 2, 2019
1 parent dddcb0a commit 6d0f12b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/apps/segments/segments-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies {
compileOnly project(":apps:portal:portal-upgrade-api")
compileOnly project(":apps:segments:segments-api")
compileOnly project(":apps:staging:staging-api")
compileOnly project(":apps:static:osgi:osgi-util")
compileOnly project(":apps:static:portal-configuration:portal-configuration-metatype-api")
compileOnly project(":apps:xstream:xstream-configurator-api")
compileOnly project(":core:osgi-service-tracker-collections")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.liferay.osgi.service.tracker.collections.map.ServiceReferenceMapper;
import com.liferay.osgi.service.tracker.collections.map.ServiceTrackerMap;
import com.liferay.osgi.service.tracker.collections.map.ServiceTrackerMapFactory;
import com.liferay.osgi.util.StringPlus;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.segments.field.customizer.SegmentsFieldCustomizer;
import com.liferay.segments.field.customizer.SegmentsFieldCustomizerRegistry;
Expand Down Expand Up @@ -104,10 +105,13 @@ public void map(
ServiceReference<SegmentsFieldCustomizer> serviceReference,
Emitter<String> emitter) {

String entityName = (String)serviceReference.getProperty(
"segments.field.customizer.entity.name");
List<String> entityNames = StringPlus.asList(
serviceReference.getProperty(
"segments.field.customizer.entity.name"));

emitter.emit(entityName);
for (String entityName : entityNames) {
emitter.emit(entityName);
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public OrganizationEntityModel(List<EntityField> customEntityFields) {
"dateModified",
locale -> Field.getSortableFieldName(Field.MODIFIED_DATE),
locale -> Field.MODIFIED_DATE),
new IdEntityField(
"assetTagIds", locale -> Field.ASSET_TAG_IDS, String::valueOf),
new IdEntityField(
"classPK", locale -> Field.ORGANIZATION_ID, String::valueOf),
new IdEntityField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
@Component(
immediate = true,
property = {
"segments.field.customizer.entity.name=Organization",
"segments.field.customizer.entity.name=User",
"segments.field.customizer.key=" + AssetTagSegmentsFieldCustomizer.KEY,
"segments.field.customizer.priority:Integer=50"
Expand Down

0 comments on commit 6d0f12b

Please sign in to comment.