/** @since Available in iOS 7.0 and later. */
 public boolean isExpired() {
   if (data.containsKey(IsExpiredKey())) {
     NSNumber val = (NSNumber) data.get(IsExpiredKey());
     return val.booleanValue();
   }
   return false;
 }
 /** @since Available in iOS 4.1 and later. */
 public Map<String, NSObject> getMediaMetadata() {
   if (has(Keys.MediaMetadata())) {
     NSDictionary val = (NSDictionary) get(Keys.MediaMetadata());
     return val.asStringMap();
   }
   return null;
 }
Ejemplo n.º 3
0
    public void prepareUpdateExpressionWithRow(NSDictionary row, EOQualifier qualifier) {
      EOAttribute attribute;
      Object value;
      for (Enumeration enumeration = row.keyEnumerator();
          enumeration.hasMoreElements();
          addUpdateListAttribute(attribute, value)) {
        String attributeName = (String) enumeration.nextElement();
        attribute = this.entity().anyAttributeNamed(attributeName);
        if (attribute == null)
          throw new IllegalStateException(
              "prepareUpdateExpressionWithRow: row argument contains key '"
                  + attributeName
                  + "' which does not have corresponding attribute on entity '"
                  + this.entity().name()
                  + "'");
        value = row.objectForKey(attributeName);
      }

      _whereClauseString =
          EOQualifierSQLGeneration.Support._sqlStringForSQLExpression(qualifier, this);
      String tableList = tableListWithRootEntity(_rootEntityForExpression());
      _statement =
          assembleUpdateStatementWithRow(
              row, qualifier, tableList, new String(_listString), _whereClauseString);
    }
 /** @since Available in iOS 7.0 and later. */
 public boolean isVolumePurchase() {
   if (data.containsKey(IsVolumePurchaseKey())) {
     NSNumber val = (NSNumber) data.get(IsVolumePurchaseKey());
     return val.booleanValue();
   }
   return false;
 }
Ejemplo n.º 5
0
 /** @since Available in iOS 4.0 and later. */
 public AVVideoSettings setPixelAspectRatio(AVPixelAspectRatio pixelAspectRatio) {
   NSDictionary<NSString, NSObject> val = new NSMutableDictionary<>();
   val.put(AVPixelAspectRatio.HorizontalSpacing(), pixelAspectRatio.getHorizontalSpacing());
   val.put(AVPixelAspectRatio.VerticalSpacing(), pixelAspectRatio.getVerticalSpacing());
   set(Keys.PixelAspectRatio(), val);
   return this;
 }
 /** @since Available in iOS 4.0 and later. */
 public String getAirline() {
   if (data.containsKey(AirlineKey())) {
     NSString val = (NSString) data.get(AirlineKey());
     return val.toString();
   }
   return null;
 }
 /** @since Available in iOS 4.0 and later. */
 public String getFlight() {
   if (data.containsKey(FlightKey())) {
     NSString val = (NSString) data.get(FlightKey());
     return val.toString();
   }
   return null;
 }
Ejemplo n.º 8
0
  /**
   * Overrides the parent implementation to provide a more efficient mechanism for generating
   * primary keys, while generating the primary key support on the fly.
   *
   * @param count the batch size
   * @param entity the entity requesting primary keys
   * @param channel open JDBCChannel
   * @return NSArray of NSDictionary where each dictionary corresponds to a unique primary key value
   */
  public NSArray newPrimaryKeys(int count, EOEntity entity, JDBCChannel channel) {
    if (isPrimaryKeyGenerationNotSupported(entity)) {
      return null;
    }

    EOAttribute attribute = (EOAttribute) entity.primaryKeyAttributes().lastObject();
    String attrName = attribute.name();
    boolean isIntType = "i".equals(attribute.valueType());

    NSMutableArray results = new NSMutableArray(count);
    String sequenceName = sequenceNameForEntity(entity);
    DB2Expression expression = new DB2Expression(entity);

    boolean succeeded = false;
    for (int tries = 0; !succeeded && tries < 2; tries++) {
      while (results.count() < count) {
        try {
          StringBuffer sql = new StringBuffer();
          sql.append("SELECT ");
          sql.append("next value for " + sequenceName + " AS KEY");
          sql.append(" from sysibm.sysdummy1");
          expression.setStatement(sql.toString());
          channel.evaluateExpression(expression);
          try {
            NSDictionary row;
            while ((row = channel.fetchRow()) != null) {
              Enumeration pksEnum = row.allValues().objectEnumerator();
              while (pksEnum.hasMoreElements()) {
                Number pkObj = (Number) pksEnum.nextElement();
                Number pk;
                if (isIntType) {
                  pk = Integer.valueOf(pkObj.intValue());
                } else {
                  pk = Long.valueOf(pkObj.longValue());
                }
                results.addObject(new NSDictionary(pk, attrName));
              }
            }
          } finally {
            channel.cancelFetch();
          }
          succeeded = true;
        } catch (JDBCAdaptorException ex) {
          throw ex;
        }
      }
    }

    if (results.count() != count) {
      throw new IllegalStateException(
          "Unable to generate primary keys from the sequence for " + entity + ".");
    }

    return results;
  }
