Gets entity id as parameter.

@param service the service
@return the entity id as parameter
327606
protected static Optional<URIBuilder.BasicNameValuePair> getEntityIdAsParameter(final Service service) {
        val builder = new URIBuilder(service.getId());
        return builder.getQueryParams()
            .stream()
            .filter(p -> p.getName().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID))
            .findFirst();
    }
970971
private UserRegistryService getUserRegistryService(String id) {
        UserRegistryService service = userRegistry.getService(id);
        if (service == null) {
            throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_USERREGISTRY_REF, id);
        }
        return service;
    }
1184876
private static QName getServiceName(Server server) {
        QName serviceName;
        String bindingId = getBindingId(server);
        EndpointInfo eInfo = server.getEndpoint().getEndpointInfo();
        
        if (JAXRS_BINDING_ID.equals(bindingId)) {
            serviceName = eInfo.getName();
        } else {
            ServiceInfo serviceInfo = eInfo.getService();
            serviceName =  serviceInfo.getName();
        }
        return serviceName;
    }
875661
public static boolean isServiceEnabled(EntityManager em, Service service) {
        ServiceManagementRecord record = findServiceManagementRecord(em, service);

        return record == null ? true : record.isEnabled();
    }
695067
public Collection<MultifactorAuthenticationProvider> getAuthenticationProviderForService(final RegisteredService service) {
        val policy = service.getMultifactorPolicy();
        if (policy != null) {
            return policy.getMultifactorAuthenticationProviders().stream()
                .map(MultifactorAuthenticationUtils::getMultifactorAuthenticationProviderFromApplicationContext)
                .filter(Optional::isPresent)
                .map(Optional::get)
                .collect(Collectors.toSet());
        }
        return null;
    }
1011775
public String getId() {
        String id = operation.getOperationId();

        if (id == null)
            id = getPath() + " " + getMethod().toString().toLowerCase();

        return id;
    }
127945
@SuppressWarnings("unchecked")
	@Override
	public ID getId(T entity) {
		return (ID) MetadataParser.getItemName(entity);
	}
978684
private Builder getResource(EntityOperation operation)
            throws ServiceException {
        return getResource(operation.getUri()).type(operation.getContentType())
                .accept(operation.getAcceptType());
    }
938823
@Override
    public IEntity getEntity(String key, Class type, String svcName) throws GroupsException {
        IIndividualGroupService svc = null;
        if (svcName == null) {
            svc = getDefaultService();
        } else {
            try {
                Name n = GroupService.parseServiceName(svcName);
                svc = getComponentService(n);
            } catch (InvalidNameException ine) {
                throw new GroupsException("Invalid service name.");
            }
        }
        return (svc == null) ? null : svc.getEntity(key, type);
    }
870611
@Override
    public Long get(Entity entity) {
        Objects.requireNonNull(entity, "entity cannot be null");
        // return id()
        return entity.id();
    }
795929
protected String produceTicketIdentifier(final Service service) {
        val uniqueTicketIdGenKey = service.getClass().getName();
        LOGGER.debug("Looking up ticket id generator for [{}]", uniqueTicketIdGenKey);
        var generator = this.uniqueTicketIdGeneratorsForService.get(uniqueTicketIdGenKey);
        if (generator == null) {
            generator = this.defaultTicketIdGenerator;
            LOGGER.debug("Ticket id generator not found for [{}]. Using the default generator...", uniqueTicketIdGenKey);
        }

        val ticketId = generator.getNewTicketId(ProxyTicket.PROXY_TICKET_PREFIX);
        if (this.cipherExecutor == null) {
            return ticketId;
        }
        LOGGER.trace("Attempting to encode proxy ticket [{}]", ticketId);
        val encodedId = this.cipherExecutor.encode(ticketId);
        LOGGER.debug("Encoded proxy ticket id [{}]", encodedId);
        return encodedId;
    }
588026
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public ResponseEntity<E> findById(@PathVariable Integer id) {

        try {
            E entity = this.service.findById(id);
            LOG.trace("Found " + entity.getClass().getSimpleName()
                + " with ID " + entity.getId());
            return new ResponseEntity<E>(entity, HttpStatus.OK);
        } catch (Exception e) {
            LOG.error("Error finding entity with id " + id + ": "
                + e.getMessage());
            return new ResponseEntity<E>(HttpStatus.NOT_FOUND);
        }
    }
657102
public static String streamEntityName(final StreamId streamId) {
        // User defined ID
        if (streamId instanceof JpaStreamId) {
            final JpaStreamId jpaId = (JpaStreamId) streamId;
            return jpaId.getEntityName();
        }
        // Default ID
        if (streamId.isProjection()) {
            return streamId.getName();
        }
        if (streamId.getParameters().size() == 0) {
            return NoParamsStream.class.getSimpleName();
        }
        return streamId.getName() + "Stream";
    }
411030
public X getPrimaryID(T entity) {
		if(mappingContext == null || conversionService == null) {
			fetchMappingContextAndConversionService();
		}

		MongoPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(entity.getClass());
		MongoPersistentProperty idProperty = persistentEntity.getIdProperty();
		if(idProperty == null) {
			return null;
		}
		
//		X idValue = BeanWrapper.create(entity, conversionService).getProperty(idProperty, this.primaryIDClass);
		X idValue = (X) this.mappingContext.getPersistentEntity(this.entityClass).getPropertyAccessor(entity).getProperty(idProperty);
		return idValue;
	}
475937
@GetMapping(value = "/{entityTypeId}/{id}", produces = APPLICATION_JSON_VALUE)
  public Map<String, Object> retrieveEntity(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @RequestParam(value = "attributes", required = false) String[] attributes,
      @RequestParam(value = "expand", required = false) String[] attributeExpands) {
    Set<String> attributesSet = toAttributeSet(attributes);
    Map<String, Set<String>> attributeExpandSet = toExpandMap(attributeExpands);

    EntityType meta = dataService.getEntityType(entityTypeId);
    Object id = getTypedValue(untypedId, meta.getIdAttribute());
    Entity entity = dataService.findOneById(entityTypeId, id);
    if (entity == null) {
      throw new UnknownEntityException(meta, id);
    }

    return getEntityAsMap(entity, meta, attributesSet, attributeExpandSet);
  }
79481
private static Class<?> getIdClass(Class<?> entityClass) {
        Type[] genTypes = entityClass.getGenericInterfaces();

        for (int i = 0; i < genTypes.length; i++) {
            Type genType = genTypes[i];
            String s1 = genType.getClass().getName();
            String s2 = BaseEntity.class.getName();
            if (s1.startsWith(s2)) {
                Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
                // ID真实的class
                Class<?> mapperClass = (Class<?>) params[0];
                return mapperClass;
            }
        }

        return null;
    }
92606
def _get_or_create_service_key(self):
        
        keys = self.service._get_service_keys(self.name)
        for key in keys['resources']:
            if key['entity']['name'] == self.service_name:
                return self.service.get_service_key(self.name,
                        self.service_name)

        self.service.create_service_key(self.name, self.service_name)
        return self.service.get_service_key(self.name, self.service_name)