Search in sources :

Example 1 with PersonPartyRolesBuilder

use of org.estatio.module.party.fixtures.person.builders.PersonPartyRolesBuilder in project estatio by estatio.

the class PersonAndRolesBuilder method execute.

@Override
public void execute(ExecutionContext executionContext) {
    object = new PersonBuilder().setReference(reference).setFirstName(firstName).setInitials(initials).setLastName(lastName).setAtPath(atPath).setPersonGenderType(personGenderType).build(this, executionContext).getObject();
    if (securityUsername != null) {
        applicationUser = new ApplicationUserBuilder().setPerson(object).setSecurityUsername(securityUsername).setSecurityUserAccountCloneFrom(securityUserAccountCloneFrom).build(this, executionContext).getObject();
    }
    if (emailAddress != null || phoneNumber != null) {
        new PersonCommsBuilder().setPerson(object).setEmailAddress(emailAddress).setPhoneNumber(phoneNumber).build(this, executionContext);
    }
    if (relationshipType != null && fromParty != null) {
        partyRelationship = new PersonRelationshipBuilder().setPerson(object).setRelationshipType(relationshipType.fromTitle()).setFromParty(fromParty).build(this, executionContext).getObject();
    }
    partyRoles = new PersonPartyRolesBuilder().setPerson(object).addPartyRoleTypes(partyRoleTypes).build(this, executionContext).getObject();
    fixedAssetRoles = new PersonFixedAssetRolesBuilder().setPerson(object).setFixedAssetRoleSpecs(fixedAssetRoleSpecs).build(this, executionContext).getObject();
}
Also used : PersonPartyRolesBuilder(org.estatio.module.party.fixtures.person.builders.PersonPartyRolesBuilder) PersonBuilder(org.estatio.module.party.fixtures.person.builders.PersonBuilder) ApplicationUserBuilder(org.estatio.module.party.fixtures.appuser.ApplicationUserBuilder) PersonCommsBuilder(org.estatio.module.party.fixtures.person.builders.PersonCommsBuilder) PersonRelationshipBuilder(org.estatio.module.party.fixtures.person.builders.PersonRelationshipBuilder)

Example 2 with PersonPartyRolesBuilder

use of org.estatio.module.party.fixtures.person.builders.PersonPartyRolesBuilder 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)

Aggregations

PersonPartyRolesBuilder (org.estatio.module.party.fixtures.person.builders.PersonPartyRolesBuilder)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 Property (org.estatio.module.asset.dom.Property)1 FixedAssetRole (org.estatio.module.asset.dom.role.FixedAssetRole)1 FixedAssetRoleTypeEnum (org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum)1 Person (org.estatio.module.party.dom.Person)1 PartyRole (org.estatio.module.party.dom.role.PartyRole)1 ApplicationUserBuilder (org.estatio.module.party.fixtures.appuser.ApplicationUserBuilder)1 PersonBuilder (org.estatio.module.party.fixtures.person.builders.PersonBuilder)1 PersonCommsBuilder (org.estatio.module.party.fixtures.person.builders.PersonCommsBuilder)1 PersonRelationshipBuilder (org.estatio.module.party.fixtures.person.builders.PersonRelationshipBuilder)1