Ejemplo n.º 9
0
 /** @since Available in iOS 4.0 and later. */
 public AVPixelAspectRatio getPixelAspectRatio() {
   if (has(Keys.PixelAspectRatio())) {
     NSDictionary<NSString, NSObject> val =
         (NSDictionary<NSString, NSObject>) get(Keys.PixelAspectRatio());
     AVPixelAspectRatio result =
         new AVPixelAspectRatio(
             val.getLong(AVPixelAspectRatio.HorizontalSpacing(), 0),
             val.getLong(AVPixelAspectRatio.VerticalSpacing(), 0));
     return result;
   }
   return null;
 }
Ejemplo n.º 10
0
    public void prepareInsertExpressionWithRow(NSDictionary row) {
      EOAttribute attribute;
      Object value;
      for (Enumeration enumeration = row.keyEnumerator();
          enumeration.hasMoreElements();
          this.addInsertListAttribute(attribute, value)) {
        String attributeName = (String) enumeration.nextElement();
        attribute = this.entity().anyAttributeNamed(attributeName);
        if (attribute == null)
          throw new IllegalStateException(
              "prepareInsertExpressionWithRow: row argument contains key '"
                  + attributeName
                  + "' which does not have corresponding attribute on entity '"
                  + this.entity().name()
                  + "'");
        value = row.objectForKey(attributeName);
      }

      String tableList = tableListWithRootEntity(_rootEntityForExpression());
      _statement =
          this.assembleInsertStatementWithRow(
              row, tableList, new String(_listString), new String(_valueListString));
    }
 /** @since Available in iOS 4.1 and later. */
 public UIImagePickerControllerEditingInfo setMediaMetadata(Map<String, NSObject> mediaMetadata) {
   set(Keys.MediaMetadata(), NSDictionary.fromStringMap(mediaMetadata));
   return this;
 }
Ejemplo n.º 12
0
 /** @since Available in iOS 5.0 and later. */
 @WeaklyLinked
 public CTAttributedStringAttributes getTitleCoreTextAttributes(UIControlState state) {
   NSDictionary<NSString, ?> dict = getTitleTextAttributesDictionary(state);
   if (dict == null) return null;
   return new CTAttributedStringAttributes(dict.as(CFDictionary.class));
 }
 @Override
 public String toString() {
   if (data != null) return data.toString();
   return super.toString();
 }
 /** @since Available in iOS 7.0 and later. */
 public SKReceiptRefreshRequestOptions setVolumePurchase(boolean volumePurchase) {
   data.put(IsVolumePurchaseKey(), NSNumber.valueOf(volumePurchase));
   return this;
 }
 /** @since Available in iOS 7.0 and later. */
 public SKReceiptRefreshRequestOptions setRevoked(boolean revoked) {
   data.put(IsRevokedKey(), NSNumber.valueOf(revoked));
   return this;
 }
 /** @since Available in iOS 7.0 and later. */
 public SKReceiptRefreshRequestOptions setExpired(boolean expired) {
   data.put(IsExpiredKey(), NSNumber.valueOf(expired));
   return this;
 }