Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EOEntity.attributeNamed()


     * @param attributeName name of attribute in same entity to consider in order to determine uniqueness
     * @return number of matching objects
     */
    public static Integer objectCountUniqueWithQualifierAndAttribute(EOEditingContext ec, String entityName, EOQualifier qualifier, String attributeName) {
        EOEntity entity = EOUtilities.entityNamed(ec, entityName);
        EOAttribute attribute = entity.attributeNamed(attributeName);
        EOAttribute aggregateAttribute = EOEnterpriseObjectClazz.objectCountUniqueAttribute(attribute);
        return (Integer)_aggregateFunctionWithQualifierAndAggregateAttribute(ec, entityName, qualifier, aggregateAttribute);
    }

  /**
 
View Full Code Here


                lastEO=rawLastEO instanceof EOEnterpriseObject ? (EOEnterpriseObject)rawLastEO : null;
            }
            if (lastEO!=null) {
                EOEntity entity=EOModelGroup.defaultGroup().entityNamed(lastEO.entityName());
                String lastKey=KeyValuePath.lastPropertyKeyInKeyPath(propertyKey);
                result=entity.attributeNamed(lastKey);
            }
        }
        if (result==null) {
            // default to the basic attribute if the above didnt' work
            if (propertyKey!=null) result=c.attribute();
View Full Code Here

    for (String attributeName : classDescription.attributeKeys()) {
      ERXKey<Object> key = new ERXKey<Object>(attributeName);
      if (filter.matches(key, ERXKey.Type.Attribute)) {
        EOAttribute attribute = null;
        if (entity != null) {
          attribute = entity.attributeNamed(key.key());
        }
        NSMutableDictionary<String, Object> property = new NSMutableDictionary<String, Object>();

        boolean optional = attribute != null && attribute.allowsNull();
        property.setObjectForKey(optional, "optional");
View Full Code Here

            return;
        }
        for (Enumeration e=ERXEOControlUtilities.stringAttributeListForEntityNamed(object.editingContext(), object.entityName()).objectEnumerator(); e.hasMoreElements();) {
            String key=(String)e.nextElement();
            String value=(String)object.storedValueForKey(key);
            if (value != null && !entity.attributeNamed(key).isReadOnly()) {
                String trimmedValue=value.trim();
                if (trimmedValue.length()!=value.length())
                    object.takeStoredValueForKey(trimmedValue,key);
            }
        }
View Full Code Here

      EORelationship rel = current.relationshipNamed(key);
     
      if (rel != null) {
        lastRetriever = (Retriever<? extends PropertyContainer, V>) RelationshipRetriever.create(rel);       
      } else {
        EOAttribute att = current.attributeNamed(key);
        NSArray<EOAttribute> pks = current.primaryKeyAttributes();
       
        if (pks.size() == 1 && pks.get(0).equals(att)) {
          lastRetriever = (Retriever<? extends PropertyContainer, V>) PrimaryKeyRetriever.create(current);
        } else {
View Full Code Here

    public Format valueFormatter() {
        Format f = null;
        EORelationship rel = (EORelationship) valueForKeyPath("d2wContext.smartRelationship");
        EOEntity destEnt = rel.destinationEntity();
        EOAttribute searchAttr = destEnt.attributeNamed(keyWhenRelationship());
        if(searchAttr != null) {
            String className = searchAttr.className();
            if(className.equals("java.lang.Number"))
                f = new NSNumberFormatter("0");
            if(className.equals("java.lang.BigDecimal"))
View Full Code Here

        String externalName = entity.externalName();
        if (externalName != null && parentEntity != null) {
          // If you have a parent entity and that parent entity shares your table name, then you're single table inheritance
          boolean singleTableInheritance = externalName.equals(parentEntity.externalName());
          if (singleTableInheritance) {
            EOAttribute parentAttribute = parentEntity.attributeNamed(attribute.name());
            if (parentAttribute == null) {
              // If this attribute is new in the subclass, you have to allow nulls
              shouldAllowNull = true;
            }
          }
View Full Code Here

        int lastDotIdx = kp.lastIndexOf(".");
        if (lastDotIdx == -1) {
          attribute = entity().attributeNamed(kp);
        } else {
          EOEntity kpEntity = entityForKeyPath(kp);
          attribute = kpEntity.attributeNamed(kp.substring(lastDotIdx+1));
        }
        // AK: inet6 addresses get handed down as "xxx:xxx:...:xxx%y", not "xxx:xxx:...:xxx/y"
        // note that this might break if you hand over a host name that contains percent chars (not sure if possible)
      if(attribute != null && "inet".equals(attribute.externalType()) && v != null && v.toString().indexOf('%') > 0) {
        v = v.toString().replace('%', '/');
View Full Code Here

        EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
        if (entity == null) {
          throw new IllegalStateException("Unable find entity named: " + entityName);
        }

        EOAttribute attribute = entity.attributeNamed(attributeName);
        if (attribute == null) {
          throw new IllegalStateException("Unable find attribute named: " + attributeName + " for entity: " + entityName);
        }

        EOAttribute aggregate = new EOAttribute();
View Full Code Here

        NSArray keys = changedValues.allKeys();
        NSMutableSet relationships = new NSMutableSet();
       
        for (int i=0; i<keys.count(); i++) {
            String key = (String)keys.objectAtIndex(i);
            EOAttribute attrib = entity.attributeNamed(key);
            if (attrib != null) {
                Object val = changedValues.objectForKey(key);
                if(ERXValueUtilities.isNull(val)) {
                  val = null;
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.