Package org.springframework.data.rest.core.invoke

Examples of org.springframework.data.rest.core.invoke.RepositoryInvoker


      if (id == null) {
        new ResourceNotFoundException();
      }

      RepositoryInvoker invoker = information.getInvoker();
      Object existingObject = invoker.invokeFindOne(id);

      if (existingObject == null) {
        throw new ResourceNotFoundException();
      }
View Full Code Here


    }

    @RequestMapping(value = BASE_MAPPING + "/file", method = GET)
    public void filePropertyOfEntity(RootResourceInformation repoRequest, ServletResponse response, @BackendId Serializable id, @PathVariable String property) throws Exception {
        PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();
        RepositoryInvoker invoker = repoRequest.getInvoker();

        Object domainObj = invoker.invokeFindOne(id);

        if (null == domainObj) {
            throw new ResourceNotFoundException();
        }
View Full Code Here

    }

    @RequestMapping(value = BASE_MAPPING + "/binary", method = GET)
    public ResponseEntity<?> filePropertyValueOfEntity(RootResourceInformation repoRequest, @BackendId Serializable id, @PathVariable String property) throws Exception {
        PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();
        RepositoryInvoker invoker = repoRequest.getInvoker();

        Object domainObj = invoker.invokeFindOne(id);

        if (null == domainObj) {
            throw new ResourceNotFoundException();
        }
View Full Code Here

    }

    @RequestMapping(value = BASE_MAPPING + "/file", method = DELETE)
    public ResponseEntity<?> deleteFileOfPropertyOfEntity(RootResourceInformation repoRequest, @BackendId Serializable id, @PathVariable String property) throws Exception {
        PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();
        RepositoryInvoker invoker = repoRequest.getInvoker();

        Object domainObj = invoker.invokeFindOne(id);

        if (null == domainObj) {
            throw new ResourceNotFoundException();
        }

        PersistentProperty<?> prop = persistentEntity.getPersistentProperty(property);
        if (null == prop) {
            throw new ResourceNotFoundException();
        }

        if (!isOfFileType(prop)) {
            return toEmptyResponse(METHOD_NOT_ALLOWED);
        }

        fileResourceStorage().delete(domainObj, prop);

        invoker.invokeSave(domainObj);

        return toEmptyResponse(OK);
    }
View Full Code Here

    }

    @Override
    public RepositoryInvoker getInvokerFor(Class<?> domainType) {
        DynamicJpaRepository dynamicJpaRepository = (DynamicJpaRepository) repositories.getRepositoryFor(domainType);
        RepositoryInvoker repositoryInvoker = delegate.getInvokerFor(domainType);

        return new DynamicRepositoryInvokerWrapper(dynamicJpaRepository, repositoryInvoker);
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.rest.core.invoke.RepositoryInvoker

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.