本文整理汇总了Java中org.netbeans.jpa.modeler.spec.Embedded类的典型用法代码示例。如果您正苦于以下问题:Java Embedded类的具体用法?Java Embedded怎么用?Java Embedded使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Embedded类属于org.netbeans.jpa.modeler.spec包,在下文中一共展示了Embedded类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isExist
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的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();
}
}
示例2: isExist
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的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;
}
}
}
示例3: getKeyName
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
protected String getKeyName() {
if (keyName != null) {
return keyName;
}
StringBuilder keyNameBuilder = new StringBuilder();
boolean skipFirst = true;
for (Embedded next : embeddedList) {
if (skipFirst) {
skipFirst = false;
continue;
}
keyNameBuilder.append(next.getName()).append('.');
}
keyNameBuilder.append(getAttribute().getName());
return keyName = keyNameBuilder.toString();
}
示例4: processEmbedded
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
protected void processEmbedded(List<Embedded> parsedEmbeddeds) {
if (parsedEmbeddeds == null) {
return;
}
for (Embedded parsedEmbeded : parsedEmbeddeds) {
VariableDefSnippet variableDef = getVariableDef(parsedEmbeded);
variableDef.setEmbedded(true);
variableDef.setType(parsedEmbeded.getConnectedClass().getAbsolutePackage(rootPackageName) + ORMConverterUtil.DOT
+ parsedEmbeded.getAttributeType());
variableDef.setFunctionalType(parsedEmbeded.isOptionalReturnType());
variableDef.setConverts(processConverts(parsedEmbeded.getConverts()));
processInternalAttributeOverride(variableDef, parsedEmbeded.getAttributeOverride());
processInternalAssociationOverride(variableDef, parsedEmbeded.getAssociationOverride());
}
}
示例5: filter
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
/**
* Used to remove all stale AttributeOverride (ex : if Embeddable attribute
* is removed then AttributeOverride reference should be removed)
*
* @param embedded
*/
public static void filter(Embedded embedded) {
embedded.getAttributeOverride().removeIf(attributeOverride
-> !isExist(attributeOverride.getName().split("\\."), embedded.getConnectedClass())
|| AttributeValidator.isEmpty(attributeOverride)
);
}
示例6: getEmbedded
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
@Override
public Optional<Embedded> getEmbedded(String id) {
if (embedded != null) {
return embedded.stream().filter(a -> a.getId().equals(id)).findFirst();
}
return null;
}
示例7: addEmbedded
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
@Override
public void addEmbedded(Embedded embedded) {
if (embedded != null) {
this.getEmbedded().add(embedded);
notifyListeners(embedded, "addAttribute", null, null);
embedded.setAttributes(this);
}
}
示例8: getRelationConnectedClassRef
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
@Override
public Set<Entity> getRelationConnectedClassRef() {
Set<Entity> javaClasses = getRelationAttributes().stream()
.map(RelationAttribute::getConnectedEntity)
.collect(toSet());
javaClasses.addAll(getEmbedded().stream()
.map(Embedded::getConnectedClass)
.flatMap(c -> c.getAttributes().getRelationConnectedClassRef().stream())
.collect(toSet()));
return javaClasses;
}
示例9: getEmbeddedConnectedClass
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public Set<String> getEmbeddedConnectedClass(Set<String> javaClasses){
Map<ManagedClass, String> releationClasses = getEmbedded().stream()
.map(Embedded::getConnectedClass)
.distinct()
.filter(jc -> !javaClasses.contains(jc.getFQN()))
.collect(toMap(identity(), JavaClass::getFQN));
javaClasses.addAll(releationClasses.values());
for (ManagedClass releationClass : releationClasses.keySet()) {
javaClasses.addAll(releationClass.getAttributes().getConnectedClass(javaClasses));
}
return javaClasses;
}
示例10: getInstance
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public static EmbeddedSpecAccessor getInstance(Embedded embedded, boolean inherit) {
EmbeddedSpecAccessor accessor = new EmbeddedSpecAccessor(embedded);
accessor.inherit = inherit;
accessor.setName(embedded.getName());
accessor.setAttributeType(embedded.getAttributeType());
AttributeValidator.filter(embedded);
accessor.setAttributeOverrides(embedded.getAttributeOverride().stream().map(AttributeOverrideSpecMetadata::getInstance).collect(toList()));
AssociationValidator.filter(embedded);
accessor.setAssociationOverrides(embedded.getAssociationOverride().stream().map(AssociationOverrideSpecMetadata::getInstance).collect(toList()));
accessor.setConverts(embedded.getConverts().stream().map(Convert::getAccessor).collect(toList()));
return accessor;
}
示例11: loadAttribute
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public void loadAttribute() {
List<JSONBNode> nodes = new LinkedList<>();
List<Attribute> attributes = this.javaClass.getAttributes().getAllAttribute();
List<Attribute> propertyOrder = this.javaClass.getJsonbPropertyOrder();
if (!propertyOrder.isEmpty()) {
Map<String, Integer> attributesMap = IntStream.range(0, propertyOrder.size())
.boxed()
.collect(toMap(i -> propertyOrder.get(i).getId(), identity()));
attributes.sort(Comparator.comparing(attr -> attributesMap.get(attr.getId())));
}
for (Attribute attribute : attributes) {
JSONBNode node = null;
if (attribute instanceof RelationAttribute) {
if (workSpace == null || workSpace.hasItem(((RelationAttribute) attribute).getConnectedEntity())) {
node = new JSONBBranchNode(attribute);
}
} else if (attribute instanceof Embedded) {
if (workSpace == null || workSpace.hasItem(((Embedded) attribute).getConnectedClass())) {
node = new JSONBBranchNode(attribute);
}
} else if (attribute instanceof ElementCollection && ((ElementCollection) attribute).getConnectedClass() != null) {
if (workSpace == null || workSpace.hasItem(((ElementCollection) attribute).getConnectedClass())) {
node = new JSONBBranchNode(attribute);
}
} else {
node = new JSONBLeafNode(attribute);
}
if (node != null) {
nodes.add(node);
}
}
this.nodes = nodes;
}
示例12: getJSONNodeWidget
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
/**
* @return the JSONNodeWidget
*/
public JSONNodeWidget getJSONNodeWidget(Attribute attr) {
if(attr instanceof RelationAttribute || attr instanceof Embedded ||
(attr instanceof ElementCollection && ((ElementCollection)attr).getConnectedClass()!=null)){
return branchNodeWidgets.get(attr.getId());
} else {
return leafNodeWidgets.get(attr.getId());
}
}
示例13: buildMapKeyColumn
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
private DBColumn buildMapKeyColumn() {
DBColumn column;
MapKeyHandler mapKeyHandler = (MapKeyHandler) intrinsicAttribute.peek();
if (mapKeyHandler.getMapKeyEntity() != null) {
column = new DBMapKeyJoinColumn(name, managedAttribute);
} else if (mapKeyHandler.getMapKeyEmbeddable() != null) {
// Wrap AttributeOverride to Embedded to reuse the api
column = new DBMapKeyEmbeddedColumn(name, Collections.singletonList(new Embedded(mapKeyHandler.getMapKeyAttributeOverride())), managedAttribute);
} else {
column = new DBMapKeyColumn(name, managedAttribute);
}
return column;
}
示例14: DBEmbeddedAssociationJoinColumn
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public DBEmbeddedAssociationJoinColumn(String name, List<Embedded> embeddedList, RelationAttribute managedAttribute, boolean relationTableExist) {
super(name, embeddedList, managedAttribute, relationTableExist);
joinColumnsOverride = JoinColumnFinder.findJoinColumns(associationOverride, managedAttribute, relationTableExist, false);
joinColumnOverride = JoinColumnFinder.findJoinColumn(name, joinColumnsOverride);
joinColumns = JoinColumnFinder.findJoinColumns(managedAttribute, relationTableExist, false);
joinColumn = JoinColumnFinder.findJoinColumn(name, joinColumns);
}
示例15: DBEmbeddedAssociationInverseJoinColumn
import org.netbeans.jpa.modeler.spec.Embedded; //导入依赖的package包/类
public DBEmbeddedAssociationInverseJoinColumn(String name, List<Embedded> embeddedList, RelationAttribute managedAttribute, boolean relationTableExist) {
super(name, embeddedList, managedAttribute, relationTableExist);
joinColumnsOverride = JoinColumnFinder.findJoinColumns(associationOverride, managedAttribute, relationTableExist, true);
joinColumnOverride = JoinColumnFinder.findJoinColumn(name, joinColumnsOverride);
joinColumns = JoinColumnFinder.findJoinColumns(managedAttribute, relationTableExist, true);
joinColumn = JoinColumnFinder.findJoinColumn(name, joinColumns);
}