Example #1
0
    public NSArray statementsToDropPrimaryKeyConstraintsOnEntityGroups(
        NSArray entityGroups,
        EOSchemaSynchronizationModelChanges changes,
        EOSchemaGenerationOptions options) {
      if (entityGroups == null) return NSArray.EmptyArray;
      if (changes == null) changes = newChanges();

      NSMutableArray expressions = new NSMutableArray();
      for (Enumeration enumerator = entityGroups.objectEnumerator();
          enumerator.hasMoreElements(); ) {
        NSArray entities = (NSArray) enumerator.nextElement();
        EOEntity _last =
            (EOEntity)
                entities.lastObject(); // only need entity to get the table name for the group
        String nameInObjectStore =
            _nameInObjectStoreForEntityGroupWithChangeDictionary(
                entities, changes.changesForTableNamed(_last.externalName()));
        if ((nameInObjectStore != null) && (!"".equals(nameInObjectStore))) {
          expressions.addObject(
              this._expressionForString(
                  "delete from _SYS_RELATIONSHIP where source_table = '"
                      + nameInObjectStore
                      + "' or dest_table = '"
                      + nameInObjectStore
                      + "'"));
        }
      }
      return expressions.immutableClone();
    }
Example #2
0
 /*
  * [PJYF Oct 19 2004]
  * This is a bad hack to get WO to create indes for external keys.
  * We use the primary key constrain generation to create our indexes.
  * But we need to be carefull not to overwrite previous constrains
  *
  */
 protected boolean isSinglePrimaryKeyAttribute(EOAttribute attribute) {
   if (attribute == null) return false;
   EOEntity entity = (EOEntity) attribute.entity();
   if ((entity == null) || entity.isAbstractEntity() || (entity.externalName() == null))
     return false;
   NSArray primaryKeyAttributes = entity.primaryKeyAttributes();
   if (primaryKeyAttributes.count() != 1) return false;
   return attribute.name().equals(((EOAttribute) primaryKeyAttributes.lastObject()).name());
 }
Example #3
0
 @SuppressWarnings("unchecked")
 @Override
 public U get(int index) {
   int size = array.count();
   if (index < 0 || index >= size) {
     throw new IndexOutOfBoundsException("index = " + index + ", size = " + size);
   }
   return (U) array.objectAtIndex(index);
 }
