List of usage examples for org.springframework.data.rest.webmvc PersistentEntityResource getPersistentEntity
public PersistentEntity<?, ? extends PersistentProperty<?>> getPersistentEntity()
From source file:org.lightadmin.core.web.support.DomainEntityLinks.java
public Link linkFor(PersistentEntityResource persistentEntityResource) { PersistentEntity persistentEntity = persistentEntityResource.getPersistentEntity(); Object instance = persistentEntityResource.getContent(); return linkToSingleResource(persistentEntity.getType(), idAttributeValue(instance, persistentEntity)); }
From source file:org.lightadmin.core.web.support.DynamicPersistentEntityResourceProcessor.java
private Link domainLink(PersistentEntityResource persistentEntityResource) { PersistentEntity persistentEntity = persistentEntityResource.getPersistentEntity(); if (domainEntityLinks.supports(persistentEntity.getType())) { return domainEntityLinks.linkFor(persistentEntityResource); }//from w w w . j a v a2s.c o m return null; }
From source file:org.lightadmin.core.web.support.DynamicPersistentEntityResourceProcessor.java
@Override public PersistentEntityResource<?> process(PersistentEntityResource<?> persistentEntityResource) { PersistentEntity persistentEntity = persistentEntityResource.getPersistentEntity(); Object value = persistentEntityResource.getContent(); Link[] links = persistentEntityResource.getLinks() .toArray(new Link[persistentEntityResource.getLinks().size()]); String stringRepresentation = stringRepresentation(value, persistentEntity); Link domainLink = domainLink(persistentEntityResource); boolean managedDomainType = adminConfiguration.isManagedDomainType(persistentEntity.getType()); String primaryKey = primaryKey(persistentEntity); Map<DomainConfigurationUnitType, Map<String, Object>> dynamicProperties = dynamicPropertiesPerUnit(value, persistentEntity);//w w w . j a va 2 s . com PersistentEntityWrapper persistentEntityWrapper = persistentEntity(value, dynamicProperties, stringRepresentation, domainLink, managedDomainType, primaryKey); return new PersistentEntityResource<Object>(persistentEntity, persistentEntityWrapper, links); }