示例#1
0
 public DynamicTypeImpl getType() {
   if (resolver == null) {
     throw new IllegalStateException("Resolver not set on classification  ");
   }
   String parentId = getParentId();
   DynamicTypeImpl type = (DynamicTypeImpl) resolver.tryResolve(parentId, DynamicType.class);
   if (type == null) {
     throw new UnresolvableReferenceExcpetion(DynamicType.class + ":" + parentId + " " + data);
   }
   return type;
 }
示例#2
0
 private String getParentId() {
   if (typeId != null) return typeId;
   if (type == null) {
     throw new UnresolvableReferenceExcpetion("type and parentId are both not set");
   }
   DynamicType dynamicType = resolver.getDynamicType(type);
   if (dynamicType == null) {
     throw new UnresolvableReferenceExcpetion(type);
   }
   typeId = dynamicType.getId();
   return typeId;
 }
示例#3
0
 private Object fromString(Attribute attribute, EntityResolver resolver, String value)
     throws EntityNotFoundException, IllegalStateException {
   Class<? extends Entity> refType = attribute.getRefType();
   if (refType != null) {
     Entity resolved = resolver.resolve(value, refType);
     return resolved;
   }
   try {
     Object result = AttributeImpl.parseAttributeValueWithoutRef(attribute, value);
     return result;
   } catch (RaplaException exception) {
     throw new IllegalStateException(exception.getMessage(), exception);
   }
 }