Example #1
0
 public void add(int index, Policy policy, ReferenceMetaDataPolicy referenceMetaData) {
   contentIds()
       .add(
           index,
           policy.getContentId().getContentId(),
           (referenceMetaData != null ? referenceMetaData.getContentId().getContentId() : null));
 }
 @Test
 public void shouldGetCurrentRootSiteId() throws CMException {
   doReturn(policyCMServer).when(target).getCmServer();
   doReturn(configUtil).when(target).getConfiguration(policyCMServer);
   Policy topPolicy = mock(Policy.class);
   VersionedContentId id = mock(VersionedContentId.class);
   when(contentSession.getTopPolicy()).thenReturn(topPolicy);
   when(topPolicy.getContentId()).thenReturn(id);
   when(configUtil.getCurrentRootSiteId(id)).thenReturn(siteId);
   assertEquals(siteId, target.getCurrentRootSiteId());
 }
Example #3
0
  public int indexOf(Policy policy) {
    VersionedContentId policyId = policy.getContentId();

    for (int i = size() - 1; i >= 0; i--) {
      ContentIdUtil referredContentId = getEntry(i).getReferredContentId();

      if (referredContentId == null) {
        LOGGER.log(WARNING, "There was a null ID added to the content list " + this + ".");
        continue;
      }

      if (referredContentId.equalsIgnoreVersion(policyId)) {
        return i;
      }
    }

    return -1;
  }
Example #4
0
 public void remove(Policy policy) {
   contentIds().remove(policy.getContentId());
 }
Example #5
0
 public void add(int index, Policy policy) {
   contentIds().add(index, policy.getContentId().getContentId());
 }