本文整理汇总了Java中org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler类的典型用法代码示例。如果您正苦于以下问题:Java JoinColumnHandler类的具体用法?Java JoinColumnHandler怎么用?Java JoinColumnHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JoinColumnHandler类属于org.netbeans.jpa.modeler.spec.extend包,在下文中一共展示了JoinColumnHandler类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPopupMenuItemList
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
@Override
protected List<JMenuItem> getPopupMenuItemList() {
List<JMenuItem> menuList = super.getPopupMenuItemList();
DBRelationTable relationTable = this.getBaseElementSpec();
if (relationTable.getAttribute() instanceof JoinColumnHandler) {
JMenuItem joinTable = new JMenuItem("Delete Join Table");
joinTable.addActionListener((ActionEvent e) -> {
convertToJoinColumn();
ModelerFile parentFile = RelationTableWidget.this.getModelerScene().getModelerFile().getParentFile();
DBUtil.openDBViewer(parentFile);
JeddictLogger.recordDBAction("Delete Join Table");
});
menuList.add(0, joinTable);
}
return menuList;
}
示例2: createPropertySet
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
@Override
public void createPropertySet(ElementPropertySet set) {
super.createPropertySet(set);
set.put("JPA_PROP", getCascadeProperty(this));
// Issue Fix #6153 Start
set.put("JPA_PROP", PropertiesHandler.getFetchTypeProperty(this.getModelerScene(), (FetchTypeHandler) this.getBaseElementSpec()));
// Issue Fix #6153 End
RelationAttribute relationAttributeSpec = (RelationAttribute) this.getBaseElementSpec();
if (relationAttributeSpec.isOwner()) {
if (this.getBaseElementSpec() instanceof JoinColumnHandler) {
Entity targetEntity = ((RelationAttribute) this.getBaseElementSpec()).getConnectedEntity();
JoinColumnHandler joinColumnHandlerSpec = (JoinColumnHandler) this.getBaseElementSpec();
set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), joinColumnHandlerSpec.getJoinColumn(), targetEntity));
}
set.createPropertySet(this, relationAttributeSpec.getJoinTable());
set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), relationAttributeSpec.getJoinTable().getJoinColumn()));
set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), relationAttributeSpec.getJoinTable().getInverseJoinColumn()));
}
}
示例3: createPropertySet
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
@Override
public void createPropertySet(ElementPropertySet set) {
super.createPropertySet(set);
set.put("BASIC_PROP", getCascadeProperty());
RelationAttribute relationAttributeSpec = (RelationAttribute) this.getBaseElementSpec();
if (owner) {
if (this.getBaseElementSpec() instanceof JoinColumnHandler) {
JoinColumnHandler joinColumnHandlerSpec = (JoinColumnHandler) this.getBaseElementSpec();
set.put("JOIN_COLUMN_PROP", JPAModelerUtil.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), joinColumnHandlerSpec.getJoinColumn()));
}
ElementConfigFactory elementConfigFactory = this.getModelerScene().getModelerFile().getVendorSpecification().getElementConfigFactory();
elementConfigFactory.createPropertySet(set, relationAttributeSpec.getJoinTable());
set.put("JOIN_TABLE_PROP", JPAModelerUtil.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), relationAttributeSpec.getJoinTable().getJoinColumn()));
set.put("JOIN_TABLE_PROP", JPAModelerUtil.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), relationAttributeSpec.getJoinTable().getInverseJoinColumn()));
// set.put("JOIN_TABLE_PROP", getJoinTableColumnProperty());
// set.put("JOIN_TABLE_PROP", getJoinTableInverseColumnProperty());
}
}
示例4: getRelationAttributeJoinColumn
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
private static List<JoinColumn> getRelationAttributeJoinColumn(Attribute attribute, JoinTableHandler tableHandler, boolean relationTableExist, boolean inverse) {
List<JoinColumn> joinColumns;
if (!relationTableExist) {
if (attribute instanceof JoinColumnHandler) {//SingleRelationAttribute OneToMany
joinColumns = ((JoinColumnHandler)tableHandler).getJoinColumn();
} else {
throw new IllegalStateException("Invalid attribute type : " + attribute.getClass().getSimpleName());
}
} else if (inverse) {
joinColumns = tableHandler.getJoinTable().getInverseJoinColumn();
} else {
joinColumns = tableHandler.getJoinTable().getJoinColumn();
}
return joinColumns;
}
示例5: convertToJoinColumn
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
private void convertToJoinColumn() {
DBRelationTable relationTable = this.getBaseElementSpec();
relationTable.getAttribute().getJoinTable().clear();
if (relationTable.getAttribute() instanceof OneToMany) {
String joinColumnName = JOptionPane.showInputDialog((Component) RelationTableWidget.this.getModelerScene().getModelerPanelTopComponent(), "Please enter join column name (required) :");
((JoinColumnHandler) relationTable.getAttribute()).getJoinColumn().clear();
JoinColumn joinColumn = new JoinColumn();
joinColumn.setName(joinColumnName);
((JoinColumnHandler) relationTable.getAttribute()).addJoinColumn(joinColumn);
}
}
示例6: getJoinColumnsSnippet
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
private JoinColumnsSnippet getJoinColumnsSnippet(JoinColumnHandler joinColumnHandler, boolean mapKey) {
List<JoinColumnSnippet> joinColumnsList = getJoinColumns(joinColumnHandler.getJoinColumn(), mapKey);
JoinColumnsSnippet joinColumns = null;
if (!joinColumnsList.isEmpty()) {
joinColumns = new JoinColumnsSnippet(repeatable, mapKey);
joinColumns.setJoinColumns(joinColumnsList);
joinColumns.setForeignKey(getForeignKey(joinColumnHandler.getForeignKey()));
}
return joinColumns;
}
示例7: createNodeForKey
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的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;
}
示例8: createNodeForKey
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的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;
}
示例9: handleDBValidationException
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的package包/类
private static Boolean handleDBValidationException(DBValidationException validationException, ModelerFile file) throws ProcessInterruptedException {
Boolean fixError = null;
JavaClass javaClass = validationException.getJavaClass();
Attribute attribute = validationException.getAttribute();
String attrDetail = javaClass.getClass().getSimpleName().toLowerCase() + " " + javaClass.getClazz();
if(attribute!=null){
attrDetail = attrDetail+ " for attribute " + attribute.getName();
}
switch (validationException.getErrorCode()) {
case INCOMPLETE_JOIN_COLUMNS_SPECIFIED:
//reconstruct join column
//e.g : https://github.com/jeddict/jeddict/issues/67
if (JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(),
getMessage(DeploymentExceptionManager.class, "MSG_INCOMPLETE_JOIN_COLUMNS_SPECIFIED", attrDetail),
"Error", YES_NO_OPTION) == YES_NO_OPTION) {
if (attribute instanceof RelationAttribute) {
if (attribute instanceof JoinColumnHandler) {
JoinColumnHandler columnHandler = (JoinColumnHandler) attribute;
columnHandler.getJoinColumn().clear();
}
JoinTable joinTable = ((RelationAttribute) attribute).getJoinTable();
joinTable.getJoinColumn().clear();
joinTable.getInverseJoinColumn().clear();
fixError = true;
} else {
fixError = false;
}
} break;
case INVALID_DERIVED_ID_PRIMARY_KEY_FIELD:
// If there is no primary key accessor then the user must have
// specified an incorrect reference column name. Throw an exception.
//Ref : https://github.com/jeddict/jeddict/issues/164
if (attribute instanceof SingleRelationAttribute) {
SingleRelationAttribute relationAttribute = (SingleRelationAttribute) attribute;
if (JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(),
getMessage(DeploymentExceptionManager.class, "MSG_INVALID_DERIVED_ID_PRIMARY_KEY_FIELD", attrDetail),
getMessage(DeploymentExceptionManager.class, "TITLE_INVALID_DERIVED_ID_PRIMARY_KEY_FIELD"),
YES_NO_OPTION) == YES_NO_OPTION) {
relationAttribute.getJoinColumn().clear();
relationAttribute.getJoinTable().getJoinColumn().clear();
relationAttribute.getJoinTable().getInverseJoinColumn().clear();
fixError = true;
} else {
fixError = false;
}
} break;
case NON_UNIQUE_ENTITY_NAME:
if (javaClass instanceof DefaultClass) {
DefaultClass defaultClass = (DefaultClass) javaClass;
EntityMappings mappings = defaultClass.getRootElement();
List<IdentifiableClass> conflictClasses = mappings.getJavaClass()
.stream()
.filter(clazz -> clazz instanceof IdentifiableClass)
.map(clazz -> (IdentifiableClass) clazz)
.filter(ic -> ic.getCompositePrimaryKeyType() != null)
.filter(ic -> ic.getCompositePrimaryKeyClass().equals(javaClass.getClazz()))
.collect(toList());
String conflictClassNames = conflictClasses.stream()
.map(clazz -> clazz.getClazz())
.collect(Collectors.joining(" , ", "[", "]"));
showErrorMessage("NON_UNIQUE_ENTITY_NAME",
defaultClass.getClazz() + " is defined in " + conflictClassNames + " with different attribute type");
} else {
showErrorMessage("NON_UNIQUE_ENTITY_NAME", validationException.getValidationException().getMessage());
}
fixError = false;
break;
default:
break;
}
return fixError;
}
示例10: createNodeForKey
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的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;
}
示例11: createNodeForKey
import org.netbeans.jpa.modeler.spec.extend.JoinColumnHandler; //导入依赖的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;
}