Package com.jengine.orm.model.field.reference

Examples of com.jengine.orm.model.field.reference.ReferenceField


                continue;
            }
            ModelClassBase modelClass = item.getModelClass();
            HashMap<String, ReferenceField> referenceModels = modelClass.getManager().getReferenceModels();
            if (referenceModels.containsKey(joinItem.getModelClass().getName())) {
                ReferenceField referenceField = referenceModels.get(joinItem.getModelClass().getName());
                result[0] = joinItem.getMultiModelField(referenceField.getReferenceModelKey()).getName();
                result[1] = item.getMultiModelField(referenceField).getName();
                return result;
            }
        }
View Full Code Here


    }

    public void joinRelatedModels(MultiModelItem item, List<String> path) {
        if (path.size() > 0) {
            String fieldName = path.get(0);
            ReferenceField currentField  = (ReferenceField) item.getModelClass().getManager().getField(fieldName);
            ModelClassBase referenceClass = currentField.getReferenceClass();
            String referenceItemName = item.getName() + "." + fieldName;
            if (!this.items.containsKey(referenceItemName)) {
                this.ljoin(referenceClass, referenceItemName,
                        String.format("%s.%s", referenceItemName, currentField.getReferenceModelKey().getFieldName()),
                        String.format("%s.%s", item.getName(), fieldName));
            }
            joinRelatedModels(items.get(referenceItemName), path.subList(1, path.size()));
        }
    }
View Full Code Here

        }
        if (field.getType() == Field.Type.SELF) {
            this.self = (SelfField) field;
        }
        if (field instanceof ReferenceField) {
            ReferenceField referenceField = (ReferenceField) field;
            this.references.put(field.getFieldName(), referenceField);
            this.referenceModels.put(referenceField.getReferenceModelName(), referenceField);
        }

        return field;
    }
View Full Code Here

    }

    public Field getField(String fieldName) {
        if (fieldName.contains(".")) {
            List<String> parts = Arrays.asList(fieldName.split("\\."));
            ReferenceField referenceField = (ReferenceField) fields.get(parts.get(0));
            ModelManager manager = modelClass.getDb().getModelClass(referenceField.getReferenceModelName()).getManager();
            String tail = concat(parts.subList(1, parts.size()), ".").toString();
            ForeignField foreignField = new ForeignField(referenceField,  manager.getField(tail));
            foreignField.config(fieldName, this);
            return foreignField;
        } else {
View Full Code Here

TOP

Related Classes of com.jengine.orm.model.field.reference.ReferenceField

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.