本文整理汇总了Java中org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType类的典型用法代码示例。如果您正苦于以下问题:Java CompositePrimaryKeyType类的具体用法?Java CompositePrimaryKeyType怎么用?Java CompositePrimaryKeyType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompositePrimaryKeyType类属于org.netbeans.jpa.modeler.spec.extend包,在下文中一共展示了CompositePrimaryKeyType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: manageCompositePrimaryKeyType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
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
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
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
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
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: onCompositePrimaryKeyTypeChange
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
public void onCompositePrimaryKeyTypeChange(CompositePrimaryKeyType compositePrimaryKeyType) {
if ((compositePrimaryKeyType == CompositePrimaryKeyType.EMBEDDEDID
|| (compositePrimaryKeyType == CompositePrimaryKeyType.DEFAULT && CodePanel.isEmbeddedIdDefaultType()))) {
if (embeddedIdAttributeWidget == null) {
addNewEmbeddedIdAttribute(getNextAttributeName(this.getName() + "EmbeddedId"));
}
} else if (embeddedIdAttributeWidget != null) {
embeddedIdAttributeWidget.remove();
}
}
示例5: load
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
public void load(EntityMappings entityMappings, TypeElement element, boolean fieldAccess) {
// AnnotationMirror annotationMirror = JavaSourceParserUtil.getAnnotation(element, "javax.persistence.MappedSuperclass");
if (entityMappings.findMappedSuperclass(element.getSimpleName().toString()) == null) {
TypeElement superClassElement = JavaSourceParserUtil.getSuperclassTypeElement(element);
if (!superClassElement.getQualifiedName().toString().equals("java.lang.Object")) {
if (JavaSourceParserUtil.isEntityClass(superClassElement)) {
org.netbeans.jpa.modeler.spec.Entity entitySuperclassSpec = new org.netbeans.jpa.modeler.spec.Entity();
entitySuperclassSpec.load(entityMappings, superClassElement, fieldAccess);
super.setSuperclass(entitySuperclassSpec.getClazz());
super.setSuperclassId(entitySuperclassSpec.getId());
entityMappings.addEntity(entitySuperclassSpec);
} else if (JavaSourceParserUtil.isMappedSuperClass(superClassElement)) {
org.netbeans.jpa.modeler.spec.MappedSuperclass mappedSuperclassSpec = new org.netbeans.jpa.modeler.spec.MappedSuperclass();
mappedSuperclassSpec.load(entityMappings, superClassElement, fieldAccess);
super.setSuperclass(mappedSuperclassSpec.getClazz());
super.setSuperclassId(mappedSuperclassSpec.getId());
entityMappings.addMappedSuperclass(mappedSuperclassSpec);
} else {
//Skip
}
}
this.setId(NBModelerUtil.getAutoGeneratedStringId());
this.idClass = IdClass.load(element);
this.getAttributes().load(entityMappings, element, fieldAccess);
this.clazz = element.getSimpleName().toString();
this.access = AccessType.load(element);
if (this.getAttributes().getEmbeddedId() != null) {
this.setCompositePrimaryKeyClass(this.getAttributes().getEmbeddedId().getAttributeType());
this.setCompositePrimaryKeyType(CompositePrimaryKeyType.EMBEDDEDID);
} else if (idClass != null) {
this.setCompositePrimaryKeyClass(this.getIdClass().getClazz());
this.setCompositePrimaryKeyType(CompositePrimaryKeyType.IDCLASS);
} else {
this.setCompositePrimaryKeyClass(null);
this.setCompositePrimaryKeyType(null);
}
}
}
示例6: marshal
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
@Override
public String marshal(CompositePrimaryKeyType compositePrimaryKeyType) {
return compositePrimaryKeyType!=null?compositePrimaryKeyType.getType():null;
}
示例7: unmarshal
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
@Override
public CompositePrimaryKeyType unmarshal(String val) {
return CompositePrimaryKeyType.get(val);
}
示例8: getCompositePrimaryKeyType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
/**
* @return the compositePrimaryKeyType
*/
@Override
public CompositePrimaryKeyType getCompositePrimaryKeyType() {
return compositePrimaryKeyType;
}
示例9: isIdClassType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
@Override
public boolean isIdClassType() {
return compositePrimaryKeyType == CompositePrimaryKeyType.IDCLASS
|| (compositePrimaryKeyType == CompositePrimaryKeyType.DEFAULT && !CodePanel.isEmbeddedIdDefaultType());
}
示例10: isEmbeddedIdType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
@Override
public boolean isEmbeddedIdType() {
return compositePrimaryKeyType == CompositePrimaryKeyType.EMBEDDEDID
|| (compositePrimaryKeyType == CompositePrimaryKeyType.DEFAULT && CodePanel.isEmbeddedIdDefaultType());
}
示例11: setCompositePrimaryKeyType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
/**
* @param compositePrimaryKeyType the compositePrimaryKeyType to set
*/
@Override
public void setCompositePrimaryKeyType(CompositePrimaryKeyType compositePrimaryKeyType) {
this.compositePrimaryKeyType = compositePrimaryKeyType;
}
示例12: getCompositePrimaryKeyProperty
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
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);
}
示例13: load
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
public void load(EntityMappings entityMappings, TypeElement element, boolean fieldAccess) {
AnnotationMirror annotationMirror = JavaSourceParserUtil.getAnnotation(element, "javax.persistence.Entity");
if (entityMappings.findEntity(element.getSimpleName().toString()) == null) {
TypeElement superClassElement = JavaSourceParserUtil.getSuperclassTypeElement(element);
if (!superClassElement.getQualifiedName().toString().equals("java.lang.Object")) {
if (JavaSourceParserUtil.isEntityClass(superClassElement)) {
org.netbeans.jpa.modeler.spec.Entity entitySuperclassSpec = new org.netbeans.jpa.modeler.spec.Entity();
entitySuperclassSpec.load(entityMappings, superClassElement, fieldAccess);
super.setSuperclass(entitySuperclassSpec.getClazz());
super.setSuperclassId(entitySuperclassSpec.getId());
entityMappings.addEntity(entitySuperclassSpec);
} else if (JavaSourceParserUtil.isMappedSuperClass(superClassElement)) {
org.netbeans.jpa.modeler.spec.MappedSuperclass mappedSuperclassSpec = new org.netbeans.jpa.modeler.spec.MappedSuperclass();
mappedSuperclassSpec.load(entityMappings, superClassElement, fieldAccess);
super.setSuperclass(mappedSuperclassSpec.getClazz());
super.setSuperclassId(mappedSuperclassSpec.getId());
entityMappings.addMappedSuperclass(mappedSuperclassSpec);
} else {
//Skip
}
}
this.setId(NBModelerUtil.getAutoGeneratedStringId());
this.table = Table.load(element);
this.idClass = IdClass.load(element);
this.inheritance = Inheritance.load(element);
AnnotationMirror annotDiscrValue = JavaSourceParserUtil.findAnnotation(element, "javax.persistence.DiscriminatorValue");
if (annotDiscrValue != null) {
Object value = JavaSourceParserUtil.findAnnotationValue(annotationMirror, "value");
if (value != null) {
discriminatorValue = value.toString();
}
}
this.discriminatorColumn = DiscriminatorColumn.load(element);
this.tableGenerator = TableGenerator.load(element);
this.sequenceGenerator = SequenceGenerator.load(element);
this.getAttributes().load(entityMappings, element, fieldAccess);
if (annotationMirror != null) {
this.name = (String) JavaSourceParserUtil.findAnnotationValue(annotationMirror, "name");
}
this.clazz = element.getSimpleName().toString();
this.access = AccessType.load(element);
if (this.getAttributes().getEmbeddedId() != null) {
this.setCompositePrimaryKeyClass(this.getAttributes().getEmbeddedId().getAttributeType());
this.setCompositePrimaryKeyType(CompositePrimaryKeyType.EMBEDDEDID);
} else if (idClass != null) {
this.setCompositePrimaryKeyClass(this.getIdClass().getClazz());
this.setCompositePrimaryKeyType(CompositePrimaryKeyType.IDCLASS);
} else {
this.setCompositePrimaryKeyClass(null);
this.setCompositePrimaryKeyType(null);
}
}
}
示例14: getCompositePrimaryKeyType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
/**
* @return the compositePrimaryKeyType
*/
public CompositePrimaryKeyType getCompositePrimaryKeyType() {
return compositePrimaryKeyType;
}
示例15: setCompositePrimaryKeyType
import org.netbeans.jpa.modeler.spec.extend.CompositePrimaryKeyType; //导入依赖的package包/类
/**
* @param compositePrimaryKeyType the compositePrimaryKeyType to set
*/
public void setCompositePrimaryKeyType(CompositePrimaryKeyType compositePrimaryKeyType) {
this.compositePrimaryKeyType = compositePrimaryKeyType;
manageCompositePrimaryKeyClass();
}