private EntityInvocationHandler( final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.uuid = new EntityUUID(null, typeRef, null); }
service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName());
service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName());
private EntityInvocationHandler( final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.uuid = new EntityUUID(null, typeRef, null); }
private EntityInvocationHandler( final URI entityURI, final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.baseURI = entityURI; this.uri = entityURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString()); this.uuid = new EntityUUID(null, typeRef, null); }
private EntityInvocationHandler( final URI entityURI, final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.baseURI = entityURI; this.uri = entityURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString()); this.uuid = new EntityUUID(null, typeRef, null); }
private Object getSingleton(final Method method) throws IllegalArgumentException { final Class<?> typeRef = method.getReturnType(); final Singleton singleton = method.getAnnotation(Singleton.class); final URI uri = buildEntitySetURI(singleton.name(), service).build(); final EntityUUID uuid = new EntityUUID(uri, typeRef); LOG.debug("Ask for singleton '{}'", typeRef.getSimpleName()); EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef))); handler = EntityInvocationHandler.getInstance(entity, uri, uri, typeRef, service); } else if (isDeleted(handler)) { // object deleted LOG.debug("Singleton '{}' has been deleted", typeRef.getSimpleName()); handler = null; } return handler == null ? null : Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {typeRef}, handler); }
private Object getSingleton(final Method method) throws IllegalArgumentException { final Class<?> typeRef = method.getReturnType(); final Singleton singleton = method.getAnnotation(Singleton.class); final URI uri = buildEntitySetURI(singleton.name(), service).build(); final EntityUUID uuid = new EntityUUID(uri, typeRef); LOG.debug("Ask for singleton '{}'", typeRef.getSimpleName()); EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef))); handler = EntityInvocationHandler.getInstance(entity, uri, uri, typeRef, service); } else if (isDeleted(handler)) { // object deleted LOG.debug("Singleton '{}' has been deleted", typeRef.getSimpleName()); handler = null; } return handler == null ? null : Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[] {typeRef}, handler); }
@Override @SuppressWarnings("unchecked") public <S extends T> S getByKey(final KEY key, final Class<S> typeRef) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("Null key"); } final EntityUUID uuid = new EntityUUID(this.baseURI, typeRef, key); LOG.debug("Ask for '{}({})'", typeRef.getSimpleName(), key); EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef))); handler = EntityInvocationHandler.getInstance(key, entity, this.baseURI, typeRef, service); } if (isDeleted(handler)) { // object deleted LOG.debug("Object '{}({})' has been deleted", typeRef.getSimpleName(), uuid); return null; } else { // clear query options handler.clearQueryOptions(); return (S) Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader(), new Class<?>[] {typeRef}, handler); } }
@Override @SuppressWarnings("unchecked") public <S extends T> S getByKey(final KEY key, final Class<S> typeRef) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("Null key"); } final EntityUUID uuid = new EntityUUID(this.baseURI, typeRef, key); LOG.debug("Ask for '{}({})'", typeRef.getSimpleName(), key); EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef))); handler = EntityInvocationHandler.getInstance(key, entity, this.baseURI, typeRef, service); } if (isDeleted(handler)) { // object deleted LOG.debug("Object '{}({})' has been deleted", typeRef.getSimpleName(), uuid); return null; } else { // clear query options handler.clearQueryOptions(); return (S) Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader(), new Class<?>[] {typeRef}, handler); } }
if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) { final ClientEntity tmp = odataClient.getObjectFactory().newEntity(null); for (Map.Entry<String, ClientValue> param : parameters.entrySet()) { ClientProperty property = null;
if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) { final ClientEntity tmp = odataClient.getObjectFactory().newEntity(null); for (Map.Entry<String, ClientValue> param : parameters.entrySet()) { ClientProperty property = null;
final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( collItemType.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(collItemType)));
final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( collItemType.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(collItemType)));
template = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); CoreUtils.addProperties(getClient(), handler.getPropertyChanges(), template); final Object key = CoreUtils.getKey(getClient(), handler, handler.getUUID().getType(), template);
template = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); CoreUtils.addProperties(getClient(), handler.getPropertyChanges(), template); final Object key = CoreUtils.getKey(getClient(), handler, handler.getUUID().getType(), template);