コード例 #1
0
 @Override
 public <G extends Customer> CreateResponse<G> createOrRetrieveCopyInstance(
     MultiTenantCopyContext context) throws CloneNotSupportedException {
   CreateResponse<G> createResponse = context.createOrRetrieveCopyInstance(this);
   if (createResponse.isAlreadyPopulated()) {
     return createResponse;
   }
   Customer cloned = createResponse.getClone();
   cloned.setAnonymous(anonymous);
   cloned.setChallengeAnswer(challengeAnswer);
   cloned.setChallengeQuestion(challengeQuestion);
   cloned.setCookied(cookied);
   for (CustomerAddress entry : customerAddresses) {
     CustomerAddress clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();
     clonedEntry.setCustomer(cloned);
     cloned.getCustomerAddresses().add(clonedEntry);
   }
   for (Map.Entry<String, CustomerAttribute> entry : customerAttributes.entrySet()) {
     CustomerAttribute clonedEntry =
         entry.getValue().createOrRetrieveCopyInstance(context).getClone();
     clonedEntry.setCustomer(cloned);
     cloned.getCustomerAttributes().put(entry.getKey(), clonedEntry);
   }
   cloned.setLoggedIn(loggedIn);
   cloned.setUsername(username);
   cloned.setUnencodedPassword(unencodedPassword);
   cloned.setTaxExemptionCode(taxExemptionCode);
   cloned.setUnencodedChallengeAnswer(unencodedChallengeAnswer);
   cloned.setRegistered(registered);
   cloned.setReceiveEmail(receiveEmail);
   cloned.setPasswordChangeRequired(passwordChangeRequired);
   cloned.setPassword(password);
   cloned.setLastName(lastName);
   cloned.setFirstName(firstName);
   cloned.setEmailAddress(emailAddress);
   cloned.setDeactivated(deactivated);
   for (CustomerPayment entry : customerPayments) {
     CustomerPayment clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();
     clonedEntry.setCustomer(cloned);
     cloned.getCustomerPayments().add(clonedEntry);
   }
   for (CustomerPhone entry : customerPhones) {
     CustomerPhone clonedEntry = entry.createOrRetrieveCopyInstance(context).getClone();
     clonedEntry.setCustomer(cloned);
     cloned.getCustomerPhones().add(clonedEntry);
   }
   return createResponse;
 }
コード例 #2
0
 @Override
 public <G extends SkuBundleItem> CreateResponse<G> createOrRetrieveCopyInstance(
     MultiTenantCopyContext context) throws CloneNotSupportedException {
   CreateResponse<G> createResponse = context.createOrRetrieveCopyInstance(this);
   if (createResponse.isAlreadyPopulated()) {
     return createResponse;
   }
   SkuBundleItem cloned = createResponse.getClone();
   cloned.setQuantity(quantity);
   cloned.setSalePrice(getSalePrice());
   if (sku != null) {
     cloned.setSku(sku.createOrRetrieveCopyInstance(context).getClone());
   }
   if (bundle != null) {
     cloned.setBundle((ProductBundle) bundle.createOrRetrieveCopyInstance(context).getClone());
   }
   return createResponse;
 }
コード例 #3
0
 @Override
 public <G extends StructuredContentFieldXref> CreateResponse<G> createOrRetrieveCopyInstance(
     MultiTenantCopyContext context) throws CloneNotSupportedException {
   CreateResponse<G> createResponse = context.createOrRetrieveCopyInstance(this);
   if (createResponse.isAlreadyPopulated()) {
     return createResponse;
   }
   StructuredContentFieldXref cloned = createResponse.getClone();
   cloned.setKey(key);
   if (structuredContent != null) {
     cloned.setStructuredContent(
         structuredContent.createOrRetrieveCopyInstance(context).getClone());
   }
   if (structuredContentField != null) {
     CreateResponse<StructuredContentField> clonedFieldRsp =
         structuredContentField.createOrRetrieveCopyInstance(context);
     cloned.setStrucuturedContentField(clonedFieldRsp.getClone());
   }
   return createResponse;
 }