Tabnine Logo
CollectionDescriptor.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.intermine.metadata.CollectionDescriptor
constructor

Best Java code snippets using org.intermine.metadata.CollectionDescriptor.<init> (Showing top 20 results out of 315)

origin: intermine/intermine

private Set<CollectionDescriptor> getCollections() {
  Set<CollectionDescriptor> collections = new HashSet<CollectionDescriptor>();
  CollectionDescriptor cld1 = new CollectionDescriptor("cld1", "String", "reverse1");
  CollectionDescriptor cld2 = new CollectionDescriptor("cld2", "Integer", "reverse2");
  collections.add(cld1);
  collections.add(cld2);
  return collections;
}
origin: org.intermine/intermine-objectstore

private static CollectionDescriptor cloneCollectionDescriptor(CollectionDescriptor ref) {
  return new CollectionDescriptor(ref.getName(), ref.getReferencedClassName(),
      ref.getReverseReferenceFieldName());
}
origin: intermine/intermine

private static CollectionDescriptor cloneCollectionDescriptor(CollectionDescriptor ref) {
  return new CollectionDescriptor(ref.getName(), ref.getReferencedClassName(),
      ref.getReverseReferenceFieldName());
}
origin: intermine/intermine

public void testRelationTypeManyToMany() throws Exception {
  CollectionDescriptor col1 = new CollectionDescriptor("col1", "package.name.Class1", "col2");
  CollectionDescriptor col2 = new CollectionDescriptor("col2", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = new HashSet<CollectionDescriptor>(Arrays.asList(col1, col2));
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, noRefs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.M_N_RELATION, col1.relationType());
}
origin: intermine/intermine

public void testGenerateCollectionDescriptor() throws Exception {
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "Class2", null);
  Set cols = new HashSet(Collections.singleton(cod1));
  ClassDescriptor cld1 = new ClassDescriptor("Class1", null, false, new HashSet(), new HashSet(), cols);
  ClassDescriptor cld2 = new ClassDescriptor("Class2", null, false, new HashSet(), new HashSet(), new HashSet());
  Model model = new Model("model", "", new HashSet(Arrays.asList(new Object[] {cld1, cld2})));
  String expected = INDENT + "// Col: Class1.cod1" + ENDL
    + INDENT + "protected java.util.Set<Class2> cod1 = new java.util.HashSet<Class2>();" + ENDL
    + INDENT + "public java.util.Set<Class2> getCod1() { return cod1; }" + ENDL
    + INDENT + "public void setCod1(final java.util.Set<Class2> cod1) { this.cod1 = cod1; }" + ENDL
    + INDENT + "public void addCod1(final Class2 arg) { cod1.add(arg); }" + ENDL + ENDL;
  assertEquals(expected, mo.generate(cod1, true));
}
origin: intermine/intermine

public void testGetIndirectionTableNameRef() throws Exception {
  CollectionDescriptor col1 = new CollectionDescriptor("col1", "package.name.Class2", "ref1");
  Set cols = new HashSet(Arrays.asList(new Object[] {col1}));
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, new HashSet(), new HashSet(), cols);
  ReferenceDescriptor ref1 = new ReferenceDescriptor("ref1", "package.name.Class1", null);
  Set refs = new HashSet(Arrays.asList(new Object[] {ref1}));
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, new HashSet(), refs, new HashSet());
  Set clds = new HashSet(Arrays.asList(new Object[] {cld1, cld2}));
  new Model("test", "package.name", clds);
  try {
    DatabaseUtil.getIndirectionTableName(col1);
    fail("Expected IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}
origin: intermine/intermine

  public void testToString() throws Exception {
    CollectionDescriptor col = new CollectionDescriptor("ref", "package.name.Class1", null);
    String expected = "<collection name=\"ref\" referenced-type=\"Class1\"/>";
    assertEquals(col.toString(), expected);
    col = new CollectionDescriptor("ref", "package.name.Class1", "reverseRef");
    expected = "<collection name=\"ref\" referenced-type=\"Class1\" reverse-reference=\"reverseRef\"/>";
    assertEquals(col.toString(), expected);
  }
}
origin: intermine/intermine

public void testEquals() throws Exception {
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "Class1", "cod1");
  CollectionDescriptor cod2 = new CollectionDescriptor("cod1", "Class1", "cod1");
  CollectionDescriptor cod3 = new CollectionDescriptor("cod2", "Class1", "cod1");
  CollectionDescriptor cod5 = new CollectionDescriptor("cod1", "Class2", "cod1");
  CollectionDescriptor cod6 = new CollectionDescriptor("cod1", "Class1", "cod2");
  assertEquals(cod1, cod2);
  assertEquals(cod1.hashCode(), cod2.hashCode());
  assertFalse(cod1.equals(cod3));
  assertFalse(cod1.equals(cod5));
  assertFalse(cod1.equals(cod6));
}
origin: intermine/intermine

