本文整理汇总了Java中org.netbeans.jpa.modeler.spec.Basic类的典型用法代码示例。如果您正苦于以下问题:Java Basic类的具体用法?Java Basic怎么用?Java Basic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Basic类属于org.netbeans.jpa.modeler.spec包,在下文中一共展示了Basic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBasicConnectedClass
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
public Set<String> getBasicConnectedClass(Set<String> javaClasses) {
List<String> basicClasses = getBasic().stream()
.map(Basic::getDataTypeLabel)
.filter(dataType -> {
if (StringUtils.isNotEmpty(dataType)) {
dataType = isArray(dataType) ? getArrayType(dataType) : dataType;
Type type = getType(dataType);
if (type == OTHER) {
return !JavaIdentifiers.getPackageName(dataType).startsWith("java");
}
}
return false;
})
.distinct()
.collect(Collectors.toList());
javaClasses.addAll(basicClasses);
return javaClasses;
}
示例2: getSuperBasic
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
public List<Basic> getSuperBasic(){
List<Basic> superVersion = new ArrayList();
JavaClass currentClass = getJavaClass();
do {
if(currentClass instanceof ManagedClass){
ManagedClass<IPersistenceAttributes> managedClass = (ManagedClass)currentClass;
superVersion.addAll(managedClass.getAttributes().getBasic());
}
currentClass = currentClass.getSuperclass();
} while(currentClass != null);
return superVersion;
}
示例3: getBasic
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
public Optional<Basic> getBasic(String id) {
if (basic != null) {
return basic.stream().filter(a -> a.getId().equals(id)).findFirst();
}
return null;
}
示例4: getInstance
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
public static BasicSpecAccessor getInstance(Basic basic, boolean inherit) {
BasicSpecAccessor accessor = new BasicSpecAccessor(basic);
accessor.inherit = inherit;
accessor.setAttributeType(basic.getAttributeType());
AccessorUtil.setEnumerated(accessor, basic.getEnumerated());
AccessorUtil.setLob(accessor, basic.getLob(), basic.getAttributeType(), false);
AccessorUtil.setTemporal(accessor, basic.getTemporal());
accessor.setConverts(Collections.singletonList(basic.getConvert().getAccessor()));
accessor.setName(basic.getName());
accessor.setColumn(basic.getColumn().getAccessor());
return accessor;
}
示例5: initTypeComboBox
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
private void initTypeComboBox() {
TitledBorder titledBorder = (TitledBorder) jLayeredPane1.getBorder();
List<String> type = new ArrayList<>();
type.add(DEFAULT);
if (mapKey) {
type.add(ENUMERATED);
type.add(TEMPORAL);
type.add(ENTITY);
type.add(EMBEDDABLE);
titledBorder.setTitle("MapKey Attribute");
} else if (attribute instanceof PersistenceBaseAttribute) {
type.add(TEMPORAL);
if (attribute instanceof Basic) {
type.add(ENUMERATED);
type.add(LOB);
titledBorder.setTitle("Basic Attribute");
} else if (attribute instanceof Id) {
titledBorder.setTitle("Id Attribute");
} else if (attribute instanceof Version) {
titledBorder.setTitle("Version Attribute");
}
} else if (attribute instanceof ElementCollection) {
type.add(ENUMERATED);
type.add(LOB);
type.add(TEMPORAL);
titledBorder.setTitle("ElementCollection<Basic> Attribute");
} else if (attribute instanceof Transient) {
titledBorder.setTitle("Transient Attribute");
}
type_ComboBox.removeAllItems();
type_ComboBox.setModel(new DefaultComboBoxModel(type.toArray(new String[0])));
//ElementCollection[Basic Type Value] => Lob,Enumerated,Temporal
//Id => Temporal
}
示例6: initTypeComboBox
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
private void initTypeComboBox() {
TitledBorder titledBorder = (TitledBorder) jLayeredPane1.getBorder();
List<String> type = new ArrayList<String>();
type.add("Default");
if (baseAttribute instanceof Basic) {
type.add("Enumerated");
type.add("Lob");
type.add("Temporal");
titledBorder.setTitle("Basic Attribute");
} else if (baseAttribute instanceof ElementCollection) {
type.add("Enumerated");
type.add("Lob");
type.add("Temporal");
titledBorder.setTitle("ElementCollection<Basic> Attribute");
} else if (baseAttribute instanceof Id) {
type.add("Temporal");
titledBorder.setTitle("Id Attribute");
} else if (baseAttribute instanceof Version) {
// type.add("Temporal");
titledBorder.setTitle("Version Attribute");
} else if (baseAttribute instanceof Transient) {
titledBorder.setTitle("Transient Attribute");
}
type_ComboBox.removeAllItems();
type_ComboBox.setModel(new DefaultComboBoxModel(type.toArray(new String[0])));
//ElementCollection[Basic Type Value] => Lob,Enumerated,Temporal
//Id => Temporal
}
示例7: addBasic
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
public void addBasic(Basic basic) {
this.getBasic().add(basic);
notifyListeners(basic, "addAttribute", null, null);
basic.setAttributes(this);
}
示例8: removeBasic
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
public void removeBasic(Basic basic) {
this.getBasic().remove(basic);
notifyListeners(basic, "removeAttribute", null, null);
}
示例9: isAttributeExist
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
public boolean isAttributeExist(String name) {
if (super.isAttributeExist(name)) {
return true;
}
if (basic != null) {
for (Basic basic_TMP : basic) {
if (basic_TMP.getName() != null && basic_TMP.getName().equals(name)) {
return true;
}
}
}
if (_transient != null) {
for (Transient transient_TMP : _transient) {
if (transient_TMP.getName() != null && transient_TMP.getName().equals(name)) {
return true;
}
}
}
if (elementCollection != null) {
for (ElementCollection elementCollection_TMP : elementCollection) {
if (elementCollection_TMP.getName() != null && elementCollection_TMP.getName().equals(name)) {
return true;
}
}
}
if (embedded != null) {
for (Embedded embedded_TMP : embedded) {
if (embedded_TMP.getName() != null && embedded_TMP.getName().equals(name)) {
return true;
}
}
}
if (oneToOne != null) {
for (OneToOne oneToOne_TMP : oneToOne) {
if (oneToOne_TMP.getName() != null && oneToOne_TMP.getName().equals(name)) {
return true;
}
}
}
if (oneToMany != null) {
for (OneToMany oneToMany_TMP : oneToMany) {
if (oneToMany_TMP.getName() != null && oneToMany_TMP.getName().equals(name)) {
return true;
}
}
}
if (manyToOne != null) {
for (ManyToOne manyToOne_TMP : manyToOne) {
if (manyToOne_TMP.getName() != null && manyToOne_TMP.getName().equals(name)) {
return true;
}
}
}
if (manyToMany != null) {
for (ManyToMany manyToMany_TMP : manyToMany) {
if (manyToMany_TMP.getName() != null && manyToMany_TMP.getName().equals(name)) {
return true;
}
}
}
return false;
}
示例10: findAllAttribute
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
public List<Attribute> findAllAttribute(String name,boolean includeParentClassAttibute) {
List<Attribute> attributes = super.findAllAttribute(name,includeParentClassAttibute);
if (basic != null) {
for (Basic basic_TMP : basic) {
if (basic_TMP.getName() != null && basic_TMP.getName().equals(name)) {
attributes.add(basic_TMP);
}
}
}
if (elementCollection != null) {
for (ElementCollection elementCollection_TMP : elementCollection) {
if (elementCollection_TMP.getName() != null && elementCollection_TMP.getName().equals(name)) {
attributes.add(elementCollection_TMP);
}
}
}
if (_transient != null) {
for (Transient transient_TMP : _transient) {
if (transient_TMP.getName() != null && transient_TMP.getName().equals(name)) {
attributes.add(transient_TMP);
}
}
}
if (oneToOne != null) {
for (OneToOne oneToOne_TMP : oneToOne) {
if (oneToOne_TMP.getName() != null && oneToOne_TMP.getName().equals(name)) {
attributes.add(oneToOne_TMP);
}
}
}
if (oneToMany != null) {
for (OneToMany oneToMany_TMP : oneToMany) {
if (oneToMany_TMP.getName() != null && oneToMany_TMP.getName().equals(name)) {
attributes.add(oneToMany_TMP);
}
}
}
if (manyToOne != null) {
for (ManyToOne manyToOne_TMP : manyToOne) {
if (manyToOne_TMP.getName() != null && manyToOne_TMP.getName().equals(name)) {
attributes.add(manyToOne_TMP);
}
}
}
if (manyToMany != null) {
for (ManyToMany manyToMany_TMP : manyToMany) {
if (manyToMany_TMP.getName() != null && manyToMany_TMP.getName().equals(name)) {
attributes.add(manyToMany_TMP);
}
}
}
if (embedded != null) {
for (Embedded embedded_TMP : embedded) {
if (embedded_TMP.getName() != null && embedded_TMP.getName().equals(name)) {
attributes.add(embedded_TMP);
}
}
}
return attributes;
}
示例11: setBasic
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
/**
* @param basic the basic to set
*/
public void setBasic(List<Basic> basic) {
this.basic = basic;
}
示例12: BasicSpecAccessor
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
private BasicSpecAccessor(Basic basic) {
this.basic = basic;
}
示例13: processBasic
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
protected void processBasic(List<Basic> parsedBasics) {
if (parsedBasics == null) {
return;
}
for (Basic parsedBasic : parsedBasics) {
ColumnDefSnippet columnDef = getColumnDef(parsedBasic.getColumn());
EnumType parsedEnumType = parsedBasic.getEnumerated();
EnumeratedSnippet enumerated = null;
if (parsedEnumType != null) {
enumerated = new EnumeratedSnippet();
enumerated.setValue(parsedEnumType);
}
TemporalType parsedTemporalType = parsedBasic.getTemporal();
TemporalSnippet temporal = null;
if (parsedTemporalType != null) {
temporal = new TemporalSnippet();
temporal.setValue(parsedTemporalType);
}
FetchType parsedFetchType = parsedBasic.getFetch();
BasicSnippet basic = new BasicSnippet();
if (parsedFetchType != null) {
basic.setFetchType(parsedFetchType.value());
}
if (parsedBasic.getOptional() != null) {
basic.setOptional(parsedBasic.getOptional());
}
Lob parsedLob = parsedBasic.getLob();
VariableDefSnippet variableDef = getVariableDef(parsedBasic);
variableDef.setBasic(basic);
variableDef.setColumnDef(columnDef);
variableDef.setEnumerated(enumerated);
variableDef.setTemporal(temporal);
variableDef.setType(parsedBasic.getAttributeType());
variableDef.setFunctionalType(parsedBasic.isOptionalReturnType());
variableDef.setConverts(processConverts(Collections.singletonList(parsedBasic.getConvert())));
variableDef.setLob(parsedLob != null);
}
}
示例14: createKeys
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
@Override
protected boolean createKeys(List<AttributeWidget> attributeWidgets) {
PersistenceClassWidget<? extends ManagedClass> classWidget = null;
if (parentNode instanceof EGRootNode) {
classWidget = ((EGRootNode) parentNode).getRootWidget();
} else if (parentNode instanceof EGInternalNode) {
classWidget = ((EGInternalNode) parentNode).getParentWidget();
}
if (classWidget != null) {
for (AttributeWidget attributeWidget : classWidget.getAllSortedAttributeWidgets()) {
if (attributeWidget instanceof IdAttributeWidget || attributeWidget instanceof EmbeddedIdAttributeWidget || attributeWidget instanceof EmbeddedAttributeWidget || attributeWidget instanceof VersionAttributeWidget) {
attributeWidgets.add(attributeWidget);
} else if (attributeWidget instanceof TransientAttributeWidget) {
// skip
} else { //check for all remaining
Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
NamedAttributeNode namedAttributeNode = null;
if (parentNode instanceof EGRootNode) {
namedAttributeNode = parentNode.getBaseElementSpec().findNamedAttributeNode(attribute.getName());
} else if (parentNode instanceof EGInternalNode && ((EGInternalNode) parentNode).getSubgraph() != null) {//if sub graph not exist for relation node
namedAttributeNode = ((EGInternalNode) parentNode).getSubgraph().findNamedAttributeNode(attribute.getName());
}
if (namedAttributeNode != null) {
attributeWidgets.add(attributeWidget);
} else if (loadGraph && attribute instanceof FetchTypeHandler) {
FetchType fetch = ((FetchTypeHandler) attribute).getFetch();
if (fetch != null) {
if (fetch == FetchType.EAGER) {
attributeWidgets.add(attributeWidget);
}
} else if (attribute instanceof Basic || attribute instanceof OneToOne || attribute instanceof ManyToOne) {
attributeWidgets.add(attributeWidget);
}
}
}
}
}
return true;
}
示例15: loadAttributes
import org.netbeans.jpa.modeler.spec.Basic; //导入依赖的package包/类
private void loadAttributes() {
ManagedClass attributeClass = null;
String prefix;
if(mapKey){
prefix = "key";
if (convertContainer instanceof MapKeyHandler) {//ElementCollection,MultiRelationAttribute
MapKeyHandler elementCollection = (MapKeyHandler) convertContainer;
// if (elementCollection.getMapKeyAttribute() != null) {//MapKeyType.EXT
// if (elementCollection.getMapKeyAttribute() instanceof Embedded) {
// attributeClass = ((Embedded) elementCollection.getMapKeyAttribute()).getConnectedClass();
// }
// } else
if (elementCollection.getMapKeyEmbeddable() != null) {//MapKeyType.NEW
attributeClass = elementCollection.getMapKeyEmbeddable();
} else if (elementCollection.getMapKeyEntity() != null) {//MapKeyType.NEW
attributeClass = elementCollection.getMapKeyEntity();
}
}
} else {
prefix = EMPTY;
if (convertContainer instanceof org.netbeans.jpa.modeler.spec.Entity) {
attributeClass = (ManagedClass) ((org.netbeans.jpa.modeler.spec.Entity) convertContainer).getSuperclass();
} else if (convertContainer instanceof Embedded) {
attributeClass = ((Embedded) convertContainer).getConnectedClass();
} else if (convertContainer instanceof ElementCollection) {
attributeClass = ((ElementCollection) convertContainer).getConnectedClass();
}
}
attribute_ComboBox.removeAllItems();
attribute_Label.setEnabled(attributeClass != null);
attribute_ComboBox.setEnabled(attributeClass != null);
if (attributeClass != null) {
List<String> items = new ArrayList<>();
List<Attribute> attributes = attributeClass.getAttributes().getAllAttribute(true);
items.addAll(attributes
.stream()
.filter(attr -> attr instanceof Basic)
.map(attr -> (Basic)attr)
.filter(basic -> basic.getTemporal() == null)
.filter(basic -> basic.getEnumerated() == null)
.map(Basic::getName)
.map(attrName -> prefix.isEmpty() ? attrName : (prefix + '.' + attrName))
.collect(toList()));
items.addAll(attributes
.stream()
.filter(attr -> attr instanceof ElementCollection)
.map(attr -> (ElementCollection)attr)
.filter(ec -> ec.getTemporal() == null)
.filter(ec -> ec.getEnumerated() == null)
.map(ElementCollection::getName)
.map(attrName -> prefix.isEmpty() ? attrName : (prefix + '.' + attrName))
.collect(toList()));
// if ((attributeClass instanceof org.netbeans.jpa.modeler.spec.Entity) || (attributeClass instanceof MappedSuperclass)) {
if (attributeClass instanceof Embeddable) {
items.addAll(attributes
.stream()
.filter(attr -> attr instanceof Embedded)
.map(attr -> (Embedded)attr)
.map(emb -> getPaths(prefix, emb, attr -> ((attr instanceof Basic) || (attr instanceof ElementCollection))))
.collect(ArrayList<String>::new, ArrayList::addAll, ArrayList::addAll));
}
items.stream().forEach(attribute_ComboBox::addItem);
}
}