Examples of IdCoder


Examples of org.apache.cayenne.lifecycle.id.IdCoder

  }
 
  public void setById(ObjectContext context, Object entity, Object foreignId) throws Exception {
    Object newForeignObject = null;
    if (foreignId != null && !foreignId.equals("")) {
      IdCoder idCoder = new IdCoder(context.getEntityResolver());
      ObjectId objectId = idCoder.getObjectId(String.valueOf(foreignId));
      ObjectIdQuery query = new ObjectIdQuery(objectId);
      List<?> list = context.performQuery(query);
      newForeignObject = list.size() == 0 ? null : list.get(0);
    }
    setter.invoke(entity, newForeignObject);
View Full Code Here

Examples of org.apache.cayenne.lifecycle.id.IdCoder

   */
  private Object getEntity(Object objectContext, Class<?> clazz, Object id) {
    try {
      ObjectContext context = objectContext == null ? this.getReadOnlyObjectContext() : (ObjectContext) objectContext;
      EntityResolver entityResolver = this.factory.getDataDomain().getEntityResolver();
      IdCoder idCoder = new IdCoder(entityResolver);
      ObjectId objectId = idCoder.getObjectId((String) id);
      ObjectIdQuery query = new ObjectIdQuery(objectId);
      List<?> list = context.performQuery(query);
      return list.size() == 0 ? null : list.get(0);
    } catch (Exception e) {
      return null;
View Full Code Here

Examples of org.apache.cayenne.lifecycle.id.IdCoder

    /*
     * Get the matching records for the new collection
     */
    List<Object> newCollection = new ArrayList<Object>();
    if (listItemIds != null) {
      IdCoder idCoder = new IdCoder(context.getEntityResolver());
      for (Object listItemId : listItemIds) {
        ObjectId objectId = idCoder.getObjectId(String.valueOf(listItemId));
        ObjectIdQuery query = new ObjectIdQuery(objectId);
        List<?> list = context.performQuery(query);
        Object newForeignObject = list.size() == 0 ? null : list.get(0);
        if (newForeignObject != null) newCollection.add(newForeignObject);
      }
View Full Code Here

Examples of org.apache.cayenne.lifecycle.id.IdCoder

   */
  private Object getEntity(Object objectContext, Class<?> clazz, Object id) {
    try {
      ObjectContext context = objectContext == null ? this.getReadOnlyObjectContext() : (ObjectContext) objectContext;
      EntityResolver entityResolver = this.factory.getDataDomain().getEntityResolver();
      IdCoder idCoder = new IdCoder(entityResolver);
      ObjectId objectId = idCoder.getObjectId((String) id);
      ObjectIdQuery query = new ObjectIdQuery(objectId);
      List<?> list = context.performQuery(query);
      return list.size() == 0 ? null : list.get(0);
    } catch (Exception e) {
      return null;
View Full Code Here

Examples of org.apache.cayenne.lifecycle.id.IdCoder

   
    /*
     * Get the matching records for the new collection
     */
    List<Object> newCollection = new ArrayList<Object>();
    IdCoder idCoder = new IdCoder(context.getEntityResolver());
    for (Object listItemId : listItemIds) {
      ObjectId objectId = idCoder.getObjectId(String.valueOf(listItemId));
      ObjectIdQuery query = new ObjectIdQuery(objectId);
      List<?> list = context.performQuery(query);
      Object newForeignObject = list.size() == 0 ? null : list.get(0);
      if (newForeignObject != null) newCollection.add(newForeignObject);
    }
View Full Code Here

Examples of org.apache.cayenne.lifecycle.id.IdCoder

  public Object getAssociationFrom(Object entity) throws Exception {
    return getter.invoke(entity);
  }
 
  public void setById(ObjectContext context, Object entity, Object foreignId) throws Exception {
    IdCoder idCoder = new IdCoder(context.getEntityResolver());
    ObjectId objectId = idCoder.getObjectId(String.valueOf(foreignId));
    ObjectIdQuery query = new ObjectIdQuery(objectId);
    List<?> list = context.performQuery(query);
    Object newForeignObject = list.size() == 0 ? null : list.get(0);
   
    setter.invoke(entity, newForeignObject);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.