本文整理汇总了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;
}
}
}
示例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);
}
}
}
示例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;
}
示例4: isIdClassType
@Override
public boolean isIdClassType() {
return compositePrimaryKeyType == CompositePrimaryKeyType.IDCLASS
|| (compositePrimaryKeyType == CompositePrimaryKeyType.DEFAULT && !CodePanel.isEmbeddedIdDefaultType());
}
示例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);
}
示例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);
}