本文整理汇总了Java中org.netbeans.jpa.modeler.spec.ElementCollection类的典型用法代码示例。如果您正苦于以下问题:Java ElementCollection类的具体用法?Java ElementCollection怎么用?Java ElementCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElementCollection类属于org.netbeans.jpa.modeler.spec包,在下文中一共展示了ElementCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public void init() {
MULTI_VALUE = new OneOrMoreCrowShape(8);
SINGLE_VALUE = new OneAndOneCrowShape(5);
branchNodeWidget.setAnchorGap(2);
referenceDocumentWidget.setAnchorGap(2);
if (branchNodeWidget.getBaseElementSpec().getAttribute() instanceof RelationAttribute) {
RelationAttribute relationAttribute = (RelationAttribute) branchNodeWidget.getBaseElementSpec().getAttribute();
if (relationAttribute instanceof MultiRelationAttribute) {
setSourceAnchorShape(MULTI_VALUE);
} else {
setSourceAnchorShape(SINGLE_VALUE);
}
} else if (branchNodeWidget.getBaseElementSpec().getAttribute() instanceof ElementCollection) {
setSourceAnchorShape(MULTI_VALUE);
}
setTargetAnchorShape(SINGLE_VALUE);
}
示例2: getIconPath
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public String getIconPath() {
Attribute attr = this.getBaseElementSpec().getAttribute();
if(attr instanceof ElementCollection || AttributeType.isArray(attr.getDataTypeLabel())){
return ARRAY_ICON_PATH;
} else if(AttributeType.isText(attr.getDataTypeLabel())){
return TEXT_ICON_PATH;
} else if(AttributeType.isNumber(attr.getDataTypeLabel())){
return NUMBER_ICON_PATH;
} else if(AttributeType.isBoolean(attr.getDataTypeLabel())){
return BOOLEAN_ICON_PATH;
} else if(AttributeType.isDate(attr.getDataTypeLabel()) || AttributeType.isDateTime(attr.getDataTypeLabel())){
return DATE_ICON_PATH;
} else if(AttributeType.isTime(attr.getDataTypeLabel())){
return TIME_ICON_PATH;
}
if(attr instanceof EnumTypeHandler && ((EnumTypeHandler)attr).getEnumerated() != null){
return ENUM_ICON_PATH;
}
return UNKNOWN_ICON_PATH;
}
示例3: getIcon
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public Image getIcon() {
Attribute attr = this.getBaseElementSpec().getAttribute();
if(attr instanceof ElementCollection || AttributeType.isArray(attr.getDataTypeLabel())){
return ARRAY_ICON;
} else if(AttributeType.isText(attr.getDataTypeLabel())){
return TEXT_ICON;
} else if(AttributeType.isNumber(attr.getDataTypeLabel())){
return NUMBER_ICON;
} else if(AttributeType.isBoolean(attr.getDataTypeLabel())){
return BOOLEAN_ICON;
} else if(AttributeType.isDate(attr.getDataTypeLabel()) || AttributeType.isDateTime(attr.getDataTypeLabel())){
return DATE_ICON;
} else if(AttributeType.isTime(attr.getDataTypeLabel())){
return TIME_ICON;
}
if(attr instanceof EnumTypeHandler && ((EnumTypeHandler)attr).getEnumerated() != null){
return ENUM_ICON;
}
return UNKNOWN_ICON;
}
示例4: buildDBTable
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
/**
* INTERNAL: Return the create table object.
*/
public void buildDBTable(AbstractSession session, DBMapping dbMapping) throws ValidationException {
DBTable dBTable;
Entity entity = (Entity) intrinsicEntity.get(0);
Table table;
if (attribute instanceof RelationAttribute) {
dBTable = new DBRelationTable(getFullName(), entity, (RelationAttribute) attribute);//Todo pass managedClass
} else if (attribute instanceof ElementCollection) {
dBTable = new DBCollectionTable(getFullName(), entity, (ElementCollection) attribute);
} else if((table = entity.getTable(getFullName())) instanceof SecondaryTable){
dBTable = new DBSecondaryTable(getFullName(), entity, (SecondaryTable)table);
} else {
dBTable = new DBBaseTable(getFullName(), entity);
}
dBTable.setId(NBModelerUtil.getAutoGeneratedStringId());
for (Iterator<FieldDefinition> itetrator = getFields().iterator(); itetrator.hasNext();) {
JPAMFieldDefinition field = (JPAMFieldDefinition) itetrator.next();
field.buildDBColumn(dBTable, session, this);
}
dbMapping.addTable(dBTable);
}
示例5: findJoinColumns
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
private static List<JoinColumn> findJoinColumns(Attribute attribute, boolean relationTableExist, boolean inverse, boolean mapKey) {
List<JoinColumn> joinColumns;
if (mapKey) {
if (attribute instanceof MapKeyHandler) {
joinColumns = ((MapKeyHandler) attribute).getMapKeyJoinColumn();
} else {
throw new IllegalStateException("Invalid attribute type : " + attribute.getClass().getSimpleName());
}
} else {
if (attribute instanceof RelationAttribute) {
joinColumns = getRelationAttributeJoinColumn(attribute, (JoinTableHandler) attribute, relationTableExist, inverse);
} else if (attribute instanceof ElementCollection) { // not applicable for inverse-join-column
joinColumns = ((ElementCollection) attribute).getCollectionTable().getJoinColumn();
} else {
throw new IllegalStateException("Invalid attribute type : " + attribute.getClass().getSimpleName());
}
}
return joinColumns;
}
示例6: evaluateName
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
protected String evaluateName() {
AttributeOverride attributeOverride = this.getBaseElementSpec().getAttributeOverride();
Attribute refAttribute = this.getBaseElementSpec().getAttribute();
if (this.getBaseElementSpec().getAttribute() instanceof ElementCollection) {
inDev();
}
if (refAttribute instanceof ColumnHandler) {
ColumnHandler baseRefAttribute = (ColumnHandler) refAttribute;
Column column = baseRefAttribute.getColumn();
if (StringUtils.isNotBlank(attributeOverride.getColumn().getName())) {
return attributeOverride.getColumn().getName();
} else if (StringUtils.isNotBlank(column.getName())) {
return column.getName();
} else {
return baseRefAttribute.getDefaultColumnName();
}
} else {
throw new IllegalStateException("Invalid attribute type : " + refAttribute.getClass().getSimpleName());
}
}
示例7: createPropertySet
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public void createPropertySet(ElementPropertySet set) {
Attribute refAttribute = this.getBaseElementSpec().getAttribute();
if (refAttribute instanceof PersistenceBaseAttribute) {
PersistenceBaseAttribute baseRefAttribute = (PersistenceBaseAttribute) refAttribute;
set.createPropertySet("EMBEDDABLE_COLUMN", this, baseRefAttribute.getColumn(), getPropertyChangeListeners());
AttributeOverride attributeOverride = this.getBaseElementSpec().getAttributeOverride();
set.createPropertySet("ATTRIBUTE_OVERRIDE", "ATTR_OVERRIDE", this, attributeOverride.getColumn(), getPropertyChangeListeners());
} else if (this.getBaseElementSpec().getAttribute() instanceof ElementCollection) {
//in dev
}
this.addPropertyChangeListener("column_name", (PropertyChangeListener<String>) (oldValue, value) -> setMultiPropertyName(value));
this.addPropertyChangeListener("attr_override_column_name", (PropertyChangeListener<String>) (oldValue, value) -> setMultiPropertyName(value));
this.addPropertyChangeListener("table_name", (PropertyChangeListener<String>) (oldValue, value) -> validateTableName(value));
this.addPropertyChangeListener("attr_override_table_name", (PropertyChangeListener<String>) (oldValue, value) -> validateTableName(value));
}
示例8: setName
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public void setName(String newName) {
if (StringUtils.isNotBlank(newName)) {
this.name = newName.replaceAll("\\s+", "");
if (this.getModelerScene().getModelerFile().isLoaded()) {
ElementCollection attribute = this.getBaseElementSpec().getAttribute();
attribute.getCollectionTable().setName(this.name);
}
} else {
setDefaultName();
}
if (SQLKeywords.isSQL99ReservedKeyword(CollectionTableWidget.this.getName())) {
this.getSignalManager().fire(ERROR, ClassValidator.CLASS_TABLE_NAME_WITH_RESERVED_SQL_KEYWORD);
} else {
this.getSignalManager().clear(ERROR, ClassValidator.CLASS_TABLE_NAME_WITH_RESERVED_SQL_KEYWORD);
}
DBMapping mapping = CollectionTableWidget.this.getModelerScene().getBaseElementSpec();
if (mapping.findAllTable(CollectionTableWidget.this.getName()).size() > 1) {
getSignalManager().fire(ERROR, ClassValidator.NON_UNIQUE_TABLE_NAME);
} else {
getSignalManager().clear(ERROR, ClassValidator.NON_UNIQUE_TABLE_NAME);
}
}
示例9: processBase
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
private void processBase(BaseAttribute parsedBaseAttribute) {
MetamodelVariableDefSnippet variableDef = getVariableDef(parsedBaseAttribute);
if (parsedBaseAttribute instanceof CompositionAttribute) {
if (parsedBaseAttribute instanceof ElementCollection) {
ElementCollection elementCollection = (ElementCollection) parsedBaseAttribute;
variableDef.setType(parsedBaseAttribute.getAttributeType());
variableDef.setAttributeType(MetamodelAttributeType.getInstance(elementCollection.getCollectionType()));
} else {
variableDef.setType(parsedBaseAttribute.getAttributeType());
variableDef.setAttributeType(MetamodelAttributeType.SINGULAR);
}
} else if (parsedBaseAttribute instanceof PersistenceBaseAttribute) {
variableDef.setType(parsedBaseAttribute.getAttributeType());
variableDef.setAttributeType(MetamodelAttributeType.SINGULAR);
}
}
示例10: createPropertySet
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public void createPropertySet(ElementPropertySet set) {
super.createPropertySet(set);
if (this.getBaseElementSpec() instanceof PersistenceBaseAttribute) {
PersistenceBaseAttribute persistenceBaseAttribute = (PersistenceBaseAttribute) this.getBaseElementSpec();
set.createPropertySet(this, persistenceBaseAttribute.getColumn(), getPropertyChangeListeners(), getPropertyVisibilityHandlers());
} else if (this instanceof BasicCollectionAttributeWidget) {
ElementCollection elementCollection = (ElementCollection) this.getBaseElementSpec();
set.createPropertySet(this, elementCollection.getColumn(), getPropertyChangeListeners(), getPropertyVisibilityHandlers());
}
// BasicCollectionAttributeWidget => ElementCollection [Column allowed]
// MultiValueEmbeddedAttributeWidget => ElementCollection [Column not allowed]
// set.put("BASIC_PROP", getValidationProperty());
}
示例11: BaseAttributeWidget
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
public BaseAttributeWidget(IModelerScene scene, IPNodeWidget nodeWidget, PinWidgetInfo pinWidgetInfo) {
super(scene, nodeWidget, pinWidgetInfo);
this.addPropertyChangeListener("collectionType", new PropertyChangeListener<String>() {
@Override
public void changePerformed(String collectionType) { //Point here should be for only ElementCollection
if (BaseAttributeWidget.this.getBaseElementSpec() instanceof ElementCollection) {
ElementCollection elementCollection = (ElementCollection) BaseAttributeWidget.this.getBaseElementSpec();
boolean valid = false;
try {
if (collectionType != null || !collectionType.trim().isEmpty()) {
if (java.util.Collection.class.isAssignableFrom(Class.forName(collectionType.trim()))) {
valid = true;
}
}
} catch (ClassNotFoundException ex) {
//skip allow = false;
}
if (!valid) {
collectionType = java.util.Collection.class.getName();
}
elementCollection.setCollectionType(collectionType.trim());
}
}
});
}
示例12: filter
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
/**
* Used to remove all stale AttributeOverride (ex : if Embeddable attribute
* is removed then AttributeOverride reference should be removed)
*/
public static void filter(ElementCollection elementCollection) {
elementCollection.getAttributeOverride().removeIf(attributeOverride
-> !isExist(attributeOverride.getName().split("\\."), elementCollection.getConnectedClass())
|| AttributeValidator.isEmpty(attributeOverride)
);
elementCollection.getMapKeyAttributeOverride().removeIf(attributeOverride
-> !isExist(attributeOverride.getName().split("\\."), elementCollection.getMapKeyEmbeddable())
|| AttributeValidator.isEmpty(attributeOverride)
);
}
示例13: getElementCollection
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
@Override
public Optional<ElementCollection> getElementCollection(String id) {
if (elementCollection != null) {
return elementCollection.stream().filter(a -> a.getId().equals(id)).findFirst();
}
return null;
}
示例14: getElementCollectionConnectedClass
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
public Set<String> getElementCollectionConnectedClass(Set<String> javaClasses) {
Map<ManagedClass, String> elementCollectionClasses = getElementCollection().stream()
.filter(ec -> ec.getConnectedClass() != null)
.map(ElementCollection::getConnectedClass)
.distinct()
.filter(jc -> !javaClasses.contains(jc.getFQN()))
.collect(toMap(identity(), JavaClass::getFQN));
javaClasses.addAll(elementCollectionClasses.values());
for (ManagedClass elementCollectionClass : elementCollectionClasses.keySet()) {
javaClasses.addAll(elementCollectionClass.getAttributes().getConnectedClass(javaClasses));
}
return javaClasses;
}
示例15: getInstance
import org.netbeans.jpa.modeler.spec.ElementCollection; //导入依赖的package包/类
public static ElementCollectionSpecAccessor getInstance(ElementCollection elementCollection, boolean inherit) {
ElementCollectionSpecAccessor accessor = new ElementCollectionSpecAccessor(elementCollection);
accessor.inherit = inherit;
accessor.setName(elementCollection.getName());
accessor.setAttributeType(elementCollection.getCollectionType());
accessor.setTargetClassName(elementCollection.getAttributeType());
AccessorUtil.setEnumerated((DirectAccessor)accessor,elementCollection.getEnumerated());
AccessorUtil.setLob(accessor, elementCollection.getLob(), elementCollection.getAttributeType(), true);
AccessorUtil.setTemporal((DirectAccessor)accessor, elementCollection.getTemporal());
accessor.setColumn(elementCollection.getColumn().getAccessor());
if (elementCollection.getCollectionTable() != null) {
accessor.setCollectionTable(elementCollection.getCollectionTable().getAccessor());
}
if (elementCollection.getOrderColumn() != null) {
accessor.setOrderColumn(elementCollection.getOrderColumn().getAccessor());
}
AttributeValidator.filter(elementCollection);
accessor.setAttributeOverrides(elementCollection.getAttributeOverride().stream().map(AttributeOverrideSpecMetadata::getInstance).collect(toList()));
AssociationValidator.filter(elementCollection);
accessor.setAssociationOverrides(elementCollection.getAssociationOverride().stream().map(AssociationOverrideSpecMetadata::getInstance).collect(toList()));
accessor.setConverts(elementCollection.getConverts().stream().map(Convert::getAccessor).collect(toList()));
accessor.setMapKeyConverts(elementCollection.getMapKeyConverts().stream().map(Convert::getAccessor).collect(toList()));
MapKeyUtil.load(accessor, elementCollection);
return accessor;
}