Search in sources :

Example 6 with FixedAssetRole

use of org.estatio.module.asset.dom.role.FixedAssetRole in project estatio by estatio.

the class FixedAsset method createRole.

@Programmatic
public FixedAssetRole createRole(final FixedAssetRoleTypeEnum type, final Party party, final LocalDate startDate, final LocalDate endDate) {
    final FixedAssetRole role = newTransientInstance(FixedAssetRole.class);
    role.setStartDate(startDate);
    role.setEndDate(endDate);
    // must do before associate with agreement, since
    role.setType(type);
    // part of AgreementRole#compareTo impl.
    // JDO will manage the relationship for us
    // see http://markmail.org/thread/b6lpzktr6hzysisp, Dan's email
    // 2013-7-17
    role.setParty(party);
    role.setAsset(this);
    persistIfNotAlready(role);
    return role;
}
Also used : FixedAssetRole(org.estatio.module.asset.dom.role.FixedAssetRole) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 7 with FixedAssetRole

use of org.estatio.module.asset.dom.role.FixedAssetRole in project estatio by estatio.

the class PersonFixedAssetRolesBuilder method execute.

@Override
protected void execute(ExecutionContext executionContext) {
    checkParam("person", executionContext, Person.class);
    // party roles
    PersonPartyRolesBuilder personPartyRolesBuilder = new PersonPartyRolesBuilder();
    partyRoles = personPartyRolesBuilder.setPerson(person).addPartyRoleTypes(fixedAssetRoleSpecs.stream().map(x -> x.roleType).collect(Collectors.toList())).build(this, executionContext).getObject();
    // fixed asset roles
    for (FixedAssetRoleSpec spec : fixedAssetRoleSpecs) {
        final Property property = spec.getProperty();
        final FixedAssetRole fixedAssetRole = property.addRoleIfDoesNotExist(person, spec.roleType, null, null);
        object.add(fixedAssetRole);
    }
}
Also used : PersonPartyRolesBuilder(org.estatio.module.party.fixtures.person.builders.PersonPartyRolesBuilder) Person(org.estatio.module.party.dom.Person) Setter(lombok.Setter) Accessors(lombok.experimental.Accessors) Getter(lombok.Getter) PersonPartyRolesBuilder(org.estatio.module.party.fixtures.person.builders.PersonPartyRolesBuilder) Property(org.estatio.module.asset.dom.Property) EqualsAndHashCode(lombok.EqualsAndHashCode) Collectors(java.util.stream.Collectors) BuilderScriptAbstract(org.apache.isis.applib.fixturescripts.BuilderScriptAbstract) List(java.util.List) Lists(com.google.common.collect.Lists) FixedAssetRole(org.estatio.module.asset.dom.role.FixedAssetRole) FixedAssetRoleTypeEnum(org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum) Data(lombok.Data) ToString(lombok.ToString) PartyRole(org.estatio.module.party.dom.role.PartyRole) FixedAssetRole(org.estatio.module.asset.dom.role.FixedAssetRole) Property(org.estatio.module.asset.dom.Property)

Example 8 with FixedAssetRole

use of org.estatio.module.asset.dom.role.FixedAssetRole in project estatio by estatio.

the class PartyRoleMemberInferenceServiceForFixedAssetRoleAndOrder method doInferMembersOf.

@Override
protected List<Person> doInferMembersOf(final FixedAssetRoleTypeEnum partyRoleType, final Order order) {
    final FixedAsset fixedAsset = order.getProperty();
    if (fixedAsset == null) {
        // can't go any further
        return null;
    }
    final List<FixedAssetRole> fixedAssetRoles = fixedAssetRoleRepository.findByAssetAndType(fixedAsset, partyRoleType);
    return currentPersonsFrom(fixedAssetRoles);
}
Also used : FixedAssetRole(org.estatio.module.asset.dom.role.FixedAssetRole) FixedAsset(org.estatio.module.asset.dom.FixedAsset)

Aggregations

FixedAssetRole (org.estatio.module.asset.dom.role.FixedAssetRole)8 Property (org.estatio.module.asset.dom.Property)3 Programmatic (org.apache.isis.applib.annotation.Programmatic)2 FixedAsset (org.estatio.module.asset.dom.FixedAsset)2 FixedAssetRoleTypeEnum (org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum)2 Lists (com.google.common.collect.Lists)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Data (lombok.Data)1 EqualsAndHashCode (lombok.EqualsAndHashCode)1 Getter (lombok.Getter)1 Setter (lombok.Setter)1 ToString (lombok.ToString)1 Accessors (lombok.experimental.Accessors)1 BuilderScriptAbstract (org.apache.isis.applib.fixturescripts.BuilderScriptAbstract)1 Unit (org.estatio.module.asset.dom.Unit)1 Numerator (org.estatio.module.numerator.dom.Numerator)1 Party (org.estatio.module.party.dom.Party)1 Person (org.estatio.module.party.dom.Person)1 PartyRole (org.estatio.module.party.dom.role.PartyRole)1