public void testGenerateToString() throws Exception {
  AttributeDescriptor atd1 = new AttributeDescriptor("inty", "int");
  AttributeDescriptor atd2 = new AttributeDescriptor("str", "java.lang.String");
  AttributeDescriptor atd3 = new AttributeDescriptor("integery", "java.lang.Integer");
  ReferenceDescriptor rfd1 = new ReferenceDescriptor("rfd1", "package.name.Class2", null);
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "package.name.Class2", null);
  Set<AttributeDescriptor> atts = new LinkedHashSet(Arrays.asList(atd1, atd2, atd3));
  Set<ReferenceDescriptor> refs = new LinkedHashSet(Arrays.asList(rfd1));
  Set<CollectionDescriptor> cols = new LinkedHashSet(Arrays.asList(cod1));
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, atts, refs, cols);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, new HashSet(), new HashSet(), new HashSet());
  Model model = new Model("model", "package.name", new LinkedHashSet(Arrays.asList(cld1, cld2)));
  String expected = INDENT + "@Override public String toString() { return \"Class1 [id=\" + id + \", integery=\" + integery + \", inty=\" + inty + \", rfd1=\" + (rfd1 == null ? \"null\" : (rfd1.getId() == null ? \"no id\" : rfd1.getId().toString())) + \", str=\" + (str == null ? \"null\" : \"\\\"\" + str + \"\\\"\") + \"]\"; }" + ENDL;
  assertEquals(expected, mo.generateToString(cld1));
}
origin: intermine/intermine

public void testGetType() throws Exception {
  AttributeDescriptor atd1 = new AttributeDescriptor("atd1", "java.lang.String");
  assertEquals("java.lang.String", mo.getType(atd1));
  ReferenceDescriptor rfd1 = new ReferenceDescriptor("rfd1", "package.name.Class2", null);
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "package.name.Class2", null);
  Set refs = new HashSet(Collections.singleton(rfd1));
  Set cols = new HashSet(Collections.singleton(cod1));
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, new HashSet(), refs, cols);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, new HashSet(), new HashSet(), new HashSet());
  Model model = new Model("model", "package.name", new HashSet(Arrays.asList(new Object[] {cld1, cld2})));
  assertEquals("package.name.Class2", mo.getType(rfd1));
  assertEquals("java.util.Set<package.name.Class2>", mo.getType(cod1));
}
origin: intermine/intermine

public void testMultiInheritanceLegalCol() throws Exception {
  CollectionDescriptor coll1 = new CollectionDescriptor("atd1", "package.name.Class2", null);
  CollectionDescriptor coll2 = new CollectionDescriptor("atd1", "package.name.Class2", null);
  Set<CollectionDescriptor> colls1 = Collections.singleton(coll1);
  Set<CollectionDescriptor> colls2 = Collections.singleton(coll2);
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, true, noAttrs, noRefs, colls1);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, true, noAttrs, noRefs, colls2);
  ClassDescriptor cld3 = makeClass("package.name.Class3", "package.name.Class1 package.name.Class2");
  new Model("model", "package.name", Arrays.asList(cld1, cld2, cld3));
  ReferenceDescriptor rd = cld3.getCollectionDescriptorByName("atd1", true);
  assertEquals("package.name.Class2", rd.getReferencedClassName());
}
origin: intermine/intermine

public void testGetIndirectionTableNameCol() throws Exception {
  CollectionDescriptor col1 = new CollectionDescriptor("col1", "package.name.Class2", "col2");
  Set cols = new HashSet(Arrays.asList(new Object[] {col1}));
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, new HashSet(), new HashSet(), cols);
  CollectionDescriptor col2 = new CollectionDescriptor("col2", "package.name.Class1", "col1");
  cols = new HashSet(Arrays.asList(new Object[] {col2}));
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, new HashSet(), new HashSet(), cols);
  Set clds = new HashSet(Arrays.asList(new Object[] {cld1, cld2}));
  new Model("test", "package.name", clds);
  assertEquals("Col1Col2", DatabaseUtil.getIndirectionTableName(col1));
  assertEquals("Col1", DatabaseUtil.getInwardIndirectionColumnName(col1, 0));
  assertEquals("Col2", DatabaseUtil.getOutwardIndirectionColumnName(col1, 0));
  assertEquals("Col2", DatabaseUtil.getInwardIndirectionColumnName(col1, 1));
  assertEquals("Col1", DatabaseUtil.getOutwardIndirectionColumnName(col1, 1));
}
origin: intermine/intermine

public void testRelationTypeManyToOne() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", null);
  ReferenceDescriptor ref  = new ReferenceDescriptor("ref1", "package.name.Class1", "col1");
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  Set<ReferenceDescriptor> refs = Collections.singleton(ref);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false,
      ClassDescriptorFactory.NO_ATTRS, refs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.N_ONE_RELATION, ref.relationType());
}
origin: intermine/intermine

