コード例 #1
0
  @Path("{businessId}")
  public LocationResource getBusinessResource(@PathParam("businessId") Long businessId) {
    Business business;
    try {
      business = businessRepo.getById(businessId);
    } catch (com.googlecode.objectify.NotFoundException e) {
      throw new NotFoundException();
    }

    if (business.isTrash()) {
      if (HttpMethods.WRITE_METHODS.contains(servletRequest.getMethod())) {
        throw new IllegalAccessException("Can not modified trashed resource.");
      }
    }

    Account account = (Account) servletRequest.getAttribute("net.eatsense.domain.Account");
    CheckIn checkIn = (CheckIn) servletRequest.getAttribute("net.eatsense.domain.CheckIn");

    LocationResource businessResource = resourceContext.getResource(LocationResource.class);

    businessResource.setAccount(account);
    businessResource.setBusiness(business);
    businessResource.setCheckIn(checkIn);

    return businessResource;
  }
コード例 #2
0
 /**
  * Returns a dynamic instance of MulchLevelResource used for entity navigation.
  *
  * @param id identifier for the parent entity
  * @return an instance of MulchLevelResource
  */
 @Path("mulchLevels/")
 public MulchLevelResource getMulchLevelsResource() {
   MulchLevelsResourceSub mulchLevelsResourceSub =
       resourceContext.getResource(MulchLevelsResourceSub.class);
   mulchLevelsResourceSub.setParent(getEntity());
   return mulchLevelsResourceSub;
 }
コード例 #3
0
 /**
  * Returns a dynamic instance of PrivacyPreferencesResource used for entity navigation.
  *
  * @return an instance of PrivacyPreferencesResource
  */
 @Secured({"ROLE_USER", "USER_ACCESS"})
 @Path("{id}/")
 public PrivacyPreferencesResource getPrivacyPreferencesResource(@PathParam("id") Long id) {
   PrivacyPreferencesResource resource =
       resourceContext.getResource(PrivacyPreferencesResource.class);
   resource.setId(id);
   return resource;
 }
コード例 #4
0
 /**
  * Returns a dynamic instance of NetworkResource used for entity navigation.
  *
  * @return an instance of NetworkResource
  */
 @Path("{id}/")
 public service.NetworkResource getNetworkResource(@PathParam("id") String id) {
   NetworkResource resource = resourceContext.getResource(NetworkResource.class);
   resource.setId(id);
   return resource;
 }
コード例 #5
0
 @Path("subresource")
 public SpringAopSubResource getSubResource() {
   return _resourceContext.getResource(SpringAopSubResource.class);
 }