@Override
  public void initSelf(OrchidContext oc) throws OrchidException {
    callSuperInitSelf(oc);

    cssPath = lookupContentFile(FILES, CSS, oc);

    try {
      ContentPolicy policy = getContentPolicy();
      icon = getOContentIcon();
      icon.initContent((Policy) policy, getContentSession().getPolicyCMServer());
      addAndInitChild(oc, icon);

      videoPolicy = getBrightcoveVideoPolicy();

      name = videoPolicy.getName();
      name =
          (name == null || "".equals(name))
              ? videoPolicy.getContentId().getContentId().getContentIdString()
              : abbreviate(name, 30);

      thumbnail = videoPolicy.getImagePath();

    } catch (CMException e) {
      LOG.log(Level.WARNING, e.getMessage(), e);
    }
  }
Пример #2
0
 public void add(int index, ContentId contentId, ContentId referenceMetaDataId) {
   try {
     contentList.add(index, new ContentReference(contentId, referenceMetaDataId));
   } catch (CMException e) {
     throw new CMRuntimeException(
         "While adding "
             + contentId.getContentIdString()
             + " to "
             + this
             + ": "
             + e.getMessage(),
         e);
   }
 }
Пример #3
0
  @Override
  public String toString() {
    String group;
    try {
      group = contentList.getContentListStorageGroup();
    } catch (CMException e) {
      group = e.getMessage();
    }

    if (toString == null) {
      return "content list \"" + group + "\"";
    } else {
      return "content list \"" + group + "\" in " + toString.toString();
    }
  }
Пример #4
0
  public String get(Policy policy, PolopolyContext context) {
    if (policy instanceof SingleValued) {
      try {
        return '"' + ((SingleValued) policy).getValue() + '"';
      } catch (CMException e) {
        System.err.println(e.toString());
        return "";
      }
    }
    // ContentPolicy implements ContentListAware but does not generally represent a content list.
    else if (policy instanceof ContentListAware && !(policy.getClass() == ContentPolicy.class)) {
      try {
        ContentList contentList = ((ContentListAware) policy).getContentList();

        StringBuffer result = new StringBuffer(100);

        result.append("[");

        boolean first = true;

        for (ContentId contentId : new ContentListIterator(contentList)) {
          if (!first) {
            result.append(", ");
          }

          result.append(AbstractContentIdField.get(contentId, context));

          first = false;
        }

        result.append("]");

        return result.toString();
      } catch (CMException e) {
        System.err.println(e);

        return "";
      }
    } else {
      return "";
    }
  }
Пример #5
0
    public ContentIdUtil get(int i) {
      try {
        ContentId result = contentList.getEntry(i).getReferredContentId();

        if (result != null) {
          return Util.util(result, getContext());
        } else {
          return null;
        }
      } catch (CMException e) {
        throw new CMRuntimeException(
            "While getting entry "
                + i
                + " in "
                + ContentListUtilImpl.this.toString()
                + ": "
                + e.getMessage(),
            e);
      }
    }