Skip to content

Commit

Permalink
LPS-86674 Add primitive class types to User and Organization EntityMo…
Browse files Browse the repository at this point in the history
…dels
  • Loading branch information
Eduardo Garcia authored and brianchandotcom committed Oct 24, 2018
1 parent 87607db commit eb0fa85
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -51,29 +53,22 @@ public String getName() {
}

private static final Map<String, EntityField> _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())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,51 +52,33 @@ public String getName() {
}

private static final Map<String, EntityField> _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())
);
Expand Down

0 comments on commit eb0fa85

Please sign in to comment.