예제 #1
0
  @Atomic
  public static ExternalContract run(ServiceArguments arguments) throws FenixServiceException {

    ExternalContract storedExternalContract = null;
    String personName = arguments.getPersonName();
    Unit organization = arguments.getUnit();
    storedExternalContract =
        ExternalContract.readByPersonNameAddressAndInstitutionID(
            personName, null, organization.getExternalId());
    if (storedExternalContract != null) {
      throw new ExistingServiceException(
          "error.exception.commons.ExternalContract.existingExternalContract");
    }

    Person externalPerson =
        Person.createExternalPerson(
            personName,
            Gender.MALE,
            null,
            null,
            null,
            null,
            null,
            String.valueOf(System.currentTimeMillis()),
            IDDocumentType.EXTERNAL);
    return new ExternalContract(externalPerson, organization, new YearMonthDay(), null);
  }
예제 #2
0
  @Atomic
  public static ExternalContract run(String personName, String organizationName) {
    final Unit organization = Unit.createNewNoOfficialExternalInstitution(organizationName);
    Person externalPerson =
        Person.createExternalPerson(
            personName,
            Gender.MALE,
            null,
            null,
            null,
            null,
            null,
            String.valueOf(System.currentTimeMillis()),
            IDDocumentType.EXTERNAL);

    return new ExternalContract(externalPerson, organization, new YearMonthDay(), null);
  }
예제 #3
0
  @Atomic
  public static ExternalContract run(
      String name, Unit institutionLocation, String phone, String mobile, String email)
      throws FenixServiceException {

    Person externalPerson =
        Person.createExternalPerson(
            name,
            Gender.MALE,
            null,
            phone,
            mobile,
            null,
            email,
            String.valueOf(System.currentTimeMillis()),
            IDDocumentType.EXTERNAL);

    return new ExternalContract(externalPerson, institutionLocation, new YearMonthDay(), null);
  }
예제 #4
0
  @Atomic
  public static ExternalContract runWithOrganizationName(
      String name, String organizationName, String phone, String mobile, String email)
      throws FenixServiceException {

    final Unit organization = Unit.createNewNoOfficialExternalInstitution(organizationName);
    Person externalPerson =
        Person.createExternalPerson(
            name,
            Gender.MALE,
            null,
            phone,
            mobile,
            null,
            email,
            String.valueOf(System.currentTimeMillis()),
            IDDocumentType.EXTERNAL);

    return new ExternalContract(externalPerson, organization, new YearMonthDay(), null);
  }