public void testRelationTypeUnidirectional() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, noRefs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.M_N_RELATION, col.relationType());
}
origin: intermine/intermine

public void testGetIndirectionTableNameNull() throws Exception {
  CollectionDescriptor col1 = new CollectionDescriptor("col1", "package.name.Class2", null);
  Set cols = new HashSet(Arrays.asList(new Object[] {col1}));
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, new HashSet(), new HashSet(), cols);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, new HashSet(), new HashSet(), new HashSet());
  Set clds = new HashSet(Arrays.asList(new Object[] {cld1, cld2}));
  new Model("test", "package.name", clds);
  assertEquals("Class1Col1", DatabaseUtil.getIndirectionTableName(col1));
  assertEquals("Col1", DatabaseUtil.getInwardIndirectionColumnName(col1, 0));
  assertEquals("Class1", DatabaseUtil.getOutwardIndirectionColumnName(col1, 0));
  assertEquals("Class1", DatabaseUtil.getInwardIndirectionColumnName(col1, 1));
  assertEquals("Col1", DatabaseUtil.getOutwardIndirectionColumnName(col1, 1));
}
origin: intermine/intermine

public void testRelationTypeOneToMany() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", "ref1");
  ReferenceDescriptor ref  = new ReferenceDescriptor("ref1", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  Set<ReferenceDescriptor> refs = Collections.singleton(ref);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, refs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.ONE_N_RELATION, col.relationType());
}
origin: intermine/intermine

public void testReferencedClassNotSet() throws Exception {
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "Class2", null);
  Set<CollectionDescriptor> collections = Collections.singleton(cod1);
  // cld1 has a CollectionDescriptor that contains objects of type Class2
  new ClassDescriptor("Class1", null, false, noAttrs, noRefs, collections);
  new ClassDescriptor("Class2", null, false, noAttrs, noRefs, noColls);
  try {
    cod1.getReferencedClassDescriptor();
    fail("Expected IllegalStateException, model has not yet been set");
  } catch (IllegalStateException e) {
  }
}
origin: intermine/intermine

public void testMultiInheritanceIllegalRefCol() throws Exception {
  CollectionDescriptor coll = new CollectionDescriptor("atd1", "package.name.Class2", null);
  ReferenceDescriptor ref = new ReferenceDescriptor("atd1", "package.name.Class2", null);
  Set<CollectionDescriptor> colls = Collections.singleton(coll);
  Set<ReferenceDescriptor> refs = Collections.singleton(ref);
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, true, noAttrs, noRefs, colls);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, true, noAttrs, refs, noColls);
  ClassDescriptor cld3 = makeClass("package.name.Class3", "package.name.Class1 package.name.Class2");
  try {
    new Model("model", "package.name", Arrays.asList(cld1, cld2, cld3));
    fail("Expected: MetaDataException");
  } catch (MetaDataException e) {
  }
}
origin: intermine/intermine

public void testGetReferencedClass() throws Exception {
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "package.name.Class2", null);
  Set<CollectionDescriptor> collections = Collections.singleton(cod1);
  // cld1 has a ReferenceDescriptor that points to Class2
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, noAttrs, noRefs, collections);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, noAttrs, noRefs, noColls);
  new Model("model", "package.name", Arrays.asList(cld1, cld2));
  try {
    ClassDescriptor refCld = cod1.getReferencedClassDescriptor();
    assertTrue("ClassDescriptor was null", refCld != null);
    assertTrue("Expected ClassDescriptor to be Class2", refCld.getName().equals("package.name.Class2"));
  } catch (IllegalStateException e) {
    fail("Should have returned a ClassDescriptor");
  }
}
origin: intermine/intermine

public void testSetClassDescriptor() throws Exception {
  ClassDescriptor cld = new ClassDescriptor("Class1", null, false, noAttrs, noRefs, noColls);
  CollectionDescriptor cod = new CollectionDescriptor("name", "String", null);
  try {
    cod.setClassDescriptor(cld);
  } catch (IllegalStateException e) {
    fail("should have been able set ClassDescriptor");
  }
  try {
    cod.setClassDescriptor(cld);
    fail("Expected: IllegalStateException, ClassDescriptor already set");
  } catch (IllegalStateException e) {
  }
}
org.intermine.metadataCollectionDescriptor<init>

Javadoc

Construct a CollectionDescriptor. name and referencedType may not be null.

Popular methods of CollectionDescriptor

  • getReferencedClassDescriptor
  • getReverseReferenceDescriptor
  • getClassDescriptor
  • getName
  • getReferencedClassName
  • getReverseReferenceFieldName
  • relationType
  • findReferencedDescriptor
  • equals
  • hashCode
  • setClassDescriptor
  • toString
  • setClassDescriptor,
  • toString

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now