本文整理汇总了Java中org.netbeans.jpa.modeler.spec.extend.IAttributes类的典型用法代码示例。如果您正苦于以下问题:Java IAttributes类的具体用法?Java IAttributes怎么用?Java IAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAttributes类属于org.netbeans.jpa.modeler.spec.extend包,在下文中一共展示了IAttributes类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadDependentItems
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
public void loadDependentItems(WorkSpace workSpace) {
Set<JavaClass<? extends IAttributes>> selectedClasses = workSpace.getItems()
.stream()
.map(wi -> (JavaClass<? extends IAttributes>) wi.getJavaClass())
.collect(toSet());
Set<JavaClass<? extends IAttributes>> dependantClasses = findDependents(selectedClasses);
if (dependantClasses.size() > 0) {
selectedClasses.addAll(dependantClasses);
workSpace.setItems(
selectedClasses
.stream()
.map(WorkSpaceItem::new)
.collect(toSet())
);
}
}
示例2: getInstance
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
public static OneToOneSpecAccessor getInstance(OneToOne oneToOne, boolean inherit) {
OneToOneSpecAccessor accessor = new OneToOneSpecAccessor(oneToOne);
accessor.inherit = inherit;
accessor.setName(oneToOne.getName());
accessor.setTargetEntityName(oneToOne.getTargetEntity());
if (oneToOne.isPrimaryKey()) {
IdClass idClass = oneToOne.getIdClass();
if (idClass != null) {
accessor.setId(Boolean.TRUE);
} else {
IAttributes attributes = ((ManagedClass) oneToOne.getJavaClass()).getAttributes();
if (attributes instanceof PrimaryKeyAttributes && !((PrimaryKeyAttributes) attributes).hasCompositePrimaryKey()) { //Ex 4.a Derived Identity
accessor.setId(Boolean.TRUE);
} else {
accessor.setMapsId("");//oneToOne.getName());
}
}
}
accessor.setMappedBy(oneToOne.getMappedBy());
if (!JoinTableValidator.isEmpty(oneToOne.getJoinTable())) {
accessor.setJoinTable(oneToOne.getJoinTable().getAccessor());
}
JoinColumnValidator.filter(oneToOne.getJoinColumn());
accessor.setJoinColumns(oneToOne.getJoinColumn().stream().map(JoinColumn::getAccessor).collect(toList()));
return accessor;
}
示例3: getSelectedJavaClass
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
public List<JavaClass<IAttributes>> getSelectedJavaClass() {
List<JavaClass<IAttributes>> classes = new ArrayList<>();
if (node instanceof TreeParentNode) {
for (TreeNode childNode : ((TreeParentNode<EntityMappings>) node).getChildList()) {
if (childNode instanceof TreeChildNode && childNode.getCheckableNode() != null) {
JavaClass<IAttributes> javaClass = ((EMLeafNode) childNode).getJavaClass();
if (childNode.getCheckableNode().isSelected()) {
classes.add(javaClass);
}
}
}
}
return classes;
}
示例4: save_ButtonActionPerformed
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
private void save_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_ButtonActionPerformed
if (!validateField()) {
return;
}
//add dependantClasses
Set<JavaClass<? extends IAttributes>> selectedClasses = entityMappingPanel.getSelectedJavaClass()
.stream()
.collect(toSet());
Set<JavaClass<? extends IAttributes>> dependantClasses = findDependents(selectedClasses);
String dependantClassesText = dependantClasses.stream().map(JavaClass::getClazz).collect(joining(","));
int MAX_CHAR = 100;
dependantClassesText = dependantClassesText.substring(0, Math.min(MAX_CHAR, dependantClassesText.length())) + "...";
if (dependantClasses.size() > 0) {
int option = showConfirmDialog(
WindowManager.getDefault().getMainWindow(),
String.format("Workspace have dependecies on [%s] classes, Are you sure you want to proceed by adding \n [%s]?", dependantClasses.size(), dependantClassesText),
"Dependant class",
YES_NO_OPTION);
if (option == OK_OPTION) {
selectedClasses.addAll(dependantClasses);
} else {
return;
}
}
//save data
workSpace.setItems(
selectedClasses
.stream()
.map(WorkSpaceItem::new)
.collect(toSet())
);
workSpace.setName(nameTextField.getText());
scene.getModelerPanelTopComponent().changePersistenceState(false);
saveActionPerformed(evt);
}
示例5: findDependents
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
static Set<JavaClass<? extends IAttributes>> findDependents(Set<JavaClass<? extends IAttributes>> selectedClasses){
Set<JavaClass<? extends IAttributes>> dependantClasses = selectedClasses.stream()
.flatMap(_class -> _class.getAllSuperclass().stream())
.collect(toSet());
dependantClasses.removeAll(selectedClasses);
return dependantClasses;
}
示例6: deleteAttribute
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
@Override
public void deleteAttribute(AttributeWidget attributeWidget) {
ManagedClass javaClass = this.getBaseElementSpec();
IAttributes attributes = javaClass.getAttributes();
if (attributeWidget == null) {
return;
}
if (attributeWidget instanceof IdAttributeWidget) {
getIdAttributeWidgets().remove((IdAttributeWidget) attributeWidget);
((IPrimaryKeyAttributes) attributes).getId().remove(((IdAttributeWidget) attributeWidget).getBaseElementSpec());
AttributeValidator.validateEmbeddedIdAndIdFound(this);
if (this instanceof EntityWidget) {
((EntityWidget) this).scanKeyError();
}
this.getAllSubclassWidgets().stream().filter((classWidget) -> (classWidget instanceof EntityWidget)).forEach((classWidget) -> {
((EntityWidget) classWidget).scanKeyError();
});
checkPrimaryKeyStatus();
} else if (attributeWidget instanceof EmbeddedIdAttributeWidget) {
embeddedIdAttributeWidget = null;
((IPrimaryKeyAttributes) attributes).setEmbeddedId(null);
AttributeValidator.validateMultipleEmbeddedIdFound(this);
AttributeValidator.validateEmbeddedIdAndIdFound(this);
} else if (attributeWidget instanceof VersionAttributeWidget) {
getVersionAttributeWidgets().remove((VersionAttributeWidget) attributeWidget);
((IPrimaryKeyAttributes) attributes).getVersion().remove(((VersionAttributeWidget) attributeWidget).getBaseElementSpec());
} else {
super.deleteAttribute(attributeWidget);
return;
}
sortAttributes();
scanDuplicateAttributes(attributeWidget.getBaseElementSpec().getName(), null);
javaClass.updateArtifact((Attribute) attributeWidget.getBaseElementSpec());
}
示例7: getJSONBClassSnippet
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
protected List<org.netbeans.orm.converter.compiler.Snippet> getJSONBClassSnippet(JavaClass<IAttributes> javaClass) {
List<org.netbeans.orm.converter.compiler.Snippet> snippets = new ArrayList<>();
if(javaClass.getJsonbNillable()){
snippets.add(new NillableSnippet(javaClass.getJsonbNillable()));
}
if (!javaClass.getJsonbPropertyOrder().isEmpty()) {
snippets.add(new PropertyOrderSnippet(javaClass.getJsonbPropertyOrder()
.stream()
.map(Attribute::getName)
.collect(toList())
)
);
}
if (javaClass.getJsonbDateFormat() != null && !javaClass.getJsonbDateFormat().isEmpty()) {
snippets.add(new DateFormatSnippet(javaClass.getJsonbDateFormat()));
}
if (javaClass.getJsonbNumberFormat() != null && !javaClass.getJsonbNumberFormat().isEmpty()) {
snippets.add(new NumberFormatSnippet(javaClass.getJsonbNumberFormat()));
}
if(javaClass.getJsonbTypeAdapter()!=null
&& javaClass.getJsonbTypeAdapter().isEnable()
&& !StringUtils.isBlank(javaClass.getJsonbTypeAdapter().getName())){
snippets.add(new TypeAdapterSnippet(javaClass.getJsonbTypeAdapter()));
}
if(javaClass.getJsonbTypeDeserializer()!=null
&& javaClass.getJsonbTypeDeserializer().isEnable()
&& !StringUtils.isBlank(javaClass.getJsonbTypeDeserializer().getName())){
snippets.add(new TypeDeserializerSnippet(javaClass.getJsonbTypeDeserializer()));
}
if(javaClass.getJsonbTypeSerializer()!=null
&& javaClass.getJsonbTypeSerializer().isEnable()
&& !StringUtils.isBlank(javaClass.getJsonbTypeSerializer().getName())){
snippets.add(new TypeSerializerSnippet(javaClass.getJsonbTypeSerializer()));
}
if(javaClass.getJsonbVisibility()!=null
&& javaClass.getJsonbVisibility().isEnable()
&& !StringUtils.isBlank(javaClass.getJsonbVisibility().getName())){
snippets.add(new VisibilitySnippet(javaClass.getJsonbVisibility()));
}
return snippets;
}
示例8: getClassDef
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
@Override
public StaticMetamodelClassDefSnippet getClassDef() {//#ATTRIBUTE_SEQUENCE_FLOW#
//Attributes -- Method level annotations
IAttributes parsedAttributes = managedClass.getAttributes();
if (parsedAttributes != null) {
if (parsedAttributes instanceof IPersistenceAttributes) {
IPersistenceAttributes persistenceAttributes = (IPersistenceAttributes) parsedAttributes;
if (parsedAttributes instanceof IPrimaryKeyAttributes) {
IPrimaryKeyAttributes primaryKeyAttributes = (IPrimaryKeyAttributes) parsedAttributes;
if (primaryKeyAttributes.getEmbeddedId() == null) {
processBase(primaryKeyAttributes.getId());
} else {
processBase(primaryKeyAttributes.getEmbeddedId());
}
processBase(primaryKeyAttributes.getVersion());
}
processBase(persistenceAttributes.getBasic());
processBase(persistenceAttributes.getElementCollection());
processBase(persistenceAttributes.getEmbedded());
processRelation(persistenceAttributes.getOneToOne());
processRelation(persistenceAttributes.getManyToOne());
processRelation(persistenceAttributes.getOneToMany());
processRelation(persistenceAttributes.getManyToMany());
}
}
// Classlevel annotations
//Class decorations
ClassHelper classHelper = new ClassHelper(managedClass.getClazz() + "_"); //For each managed class X in package p, a metamodel class X_ in package p is created.
classHelper.setPackageName(packageName);
//The name of the metamodel class is derived from the name of the managed class by appending "_" to the name of the managed class.
if (managedClass.getSuperclass() != null) {
ClassHelper superClassHelper = new ClassHelper(managedClass.getSuperclass().getClazz() + "_");//If class X extends another class S, where S is the most derived managed class (i.e., entity or mapped superclass) extended by X, then class X_ must extend class S_, where S_ is the metamodel class created for S.
superClassHelper.setPackageName(packageName);
classDef.setSuperClassName(superClassHelper.getFQClassName());
}
classDef.setVariableDefs(new ArrayList<>(variables.values()));
classDef.setClassName(classHelper.getFQClassName());
classDef.setPackageName(classHelper.getPackageName());
classDef.getEntityClassHelper().setClassName(managedClass.getClazz());
classDef.getEntityClassHelper().setPackageName(entityPackageName);
// classDef.setStaticMetamodel(true);
classDef.setValue(managedClass.getClazz());//@StaticMetamodel( Person.class )
return classDef;
}
示例9: setAttributes
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
@Override
public void setAttributes(IAttributes attributes) {
this.attributes = (EmbeddableAttributes) attributes;
}
示例10: setAttributes
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
@Override
public void setAttributes(IAttributes attributes) {
this.attributes = (Attributes) attributes;
}
示例11: deleteAttribute
import org.netbeans.jpa.modeler.spec.extend.IAttributes; //导入依赖的package包/类
@Override
public void deleteAttribute(AttributeWidget attributeWidget) {
JavaClass javaClass = (JavaClass) this.getBaseElementSpec();
IAttributes attributes = (IAttributes) javaClass.getAttributes();
if (attributeWidget == null) {
return;
}
if (attributeWidget instanceof IdAttributeWidget) {
getIdAttributeWidgets().remove((IdAttributeWidget) attributeWidget);
((IPersistenceAttributes) attributes).getId().remove((Id) ((IdAttributeWidget) attributeWidget).getBaseElementSpec());
AttributeValidator.validateEmbeddedIdAndIdFound(this);
} else if (attributeWidget instanceof EmbeddedIdAttributeWidget) {
embeddedIdAttributeWidget = null;
((IPersistenceAttributes) attributes).setEmbeddedId(null);
AttributeValidator.validateMultipleEmbeddedIdFound(this);
AttributeValidator.validateEmbeddedIdAndIdFound(this);
} else if (attributeWidget instanceof VersionAttributeWidget) {
versionAttributeWidgets.remove((VersionAttributeWidget) attributeWidget);
((IPersistenceAttributes) attributes).getVersion().remove((Version) ((VersionAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof BasicAttributeWidget) {
basicAttributeWidgets.remove((BasicAttributeWidget) attributeWidget);
attributes.getBasic().remove((Basic) ((BasicAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof BasicCollectionAttributeWidget) {
basicCollectionAttributeWidgets.remove((BasicCollectionAttributeWidget) attributeWidget);
attributes.getElementCollection().remove((ElementCollection) ((BasicCollectionAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof TransientAttributeWidget) {
transientAttributeWidgets.remove((TransientAttributeWidget) attributeWidget);
attributes.getTransient().remove((Transient) ((TransientAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof RelationAttributeWidget) {
if (attributeWidget instanceof OTORelationAttributeWidget) {
OTORelationAttributeWidget otoRelationAttributeWidget = (OTORelationAttributeWidget) attributeWidget;
otoRelationAttributeWidget.setLocked(true);
otoRelationAttributeWidget.getOneToOneRelationFlowWidget().remove();
otoRelationAttributeWidget.setLocked(false);
oneToOneRelationAttributeWidgets.remove((OTORelationAttributeWidget) attributeWidget);
attributes.getOneToOne().remove((OneToOne) ((OTORelationAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof OTMRelationAttributeWidget) {
OTMRelationAttributeWidget otmRelationAttributeWidget = (OTMRelationAttributeWidget) attributeWidget;
otmRelationAttributeWidget.setLocked(true);
otmRelationAttributeWidget.getHierarchicalRelationFlowWidget().remove();
otmRelationAttributeWidget.setLocked(false);
oneToManyRelationAttributeWidgets.remove((OTMRelationAttributeWidget) attributeWidget);
attributes.getOneToMany().remove((OneToMany) ((OTMRelationAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof MTORelationAttributeWidget) {
MTORelationAttributeWidget mtoRelationAttributeWidget = (MTORelationAttributeWidget) attributeWidget;
mtoRelationAttributeWidget.setLocked(true);
mtoRelationAttributeWidget.getManyToOneRelationFlowWidget().remove();
mtoRelationAttributeWidget.setLocked(false);
manyToOneRelationAttributeWidgets.remove((MTORelationAttributeWidget) attributeWidget);
attributes.getManyToOne().remove((ManyToOne) ((MTORelationAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof MTMRelationAttributeWidget) {
MTMRelationAttributeWidget mtmRelationAttributeWidget = (MTMRelationAttributeWidget) attributeWidget;
mtmRelationAttributeWidget.setLocked(true);
mtmRelationAttributeWidget.getManyToManyRelationFlowWidget().remove();
mtmRelationAttributeWidget.setLocked(false);
manyToManyRelationAttributeWidgets.remove((MTMRelationAttributeWidget) attributeWidget);
attributes.getManyToMany().remove((ManyToMany) ((MTMRelationAttributeWidget) attributeWidget).getBaseElementSpec());
}
} else if (attributeWidget instanceof EmbeddedAttributeWidget) {
if (attributeWidget instanceof SingleValueEmbeddedAttributeWidget) {
singleValueEmbeddedAttributeWidgets.remove((SingleValueEmbeddedAttributeWidget) attributeWidget);
attributes.getEmbedded().remove((Embedded) ((SingleValueEmbeddedAttributeWidget) attributeWidget).getBaseElementSpec());
} else if (attributeWidget instanceof MultiValueEmbeddedAttributeWidget) {
multiValueEmbeddedAttributeWidgets.remove((MultiValueEmbeddedAttributeWidget) attributeWidget);
attributes.getElementCollection().remove((ElementCollection) ((MultiValueEmbeddedAttributeWidget) attributeWidget).getBaseElementSpec());
} else {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
}
} else {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
}
sortAttributes();
}