Package com.xmultra.processor.db.cms.content

Examples of com.xmultra.processor.db.cms.content.ContentPackage


  public void store(Document contentPackageXmlDoc, Connection con,
                    XmlParseUtils xmlParseUtils, InitMapHolder imh) throws
      SQLException, DbXmlFormatException, ParseException,
      DbStoredProcedureException, IOException, ContentPersistenceExceptions {

    ContentPackage contentPackage = null;
    try {
      contentPackage = this.lnkContentFactory.getContentPackage(
          contentPackageXmlDoc);
    }
    catch (ParseException pe) {
View Full Code Here


   * @return ContentPackage
   */
  public ContentPackage getContentPackage(Object o)
      throws ParseException {
    Document contentDoc = (Document) o;
    ContentPackage cp = this.createContent(contentDoc);
    return cp;
  }
View Full Code Here

    return cp;
  }

  private ContentPackage createContent(Document doc) throws ParseException {

    ContentPackage cp = null;
    // Select root element (PackageContent).
    Element pkgContentElem = doc.getDocumentElement();
    // Retrieve article object from the package content
    BasicArticle ba = this.getArticleFromPkgContent(pkgContentElem);
    if (ba != null) {
      // Create content package.
      cp = new ContentPackage();
      cp.setArticle(ba);

      if (this.contentContainsPhotoPkg(pkgContentElem)) {
        String fileName = ba.getFileName();
        PhotoPackage pp = new PhotoPackage();
        pp.setCategoryId(ba.getCategoryId());
        pp.setCreateBy("Insert process");
        // CMS limits photo package "name" to 50 characters.
        pp.setDescription(fileName.substring(0, Math.min(fileName.length(), 41)) +
                          "_" + ba.getStartTimeAsMMDDYYYYString());
        pp.setStartTime(ba.getStartTime());
        Date startTime = ba.getStartTime();
        Calendar cal = Calendar.getInstance();
        cal.setTime(startTime);
        // Make end time one month later than start time.
        cal.add(Calendar.MONTH, 1);
        Date endTime = cal.getTime();
        pp.setEndTime(endTime);
        pp.setKeywords(fileName.substring(0, Math.min(fileName.length(), 100)));
        pp.setNational(false);
        pp.setPubId(ba.getPubId());

        Element photoPkgElem =
            this.xmlParseUtils.getSingletonElement(pkgContentElem, "PhotoPackage");
        NodeList photoNodes = photoPkgElem.getElementsByTagName("Photo");
        int numPhotos = 0;
        Photo currentPhoto = null;
        if (photoNodes != null) {
          numPhotos = photoNodes.getLength();
        }
        for (int i = 0; i < numPhotos; i++) {
          currentPhoto = this.getPhotoFromPhotoElem((Element)photoNodes.item(i));
          pp.addPhoto(currentPhoto);
        }
        cp.setPhotoPackage(pp);
      }
    }
    return cp;
  }
View Full Code Here

TOP

Related Classes of com.xmultra.processor.db.cms.content.ContentPackage

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.