Endpoint resolveResource(ResourceId id) { return this.endpointRepository.endpointOfResource(id); }
public Endpoint getResourceEndpoint(ResourceId resourceId) throws EndpointNotFoundException { checkNotNull(resourceId,RESOURCE_IDENTIFIER_CANNOT_BE_NULL); Endpoint endpoint = this.endpointRepository.endpointOfResource(resourceId); if(endpoint==null) { throw new EndpointNotFoundException(resourceId); } return endpoint; }
public Endpoint modifyResourceEndpoint(Resource resource, EntityTag entityTag, Date lastModified) throws EndpointNotFoundException { checkNotNull(resource,RESOURCE_CANNOT_BE_NULL); checkNotNull(entityTag,ENTITY_TAG_CANNOT_BE_NULL); checkNotNull(lastModified,LAST_MODIFIED_CANNOT_BE_NULL); Endpoint endpoint = this.endpointRepository.endpointOfResource(resource.id()); if(endpoint==null) { throw new EndpointNotFoundException(resource.id()); } endpoint. modify( entityTag, getModificationDate(endpoint,lastModified)); return endpoint; }
@Override public void execute(EndpointRepository sut) { Endpoint result = sut.endpointOfResource(ep1.resourceId()); System.out.println(result); } }
private Endpoint findEndpoint(Resource resource) { return this.endpointRepository.endpointOfResource(resource.id()); }
public Endpoint deleteResourceEndpoint(Resource resource, Date deletionDate) throws EndpointNotFoundException { checkNotNull(resource,RESOURCE_CANNOT_BE_NULL); Endpoint endpoint = this.endpointRepository.endpointOfResource(resource.id()); if(endpoint==null) { throw new EndpointNotFoundException(resource.id()); } endpoint.delete(getModificationDate(endpoint,deletionDate)); this.listenerManager.notify(new EndpointDeletionNotification(endpoint)); return endpoint; }
private Endpoint endpoint(Resource resource) { EndpointRepository er = RuntimeDelegate.getInstance().getEndpointRepository(); Endpoint endpoint = er.endpointOfResource(resource.id()); return endpoint; }
private void publish(RootResource rootResource, Date creationDate) throws ApplicationConfigurationException { ResourceId resourceId = rootResource.resourceId(); String path = rootResource.path(); Resource prevResource = this.resourceRepository.resourceById(resourceId,Resource.class); Endpoint prevEndpoint = this.endpointRepository.endpointOfPath(path); if(prevEndpoint!=null && !prevEndpoint.resourceId().equals(resourceId)) { throw new ApplicationConfigurationException(String.format("Resource %s cannot be published at '%s' as that path is already in use by a resource %s",toString(resourceId),path,toString(prevEndpoint.resourceId()))); } if(prevEndpoint==null) { if(prevResource!=null) { throw new ApplicationConfigurationException(String.format("Resource %s cannot be published at '%s' as it is already published at '%s'",toString(resourceId),path,this.endpointRepository.endpointOfResource(resourceId).path())); } else { Resource resource=this.modelFactory.createResource(rootResource.template(),rootResource.name()); this.resourceRepository.add(resource); Endpoint endpoint=this.modelFactory.createEndpoint(path,resource,creationDate,EntityTag.createStrong(path)); this.endpointRepository.add(endpoint); } } }
@Override public void execute(EndpointRepository sut) { Endpoint endpointByPath = sut.endpointOfPath(ep1.path()); debug("Retrieving endpoint by path {%s} : %s",ep1.path(),endpointByPath); Endpoint endpointByResource = sut.endpointOfResource(resource.id()); debug("Retrieving endpoint by resource {%s} : %s",resource.id(),endpointByResource); } }
@Override public void execute(EndpointRepository sut) { Endpoint legacyEndpointByPath = sut.endpointOfPath(ep1.path()); debug("Retrieving endpoint by path {%s} : %s",ep1.path(),legacyEndpointByPath); Endpoint endpointByPath = sut.endpointOfPath(path); debug("Retrieving endpoint by path {%s} : %s",path,endpointByPath); Endpoint endpointByResource = sut.endpointOfResource(resource.id()); debug("Retrieving endpoint by resource {%s} : %s",resource.id(),endpointByResource); } }