001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.util.server.persistence; 018 019import com.echothree.model.control.core.common.ComponentVendors; 020import com.echothree.model.control.core.common.EntityTypes; 021import com.echothree.model.control.security.common.SecurityRoleGroups; 022import com.echothree.model.control.security.common.SecurityRoles; 023import com.echothree.model.control.security.server.logic.SecurityRoleLogic; 024import com.echothree.model.control.sequence.common.SequenceTypes; 025import com.echothree.model.control.sequence.server.logic.SequenceGeneratorLogic; 026import com.echothree.model.control.warehouse.server.control.WarehouseControl; 027import com.echothree.model.data.communication.common.pk.CommunicationEventPK; 028import com.echothree.model.data.communication.server.factory.CommunicationEventFactory; 029import com.echothree.model.data.contactlist.common.pk.PartyContactListPK; 030import com.echothree.model.data.contactlist.server.factory.PartyContactListFactory; 031import com.echothree.model.data.core.common.pk.ComponentVendorPK; 032import com.echothree.model.data.core.common.pk.EntityAliasTypePK; 033import com.echothree.model.data.core.common.pk.EntityAttributeGroupPK; 034import com.echothree.model.data.core.common.pk.EntityAttributePK; 035import com.echothree.model.data.core.common.pk.EntityListItemPK; 036import com.echothree.model.data.core.common.pk.EntityTypePK; 037import com.echothree.model.data.core.common.pk.MimeTypePK; 038import com.echothree.model.data.core.server.entity.EntityInstance; 039import com.echothree.model.data.core.server.factory.ComponentVendorFactory; 040import com.echothree.model.data.core.server.factory.EntityAliasTypeFactory; 041import com.echothree.model.data.core.server.factory.EntityAttributeFactory; 042import com.echothree.model.data.core.server.factory.EntityAttributeGroupFactory; 043import com.echothree.model.data.core.server.factory.EntityListItemFactory; 044import com.echothree.model.data.core.server.factory.EntityTypeFactory; 045import com.echothree.model.data.core.server.factory.MimeTypeFactory; 046import com.echothree.model.data.forum.common.pk.ForumGroupPK; 047import com.echothree.model.data.forum.common.pk.ForumMessagePK; 048import com.echothree.model.data.forum.common.pk.ForumPK; 049import com.echothree.model.data.forum.common.pk.ForumThreadPK; 050import com.echothree.model.data.forum.server.factory.ForumFactory; 051import com.echothree.model.data.forum.server.factory.ForumGroupFactory; 052import com.echothree.model.data.forum.server.factory.ForumMessageFactory; 053import com.echothree.model.data.forum.server.factory.ForumThreadFactory; 054import com.echothree.model.data.item.common.pk.ItemDescriptionPK; 055import com.echothree.model.data.item.common.pk.ItemPK; 056import com.echothree.model.data.item.server.factory.ItemDescriptionFactory; 057import com.echothree.model.data.item.server.factory.ItemFactory; 058import com.echothree.model.data.party.server.entity.Party; 059import com.echothree.model.data.subscription.common.pk.SubscriptionPK; 060import com.echothree.model.data.subscription.server.factory.SubscriptionFactory; 061import com.echothree.model.data.training.common.pk.PartyTrainingClassPK; 062import com.echothree.model.data.training.common.pk.TrainingClassPK; 063import com.echothree.model.data.training.server.factory.PartyTrainingClassFactory; 064import com.echothree.model.data.training.server.factory.TrainingClassFactory; 065import com.echothree.model.data.vendor.common.pk.VendorItemPK; 066import com.echothree.model.data.vendor.server.factory.VendorItemFactory; 067import com.echothree.model.data.warehouse.common.pk.LocationPK; 068import com.echothree.model.data.warehouse.server.factory.LocationFactory; 069import com.echothree.util.common.persistence.EntityNames; 070import com.echothree.util.common.persistence.Names; 071import com.echothree.util.common.persistence.Targets; 072import com.echothree.util.common.transfer.MapWrapper; 073import com.echothree.util.server.message.ExecutionErrorAccumulator; 074import com.echothree.util.server.persistence.translator.ComponentVendorTranslator; 075import com.echothree.util.server.persistence.translator.EntityInstanceAndNames; 076import com.echothree.util.server.persistence.translator.EntityInstanceTranslator; 077import com.echothree.util.server.persistence.translator.InvoiceNameTranslator; 078import com.echothree.util.server.persistence.translator.OrderNameTranslator; 079import com.echothree.util.server.persistence.translator.PartyNameTranslator; 080import com.echothree.util.server.persistence.translator.SequenceTypeTranslator; 081import java.util.Collections; 082import java.util.HashMap; 083import java.util.Map; 084 085public class EntityNamesUtils { 086 087 private EntityNamesUtils() { 088 super(); 089 } 090 091 private static class EntityNamesUtilsHolder { 092 static EntityNamesUtils instance = new EntityNamesUtils(); 093 } 094 095 public static EntityNamesUtils getInstance() { 096 return EntityNamesUtilsHolder.instance; 097 } 098 099 private final static Map<String, ComponentVendorTranslator> componentVendorTranslators = new HashMap<>(); 100 101 public static void addComponentVendorTranslator(String componentVendorName, ComponentVendorTranslator componentVendorTranslator) { 102 componentVendorTranslators.put(componentVendorName, componentVendorTranslator); 103 } 104 105 static { 106 Map<String, EntityInstanceTranslator> nameTranslators = new HashMap<>(16); 107 108 nameTranslators.put(EntityTypes.Invoice.name(), new InvoiceNameTranslator()); 109 nameTranslators.put(EntityTypes.Order.name(), new OrderNameTranslator()); 110 nameTranslators.put(EntityTypes.Party.name(), new PartyNameTranslator()); 111 112 nameTranslators.put(EntityTypes.Item.name(), (final EntityInstance entityInstance) -> { 113 var itemDetail = ItemFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 114 new ItemPK(entityInstance.getEntityUniqueId())).getLastDetail(); 115 var names = new MapWrapper<String>(1); 116 117 names.put(Names.ItemName.name(), itemDetail.getItemName()); 118 119 return new EntityNames(Targets.Item.name(), names); 120 }); 121 122 nameTranslators.put(EntityTypes.ItemDescription.name(), (final EntityInstance entityInstance) -> { 123 var itemDescriptionDetail = ItemDescriptionFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 124 new ItemDescriptionPK(entityInstance.getEntityUniqueId())).getLastDetail(); 125 var names = new MapWrapper<String>(3); 126 127 names.put(Names.ItemDescriptionTypeName.name(), itemDescriptionDetail.getItemDescriptionType().getLastDetail().getItemDescriptionTypeName()); 128 names.put(Names.ItemName.name(), itemDescriptionDetail.getItem().getLastDetail().getItemName()); 129 names.put(Names.LanguageIsoName.name(), itemDescriptionDetail.getLanguage().getLanguageIsoName()); 130 131 return new EntityNames(Targets.ItemDescription.name(), names); 132 }); 133 134 nameTranslators.put(EntityTypes.ForumGroup.name(), (final EntityInstance entityInstance) -> { 135 var forumGroupDetail = ForumGroupFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 136 new ForumGroupPK(entityInstance.getEntityUniqueId())).getLastDetail(); 137 var names = new MapWrapper<String>(1); 138 139 names.put(Names.ForumGroupName.name(), forumGroupDetail.getForumGroupName()); 140 141 return new EntityNames(Targets.ForumGroup.name(), names); 142 }); 143 144 nameTranslators.put(EntityTypes.Forum.name(), (final EntityInstance entityInstance) -> { 145 var forumDetail = ForumFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 146 new ForumPK(entityInstance.getEntityUniqueId())).getLastDetail(); 147 var names = new MapWrapper<String>(1); 148 149 names.put(Names.ForumName.name(), forumDetail.getForumName()); 150 151 return new EntityNames(Targets.Forum.name(), names); 152 }); 153 154 nameTranslators.put(EntityTypes.ForumMessage.name(), (final EntityInstance entityInstance) -> { 155 var forumMessageDetail = ForumMessageFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 156 new ForumMessagePK(entityInstance.getEntityUniqueId())).getLastDetail(); 157 var names = new MapWrapper<String>(1); 158 159 names.put(Names.ForumMessageName.name(), forumMessageDetail.getForumMessageName()); 160 161 return new EntityNames(Targets.ForumMessage.name(), names); 162 }); 163 164 nameTranslators.put(EntityTypes.ForumThread.name(), (final EntityInstance entityInstance) -> { 165 var forumThreadDetail = ForumThreadFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 166 new ForumThreadPK(entityInstance.getEntityUniqueId())).getLastDetail(); 167 var names = new MapWrapper<String>(1); 168 169 names.put(Names.ForumThreadName.name(), forumThreadDetail.getForumThreadName()); 170 171 return new EntityNames(Targets.ForumThread.name(), names); 172 }); 173 174 nameTranslators.put(EntityTypes.TrainingClass.name(), (final EntityInstance entityInstance) -> { 175 var trainingClassDetail = TrainingClassFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 176 new TrainingClassPK(entityInstance.getEntityUniqueId())).getLastDetail(); 177 var names = new MapWrapper<String>(1); 178 179 names.put(Names.TrainingClassName.name(), trainingClassDetail.getTrainingClassName()); 180 181 return new EntityNames(Targets.TrainingClass.name(), names); 182 }); 183 184 nameTranslators.put(EntityTypes.PartyTrainingClass.name(), (final EntityInstance entityInstance) -> { 185 var partyTrainingClassDetail = PartyTrainingClassFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 186 new PartyTrainingClassPK(entityInstance.getEntityUniqueId())).getLastDetail(); 187 var names = new MapWrapper<String>(1); 188 189 names.put(Names.PartyTrainingClassName.name(), partyTrainingClassDetail.getPartyTrainingClassName()); 190 191 return new EntityNames(Targets.PartyTrainingClass.name(), names); 192 }); 193 194 nameTranslators.put(EntityTypes.CommunicationEvent.name(), (final EntityInstance entityInstance) -> { 195 var communicationEventDetail = CommunicationEventFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 196 new CommunicationEventPK(entityInstance.getEntityUniqueId())).getLastDetail(); 197 var names = new MapWrapper<String>(1); 198 199 names.put(Names.CommunicationEventName.name(), communicationEventDetail.getCommunicationEventName()); 200 201 return new EntityNames(Targets.CommunicationEvent.name(), names); 202 }); 203 204 nameTranslators.put(EntityTypes.VendorItem.name(), (final EntityInstance entityInstance) -> { 205 var vendorItemDetail = VendorItemFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 206 new VendorItemPK(entityInstance.getEntityUniqueId())).getLastDetail(); 207 var names = new MapWrapper<String>(2); 208 209 names.put(Names.VendorItemName.name(), vendorItemDetail.getVendorItemName()); 210 names.put(Names.PartyName.name(), vendorItemDetail.getVendorParty().getLastDetail().getPartyName()); 211 212 return new EntityNames(Targets.VendorItem.name(), names); 213 }); 214 215 nameTranslators.put(EntityTypes.PartyContactList.name(), (final EntityInstance entityInstance) -> { 216 var partyContactListDetail = PartyContactListFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 217 new PartyContactListPK(entityInstance.getEntityUniqueId())).getLastDetail(); 218 var names = new MapWrapper<String>(2); 219 220 names.put(Names.PartyName.name(), partyContactListDetail.getParty().getLastDetail().getPartyName()); 221 names.put(Names.ContactListName.name(), partyContactListDetail.getContactList().getLastDetail().getContactListName()); 222 223 return new EntityNames(Targets.PartyContactList.name(), names); 224 }); 225 226 nameTranslators.put(EntityTypes.Subscription.name(), (final EntityInstance entityInstance) -> { 227 var subscription = SubscriptionFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 228 new SubscriptionPK(entityInstance.getEntityUniqueId())); 229 var names = new MapWrapper<String>(1); 230 231 names.put(Names.SubscriptionName.name(), subscription.getLastDetail().getSubscriptionName()); 232 233 return new EntityNames(Targets.Subscription.name(), names); 234 }); 235 236 nameTranslators.put(EntityTypes.MimeType.name(), (final EntityInstance entityInstance) -> { 237 var mimeType = MimeTypeFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 238 new MimeTypePK(entityInstance.getEntityUniqueId())); 239 var names = new MapWrapper<String>(1); 240 241 names.put(Names.MimeTypeName.name(), mimeType.getLastDetail().getMimeTypeName()); 242 243 return new EntityNames(Targets.MimeType.name(), names); 244 }); 245 246 nameTranslators.put(EntityTypes.Location.name(), (final EntityInstance entityInstance) -> { 247 var warehouseControl = Session.getModelController(WarehouseControl.class); 248 var location = LocationFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 249 new LocationPK(entityInstance.getEntityUniqueId())); 250 var names = new MapWrapper<String>(2); 251 var locationDetail = location.getLastDetail(); 252 253 names.put(Names.WarehouseName.name(), warehouseControl.getWarehouse(locationDetail.getWarehouseParty()).getWarehouseName()); 254 names.put(Names.LocationName.name(), locationDetail.getLocationName()); 255 256 return new EntityNames(Targets.Location.name(), names); 257 }); 258 259 nameTranslators.put(EntityTypes.ComponentVendor.name(), (final EntityInstance entityInstance) -> { 260 var componentVendor = ComponentVendorFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 261 new ComponentVendorPK(entityInstance.getEntityUniqueId())); 262 var names = new MapWrapper<String>(1); 263 264 names.put(Names.ComponentVendorName.name(), componentVendor.getLastDetail().getComponentVendorName()); 265 266 return new EntityNames(Targets.ComponentVendor.name(), names); 267 }); 268 269 nameTranslators.put(EntityTypes.EntityType.name(), (final EntityInstance entityInstance) -> { 270 var entityType = EntityTypeFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 271 new EntityTypePK(entityInstance.getEntityUniqueId())); 272 var names = new MapWrapper<String>(2); 273 var entityTypeDetail = entityType.getLastDetail(); 274 275 names.put(Names.ComponentVendorName.name(), entityTypeDetail.getComponentVendor().getLastDetail().getComponentVendorName()); 276 names.put(Names.EntityTypeName.name(), entityTypeDetail.getEntityTypeName()); 277 278 return new EntityNames(Targets.EntityType.name(), names); 279 }); 280 281 nameTranslators.put(EntityTypes.EntityAliasType.name(), (final EntityInstance entityInstance) -> { 282 var entityAliasType = EntityAliasTypeFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 283 new EntityAliasTypePK(entityInstance.getEntityUniqueId())); 284 var names = new MapWrapper<String>(3); 285 var entityAliasTypeDetail = entityAliasType.getLastDetail(); 286 287 names.put(Names.ComponentVendorName.name(), entityAliasTypeDetail.getEntityType().getLastDetail().getComponentVendor().getLastDetail().getComponentVendorName()); 288 names.put(Names.EntityTypeName.name(), entityAliasTypeDetail.getEntityType().getLastDetail().getEntityTypeName()); 289 names.put(Names.EntityAliasTypeName.name(), entityAliasTypeDetail.getEntityAliasTypeName()); 290 291 return new EntityNames(Targets.EntityAliasType.name(), names); 292 }); 293 294 nameTranslators.put(EntityTypes.EntityAttribute.name(), (final EntityInstance entityInstance) -> { 295 var entityAttribute = EntityAttributeFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 296 new EntityAttributePK(entityInstance.getEntityUniqueId())); 297 var names = new MapWrapper<String>(3); 298 var entityAttributeDetail = entityAttribute.getLastDetail(); 299 300 names.put(Names.ComponentVendorName.name(), entityAttributeDetail.getEntityType().getLastDetail().getComponentVendor().getLastDetail().getComponentVendorName()); 301 names.put(Names.EntityTypeName.name(), entityAttributeDetail.getEntityType().getLastDetail().getEntityTypeName()); 302 names.put(Names.EntityAttributeName.name(), entityAttributeDetail.getEntityAttributeName()); 303 304 return new EntityNames(Targets.EntityAttribute.name(), names); 305 }); 306 307 nameTranslators.put(EntityTypes.EntityListItem.name(), (final EntityInstance entityInstance) -> { 308 var entityListItem = EntityListItemFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 309 new EntityListItemPK(entityInstance.getEntityUniqueId())); 310 var names = new MapWrapper<String>(4); 311 var entityListItemDetail = entityListItem.getLastDetail(); 312 313 names.put(Names.ComponentVendorName.name(), entityListItemDetail.getEntityAttribute().getLastDetail().getEntityType().getLastDetail().getEntityType().getLastDetail().getComponentVendor().getLastDetail().getComponentVendorName()); 314 names.put(Names.EntityTypeName.name(), entityListItemDetail.getEntityAttribute().getLastDetail().getEntityType().getLastDetail().getEntityTypeName()); 315 names.put(Names.EntityAttributeName.name(), entityListItemDetail.getEntityAttribute().getLastDetail().getEntityAttributeName()); 316 names.put(Names.EntityListItemName.name(), entityListItemDetail.getEntityListItemName()); 317 318 return new EntityNames(Targets.EntityListItem.name(), names); 319 }); 320 321 nameTranslators.put(EntityTypes.EntityAttributeGroup.name(), (final EntityInstance entityInstance) -> { 322 var entityAttributeGroup = EntityAttributeGroupFactory.getInstance().getEntityFromPK(EntityPermission.READ_ONLY, 323 new EntityAttributeGroupPK(entityInstance.getEntityUniqueId())); 324 var names = new MapWrapper<String>(1); 325 var entityAttributeGroupDetail = entityAttributeGroup.getLastDetail(); 326 327 names.put(Names.EntityAttributeGroupName.name(), entityAttributeGroupDetail.getEntityAttributeGroupName()); 328 329 return new EntityNames(Targets.EntityAttributeGroup.name(), names); 330 }); 331 332 nameTranslators = Collections.unmodifiableMap(nameTranslators); 333 334 addComponentVendorTranslator(ComponentVendors.ECHO_THREE.name(), new ComponentVendorTranslator(nameTranslators)); 335 } 336 337 // Entry point from the Identify UC. Permissions have already been checked at this point. 338 public EntityInstanceAndNames getEntityNames(final EntityInstance entityInstance) { 339 EntityNames result = null; 340 var entityType = entityInstance.getEntityType(); 341 var componentVendor = entityType.getLastDetail().getComponentVendor(); 342 var componentVendorName = componentVendor.getLastDetail().getComponentVendorName(); 343 344 var componentVendorTranslator = componentVendorTranslators.get(componentVendorName); 345 346 if(componentVendorTranslator != null) { 347 var nameTranslator = componentVendorTranslator.getNameTranslators().get(entityType.getLastDetail().getEntityTypeName()); 348 349 if(nameTranslator != null) { 350 result = nameTranslator.getNames(entityInstance); 351 } 352 } 353 354 return result == null ? null : new EntityInstanceAndNames(entityInstance, result); 355 } 356 357 private final static Map<String, SequenceTypeTranslator> sequenceTypeTranslators; 358 359 private final static InvoiceNameTranslator INVOICE_NAME_TRANSLATOR = new InvoiceNameTranslator(); 360 private final static OrderNameTranslator ORDER_NAME_TRANSLATOR = new OrderNameTranslator(); 361 private final static PartyNameTranslator PARTY_NAME_TRANSLATOR = new PartyNameTranslator(); 362 363 static { 364 var sequenceTypeTranslatorsMap = new HashMap<String, SequenceTypeTranslator>(7); 365 366 sequenceTypeTranslatorsMap.put(SequenceTypes.PURCHASE_INVOICE.name(), INVOICE_NAME_TRANSLATOR); 367 sequenceTypeTranslatorsMap.put(SequenceTypes.SALES_INVOICE.name(), INVOICE_NAME_TRANSLATOR); 368 sequenceTypeTranslatorsMap.put(SequenceTypes.PURCHASE_ORDER.name(), ORDER_NAME_TRANSLATOR); 369 sequenceTypeTranslatorsMap.put(SequenceTypes.SALES_ORDER.name(), ORDER_NAME_TRANSLATOR); 370 sequenceTypeTranslatorsMap.put(SequenceTypes.WISHLIST.name(), ORDER_NAME_TRANSLATOR); 371 sequenceTypeTranslatorsMap.put(SequenceTypes.CUSTOMER.name(), PARTY_NAME_TRANSLATOR); 372 sequenceTypeTranslatorsMap.put(SequenceTypes.EMPLOYEE.name(), PARTY_NAME_TRANSLATOR); 373 374 sequenceTypeTranslators = Collections.unmodifiableMap(sequenceTypeTranslatorsMap); 375 } 376 377 private EntityInstanceAndNames getEntityNames(final String sequenceTypeName, final String value, 378 final boolean includeEntityInstance) { 379 EntityInstanceAndNames result = null; 380 var sequenceTypeTranslator = sequenceTypeTranslators.get(sequenceTypeName); 381 382 if(sequenceTypeTranslator != null) { 383 result = sequenceTypeTranslator.getNames(sequenceTypeName, value, includeEntityInstance); 384 } 385 386 return result; 387 } 388 389 // Entry point from the Identify UC. Permissions have NOT been checked at this point. 390 public EntityInstanceAndNames getEntityNames(final ExecutionErrorAccumulator eea, final Party requestingParty, 391 final String value, final boolean includeEntityInstance) { 392 EntityInstanceAndNames result = null; 393 var sequenceType = SequenceGeneratorLogic.getInstance().identifySequenceType(value); 394 395 if(sequenceType != null) { 396 var sequenceTypeName = sequenceType.getLastDetail().getSequenceTypeName(); 397 var hasAccess = false; 398 399 if(sequenceTypeName.equals(SequenceTypes.PURCHASE_INVOICE.name()) 400 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 401 SecurityRoleGroups.PurchaseInvoice.name(), SecurityRoles.Search.name())) { 402 hasAccess = true; 403 } else if(sequenceTypeName.equals(SequenceTypes.SALES_INVOICE.name()) 404 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 405 SecurityRoleGroups.SalesOrder.name(), SecurityRoles.Search.name())) { 406 hasAccess = true; 407 } else if(sequenceTypeName.equals(SequenceTypes.PURCHASE_ORDER.name()) 408 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 409 SecurityRoleGroups.PurchaseOrder.name(), SecurityRoles.Search.name())) { 410 hasAccess = true; 411 } else if(sequenceTypeName.equals(SequenceTypes.SALES_ORDER.name()) 412 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 413 SecurityRoleGroups.SalesOrder.name(), SecurityRoles.Search.name())) { 414 hasAccess = true; 415 } else if(sequenceTypeName.equals(SequenceTypes.WISHLIST.name()) 416 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 417 SecurityRoleGroups.Wishlist.name(), SecurityRoles.Search.name())) { 418 hasAccess = true; 419 } else if(sequenceTypeName.equals(SequenceTypes.CUSTOMER.name()) 420 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 421 SecurityRoleGroups.Customer.name(), SecurityRoles.Search.name())) { 422 hasAccess = true; 423 } else if(sequenceTypeName.equals(SequenceTypes.EMPLOYEE.name()) 424 && SecurityRoleLogic.getInstance().hasSecurityRoleUsingNames(eea, requestingParty, 425 SecurityRoleGroups.Employee.name(), SecurityRoles.Search.name())) { 426 hasAccess = true; 427 } 428 429 result = hasAccess ? getEntityNames(sequenceTypeName, value, includeEntityInstance) : null; 430 } 431 432 return result; 433 } 434 435}