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


Java CompositePrimaryKeyType.IDCLASS属性代码示例

本文整理汇总了Java中org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType.IDCLASS属性的典型用法代码示例。如果您正苦于以下问题:Java CompositePrimaryKeyType.IDCLASS属性的具体用法?Java CompositePrimaryKeyType.IDCLASS怎么用?Java CompositePrimaryKeyType.IDCLASS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType的用法示例。


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

示例1: manageCompositePrimaryKeyType

private void manageCompositePrimaryKeyType() {
    if (null != compositePrimaryKeyType) {
        CompositePrimaryKeyType type = compositePrimaryKeyType == CompositePrimaryKeyType.DEFAULT ? (CodePanel.isEmbeddedIdDefaultType() ? CompositePrimaryKeyType.EMBEDDEDID : CompositePrimaryKeyType.IDCLASS) : compositePrimaryKeyType;
        switch (type) {
            case EMBEDDEDID:
                this.idClass = null;
                break;
            case IDCLASS:
                if (this.idClass != null) {
                    this.idClass.setClazz(compositePrimaryKeyClass);
                } else {
                    this.idClass = new IdClass(compositePrimaryKeyClass);
                }
                break;
            default:
                this.idClass = null;
                compositePrimaryKeyClass = null;
        }
    }
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:20,代码来源:IdentifiableClass.java

示例2: manageCompositePrimaryKeyClass

public void manageCompositePrimaryKeyClass() {
    if (compositePrimaryKeyClass == null || compositePrimaryKeyClass.trim().isEmpty()) {
        compositePrimaryKeyClass = this.getClazz() + "PK";
    }
    if (this.getCompositePrimaryKeyType() == CompositePrimaryKeyType.EMBEDDEDID) {
        this.getAttributes().getEmbeddedId().setAttributeType(compositePrimaryKeyClass);
        this.idClass = null;
    } else if (this.getCompositePrimaryKeyType() == CompositePrimaryKeyType.IDCLASS) {
        this.idClass = new IdClass(compositePrimaryKeyClass);
    } else {
        this.idClass = null;
        compositePrimaryKeyClass = null;
        if (getCompositePrimaryKeyType() == null) {
            setCompositePrimaryKeyType(CompositePrimaryKeyType.NONE);
        }
    }
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:17,代码来源:Entity.java

示例3: isCompositePKPropertyAllow

public boolean isCompositePKPropertyAllow() {
    if (this.getBaseElementSpec() instanceof PrimaryKeyContainer) {
        PrimaryKeyContainer primaryKeyContainerSpec = (PrimaryKeyContainer) this.getBaseElementSpec();
        String inheritenceState = this.getInheritenceState();
        boolean visible = false;
        if (this instanceof EntityWidget) {
            visible = getIdAttributeWidgets().size() > 1 && ("ROOT".equals(inheritenceState) || "SINGLETON".equals(inheritenceState));
        } else if (this instanceof MappedSuperclassWidget) {
            visible = getIdAttributeWidgets().size() > 1;
        }
        if (visible) {
            if ((primaryKeyContainerSpec.getCompositePrimaryKeyClass() == null || primaryKeyContainerSpec.getCompositePrimaryKeyClass().trim().isEmpty())
                    && (primaryKeyContainerSpec.getCompositePrimaryKeyType() == CompositePrimaryKeyType.EMBEDDEDID || primaryKeyContainerSpec.getCompositePrimaryKeyType() == CompositePrimaryKeyType.IDCLASS)) {
                primaryKeyContainerSpec.manageCompositePrimaryKeyClass();
                getModelerScene().getModelerPanelTopComponent().changePersistenceState(false);
            }
        }
        return visible;
    }
    return false;
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:21,代码来源:PersistenceClassWidget.java

示例4: isIdClassType

@Override
public boolean isIdClassType() {
    return compositePrimaryKeyType == CompositePrimaryKeyType.IDCLASS
            || (compositePrimaryKeyType == CompositePrimaryKeyType.DEFAULT && !CodePanel.isEmbeddedIdDefaultType());
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:5,代码来源:IdentifiableClass.java

示例5: getCompositePrimaryKeyProperty

private ComboBoxPropertySupport getCompositePrimaryKeyProperty() {
    final JavaClassWidget javaClassWidget = this;
    final PrimaryKeyContainer primaryKeyContainerSpec = (PrimaryKeyContainer) javaClassWidget.getBaseElementSpec();
    ComboBoxListener<CompositePrimaryKeyType> comboBoxListener = new ComboBoxListener<CompositePrimaryKeyType>() {
        @Override
        public void setItem(ComboBoxValue<CompositePrimaryKeyType> value) {
            CompositePrimaryKeyType compositePrimaryKeyType = value.getValue();
            onCompositePrimaryKeyTypeChange(compositePrimaryKeyType);
            primaryKeyContainerSpec.setCompositePrimaryKeyType(compositePrimaryKeyType);
        }

        @Override
        public ComboBoxValue<CompositePrimaryKeyType> getItem() {
            if (primaryKeyContainerSpec.getCompositePrimaryKeyType() == CompositePrimaryKeyType.EMBEDDEDID) {
                return new ComboBoxValue(CompositePrimaryKeyType.EMBEDDEDID, "Embedded Id");
            } else if (primaryKeyContainerSpec.getCompositePrimaryKeyType() == CompositePrimaryKeyType.IDCLASS) {
                return new ComboBoxValue(CompositePrimaryKeyType.IDCLASS, "Id Class");
            } else {
                return new ComboBoxValue(CompositePrimaryKeyType.DEFAULT, String.format("Default (%s)", CodePanel.getDefaultCompositePrimaryKeyType()));
            }
        }

        @Override
        public List<ComboBoxValue<CompositePrimaryKeyType>> getItemList() {
            List<ComboBoxValue<CompositePrimaryKeyType>> values = new ArrayList<>();
            values.add(new ComboBoxValue(CompositePrimaryKeyType.DEFAULT, String.format("Default (%s)", CodePanel.getDefaultCompositePrimaryKeyType())));
            values.add(new ComboBoxValue(CompositePrimaryKeyType.IDCLASS, "Id Class"));
            values.add(new ComboBoxValue(CompositePrimaryKeyType.EMBEDDEDID, "Embedded Id"));
            return values;
        }

        @Override
        public String getDefaultText() {
            return "Id Class";
        }

        @Override
        public ActionHandler getActionHandler() {
            return null;
        }
    };
    return new ComboBoxPropertySupport(this.getModelerScene().getModelerFile(), "compositePrimaryKeyType", "Composite PrimaryKey Type", "", comboBoxListener);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:43,代码来源:PrimaryKeyContainerWidget.java

示例6: getCompositePrimaryKeyProperty

private ComboBoxPropertySupport getCompositePrimaryKeyProperty() {
    final JavaClassWidget javaClassWidget = this;
    final PrimaryKeyContainer primaryKeyContainerSpec = (PrimaryKeyContainer) javaClassWidget.getBaseElementSpec();
    ComboBoxListener comboBoxListener = new ComboBoxListener() {
        @Override
        public void setItem(ComboBoxValue value) {
            CompositePrimaryKeyType compositePrimaryKeyType = (CompositePrimaryKeyType) value.getValue();
            if (compositePrimaryKeyType == CompositePrimaryKeyType.EMBEDDEDID) {
                PersistenceClassWidget.this.addNewEmbeddedIdAttribute(getNextAttributeName(PersistenceClassWidget.this.getName() + "EmbeddedId"));
            } else {
                if (embeddedIdAttributeWidget != null) {
                    embeddedIdAttributeWidget.remove();
                }
            }
            primaryKeyContainerSpec.setCompositePrimaryKeyType(compositePrimaryKeyType);
        }

        @Override
        public ComboBoxValue getItem() {
            if (primaryKeyContainerSpec.getCompositePrimaryKeyType() == CompositePrimaryKeyType.EMBEDDEDID) {
                return new ComboBoxValue(CompositePrimaryKeyType.EMBEDDEDID, "Embedded Id");
            } else if (primaryKeyContainerSpec.getCompositePrimaryKeyType() == CompositePrimaryKeyType.IDCLASS) {
                return new ComboBoxValue(CompositePrimaryKeyType.IDCLASS, "Id Class");
            } else {
                return new ComboBoxValue(CompositePrimaryKeyType.NONE, "None");
            }
        }

        @Override
        public List<ComboBoxValue> getItemList() {
            List<ComboBoxValue> values = new ArrayList<ComboBoxValue>();
            values.add(new ComboBoxValue(CompositePrimaryKeyType.NONE, "None"));
            values.add(new ComboBoxValue(CompositePrimaryKeyType.IDCLASS, "Id Class"));
            values.add(new ComboBoxValue(CompositePrimaryKeyType.EMBEDDEDID, "Embedded Id"));
            return values;
        }

        @Override
        public String getDefaultText() {
            return "None";
        }

        @Override
        public ActionHandler getActionHandler() {
            return null;
        }
    };
    return new ComboBoxPropertySupport(this.getModelerScene().getModelerFile(), "compositePrimaryKeyType", "Composite PrimaryKey Type", "", comboBoxListener);
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:49,代码来源:PersistenceClassWidget.java


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