本文整理汇总了Java中org.netbeans.jpa.modeler.spec.Embeddable类的典型用法代码示例。如果您正苦于以下问题:Java Embeddable类的具体用法?Java Embeddable怎么用?Java Embeddable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Embeddable类属于org.netbeans.jpa.modeler.spec包,在下文中一共展示了Embeddable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isExist
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
*
* @param keys arrays path to managedAttr separated by dots
* @param embeddable next intrinsic element , incremented in each recursion
*/
private static boolean isExist(String[] keys, Embeddable embeddable, AssociationOverride associationOverride) {
if (keys.length > 1) {
Optional<Embedded> embeddedOptional = embeddable.getAttributes().getEmbedded().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
if (embeddedOptional.isPresent()) {
return isExist(Arrays.copyOfRange(keys, 1, keys.length), embeddedOptional.get().getConnectedClass(), associationOverride);
} else {
return false;
}
} else {
Optional<RelationAttribute> attrOptional = embeddable.getAttributes().getRelationAttributes().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
if (attrOptional.isPresent()) {
RelationAttribute attribute = attrOptional.get();
if (attribute instanceof SingleRelationAttribute) {
associationOverride.getJoinTable().clear();
} else if (attribute instanceof MultiRelationAttribute) {
if (attribute instanceof OneToMany) {
associationOverride.getJoinColumn().clear();
}
}
return true;
} else {
return false;
}
}
}
示例2: isExist
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
*
* @param keys arrays path to managedAttr separated by dots
* @param embeddable next intrinsic element , incremented in each recursion
*/
private static boolean isExist(String[] keys, Embeddable embeddable) {
if(embeddable==null){
return false;
}
if (keys.length > 1) {
Optional<Embedded> embeddedOptional = embeddable.getAttributes().getEmbedded().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
if (embeddedOptional.isPresent()) {
return isExist(Arrays.copyOfRange(keys, 1, keys.length), embeddedOptional.get().getConnectedClass());
} else {
return false;
}
} else {
Optional<Attribute> attrOptional = embeddable.getAttributes().getNonRelationAttributes().stream().filter(e -> e.getName().equalsIgnoreCase(keys[0])).findAny();
return attrOptional.isPresent();
}
}
示例3: generateEmbededClasses
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private void generateEmbededClasses()
throws InvalidDataException, IOException {
List<Embeddable> parsedEmbeddables
= parsedEntityMappings.getEmbeddable();
for (Embeddable parsedEmbeddable : parsedEmbeddables) {
task.log("Generating Embeddable Class : " + parsedEmbeddable.getClazz(), true);
ClassDefSnippet classDef = new EmbeddableGenerator(
parsedEmbeddable, packageName).getClassDef();
classesRepository.addWritableSnippet(
ClassType.EMBEDED_CLASS, classDef);
writeSnippet(classDef);
}
}
示例4: getInstance
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
public static EmbeddableSpecAccessor getInstance(WorkSpace workSpace, Embeddable embeddable) {
EmbeddableSpecAccessor accessor = new EmbeddableSpecAccessor(embeddable);
accessor.setClassName(embeddable.getClazz());
accessor.setAccess("VIRTUAL");
accessor.setAttributes(embeddable.getAttributes().getAccessor(workSpace));
if (embeddable.getSuperclass() != null) {
accessor.setParentClassName(embeddable.getSuperclass().getClazz());
}
return accessor;
}
示例5: generateEmbededClasses
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private void generateEmbededClasses() throws InvalidDataException, IOException {
List<Embeddable> parsedEmbeddables = entityMappings.getEmbeddable().stream().filter(e -> e.getGenerateSourceCode()).collect(toList());
if(!parsedEmbeddables.isEmpty()){
task.log(Console.wrap("Generating Embeddable Class : " , FG_RED, BOLD), true);
}
for (Embeddable parsedEmbeddable : parsedEmbeddables) {
task.log(parsedEmbeddable.getClazz(), true);
ManagedClassDefSnippet classDef = new EmbeddableGenerator(parsedEmbeddable, packageName).getClassDef();
classDef.setJaxbSupport(entityMappings.getJaxbSupport());
classesRepository.addWritableSnippet(ClassType.EMBEDED_CLASS, classDef);
parsedEmbeddable.setFileObject(ORMConverterUtil.writeSnippet(classDef, destDir));
}
}
示例6: makeSiblingOrphan
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Deprecated
private static void makeSiblingOrphan(Embeddable embeddable) {
EmbeddableAttributes attr = embeddable.getAttributes();
attr.setManyToMany(null);
attr.setManyToOne(null);
attr.setOneToMany(null);
attr.setOneToOne(null);
attr.setEmbedded(null);
attr.setElementCollection(null);
}
示例7: init
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Override
public void init() {
super.init();
Embeddable embeddable = this.getBaseElementSpec();
if (embeddable.getAttributes() == null) {
embeddable.setAttributes(new EmbeddableAttributes());
}
if (embeddable.getClazz() == null || embeddable.getClazz().isEmpty()) {
embeddable.setClazz(this.getModelerScene().getNextClassName("Embeddable_"));
}
setName(embeddable.getClazz());
setLabel(embeddable.getClazz());
validateName(null, this.getName());
}
示例8: init
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Override
public void init() {
Embeddable embeddable = (Embeddable) this.getBaseElementSpec();
if (embeddable.getAttributes() == null) {
embeddable.setAttributes(new EmbeddableAttributes());
// addNewIdAttribute("id");
// sortAttributes();
}
if (embeddable.getClazz() == null || embeddable.getClazz().isEmpty()) {
embeddable.setClazz(((JPAModelerScene) this.getModelerScene()).getNextClassName("Embeddable_"));
}
setName(embeddable.getClazz());
setLabel(embeddable.getClazz());
}
示例9: getMapKeyEmbeddable
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
* @return the mapKeyEmbeddable
*/
@Override
public Embeddable getMapKeyEmbeddable() {
return mapKeyEmbeddable;
}
示例10: setMapKeyEmbeddable
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
* @param mapKeyEmbeddable the mapKeyEmbeddable to set
*/
@Override
public void setMapKeyEmbeddable(Embeddable mapKeyEmbeddable) {
resetMapAttributeExceptEmbeddable();
this.mapKeyEmbeddable = mapKeyEmbeddable;
}
示例11: EmbeddableSpecAccessor
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
private EmbeddableSpecAccessor(Embeddable embeddable) {
this.embeddable = embeddable;
}
示例12: getEmbeddable
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
/**
* @return the embeddable
*/
public Embeddable getEmbeddable() {
return embeddable;
}
示例13: EmbeddableGenerator
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
public EmbeddableGenerator(Embeddable parsedEmbeddable, String packageName) {
super(new ManagedClassDefSnippet(), parsedEmbeddable.getRootElement().getJavaEEVersion());
this.embeddable = parsedEmbeddable;
this.rootPackageName = packageName;
this.packageName = embeddable.getAbsolutePackage(rootPackageName);
}
示例14: loadAttributes
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的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);
}
}
示例15: createBaseElementSpec
import org.netbeans.jpa.modeler.spec.Embeddable; //导入依赖的package包/类
@Override
public Embeddable createBaseElementSpec() {
return new Embeddable();
}