public void actionPerformed(ActionEvent e) { if (view.getClientClass().isSelected()) { entity.setClientClassName(suggestedClientName); updatePerformed = true; } if (view.getServerClass().isSelected()) { entity.setClassName(suggestedServerName); updatePerformed = true; } view.dispose(); } });
void setClassName(String className) { if (className != null && className.trim().length() == 0) { className = null; } ObjEntity entity = mediator.getCurrentObjEntity(); // "ent" may be null if we quit editing by changing tree selection if (entity != null && !Util.nullSafeEquals(entity.getClassName(), className)) { entity.setClassName(className); mediator.fireObjEntityEvent(new EntityEvent(this, entity)); } }
private void processStartObjEntity(Attributes atts) { objEntity = new ObjEntity(atts.getValue("", "name")); objEntity.setClassName(atts.getValue("", "className")); objEntity.setClientClassName(atts.getValue("", "clientClassName")); String readOnly = atts.getValue("", "readOnly"); objEntity.setReadOnly(TRUE.equalsIgnoreCase(readOnly)); String serverOnly = atts.getValue("", "serverOnly"); objEntity.setServerOnly(TRUE.equalsIgnoreCase(serverOnly)); String lockType = atts.getValue("", "lock-type"); if ("optimistic".equals(lockType)) { objEntity.setDeclaredLockType(ObjEntity.LOCK_TYPE_OPTIMISTIC); } String superEntityName = atts.getValue("", "superEntityName"); if (superEntityName != null) { objEntity.setSuperEntityName(superEntityName); } else { objEntity.setDbEntityName(atts.getValue("", "dbEntityName")); objEntity.setSuperClassName(atts.getValue("", "superClassName")); objEntity.setClientSuperClassName(atts.getValue("", "clientSuperClassName")); } dataMap.addObjEntity(objEntity); }
private void processStartObjEntity(Attributes atts) { objEntity = new ObjEntity(atts.getValue("", "name")); objEntity.setClassName(atts.getValue("", "className")); objEntity.setClientClassName(atts.getValue("", "clientClassName")); String isAbstract = atts.getValue("", "abstract"); objEntity.setAbstract(TRUE.equalsIgnoreCase(isAbstract)); String readOnly = atts.getValue("", "readOnly"); objEntity.setReadOnly(TRUE.equalsIgnoreCase(readOnly)); String serverOnly = atts.getValue("", "serverOnly"); objEntity.setServerOnly(TRUE.equalsIgnoreCase(serverOnly)); String excludeSuperclassListeners = atts.getValue("", "exclude-superclass-listeners"); objEntity.setExcludingSuperclassListeners(TRUE.equalsIgnoreCase(excludeSuperclassListeners)); String excludeDefaultListeners = atts.getValue("", "exclude-default-listeners"); objEntity.setExcludingDefaultListeners(TRUE.equalsIgnoreCase(excludeDefaultListeners)); String lockType = atts.getValue("", "lock-type"); if ("optimistic".equals(lockType)) { objEntity.setDeclaredLockType(ObjEntity.LOCK_TYPE_OPTIMISTIC); } String superEntityName = atts.getValue("", "superEntityName"); if (superEntityName != null) { objEntity.setSuperEntityName(superEntityName); } else { objEntity.setSuperClassName(atts.getValue("", "superClassName")); objEntity.setClientSuperClassName(atts.getValue("", "clientSuperClassName")); } objEntity.setDbEntityName(atts.getValue("", "dbEntityName")); dataMap.addObjEntity(objEntity); }
protected void setClassName(ObjEntity entity, String newName) { if (!Util.nullSafeEquals(newName, getClassName(entity))) { if (clientUpdate) { entity.setClientClassName(newName); } else { entity.setClassName(newName); } mediator.fireObjEntityEvent(new EntityEvent(this, entity)); } } }
/** * Returns an ObjEntity stripped of any server-side information, such as DbEntity * mapping. "clientClassName" property of this entity is used to intialize "className" * property of returned entity. * * @since 1.2 */ public ObjEntity getClientEntity() { ObjEntity entity = new ObjEntity(getName()); entity.setClassName(getClientClassName()); entity.setSuperClassName(getClientSuperClassName()); entity.setSuperEntityName(getSuperEntityName()); // TODO: should we also copy lock type? // copy attributes Iterator attributes = getDeclaredAttributes().iterator(); while (attributes.hasNext()) { ObjAttribute attribute = (ObjAttribute) attributes.next(); entity.addAttribute(attribute.getClientAttribute()); } // copy relationships Iterator relationships = getDeclaredRelationships().iterator(); while (relationships.hasNext()) { ObjRelationship relationship = (ObjRelationship) relationships.next(); entity.addRelationship(relationship.getClientRelationship()); } return entity; }
objEntity.setDbEntity(dbEntity); objEntity.setClassName(getGenericClassName() != null ? getGenericClassName() : packageName + objEntity.getName());
entity.setClassName(suggestedServerName);
@Override public void execute(MergerContext context) { DbEntity dbEntity = getEntity(); DataMap map = context.getDataMap(); map.addDbEntity(dbEntity); // create a ObjEntity ObjEntity objEntity = new ObjEntity(); objEntity.setName(NameBuilder .builder(objEntity, dbEntity.getDataMap()) .baseName(context.getNameGenerator().objEntityName(dbEntity)) .name()); objEntity.setDbEntity(getEntity()); // try to find a class name for the ObjEntity String className = objEntityClassName; if (className == null) { // generate a className based on the objEntityName className = map.getNameWithDefaultPackage(objEntity.getName()); } objEntity.setClassName(className); objEntity.setSuperClassName(map.getDefaultSuperclass()); if (map.isClientSupported()) { objEntity.setClientClassName(map.getNameWithDefaultClientPackage(objEntity.getName())); objEntity.setClientSuperClassName(map.getDefaultClientSuperclass()); } map.addObjEntity(objEntity); // presumably there are no other ObjEntities pointing to this DbEntity, so syncing just this one... context.getEntityMergeSupport().synchronizeWithDbEntity(objEntity); context.getDelegate().dbEntityAdded(getEntity()); context.getDelegate().objEntityAdded(objEntity); }
entity.setClassName(dataMap.getNameWithDefaultPackage(entity.getName()));