Example #4
0
 @MarshalsPointer
 public static long toNative(List<CKErrorUserInfoKey> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (CKErrorUserInfoKey o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<MPMoviePlayerThumbnailRequest> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSDictionary> array = new NSMutableArray<>();
   for (MPMoviePlayerThumbnailRequest i : l) {
     array.add(i.getDictionary());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<NSURLProtectionSpaceProxyType> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (NSURLProtectionSpaceProxyType o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<NSStreamSOCKSProxyVersion> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (NSStreamSOCKSProxyVersion o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
Example #8
0
 @MarshalsPointer
 public static long toNative(List<HMPredicateKeyPath> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (HMPredicateKeyPath o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<AVSampleRateConverterSettings> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSDictionary> array = new NSMutableArray<>();
   for (AVSampleRateConverterSettings i : l) {
     array.add(i.getDictionary());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
Example #10
0
 @MarshalsPointer
 public static long toNative(List<SCNLightingModel> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (SCNLightingModel o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<CNInstantMessageAddressPropertyKey> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (CNInstantMessageAddressPropertyKey o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
Example #12
0
 @MarshalsPointer
 public static long toNative(List<CIContextOptions> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSDictionary> array = new NSMutableArray<>();
   for (CIContextOptions i : l) {
     array.add(i.getDictionary());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
Example #13
0
 @MarshalsPointer
 public static long toNative(List<AVMetadataFormat> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (AVMetadataFormat o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<AVAudioSessionOrientation> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (AVAudioSessionOrientation o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<UIImagePickerControllerEditingInfo> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSDictionary> array = new NSMutableArray<>();
   for (UIImagePickerControllerEditingInfo i : l) {
     array.add(i.getDictionary());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
 @MarshalsPointer
 public static long toNative(List<HKDietaryQuantityTypeIdentifier> l, long flags) {
   if (l == null) {
     return 0L;
   }
   NSArray<NSString> array = new NSMutableArray<>();
   for (HKDietaryQuantityTypeIdentifier o : l) {
     array.add(o.value());
   }
   return NSObject.Marshaler.toNative(array, flags);
 }
Example #17
0
 public String _alterPhraseDeletingColumnsWithNames(
     NSArray columnNames, NSArray entityGroup, EOSchemaGenerationOptions options) {
   StringBuffer phrase = new StringBuffer();
   int j = columnNames.count();
   for (int i = 0; i < j; i++) {
     phrase.append(
         ""
             + (i == 0 ? "" : this._alterPhraseJoinString())
             + "remove column "
             + columnNames.objectAtIndex(i));
   }
   return phrase.toString();
 }
 @MarshalsPointer
 public static List<AVSampleRateConverterSettings> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSDictionary> o =
       (NSArray<NSDictionary>) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
   if (o == null) {
     return null;
   }
   List<AVSampleRateConverterSettings> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(new AVSampleRateConverterSettings(o.get(i)));
   }
   return list;
 }
Example #19
0
 @SuppressWarnings("unchecked")
 @MarshalsPointer
 public static List<SCNLightingModel> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSString> o = (NSArray<NSString>) NSObject.Marshaler.toObject(cls, handle, flags);
   if (o == null) {
     return null;
   }
   List<SCNLightingModel> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(SCNLightingModel.valueOf(o.get(i)));
   }
   return list;
 }
Example #20
0
 public static Category fetchCategory(EOEditingContext editingContext, EOQualifier qualifier) {
   NSArray<Category> eoObjects = _Category.fetchCategories(editingContext, qualifier, null);
   Category eoObject;
   int count = eoObjects.count();
   if (count == 0) {
     eoObject = null;
   } else if (count == 1) {
     eoObject = (Category) eoObjects.objectAtIndex(0);
   } else {
     throw new IllegalStateException(
         "There was more than one Category that matched the qualifier '" + qualifier + "'.");
   }
   return eoObject;
 }
Example #21
0
 public static Employee fetchEmployee(EOEditingContext editingContext, EOQualifier qualifier) {
   NSArray<Employee> eoObjects = _Employee.fetchEmployees(editingContext, qualifier, null);
   Employee eoObject;
   int count = eoObjects.count();
   if (count == 0) {
     eoObject = null;
   } else if (count == 1) {
     eoObject = (Employee) eoObjects.objectAtIndex(0);
   } else {
     throw new IllegalStateException(
         "There was more than one Employee that matched the qualifier '" + qualifier + "'.");
   }
   return eoObject;
 }
 public static MovieRole fetchMovieRole(EOEditingContext editingContext, EOQualifier qualifier) {
   NSArray<MovieRole> eoObjects = _MovieRole.fetchMovieRoles(editingContext, qualifier, null);
   MovieRole eoObject;
   int count = eoObjects.count();
   if (count == 0) {
     eoObject = null;
   } else if (count == 1) {
     eoObject = (MovieRole) eoObjects.objectAtIndex(0);
   } else {
     throw new IllegalStateException(
         "There was more than one MovieRole that matched the qualifier '" + qualifier + "'.");
   }
   return eoObject;
 }
 @MarshalsPointer
 public static List<CBCentralManagerOptions> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSDictionary> o =
       (NSArray<NSDictionary>) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
   if (o == null) {
     return null;
   }
   List<CBCentralManagerOptions> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(new CBCentralManagerOptions(o.get(i)));
   }
   return list;
 }
 @MarshalsPointer
 public static List<UIImagePickerControllerEditingInfo> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSDictionary> o =
       (NSArray<NSDictionary>) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
   if (o == null) {
     return null;
   }
   List<UIImagePickerControllerEditingInfo> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(new UIImagePickerControllerEditingInfo(o.get(i)));
   }
   return list;
 }
Example #25
0
 public static Group fetchGroup(EOEditingContext editingContext, EOQualifier qualifier) {
   NSArray<Group> eoObjects = _Group.fetchGroups(editingContext, qualifier, null);
   Group eoObject;
   int count = eoObjects.count();
   if (count == 0) {
     eoObject = null;
   } else if (count == 1) {
     eoObject = (Group) eoObjects.objectAtIndex(0);
   } else {
     throw new IllegalStateException(
         "There was more than one Group that matched the qualifier '" + qualifier + "'.");
   }
   return eoObject;
 }
 @MarshalsPointer
 public static List<MPMoviePlayerThumbnailRequest> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSDictionary> o =
       (NSArray<NSDictionary>) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
   if (o == null) {
     return null;
   }
   List<MPMoviePlayerThumbnailRequest> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(new MPMoviePlayerThumbnailRequest(o.get(i)));
   }
   return list;
 }
 @SuppressWarnings("unchecked")
 @MarshalsPointer
 public static List<CNInstantMessageAddressPropertyKey> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSString> o =
       (NSArray<NSString>) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
   if (o == null) {
     return null;
   }
   List<CNInstantMessageAddressPropertyKey> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(CNInstantMessageAddressPropertyKey.valueOf(o.get(i)));
   }
   return list;
 }
 @SuppressWarnings("unchecked")
 @MarshalsPointer
 public static List<HKDietaryQuantityTypeIdentifier> toObject(
     Class<? extends NSObject> cls, long handle, long flags) {
   NSArray<NSString> o =
       (NSArray<NSString>) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
   if (o == null) {
     return null;
   }
   List<HKDietaryQuantityTypeIdentifier> list = new ArrayList<>();
   for (int i = 0; i < o.size(); i++) {
     list.add(HKDietaryQuantityTypeIdentifier.valueOf(o.get(i)));
   }
   return list;
 }
Example #29
0
 @Override
 public boolean contains(Object o) {
   if (o instanceof NSObject) {
     return array.containsObject((NSObject) o);
   }
   return false;
 }
 public static PDBPresentation fetchPDBPresentation(
     EOEditingContext editingContext, EOQualifier qualifier) {
   NSArray<PDBPresentation> eoObjects =
       _PDBPresentation.fetchPDBPresentations(editingContext, qualifier, null);
   PDBPresentation eoObject;
   int count = eoObjects.count();
   if (count == 0) {
     eoObject = null;
   } else if (count == 1) {
     eoObject = eoObjects.objectAtIndex(0);
   } else {
     throw new IllegalStateException(
         "There was more than one PDBPresentation that matched the qualifier '"
             + qualifier
             + "'.");
   }
   return eoObject;
 }