Package org.springframework.data.rest.core.config

Examples of org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration


      href = builder.build().toString();

      variables = variables.concat(resolver.getPaginationTemplateVariables(null, builder.build()));
    }

    ProjectionDefinitionConfiguration projectionConfiguration = config.projectionConfiguration();

    if (projectionConfiguration.hasProjectionFor(type)) {
      variables = variables.concat(new TemplateVariable(projectionConfiguration.getParameterName(), REQUEST_PARAM));
    }

    return variables.asList().isEmpty() ? linkFor(type).withRel(metadata.getRel()) : new Link(new UriTemplate(href,
        variables), metadata.getRel());
  }
View Full Code Here


    ResourceMetadata metadata = mappings.getMappingFor(type);
    String mappedId = idConverters.getPluginFor(type, DefaultIdConverter.INSTANCE).toRequestId((Serializable) id, type);

    Link link = linkFor(type).slash(mappedId).withRel(metadata.getItemResourceRel());
    ProjectionDefinitionConfiguration projectionConfiguration = config.projectionConfiguration();

    if (!projectionConfiguration.hasProjectionFor(type)) {
      return link;
    }

    String parameterName = projectionConfiguration.getParameterName();
    TemplateVariables templateVariables = new TemplateVariables(new TemplateVariable(parameterName, REQUEST_PARAM));
    UriTemplate template = new UriTemplate(link.getHref(), templateVariables);

    return new Link(template.toString(), metadata.getItemResourceRel());
  }
View Full Code Here

   * Main configuration for the REST exporter.
   */
  @Bean
  public RepositoryRestConfiguration config() {

    ProjectionDefinitionConfiguration configuration = new ProjectionDefinitionConfiguration();

    for (Class<?> projection : getProjections()) {
      configuration.addProjection(projection);
    }

    RepositoryRestConfiguration config = new RepositoryRestConfiguration(configuration, metadataConfiguration());
    configureRepositoryRestConfiguration(config);
    return config;
View Full Code Here

  @Mock ResourceMappings mappings;
  ProjectionDefinitionConfiguration configuration;

  @Before
  public void setUp() {
    configuration = new ProjectionDefinitionConfiguration();
  }
View Full Code Here

   * @param projectionConfiguration
   * @return
   */
  private Descriptor buildProjectionDescriptor(ResourceMetadata metadata) {

    ProjectionDefinitionConfiguration projectionConfiguration = configuration.projectionConfiguration();
    String projectionParameterName = projectionConfiguration.getParameterName();

    Map<String, Class<?>> projections = projectionConfiguration.getProjectionsFor(metadata.getDomainType());
    List<Descriptor> projectionDescriptors = new ArrayList<Descriptor>(projections.size());

    for (Entry<String, Class<?>> projection : projections.entrySet()) {

      Class<?> type = projection.getValue();
View Full Code Here

    if (!Type.SAFE.equals(getType(method))) {
      return Collections.emptyList();
    }

    ProjectionDefinitionConfiguration projectionConfiguration = configuration.projectionConfiguration();

    return projectionConfiguration.hasProjectionFor(type) ? Arrays.asList(buildProjectionDescriptor(mappings
        .getMappingFor(type))) : Collections.<Descriptor> emptyList();
  }
View Full Code Here

    Link linkToCollectionResource = entityLinks.linkToCollectionResource(type);
    List<TemplateVariable> variables = linkToCollectionResource.getVariables();
    List<Descriptor> descriptors = new ArrayList<Descriptor>(variables.size());

    ProjectionDefinitionConfiguration projectionConfiguration = configuration.projectionConfiguration();

    for (TemplateVariable variable : variables) {

      // Skip projection parameter
      if (projectionConfiguration.getParameterName().equals(variable.getName())) {
        continue;
      }

      ResourceDescription description = SimpleResourceDescription.defaultFor(variable.getDescription());
View Full Code Here

TOP

Related Classes of org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.