/** * Make an EntityProxy immutable. */ private void makeImmutable(final AutoBean<? extends BaseProxy> toMutate) { // Always diff'ed against itself, producing a no-op toMutate.setTag(Constants.PARENT_OBJECT, toMutate); // Act with entity-identity semantics toMutate.setTag(REQUEST_CONTEXT_STATE, null); toMutate.setFrozen(true); }
/** * Creates an AutoBean for the given id, tracking a domain object. */ private <Q extends BaseProxy> AutoBean<Q> createProxyBean(SimpleProxyId<Q> id, Object domainObject) { AutoBean<Q> toReturn = AutoBeanFactorySource.createBean(id.getProxyClass(), SimpleRequestProcessor.CONFIGURATION); toReturn.setTag(Constants.STABLE_ID, id); toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject); beans.put(id, toReturn); return toReturn; }
/** * Make the EnityProxy bean edited and owned by this RequestContext. */ private <T extends BaseProxy> T takeOwnership(AutoBean<T> bean) { state.editedProxies.put(stableId(bean), bean); bean.setTag(REQUEST_CONTEXT_STATE, this.state); return bean.as(); } }
/** * Creates a new proxy with an assigned ID. * * @param clazz The proxy type * @param id The id to be assigned to the new proxy * @param useAppendedContexts if {@code true} use the AutoBeanFactory types associated with any * contexts that have been passed into {@link #append(RequestContext)}. If {@code false}, * this method will only create proxy types reachable from the implemented RequestContext * interface. * @throws IllegalArgumentException if the requested proxy type cannot be created */ protected <T extends BaseProxy> AutoBean<T> createProxy(Class<T> clazz, SimpleProxyId<T> id, boolean useAppendedContexts) { AutoBean<T> created = null; if (useAppendedContexts) { for (AbstractRequestContext ctx : state.appendedContexts) { created = ctx.getAutoBeanFactory().create(clazz); if (created != null) { break; } } } else { created = getAutoBeanFactory().create(clazz); } if (created != null) { created.setTag(STABLE_ID, id); return created; } throw new IllegalArgumentException("Unknown proxy type " + clazz.getName()); }
@Override <Q extends BaseProxy> AutoBean<Q> getProxyForReturnPayloadGraph(SimpleProxyId<Q> id) { AutoBean<Q> toReturn = super.getProxyForReturnPayloadGraph(id); if (restored.add(id)) { /* * If we haven't seen the id before, use the data in the OperationMessage * to repopulate the properties of the canonical bean for this id. */ OperationMessage op = getOperation(getRequestFactory().getHistoryToken(id)); this.processReturnOperation(id, op); toReturn.setTag(Constants.STABLE_ID, super.getId(op)); } return toReturn; }
OperationMessage operation = itOp.next(); bean.setTag(Constants.VERSION_PROPERTY_B64, operation.getVersion());
/** * Take ownership of a proxy instance and make it editable. */ public <T extends BaseProxy> T editProxy(T object) { AutoBean<T> bean = checkStreamsNotCrossed(object); checkLocked(); @SuppressWarnings("unchecked") AutoBean<T> previouslySeen = (AutoBean<T>) state.editedProxies.get(BaseProxyCategory.stableId(bean)); if (previouslySeen != null && !previouslySeen.isFrozen()) { /* * If we've seen the object before, it might be because it was passed in as a method argument. * This does not guarantee its mutability, so check that here before returning the cached * object. */ return previouslySeen.as(); } // Create editable copies AutoBean<T> parent = bean; bean = cloneBeanAndCollections(bean); bean.setTag(Constants.PARENT_OBJECT, parent); return bean.as(); }
otherBean.setTag(REQUEST_CONTEXT_STATE, bean.getTag(REQUEST_CONTEXT_STATE));
/** * Make an EntityProxy immutable. */ private void makeImmutable(final AutoBean<? extends BaseProxy> toMutate) { // Always diff'ed against itself, producing a no-op toMutate.setTag(Constants.PARENT_OBJECT, toMutate); // Act with entity-identity semantics toMutate.setTag(REQUEST_CONTEXT_STATE, null); toMutate.setFrozen(true); }
/** * Make an EntityProxy immutable. */ private void makeImmutable(final AutoBean<? extends BaseProxy> toMutate) { // Always diff'ed against itself, producing a no-op toMutate.setTag(Constants.PARENT_OBJECT, toMutate); // Act with entity-identity semantics toMutate.setTag(REQUEST_CONTEXT_STATE, null); toMutate.setFrozen(true); }
/** * Creates an AutoBean for the given id, tracking a domain object. */ private <Q extends BaseProxy> AutoBean<Q> createProxyBean(SimpleProxyId<Q> id, Object domainObject) { AutoBean<Q> toReturn = AutoBeanFactorySource.createBean(id.getProxyClass(), SimpleRequestProcessor.CONFIGURATION); toReturn.setTag(Constants.STABLE_ID, id); toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject); beans.put(id, toReturn); return toReturn; }
/** * Creates an AutoBean for the given id, tracking a domain object. */ private <Q extends BaseProxy> AutoBean<Q> createProxyBean(SimpleProxyId<Q> id, Object domainObject) { AutoBean<Q> toReturn = AutoBeanFactorySource.createBean(id.getProxyClass(), SimpleRequestProcessor.CONFIGURATION); toReturn.setTag(Constants.STABLE_ID, id); toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject); beans.put(id, toReturn); return toReturn; }
/** * Creates an AutoBean for the given id, tracking a domain object. */ private <Q extends BaseProxy> AutoBean<Q> createProxyBean(SimpleProxyId<Q> id, Object domainObject) { AutoBean<Q> toReturn = AutoBeanFactorySource.createBean(id.getProxyClass(), SimpleRequestProcessor.CONFIGURATION); toReturn.setTag(Constants.STABLE_ID, id); toReturn.setTag(Constants.DOMAIN_OBJECT, domainObject); beans.put(id, toReturn); return toReturn; }
public static Map<String, String> getExpressions(Object bean) { final AutoBean autoBean = asAutoBean(bean); Map<String, String> exprMap = (Map<String, String>) autoBean.getTag(EXPR_TAG); if (null == exprMap) { exprMap = new HashMap<String, String>(); autoBean.setTag(EXPR_TAG, exprMap); } return exprMap; }
/** * Make the EnityProxy bean edited and owned by this RequestContext. */ private <T extends BaseProxy> T takeOwnership(AutoBean<T> bean) { state.editedProxies.put(stableId(bean), bean); bean.setTag(REQUEST_CONTEXT_STATE, this.state); return bean.as(); } }
/** * Make the EnityProxy bean edited and owned by this RequestContext. */ private <T extends BaseProxy> T takeOwnership(AutoBean<T> bean) { state.editedProxies.put(stableId(bean), bean); bean.setTag(REQUEST_CONTEXT_STATE, this.state); return bean.as(); } }
/** * Make the EnityProxy bean edited and owned by this RequestContext. */ private <T extends BaseProxy> T takeOwnership(AutoBean<T> bean) { state.editedProxies.put(stableId(bean), bean); bean.setTag(REQUEST_CONTEXT_STATE, this.state); return bean.as(); } }
toMutate.setTag(Constants.VERSION_PROPERTY_B64, op.getVersion());