The Giftlists repository is the layer between ATG Commerce and the database server. It provides an interface to the database layer to persist gift list information. The Giftlists repository is a part of the Profile Adapter Repository that uses the SQL Repository implementation. For more information on SQL repositories, see the ATG Repository Guide.

The Giftlists repository is defined in two configuration files:

  • giftlists.xml defines the repository. It is located in ATG Commerce configpath at /atg/commerce/gifts/. This XML file defines gift lists and gift list item descriptors. The Repository API uses this definition to save information in the database.

  • userProfile.xml defines the relationship between users and gift lists. It is located in ATG Commerce configpath at /atg/userprofiling/. It adds properties to the user that provide maps to wish lists and gift lists.

The manipulation of gift lists and gift list items is performed using the GiftlistManager described in the Gift List Business Layer Classes section. The GiftlistManager provides methods to create, save, and update gift lists, as well as ones to create gift list items, remove them and move them to the shopping cart.

The following XML files show how the repository is configured and mapped to the database schema. This file is located at /atg/commerce/gifts/giftlists.xml in <ATG9dir>/DCS/src/config/config.jar.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE taglib
        PUBLIC "-//Art Technology Group, Inc.//DTD General SQL
Adapter//EN"
        "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">

<gsa-template>

  <header>
    <name>Commerce Giftlists</name>
    <author>DCS Team</author>
    <version>$Id: giftlists.xml,v 1.5 2000/05/12 06:22:00 kmoy Exp
$</version>
  </header>

  <!--
  *************************************************************
    GiftList (also gift registries)
  *************************************************************
  -->

  <item-descriptor name="gift-list">
   <table name="dcs_giftlist" type="primary" id-column-name="id">
     <property name="id"/>
     <property name="owner" item-type="user"
               repository="/atg/userprofiling/ProfileAdapterRepository"
               column-name="owner_id"/>
     <property name="public" data-type="boolean" column-name="is_public"
               default="false"/>
     <property name="published" data-type="boolean"
               column-name="is_published" default="false"/>
     <property name="eventName" data-type="string"
               column-name="event_name"/>
     <property name="eventDate" data-type="timestamp"
               column-name="event_date"/>
     <property name="eventType" data-type="enumerated" default="other"
               column-name="event_type">
       <attribute name="useCodeForValue" value="false"/>
       <option value="valentine's day" code="0"/>
       <option value="wedding" code="1"/>
       <option value="bridal shower" code="2"/>
       <option value="baby shower" code="3"/>
       <option value="birthday" code="4"/>
       <option value="anniversary" code="5"/>
       <option value="christmas" code="6"/>
       <option value="chanukah" code="7"/>
       <option value="other holiday" code="8"/>
       <option value="i just want this stuff" code="9"/>
       <option value="other" code="10"/>
     </property>
     <property name="comments" data-type="string" column-name="comments"/>
     <property name="description" data-type="string"
               column-name="description"/>
     <property name="instructions" data-type="string"
               column-name="instructions"/>
     <property name="lastModifiedDate" data-type="timestamp"
               column-name="last_modified_date"/>
     <property name="creationDate" data-type="timestamp"
               column-name="creation_date">
        <attribute name="useNowForDefault" value="true"/>
     </property>
     <property name="shippingAddress" item-type="contactInfo"
               repository="/atg/userprofiling/ProfileAdapterRepository"
               column-name="shipping_addr_id"/>
     </table>
     <table name="dcs_giftlist_item" type="multi"
id-column-name="giftlist_id"
            multi-column-name="sequence_num">
       <property name="giftlistItems" data-type="list"
        component-item-type="gift-item" column-name="giftitem_id"
        cascade="delete"/>
     </table>
  </item-descriptor>

  <item-descriptor name="gift-item" display-property="displayName">
   <table name="dcs_giftitem" type="primary" id-column-name="id">
     <property name="id" column-name="id"/>
     <property name="catalogRefId" data-type="string"
               column-name="catalog_ref_id"/>
     <property name="productId" data-type="string"
               column-name="product_id"/>
     <property name="displayName" data-type="string"
               column-name="display_name"/>
     <property name="description" data-type="string"
               column-name="description"/>
     <property name="quantityDesired" data-type="long"
               column-name="quantity_desired"/>
     <property name="quantityPurchased" data-type="long"
               column-name="quantity_purchased"/>
   </table>
  </item-descriptor>

</gsa-template>

The following section of code describes how gift lists are added to the user profile. The entire file is located at /atg/userprofiling/userProfile.xml in <ATG9dir>/DCS/config/config.jar.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE taglib
  PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN"
  "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">

<gsa-template>

  <header>
    <name>Commerce Related Profile Changes</name>
    <author>DCS Team</author>
    <version>$Id: userProfile.xml,v 1.24 2000/05/03 03:51:19
 petere Exp $</version>
  </header>

  <item-descriptor name="user" default="true"
sub-type-property="userType">

    <!-- this is the key into private giftlist -->
    <table name="dcs_user_wishlist" type="auxiliary"
     id-column-name="user_id">
      <property name="wishlist" item-type="gift-list"
                repository="/atg/commerce/gifts/Giftlists"
                column-name="giftlist_id"
           cascade="insert,update,delete"/>
    </table>

    <!-- this is the key into user created giftlists -->
    <table name="dcs_user_giftlist" type="multi" id-column-name="user_id"
           multi-column-name="sequence_num">
      <property name="giftlists" data-type="list"
                component-item-type="gift-list"
                repository="/atg/commerce/gifts/Giftlists"
                column-name="giftlist_id" cascade="delete"/>
    </table>

    <!-- this is the key into giftlists found for other customers -->
    <table name="dcs_user_otherlist" type="multi" id-column-name="user_id"
           multi-column-name="sequence_num">
      <property name="otherGiftlists" data-type="list"
                component-item-type="gift-list"
                repository="/atg/commerce/gifts/Giftlists"
                column-name="giftlist_id"/>
    </table>

</gsa-template>
 
loading table of contents...