Package siena

Examples of siena.SienaRestrictedApiException


        break;
      case UUID:
        entity = new Entity(info.tableName, UUID.randomUUID().toString());
        break;
      default:
        throw new SienaRestrictedApiException("DB", "createEntityInstance", "Id Generator "+id.value()+ " not supported");
      }
    }
    else throw new SienaException("Field " + idField.getName() + " is not an @Id field");
   
    return entity;
View Full Code Here


        break;
      case UUID:
        entity = new Entity(getKindWithAncestorField(info, parentInfo, parentField), UUID.randomUUID().toString(), parentKey);
        break;
      default:
        throw new SienaRestrictedApiException("DB", "createEntityInstance", "Id Generator "+id.value()+ " not supported");
      }
    }
    else throw new SienaException("Field " + idField.getName() + " is not an @Id field");
   
    return entity;
View Full Code Here

        }
        else if (String.class.isAssignableFrom(type)){
          val = key.getName();
        }
        else{
          throw new SienaRestrictedApiException("DB", "setKey", "Id Type "+idField.getType()+ " not supported");
        }
         
        Util.setField(obj, idField, val);
        break;
      case AUTO_INCREMENT:
        // Long value means key.getId()
        if (Long.TYPE==type || Long.class.isAssignableFrom(idField.getType())){
          Util.setField(obj, idField, key.getId());
        }else {
          idField.setAccessible(true);
          Object val2 = null;
          if (Long.TYPE==type || Long.class.isAssignableFrom(idField.getType())){
            val = Long.parseLong((String) key.getName());
          }
          else if (String.class.isAssignableFrom(idField.getType())){
            val = key.getName();
          }
          else{
            throw new SienaRestrictedApiException("DB", "setKey", "Id Type "+idField.getType()+ " not supported");
          }
           
          Util.setField(obj, idField, val2);
        }
        break;
View Full Code Here

  private static long ioffset = Math.abs(0L+Integer.MIN_VALUE);

  public static String getDomainName(Class<?> clazz, String prefix) {
    ClassInfo ci = ClassInfo.getClassInfo(clazz);
    if(ClassInfo.isAutoIncrement(ci.getIdField())){
      throw new SienaRestrictedApiException("DB", "getItemName", "@Id AUTO_INCREMENT not supported by SDB");
    }
    String domain = prefix + ci.tableName;
    return domain;
  }
View Full Code Here

        keyVal = toString(idField, idVal);       
        break;
      }
      case AUTO_INCREMENT:
        // manages String ID as not long!!!
        throw new SienaRestrictedApiException("DB", "getItemName", "@Id AUTO_INCREMENT not supported by SDB");
      case UUID:
      {
        Object idVal = Util.readField(obj, idField);
        if(idVal == null){
          UUID uuid = UUID.randomUUID();
          keyVal = uuid.toString();
         
          if(idField.getType() == UUID.class){
            Util.setField(obj, idField, uuid);
          }
          else if(idField.getType() == String.class){
            Util.setField(obj, idField, uuid.toString());
          }
          else {
            throw new SienaRestrictedApiException("DB", "getItemName", "@Id UUID must be of type String or UUID");
          }
        }else {
          keyVal = toString(idField, idVal);
        }
        break;
      }
      default:
        throw new SienaRestrictedApiException("DB", "createEntityInstance", "Id Generator "+id.value()+ " not supported");
      }
    }
    else throw new SienaException("Field " + idField.getName() + " is not an @Id field");

    return keyVal;
View Full Code Here

        keyVal = toString(idField, key);       
        break;
      }
      case AUTO_INCREMENT:
        // manages String ID as not long!!!
        throw new SienaRestrictedApiException("DB", "getItemName", "@Id AUTO_INCREMENT not supported by SDB");
      case UUID:
      {
        keyVal = toString(idField, key);       
        break;
      }
      default:
        throw new SienaRestrictedApiException("DB", "createEntityInstance", "Id Generator "+id.value()+ " not supported");
      }
    }
    else throw new SienaException("Field " + idField.getName() + " is not an @Id field");

    return keyVal;
View Full Code Here

          columnType = Types.LONGVARCHAR;
        }
      } else if(field.isAnnotationPresent(Polymorphic.class)){
            columnType = Types.BLOB;
        }else {       
        throw new SienaRestrictedApiException(DB, "createColumn", "Unsupported type for field "
            +clazz.getName()+"."+field.getName());
      }
    }

    column.setTypeCode(columnType);
View Full Code Here

          return Types.LONGVARCHAR;
        }
      } else if(field.isAnnotationPresent(Polymorphic.class)){
        return Types.BLOB;
        }else {       
        throw new SienaRestrictedApiException(DB, "createColumn", "Unsupported type for field "
            +type.getName()+"."+field.getName());
      }
    }
  }
View Full Code Here

        }
      } else if(field.isAnnotationPresent(Polymorphic.class)){
        ByteArrayInputStream bis = new ByteArrayInputStream((byte[])value);
        ps.setBlob(index, bis);
        }else {       
        throw new SienaRestrictedApiException(DB, "createColumn", "Unsupported type for field "
            +type.getName()+"."+field.getName());
      }
    }
  }
View Full Code Here

    // join queries
    Map<Field, ArrayList<Key>> fieldMap = new HashMap<Field, ArrayList<Key>>();
    for (QueryJoin join : joins) {
      Field field = join.field;
      if (!ClassInfo.isModel(field.getType())){
        throw new SienaRestrictedApiException(GaePersistenceManager.DB, "join", "Join not possible: Field "+field.getName()+" is not a relation field");
      }
      else if(join.sortFields!=null && join.sortFields.length!=0)
        throw new SienaRestrictedApiException(GaePersistenceManager.DB, "join", "Join not allowed with sort fields");
      fieldMap.put(field, new ArrayList<Key>());
    }
   
    // join annotations
    for(Field field:
View Full Code Here

TOP

Related Classes of siena.SienaRestrictedApiException

Copyright © 2018 www.massapicom. 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.