Search in sources :

Example 6 with Link

use of com.cinchapi.concourse.Link in project concourse by cinchapi.

the class ConcourseAccount method getOwners.

@Override
public Customer[] getOwners() {
    Concourse concourse = Constants.CONCOURSE_CONNECTIONS.request();
    try {
        Set<Link> customerLinks = concourse.select("owners", id);
        Customer[] owners = new Customer[customerLinks.size()];
        int index = 0;
        for (Link link : customerLinks) {
            owners[index] = new ConcourseCustomer(link.longValue());
            ++index;
        }
        return owners;
    } finally {
        Constants.CONCOURSE_CONNECTIONS.release(concourse);
    }
}
Also used : Concourse(com.cinchapi.concourse.Concourse) Link(com.cinchapi.concourse.Link)

Example 7 with Link

use of com.cinchapi.concourse.Link in project concourse by cinchapi.

the class ConvertTest method testConvertLinkFromIntValue.

@Test
public void testConvertLinkFromIntValue() {
    // A int/long that is wrapped between two at (@) symbols must always
    // convert to a Link
    Number number = Random.getInt();
    // must
    String value = MessageFormat.format("{0}{1}", "@", number.toString());
    // use
    // number.toString()
    // so
    // comma
    // separators
    // are
    // not
    // added
    // to
    // the
    // output
    Link link = (Link) Convert.stringToJava(value);
    Assert.assertEquals(number.intValue(), link.intValue());
}
Also used : Link(com.cinchapi.concourse.Link) ResolvableLink(com.cinchapi.concourse.util.Convert.ResolvableLink) Test(org.junit.Test)

Example 8 with Link

use of com.cinchapi.concourse.Link in project concourse by cinchapi.

the class ConvertTest method testConvertLinkFromLongValue.

@Test
public void testConvertLinkFromLongValue() {
    // A int/long that is wrapped between two at (@) symbols must always
    // convert to a Link
    Number number = Random.getLong();
    // must
    String value = MessageFormat.format("{0}{1}", "@", number.toString());
    // use
    // number.toString()
    // so
    // comma
    // separators
    // are
    // not
    // added
    // to
    // the
    // output
    Link link = (Link) Convert.stringToJava(value);
    Assert.assertEquals(number.longValue(), link.longValue());
}
Also used : Link(com.cinchapi.concourse.Link) ResolvableLink(com.cinchapi.concourse.util.Convert.ResolvableLink) Test(org.junit.Test)

Aggregations

Link (com.cinchapi.concourse.Link)8 TObject (com.cinchapi.concourse.thrift.TObject)4 Type (com.cinchapi.concourse.thrift.Type)4 ResolvableLink (com.cinchapi.concourse.util.Convert.ResolvableLink)4 Function (com.cinchapi.ccl.type.Function)3 IndexFunction (com.cinchapi.ccl.type.function.IndexFunction)3 KeyConditionFunction (com.cinchapi.ccl.type.function.KeyConditionFunction)3 KeyRecordsFunction (com.cinchapi.ccl.type.function.KeyRecordsFunction)3 TemporalFunction (com.cinchapi.ccl.type.function.TemporalFunction)3 Constants (com.cinchapi.concourse.Constants)3 Calculations (com.cinchapi.concourse.server.calculate.Calculations)3 Finder (com.cinchapi.concourse.server.query.Finder)3 AtomicOperation (com.cinchapi.concourse.server.storage.AtomicOperation)3 Store (com.cinchapi.concourse.server.storage.Store)3 Time (com.cinchapi.concourse.time.Time)3 Convert (com.cinchapi.concourse.util.Convert)3 ImmutableSet (com.google.common.collect.ImmutableSet)3 Sets (com.google.common.collect.Sets)3 Collection (java.util.Collection)3 LinkedHashMap (java.util.LinkedHashMap)3