Esempio n. 1
0
 @SuppressWarnings("unchecked")
 public static TableField<?, Object> getTableField(
     ObjectMetaDataManager metaData, String type, Object key) {
   Object objField = metaData.convertFieldNameFor(type, key);
   if (objField instanceof TableField) {
     return (TableField<?, Object>) objField;
   } else {
     return null;
   }
 }
Esempio n. 2
0
  protected Relationship getRelationship(Class<?> mapType, Class<?> resourceType) {
    Map<String, Relationship> rels =
        metaDataManager.getLinkRelationships(schemaFactory, schemaFactory.getSchemaName(mapType));
    Relationship reference = null;
    for (Map.Entry<String, Relationship> entry : rels.entrySet()) {
      Relationship rel = entry.getValue();
      if (rel.getRelationshipType() == Relationship.RelationshipType.REFERENCE
          && resourceType.isAssignableFrom(rel.getObjectType())) {
        reference = rel;
        break;
      }
    }

    if (reference == null) {
      throw new IllegalArgumentException(
          "Failed to find reference relationship from [" + mapType + "] to [" + resourceType + "]");
    }

    return reference;
  }