本文整理了Java中org.apache.polygene.api.association.Association.get()
方法的一些代码示例,展示了Association.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association.get()
方法的具体详情如下:
包路径:org.apache.polygene.api.association.Association
类名称:Association
方法名:get
[英]Get the associated entity.
[中]获取关联的实体。
代码示例来源:origin: apache/attic-polygene-java
@Override
public Object get()
{
return next.get();
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public Set<String> permissionStrings()
{
Set<String> permissionStrings = new HashSet<>();
for ( RoleAssignment assignment : roleAssignee.roleAssignments() ) {
permissionStrings.addAll( assignment.role().get().permissions().get() );
}
return Collections.unmodifiableSet( permissionStrings );
}
}
代码示例来源:origin: apache/attic-polygene-java
public void checkConstraints( AssociationStateHolder state )
{
for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
{
Association<Object> association = state.associationFor( associationModel.accessor() );
associationModel.checkAssociationConstraints( association );
associationModel.checkConstraints( association.get() );
}
}
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void script05()
{
Person person = templateFor( Person.class );
// should return Joe Doe
Iterable<EntityReference> entities = entityFinder.findEntities(
Person.class,
eq( person.mother().get().placeOfBirth().get().name(), "Kuala Lumpur" ),
NO_SORTING2,
NO_FIRST_RESULT, NO_MAX_RESULTS,
NO_VARIABLES ).collect( toList() );
assertNames( entities, JOE );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script04()
{
Person person = templateFor( Person.class );
// should return Joe and Ann Doe
Iterable<EntityReference> entities = entityFinder.findEntities(
Person.class,
eq( person.placeOfBirth().get().name(), "Kuala Lumpur" ),
NO_SORTING2,
NO_FIRST_RESULT, NO_MAX_RESULTS,
NO_VARIABLES ).collect( toList() );
assertNames( entities, JOE, ANN );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script21()
{
// should return all Persons sorted name of the city they were born
Person person = templateFor( Person.class );
Iterable<EntityReference> entities = entityFinder.findEntities(
Person.class,
ALL,
Arrays.asList( orderBy( person.placeOfBirth().get().name() ), orderBy( person.name() ) ),
NO_FIRST_RESULT, NO_MAX_RESULTS,
NO_VARIABLES ).collect( toList() );
assertNames( false, entities, ANN, JOE, JACK );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Override
public void movedToNewAddress( String street, String zipCode, City city, Country country, Rent rent )
{
Address newAddress = repository.createAddress( street, zipCode, city, country, rent );
Address oldAddress = address().get();
oldAddresses().add( oldAddress );
address().set( newAddress );
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void amendAddress( String street, String zipCode, City city, Country country )
{
Address newAddress = repository.createAddress( street, zipCode, city, country, address().get().rent().get() );
address().set( newAddress );
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void movedToNewAddress( String street, String zipCode, City city, Country country, Rent rent )
{
Address newAddress = repository.createAddress( street, zipCode, city, country, rent );
Address oldAddress = address().get();
oldAddresses().add( oldAddress );
address().set( newAddress );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script04()
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
Person personTemplate = templateFor( Person.class );
City placeOfBirth = personTemplate.placeOfBirth().get();
Query<Person> query = unitOfWork.newQuery( qb.where( eq( placeOfBirth.name(), "Kuala Lumpur" ) ) );
System.out.println( "*** script04: " + query );
verifyUnorderedResults( query, "Joe Doe", "Ann Doe" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script04_ne()
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
Person personTemplate = templateFor( Person.class );
City placeOfBirth = personTemplate.placeOfBirth().get();
Query<Person> query = unitOfWork.newQuery( qb.where( ne( placeOfBirth.name(), "Kuala Lumpur" ) ) );
System.out.println( "*** script04_ne: " + query );
verifyUnorderedResults( query, "Jack Doe" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script21()
{
Person person = templateFor( Person.class );
final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Person.class )
.where( queries.get( "script21" ) ) );
query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
System.out.println( "*** script21: " + query );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void script21()
{
Person person = templateFor( Person.class );
final Query<Person> query = unitOfWork.newQuery( this.moduleInstance
.newQueryBuilder( Person.class )
.where( queries.get( "script21" ) ) );
query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
System.out.println( "*** script21: " + query );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Jack Doe" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
public void script21()
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
// should return all Persons sorted by name of the city they were born, and then by year they were born
Person person = templateFor( Person.class );
Query<Person> query = unitOfWork.newQuery( qb );
query.orderBy( orderBy( person.placeOfBirth().get().name() ), orderBy( person.yearOfBirth() ) );
System.out.println( "*** script21: " + query );
verifyOrderedResults( query, "Ann Doe", "Joe Doe", "Jack Doe" );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Test
@SuppressWarnings( "unchecked" )
public void script07()
{
QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
Person person = templateFor( Person.class );
Query<Nameable> query = unitOfWork.newQuery( qb.where(
and( ge( person.yearOfBirth(), 1900 ), eq( person.placeOfBirth().get().name(), "Penang" ) ) ) );
System.out.println( "*** script07: " + query );
verifyUnorderedResults( query, "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
@SuppressWarnings( "unchecked" )
public void script07()
{
QueryBuilder<Nameable> qb = this.moduleInstance.newQueryBuilder( Nameable.class );
Person person = templateFor( Person.class );
Query<Nameable> query = unitOfWork.newQuery( qb.where(
and( ge( person.yearOfBirth(), 1900 ), eq( person.placeOfBirth().get().name(), "Penang" ) ) ) );
System.out.println( "*** script07: " + query );
verifyUnorderedResults( query, "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void whenSettingAnAssociationInASideEffectExpectItToWork()
{
try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Purchase Steinway" ) ) )
{
Pianist chris = uow.newEntity( Pianist.class, StringIdentity.identityOf( "Chris" ) );
Steinway modelD = uow.newEntity( Steinway.class, StringIdentity.identityOf( "ModelD-274" ) );
assertThat( modelD.owner().get(), is( nullValue() ) );
chris.purchase( modelD );
assertThat( modelD.owner().get(), is( theInstance( chris ) ) );
}
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void givenMultipleAndQueryWhenExecutedThenReturnCorrect()
{
QueryBuilder<Nameable> qb = qbf.newQueryBuilder( Nameable.class );
Person person = templateFor( Person.class );
Query<Nameable> query = qb.where(
ge( person.yearOfBirth(), 1900 ).
and( lt( person.yearOfBirth(), 2000 ) ).
and( eq( person.placeOfBirth().get().name(), "Penang" ) )
).newQuery( Network.nameables() );
verifyUnorderedResults( query, "Jack Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void givenEqQueryOnAssociationWhenExecutedThenReturnCorrect()
{
QueryBuilder<Person> qb = qbf.newQueryBuilder( Person.class );
Person person = templateFor( Person.class );
City kl = uow.get( City.class, StringIdentity.identityOf( "kualalumpur" ) );
Query<Person> query = qb.where(
eq( person.mother().get().placeOfBirth(), kl )
).newQuery( Network.persons() );
verifyUnorderedResults( query, "Joe Doe" );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void givenAndQueryWhenExecutedThenReturnCorrect()
{
QueryBuilder<Nameable> qb = qbf.newQueryBuilder( Nameable.class );
Person person = templateFor( Person.class );
Query<Nameable> query = qb.where(
ge( person.yearOfBirth(), 1900 ).and( eq( person.placeOfBirth().get().name(), "Penang" ) )
).newQuery( Network.nameables() );
verifyUnorderedResults( query, "Jack Doe" );
}
内容来源于网络,如有侵权,请联系作者删除!