当前位置: 首页>>代码示例>>Java>>正文


Java AssociationOverride类代码示例

本文整理汇总了Java中org.netbeans.jpa.modeler.spec.AssociationOverride的典型用法代码示例。如果您正苦于以下问题:Java AssociationOverride类的具体用法?Java AssociationOverride怎么用?Java AssociationOverride使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AssociationOverride类属于org.netbeans.jpa.modeler.spec包,在下文中一共展示了AssociationOverride类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isExist

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
/**
 *
 * @param keys arrays path to managedAttr separated by dots
 * @param embeddable next intrinsic element , incremented in each recursion
 */
private static boolean isExist(String[] keys, Embeddable embeddable, AssociationOverride associationOverride) {
    if (keys.length > 1) {
        Optional<Embedded> embeddedOptional = embeddable.getAttributes().getEmbedded().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
        if (embeddedOptional.isPresent()) {
            return isExist(Arrays.copyOfRange(keys, 1, keys.length), embeddedOptional.get().getConnectedClass(), associationOverride);
        } else {
            return false;
        }
    } else {
        Optional<RelationAttribute> attrOptional = embeddable.getAttributes().getRelationAttributes().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
        if (attrOptional.isPresent()) {
            RelationAttribute attribute = attrOptional.get();
            if (attribute instanceof SingleRelationAttribute) {
                associationOverride.getJoinTable().clear();
            } else if (attribute instanceof MultiRelationAttribute) {
                if (attribute instanceof OneToMany) {
                    associationOverride.getJoinColumn().clear();
                }
            }
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:31,代码来源:AssociationValidator.java

示例2: processAssociationOverrides

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
protected void processAssociationOverrides(
        List<AssociationOverride> parsedAssociationOverrides) {

    if (parsedAssociationOverrides == null
            || parsedAssociationOverrides.isEmpty()) {
        return;
    }

    classDef.setAssociationOverrides(new AssociationOverridesSnippet());

    for (AssociationOverride parsedAssociationOverride : parsedAssociationOverrides) {

        List<JoinColumnSnippet> joinColumnsList = getJoinColumns(
                parsedAssociationOverride.getJoinColumn());

        AssociationOverrideSnippet associationOverride = new AssociationOverrideSnippet();

        associationOverride.setName(parsedAssociationOverride.getName());
        associationOverride.setJoinColumns(joinColumnsList);

        classDef.getAssociationOverrides().addAssociationOverride(
                associationOverride);
    }
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:25,代码来源:ClassGenerator.java

示例3: marshal

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
@Override
public AssociationOverride marshal(AssociationOverride associationOverride) throws Exception {
    if (associationOverride != null && isEmpty(associationOverride)) {
        return null;
    }
    return associationOverride;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:8,代码来源:AssociationValidator.java

示例4: getInstance

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
public static AssociationOverrideSpecMetadata getInstance(AssociationOverride associationOverride) {
    AssociationOverrideSpecMetadata accessor = new AssociationOverrideSpecMetadata();
    accessor.setName(associationOverride.getName());
    if (!JoinTableValidator.isEmpty(associationOverride.getJoinTable())) {
        accessor.setJoinTable(associationOverride.getJoinTable().getAccessor());
    }
    JoinColumnValidator.filter(associationOverride.getJoinColumn());
    accessor.setJoinColumns(associationOverride.getJoinColumn().stream().map(JoinColumn::getAccessor).collect(toList()));

    return accessor;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:12,代码来源:AssociationOverrideSpecMetadata.java

示例5: findJoinColumns

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
public static List<JoinColumn> findJoinColumns(AssociationOverride associationOverride, Attribute attribute, boolean relationTableExist, boolean inverse) {
    List<JoinColumn> joinColumns;
    if (attribute instanceof RelationAttribute) {
        joinColumns = getRelationAttributeJoinColumn(attribute, associationOverride, relationTableExist, inverse);
    } else if (attribute instanceof ElementCollection) { 
        joinColumns = ((ElementCollection) attribute).getCollectionTable().getJoinColumn();//https://github.com/jeddict/jeddict/issues/148 AssociactionOverride is not applicable for element collection
    } else {            throw new IllegalStateException("Invalid attribute type : " + attribute.getClass().getSimpleName());
    }
    return joinColumns;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:11,代码来源:JoinColumnFinder.java

示例6: processAssociationOverrides

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
protected void processAssociationOverrides(
        Set<AssociationOverride> parsedAssociationOverrides) {

    if (parsedAssociationOverrides == null
            || parsedAssociationOverrides.isEmpty()) {
        return;
    }

    classDef.setAssociationOverrides(new AssociationOverridesSnippet(repeatable));

    for (AssociationOverride parsedAssociationOverride : parsedAssociationOverrides) {

        List<JoinColumnSnippet> joinColumnsList = getJoinColumns(parsedAssociationOverride.getJoinColumn(), false);
        JoinTableSnippet joinTable = getJoinTable(parsedAssociationOverride.getJoinTable());

        if ((joinTable == null || joinTable.isEmpty()) && joinColumnsList.isEmpty()) {
            continue;
        }
        AssociationOverrideSnippet associationOverride = new AssociationOverrideSnippet();
        associationOverride.setName(parsedAssociationOverride.getName());
        associationOverride.setJoinColumns(joinColumnsList);
        associationOverride.setJoinTable(joinTable);

        classDef.getAssociationOverrides().add(associationOverride);
    }
    if (classDef.getAssociationOverrides() != null && classDef.getAssociationOverrides().get().isEmpty()) {
        classDef.setAssociationOverrides(null);
    }
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:30,代码来源:ClassGenerator.java

示例7: processInternalAssociationOverride

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
private void processInternalAssociationOverride(AssociationOverridesHandler assoHandler, Set<AssociationOverride> associationOverrrides) {

        if (associationOverrrides != null && !associationOverrrides.isEmpty()
                && assoHandler.getAssociationOverrides() == null) {
            assoHandler.setAssociationOverrides(new AssociationOverridesSnippet(repeatable));
        }

        for (AssociationOverride parsedAssociationOverride : associationOverrrides) {

            List<JoinColumnSnippet> joinColumnsList = getJoinColumns(parsedAssociationOverride.getJoinColumn(), false);
            JoinTableSnippet joinTable = getJoinTable(parsedAssociationOverride.getJoinTable());

            if (joinTable.isEmpty() && joinColumnsList.isEmpty()) {
                continue;
            }
            AssociationOverrideSnippet associationOverride = new AssociationOverrideSnippet();
            associationOverride.setName(parsedAssociationOverride.getName());
            associationOverride.setJoinColumns(joinColumnsList);
            associationOverride.setJoinTable(joinTable);

            associationOverride.setForeignKey(getForeignKey(parsedAssociationOverride.getForeignKey()));

            assoHandler.getAssociationOverrides().add(associationOverride);
        }
        if (assoHandler.getAssociationOverrides() != null && assoHandler.getAssociationOverrides().get().isEmpty()) {
            assoHandler.setAssociationOverrides(null);
        }
    }
 
开发者ID:jeddict,项目名称:jeddict,代码行数:29,代码来源:ClassGenerator.java

示例8: getAssociationOverridesProperty

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
public static PropertySupport getAssociationOverridesProperty(String id, String name, String desc, JPAModelerScene modelerScene, final Set<AssociationOverride> associationOverridesSpec) {
    final NAttributeEntity attributeEntity = new NAttributeEntity(id, name, desc);
    attributeEntity.setCountDisplay(new String[]{"No AssociationOverrides exist", "One AssociationOverride exist", "AssociationOverrides exist"});

    attributeEntity.setColumns(Arrays.asList(
            new Column("Association Name", false, String.class),
            new Column("JoinTable Name", false, String.class),
            new Column("JoinColumn Size", false, Integer.class)
    ));
    attributeEntity.setTableDataListener(new NEntityDataListener<>(associationOverridesSpec,
            (t) -> Arrays.asList(t.getName(), t.getJoinTable().getName(), t.getJoinColumn().size())));
    return new NEntityPropertySupport(modelerScene.getModelerFile(), attributeEntity);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:14,代码来源:PropertiesHandler.java

示例9: createNodeForKey

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAllChildFactory(entityWidget, "", embeddedAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {
            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (attributeWidget instanceof RelationAttributeWidget && entityWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) entityWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));

                } else if (entityWidget.getBaseElementSpec() instanceof AttributeOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AttributeOverrideHandler attributeOverrideHandler = (AttributeOverrideHandler) entityWidget.getBaseElementSpec();
                    AttributeOverride attributeOverride = attributeOverrideHandler.getAttributeOverride(attributeSpec.getName());
                    set.createPropertySet(attributeWidget, attributeOverride.getColumn(), attributeWidget.getPropertyChangeListeners(), attributeWidget.getPropertyVisibilityHandlers());
                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:40,代码来源:OverrideAllChildFactory.java

示例10: createNodeForKey

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAssociationChildFactory(entityWidget, "", embeddedAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (entityWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) entityWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));

                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:36,代码来源:OverrideAssociationChildFactory.java

示例11: isEmpty

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
public static boolean isEmpty(AssociationOverride associationOverride) {
    JoinColumnValidator.filter(associationOverride.getJoinColumn());
    return JoinTableValidator.isEmpty(associationOverride.getJoinTable())
            && associationOverride.getJoinColumn().isEmpty();
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:6,代码来源:AssociationValidator.java

示例12: getAssociationOverride

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
@Deprecated
public AssociationOverride getAssociationOverride(String attributePath);
 
开发者ID:jeddict,项目名称:jCode,代码行数:3,代码来源:AssociationOverrideHandler.java

示例13: getAssociationOverride

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
/**
 * @return the associationOverride
 */
public AssociationOverride getAssociationOverride() {
    return associationOverride;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:7,代码来源:DBEmbeddedAssociationColumn.java

示例14: createNodeForKey

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node = null;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        Attribute attributeSpec = (Attribute) embeddedAttributeWidget.getBaseElementSpec(); //May be Embedded or ElementCollection ( for multi Embedded )
        String prefixAttributePath_Tmp;
        if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
            prefixAttributePath_Tmp = attributeSpec.getName();
        } else {
            prefixAttributePath_Tmp = prefixAttributePath + "." + attributeSpec.getName();
        }
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAllChildFactory(entityWidget, prefixAttributePath_Tmp, initialAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (attributeWidget instanceof RelationAttributeWidget && initialAttributeWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) initialAttributeWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = null;
                    if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
                        associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    } else {
                        associationOverride = associationOverrideHandler.getAssociationOverride(prefixAttributePath + "." + attributeSpec.getName());
                    }

                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));
                } else if (initialAttributeWidget.getBaseElementSpec() instanceof AttributeOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AttributeOverrideHandler attributeOverrideHandler = (AttributeOverrideHandler) initialAttributeWidget.getBaseElementSpec();
                    AttributeOverride attributeOverride = null;
                    if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
                        attributeOverride = attributeOverrideHandler.getAttributeOverride(attributeSpec.getName());
                    } else {
                        attributeOverride = attributeOverrideHandler.getAttributeOverride(prefixAttributePath + "." + attributeSpec.getName());
                    }
                    set.createPropertySet(attributeWidget, attributeOverride.getColumn(), attributeWidget.getPropertyChangeListeners(), attributeWidget.getPropertyVisibilityHandlers());
                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:58,代码来源:OverrideEmbeddedAllChildFactory.java

示例15: createNodeForKey

import org.netbeans.jpa.modeler.spec.AssociationOverride; //导入依赖的package包/类
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node = null;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        Attribute attributeSpec = (Attribute) embeddedAttributeWidget.getBaseElementSpec(); //May be Embedded or ElementCollection ( for multi Embedded )
        String prefixAttributePath_Tmp;
        if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
            prefixAttributePath_Tmp = attributeSpec.getName();
        } else {
            prefixAttributePath_Tmp = prefixAttributePath + "." + attributeSpec.getName();
        }
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAssociationChildFactory(entityWidget, prefixAttributePath_Tmp, initialAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {
                if (initialAttributeWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) initialAttributeWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = null;
                    if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
                        associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    } else {
                        associationOverride = associationOverrideHandler.getAssociationOverride(prefixAttributePath + "." + attributeSpec.getName());
                    }

                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));
                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:47,代码来源:OverrideEmbeddedAssociationChildFactory.java


注:本文中的org.netbeans.jpa.modeler.spec.AssociationOverride类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。