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;
}
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);
}
}
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);
}
Aggregations