diff --git a/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/OrganizationEntityModel.java b/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/OrganizationEntityModel.java index 237476d40220b6..0f63ca15bebe98 100644 --- a/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/OrganizationEntityModel.java +++ b/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/OrganizationEntityModel.java @@ -15,8 +15,10 @@ package com.liferay.segments.internal.odata.entity; import com.liferay.portal.kernel.search.Field; +import com.liferay.portal.odata.entity.DateEntityField; import com.liferay.portal.odata.entity.EntityField; import com.liferay.portal.odata.entity.EntityModel; +import com.liferay.portal.odata.entity.StringEntityField; import java.util.Map; import java.util.function.Function; @@ -51,29 +53,22 @@ public String getName() { } private static final Map _entityFieldsMap = Stream.of( - new EntityField( - Field.NAME, EntityField.Type.STRING, - locale -> Field.getSortableFieldName(Field.NAME)), - new EntityField( - Field.ORGANIZATION_ID, EntityField.Type.STRING, - locale -> Field.ORGANIZATION_ID), - new EntityField( - Field.TREE_PATH, EntityField.Type.STRING, - locale -> Field.TREE_PATH), - new EntityField( - Field.TYPE, EntityField.Type.STRING, locale -> Field.TYPE), - new EntityField( - "companyId", EntityField.Type.STRING, locale -> "companyId"), - new EntityField( - "dateModified", EntityField.Type.DATE, + new StringEntityField( + Field.NAME, locale -> Field.getSortableFieldName(Field.NAME)), + new StringEntityField( + Field.ORGANIZATION_ID, locale -> Field.ORGANIZATION_ID), + new StringEntityField(Field.TREE_PATH, locale -> Field.TREE_PATH), + new StringEntityField(Field.TYPE, locale -> Field.TYPE), + new StringEntityField("companyId", locale -> "companyId"), + new DateEntityField( + "dateModified", locale -> Field.getSortableFieldName(Field.MODIFIED_DATE), locale -> Field.MODIFIED_DATE), - new EntityField( - "nameTreePath", EntityField.Type.STRING, + new StringEntityField( + "nameTreePath", locale -> Field.getSortableFieldName("nameTreePath_String")), - new EntityField( - "parentOrganizationId", EntityField.Type.STRING, - locale -> "parentOrganizationId") + new StringEntityField( + "parentOrganizationId", locale -> "parentOrganizationId") ).collect( Collectors.toMap(EntityField::getName, Function.identity()) ); diff --git a/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/UserEntityModel.java b/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/UserEntityModel.java index 7086e00c57ffc5..5c08268b5ba356 100644 --- a/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/UserEntityModel.java +++ b/modules/apps/segments/segments-service/src/main/java/com/liferay/segments/internal/odata/entity/UserEntityModel.java @@ -15,8 +15,10 @@ package com.liferay.segments.internal.odata.entity; import com.liferay.portal.kernel.search.Field; +import com.liferay.portal.odata.entity.DateEntityField; import com.liferay.portal.odata.entity.EntityField; import com.liferay.portal.odata.entity.EntityModel; +import com.liferay.portal.odata.entity.StringEntityField; import java.util.Map; import java.util.function.Function; @@ -50,51 +52,33 @@ public String getName() { } private static final Map _entityFieldsMap = Stream.of( - new EntityField( - "ancestorOrganizationIds", EntityField.Type.STRING, - locale -> "ancestorOrganizationIds"), - new EntityField( - "companyId", EntityField.Type.STRING, locale -> "companyId"), - new EntityField( - "dateModified", EntityField.Type.DATE, + new StringEntityField( + "ancestorOrganizationIds", locale -> "ancestorOrganizationIds"), + new StringEntityField("companyId", locale -> "companyId"), + new DateEntityField( + "dateModified", locale -> Field.getSortableFieldName(Field.MODIFIED_DATE), locale -> Field.MODIFIED_DATE), - new EntityField( - "emailAddress", EntityField.Type.STRING, locale -> "emailAddress"), - new EntityField( - "firstName", EntityField.Type.STRING, - locale -> Field.getSortableFieldName("firstName")), - new EntityField( - "groupId", EntityField.Type.STRING, locale -> "groupId"), - new EntityField( - "groupIds", EntityField.Type.STRING, locale -> "groupIds"), - new EntityField( - "jobTitle", EntityField.Type.STRING, - locale -> Field.getSortableFieldName("jobTitle")), - new EntityField( - "lastName", EntityField.Type.STRING, - locale -> Field.getSortableFieldName("lastName")), - new EntityField( - "organizationCount", EntityField.Type.STRING, - locale -> "organizationCount"), - new EntityField( - "organizationIds", EntityField.Type.STRING, - locale -> "organizationIds"), - new EntityField( - "roleIds", EntityField.Type.STRING, locale -> "roleIds"), - new EntityField( - "scopeGroupId", EntityField.Type.STRING, locale -> "scopeGroupId"), - new EntityField( - "screenName", EntityField.Type.STRING, - locale -> Field.getSortableFieldName("screenName"), - locale -> "screenName"), - new EntityField( - "teamIds", EntityField.Type.STRING, locale -> "teamIds"), - new EntityField( - "userGroupIds", EntityField.Type.STRING, locale -> "userGroupIds"), - new EntityField("userId", EntityField.Type.STRING, locale -> "userId"), - new EntityField( - "userName", EntityField.Type.STRING, locale -> "userName") + new StringEntityField("emailAddress", locale -> "emailAddress"), + new StringEntityField( + "firstName", locale -> Field.getSortableFieldName("firstName")), + new StringEntityField("groupId", locale -> "groupId"), + new StringEntityField("groupIds", locale -> "groupIds"), + new StringEntityField( + "jobTitle", locale -> Field.getSortableFieldName("jobTitle")), + new StringEntityField( + "lastName", locale -> Field.getSortableFieldName("lastName")), + new StringEntityField( + "organizationCount", locale -> "organizationCount"), + new StringEntityField("organizationIds", locale -> "organizationIds"), + new StringEntityField("roleIds", locale -> "roleIds"), + new StringEntityField("scopeGroupId", locale -> "scopeGroupId"), + new StringEntityField( + "screenName", locale -> Field.getSortableFieldName("screenName")), + new StringEntityField("teamIds", locale -> "teamIds"), + new StringEntityField("userGroupIds", locale -> "userGroupIds"), + new StringEntityField("userId", locale -> "userId"), + new StringEntityField("userName", locale -> "userName") ).collect( Collectors.toMap(EntityField::getName, Function.identity()) );