Package com.xmultra.processor.db.cms.exception

Examples of com.xmultra.processor.db.cms.exception.RelatedPackagePersistenceException


        pi = PublicationHelper.getPubInfoFromPubName(article.getPubName(), con);
      }
      catch (SQLException se) {
        // If there's a problem inserting the article, it's impossible to store
        // related content, so just throw exception.
        RelatedPackagePersistenceException rpe =
            new RelatedPackagePersistenceException(se.getMessage(),
            "Error trying to retrieve publication information for article " +
            article.getArticleId());
        exceptionArrayList.add(rpe);
        throw new ContentPersistenceExceptions(exceptionArrayList);
      }
      contentPackage.setSiteId(pi.getSiteId());
      contentPackage.setPubId(pi.getPubId());
    }

    if (contentPackage.hasPhotoPackage()) {
      PhotoPackage currentPhotoPkg = contentPackage.getPhotoPackage();
      currentPhotoPkg.setPubId(contentPackage.getPubId());
      try {
        photoPkgId = PhotoPackageCSHelper.storePhotoPackage(currentPhotoPkg, con);
      }
      catch (SQLException se) {
        PhotoPackagePersistenceException ppe =
            new PhotoPackagePersistenceException(se.getMessage(),
                                                 "Error trying to create photo package");
        exceptionArrayList.add(ppe);
        throw new ContentPersistenceExceptions(exceptionArrayList);
      }
      Console.displayDev("ContentPersistenceHandler",
                         "Photo package ID is: " + photoPkgId, true, "scb");
      currentPhotoPkg.setPackageId(photoPkgId);
      Iterator photos = currentPhotoPkg.getPhotos();
      Photo currentPhoto = null;
      int currentPhotoId = 0;
      while (photos.hasNext()) {
        currentPhoto = (Photo) photos.next();
        currentPhoto.setPubId(contentPackage.getPubId());
        currentPhoto.setSiteId(contentPackage.getSiteId());
        try {
          currentPhotoId = PhotoCSHelper.storePhoto(currentPhoto, photoPkgId, con);
        }
        catch (SQLException se) {
          PhotoPersistenceException ppe =
              new PhotoPersistenceException(se.getMessage(),
                                            "Error trying to insert photo");
          exceptionArrayList.add(ppe);
          currentPhotoId = 0;
        }
        Console.displayDev("ContentPersistenceHandler",
                           "Photo ID is: " + currentPhotoId, true, "scb");
        currentPhoto.setPhotoId(currentPhotoId);
      }
    }

    if (articleId != -1 && photoPkgId != -1) {
      try {
        RelatedPackageCSHelper.storeRelatedPackage(contentPackage, con);
      }
      catch (SQLException se) {
        // If there's a problem creating the related package, it's impossible
        // to store related content, so throw exception.
        RelatedPackagePersistenceException rpe =
            new RelatedPackagePersistenceException(se.getMessage(),
            "Error trying to create related package");
        exceptionArrayList.add(rpe);
        throw new ContentPersistenceExceptions(exceptionArrayList);
      }
    }
View Full Code Here

TOP

Related Classes of com.xmultra.processor.db.cms.exception.RelatedPackagePersistenceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.