package NCIP::StructuredAddress;
use parent qw(Class::Accessor);
-# This a "StructuredAddress" as defined by Z39.83-1-2012. It is used
-# for returning user address information when requested. The fields
-# are as defined in the standard.
-NCIP::StructuredAddress->mk_accessors(qw(line1 line2 locality region postalcode
- country));
+=head1 NAME
+
+StructuredAddress - A "StructuredAddress" as defined by Z39.83-1-2012
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+This a "StructuredAddress" as defined by Z39.83-1-2012. It is used
+for returning user address information when requested. The fields
+are as defined in the standard.
+
+=head1 FIELDS
+
+=head2 Line1
+
+First line of the address.
+
+=head2 Line2
+
+Second line of the address.
+
+=head2 Locality
+
+Locality of the address, typically a city.
+
+=head2 Region
+
+Region of the address, typically a state, province, or department.
+
+=head2 PostalCode
+
+The postal (or zip) code of the address.
+
+=head2 Country
+
+The country of the address.
+
+=cut
+
+NCIP::StructuredAddress->mk_accessors(qw(Line1 Line2 Locality Region PostalCode
+ Country));
1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::StructuredPersonalUserName;
+
+use parent qw(Class:Accessor);
+
+# The name of this class is a bit unwieldy, but comes directly from
+# the standard. I wonder if we shouldn't rename for our own sanity.
+
+=head1 NAME
+
+StructuredPersonalUserName - Object to hold name information
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+The fields are text strings.
+
+=head2 Prefix
+
+Optional field to hold the user's name prefix.
+
+=head2 GivenName
+
+Optional field to hold the user's given, or first, name.
+
+=head2 Surname
+
+Required field to hold the user's surname. This is the user's family
+name.
+
+This field is required by the standard and also so the code may tell
+the difference from an unstructured name if we ever support it.
+
+=head2 Initials
+
+Optional field for the user's name initials.
+
+=head2 Suffix
+
+Optional field for the user's name suffix, if any.
+
+=cut
+
+NCIP::StructuredPersonalUserName->mk_accessors(
+ qw(Prefix GivenName Surname Initials Suffix)
+);
+
+1;
use parent qw(Class::Accessor);
-# User Object needs
-# Authentication Input
-# Block Or Trap
-# Date Of Birth
-# Name Information
-# Previous User Id(s)
-# User Address Information
-# User Language
-# User Privilege
-# User Id
+=head1 NAME
+
+User - An object for user information
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 UserId
+
+=head2 UserOptionalFields
+
+=cut
+
# Make accessors for the ones that makes sense
-NCIP::User->mk_accessors(qw(userid ils userdata));
+NCIP::User->mk_accessors(qw(UserId UserOptionalFields));
1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::User::AddressInformation;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+AddressInformation - A user's Address Information
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 UserAddressRoleType
+
+A text string to indicate the role of the address.
+
+=head2 PhysicalAddress
+
+A physical address stored in a StructuredAddress.
+
+=cut
+
+NCIP::User::AddressInformation->mk_accessors(
+ qw(UserAddressRoleType PhysicalAddress)
+);
+
+1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::User::BlockOrTrap;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+BlockOrTrap - as defined in Z39.83-1-2012
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 AgencyId
+
+=head2 BlockOrTrapType
+
+=head2 ValidFromDate
+
+=head2 ValidToDate
+
+=cut
+
+NCIP::User::BlockOrTrap->mk_accessors(
+ qw(
+ AgencyId
+ BlockOrTrapType
+ ValidFromDate
+ ValidToDate
+ )
+);
+
+1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::User::Id;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+Id -
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 AgencyId
+
+=head2 UserIdentifierType
+
+=head2 UserIdentifierValue
+
+=cut
+
+NCIP::User::Id->mk_accessors(qw(AgencyId UserIdentifierType
+ UserIdentifierValue));
+
+1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::User::OptionalFields;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+OptionalFields - Data class for the UserOptionalFields
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+This data class holds the information for the UserOptionalFields. Most
+of the fields of this class all hold array refs of data objects as
+defined below. The one exception is NameInformation which only appears
+once.
+
+All of the fields are optional.
+
+=head1 FIELDS
+
+=head2 NameInformation
+
+This field holds the name information for the user. Currently, the
+templates ony support StructuredPersonalUserName.
+
+=head2 UserAddressInformation
+
+This is an array reference that contains
+NCIP::User::AddressInformation objects for the user's addresses. We
+currently only support StructuredAddress for physical addresses.
+
+=head2 UserLanguage
+
+A array of text strings indicating the user's languages.
+
+=head2 BlockOrTrap
+
+An array of NCIP::User::BlockOrTrap.
+
+=head2 UserPrivilege
+
+An array of NCIP::User::Privilege.
+
+=head2 PreviousUserId
+
+Not presently implemented.
+
+=cut
+
+NCIP::User::OptionalFields->mk_accessors(
+ qw(
+ NameInformation
+ UserAddressInformation
+ UserLanguage
+ BlockOrTrap
+ UserPrivilege
+ PreviousUserId
+ )
+);
+
+1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::User::Privilege;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+Privilege -
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 AgencyId
+
+=head2 AgencyUserPrivilegeType
+
+=head2 ValidFromDate
+
+=head2 ValidToDate
+
+=head2 UserPrivilegeStatus
+
+=head2 UserPrivilegeDescription
+
+=cut
+
+NCIP::User::Privilege->mk_accessors(
+ qw(
+ AgencyId
+ AgencyUserPrivilegeType
+ ValidFromDate
+ ValidToDate
+ UserPrivilegeStatus
+ UserPrivilegeDescription
+ )
+);
+
+1;
--- /dev/null
+# ---------------------------------------------------------------
+# Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
+#
+# This file is part of NCIPServer.
+#
+# NCIPServer is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# NCIPServer is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
+# ---------------------------------------------------------------
+package NCIP::User::PrivilegeStatus;
+
+use parent qw(Class::Accessor);
+
+=head1 NAME
+
+PrivilegeStatus -
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+=head1 FIELDS
+
+=head2 UserPrivilegeStatusType
+
+=head2 DateOfUserPrivilegeStatus
+
+=cut
+
+NCIP::User::PrivilegeStatus->mk_accessors(
+ qw(
+ UserPrivilegeStatusType
+ DateOfUserPrivilegeStatus
+ )
+);
+
+1;
-
<UserId>
-<UserIdentifierValue>[% user.userdata.cardnumber | xml %]</UserIdentifierValue>
+<UserIdentifierValue>
+[% data.UserId.UserIdentifierValue | xml %]
+</UserIdentifierValue>
+[% IF data.UserId.UserIdentifierType -%]
+<UserIdentifierType>
+[% data.UserId.UserIdentifierType | xml %]
+</UserIdentifierType>
+[% END -%]
+[% IF data.UserId.AgencyId -%]
+<AgencyId>
+[% data.UserId.AgencyId %]
+</AgencyId>
+[% END -%]
</UserId>
-[%# <UserFiscalAccount></UserFiscalAccount>
-LoanedItemsCount
-LoanedItem
-RequestedItemsCount
-RequestedItem
-%]
+[% IF data.UserOptionalFields -%]
<UserOptionalFields>
-[% FOREACH element IN elements %]
- [% IF element.textContent == 'User Address Information' %]
- <UserAddressInformation>
- <UserAddressRoleType>Primary Address</UserAddressRoleType>
- <PhysicalAddress>
- <StructuredAddress>
- <Line1>[% user.userdata.streetnumber | xml %] [% user.userdata.address | xml %]</Line1>
- [% IF user.userdata.address2 %]
- <Line2>[% user.userdata.address2 | xml %]</Line2>
- [% END %]
- [% IF user.userdata.city %]
- <Locality>[% user.userdata.city | xml %]</Locality>
- [% END %]
- [% IF user.userdata.state %]
- <Region>[% user.userdata.state | xml %]</Region>
- [% END %]
- [% IF user.userdata.zipcode %]
- <PostalCode>[% user.userdata.zipcode | xml %]</PostalCode>
- [% END %]
- [% IF user.userdata.country %]
- <Country>[% user.userdata.country | xml %]</Country>
- [% END %]
- </StructuredAddress>
- </PhysicalAddress>
- </UserAddressInformation>
- [% END %]
- [% IF element.textContent == 'Name Information' %]
+ [% IF data.UserOptionalFields.NameInformation -%]
<NameInformation>
<PersonalNameInformation>
<StructuredPersonalUserName>
- <GivenName>[% user.userdata.firstname | xml %]</GivenName>
- <Surname>[% user.userdata.surname | xml %]</Surname>
+ [% IF data.UserOptionalFields.NameInformation.GivenName -%]
+ <GivenName>[% data.UserOptionalFields.NameInformation.GivenName | xml %]</GivenName>
+ [% END -%]
+ <Surname>[% data.UserOptionalFields.NameInformation.Surname | xml %]</Surname>
+ [% IF data.UserOptionalFields.NameInformation.Prefix -%]
+ <Prefix>[% data.UserOptionalFields.NameInformation.Prefix %]</Prefix>
+ [% END -%]
+ [% IF data.UserOptionalFields.NameInformation.Suffix -%]
+ <Suffix>[% data.UserOptionalFields.NameInformation.Suffix %]</Suffix>
+ [% END -%]
+ [% IF data.UserOptionalFields.NameInformation.Initials -%]
+ <Initials>[% data.UserOptionalFields.NameInformation.Initials %]</Initials>
+ [% END -%]
</StructuredPersonalUserName>
</PersonalNameInformation>
</NameInformation>
- [% END %]
-[% END %]
+ [% END -%]
+[% IF data.UserOptionalFields.UserAddressInformation -%]
+ [% FOREACH element IN data.UserOptionalFields.UserAddressInformation -%]
+ <UserAddressInformation>
+ <UserAddressRoleType>[% element.AddressRoleType %]</UserAddressRoleType>
+ <PhysicalAddress>
+ <StructuredAddress>
+ <Line1>[% element.PhysicalAddress.Line1 | xml %]</Line1>
+ [% IF element.PhysicalAddress.Line2 -%]
+ <Line2>[% element.PhysicalAddress.Line2 | xml %]</Line2>
+ [% END -%]
+ [% IF element.PhysicalAddress.Locality -%]
+ <Locality>[% element.PhysicalAddress.Locality | xml %]</Locality>
+ [% END -%]
+ [% IF element.PhysicalAddress.Region -%]
+ <Region>[% element.PhysicalAddress.Region | xml %]</Region>
+ [% END -%]
+ [% IF element.PhysicalAddress.PostalCode -%]
+ <PostalCode>[% element.PhysicalAddress.PostalCode | xml %]</PostalCode>
+ [% END -%]
+ [% IF element.PhysicalAddress.Country -%]
+ <Country>[% element.PhysicalAddress.Country | xml %]</Country>
+ [% END -%]
+ </StructuredAddress>
+ </PhysicalAddress>
+ </UserAddressInformation>
+ [% END -%]
+[% END -%]
+[% IF data.UserOptionalFields.UserPrivilege -%]
+[% FOREACH privilege IN data.UserOptionalFields.UserPrivilege -%]
+ <UserPrivilege>
+ <AgencyId>[% privilege.AgencyId | xml -%]</AgencyId>
+ <AgencyUserPrivilegeType>[% privilege.AgencyUserPrivilegeType | xml %]</AgencyUserPrivilegeType>
+ [% IF privilege.ValidFromDate -%]
+ <ValidFromDate>[% privilege.ValidFromDate | xml %]</ValidFromDate>
+ [% END -%]
+ [% IF privilege.ValidToDate -%]
+ <ValidToDate>[% privilege.ValidToDate | xml %]</ValidToDate>
+ [% END -%]
+ [% IF privilege.UserPrivilegeDescription -%]
+ <UserPrivilegeDescription>[% privilege.UserPrivilegeDescription | xml %]</UserPrivilegeDescription>
+ [% END -%]
+ [% IF privilege.UserPrivilegeStatus -%]
+ <UserPrivilegeStatus>
+ <UserPrivilegeStatusType>
+ [% privilege.UserPrivilegeStatus.UserPrivilegeStatusType | xml %]
+ </UserPrivilegeStatusType>
+ [% IF privilege.UserPrivilegeStatus.DateOfUserPrivilegeStatus -%]
+ <DateOfUserPrivilegeStatus>
+ [% privilege.UserPrivilegeStatus.DateOfUserPrivilegeStatus | xml %]
+ </DateOfUserPrivilegeStatus>
+ [% END -%]
+ </UserPrivilegeStatus>
+ [% END -%]
+ </UserPrivilege>
+[% END -%]
+[% END -%]
+[% IF data.UserOptionalFields.UserLanguage -%]
+[% FOREACH language IN data.UserOptionalFields.UserLanguage -%]
+ <UserLanguage>[% language | xml %]</UserLanguage>
+[% END -%]
+[% END -%]
+[% IF data.UserOptionalFields.BlockOrTrap -%]
+[% FOREACH block IN data.UserOptionalFields.BlockOrTrap -%]
+ <BlockOrTrap>
+ <AgencyId>[% block.AgencyId | xml %]</AgencyId>
+ <BlockOrTrapType>[% block.BlockOrTrapType | xml %]</BlockOrTrapType>
+ [% IF block.ValidFromDate -%]
+ <ValidFromDate>[% block.ValidFromDate %]</ValidFromDate>
+ [% END -%]
+ [% IF block.ValidToDate -%]
+ <ValidToDate>[% block.ValidToDate %]</ValidToDate>
+ [% END %]
+ </BlockOrTrap>
+[% END -%]
+[% END -%]
</UserOptionalFields>
+[% END -%]