Java Code Examples for org.apache.hadoop.yarn.api.records.timeline.TimelineEntity#setDomainId()

The following examples show how to use org.apache.hadoop.yarn.api.records.timeline.TimelineEntity#setDomainId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestTimelineACLsManager.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testYarnACLsNotEnabledForEntity() throws Exception {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
  TimelineACLsManager timelineACLsManager =
      new TimelineACLsManager(conf);
  timelineACLsManager.setTimelineStore(new TestTimelineStore());
  TimelineEntity entity = new TimelineEntity();
  entity.addPrimaryFilter(
      TimelineStore.SystemFilter.ENTITY_OWNER
          .toString(), "owner");
  entity.setDomainId("domain_id_1");
  Assert.assertTrue(
      "Always true when ACLs are not enabled",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("user"),
          ApplicationAccessType.VIEW_APP, entity));
  Assert.assertTrue(
      "Always true when ACLs are not enabled",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("user"),
          ApplicationAccessType.MODIFY_APP, entity));
}
 
Example 2
Source File: TestTimelineACLsManager.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testYarnACLsNotEnabledForEntity() throws Exception {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
  TimelineACLsManager timelineACLsManager =
      new TimelineACLsManager(conf);
  timelineACLsManager.setTimelineStore(new TestTimelineStore());
  TimelineEntity entity = new TimelineEntity();
  entity.addPrimaryFilter(
      TimelineStore.SystemFilter.ENTITY_OWNER
          .toString(), "owner");
  entity.setDomainId("domain_id_1");
  Assert.assertTrue(
      "Always true when ACLs are not enabled",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("user"),
          ApplicationAccessType.VIEW_APP, entity));
  Assert.assertTrue(
      "Always true when ACLs are not enabled",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("user"),
          ApplicationAccessType.MODIFY_APP, entity));
}
 
Example 3
Source File: TimelineStoreTestUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Create a test entity
 */
protected static TimelineEntity createEntity(String entityId, String entityType,
    Long startTime, List<TimelineEvent> events,
    Map<String, Set<String>> relatedEntities,
    Map<String, Set<Object>> primaryFilters,
    Map<String, Object> otherInfo, String domainId) {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(entityId);
  entity.setEntityType(entityType);
  entity.setStartTime(startTime);
  entity.setEvents(events);
  if (relatedEntities != null) {
    for (Entry<String, Set<String>> e : relatedEntities.entrySet()) {
      for (String v : e.getValue()) {
        entity.addRelatedEntity(e.getKey(), v);
      }
    }
  } else {
    entity.setRelatedEntities(null);
  }
  entity.setPrimaryFilters(primaryFilters);
  entity.setOtherInfo(otherInfo);
  entity.setDomainId(domainId);
  return entity;
}
 
Example 4
Source File: TestTimelineClient.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity generateEntity() {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("entity id");
  entity.setEntityType("entity type");
  entity.setStartTime(System.currentTimeMillis());
  for (int i = 0; i < 2; ++i) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType("test event type " + i);
    event.addEventInfo("key1", "val1");
    event.addEventInfo("key2", "val2");
    entity.addEvent(event);
  }
  entity.addRelatedEntity("test ref type 1", "test ref id 1");
  entity.addRelatedEntity("test ref type 2", "test ref id 2");
  entity.addPrimaryFilter("pkey1", "pval1");
  entity.addPrimaryFilter("pkey2", "pval2");
  entity.addOtherInfo("okey1", "oval1");
  entity.addOtherInfo("okey2", "oval2");
  entity.setDomainId("domain id 1");
  return entity;
}
 
Example 5
Source File: ApplicationMaster.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static void publishApplicationAttemptEvent(
    final TimelineClient timelineClient, String appAttemptId,
    DSEvent appEvent, String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(appAttemptId);
  entity.setEntityType(DSEntity.DS_APP_ATTEMPT.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setEventType(appEvent.toString());
  event.setTimestamp(System.currentTimeMillis());
  entity.addEvent(event);
  try {
    timelineClient.putEntities(entity);
  } catch (YarnException | IOException e) {
    LOG.error("App Attempt "
        + (appEvent.equals(DSEvent.DS_APP_ATTEMPT_START) ? "start" : "end")
        + " event could not be published for "
        + appAttemptId.toString(), e);
  }
}
 
Example 6
Source File: TestLeveldbTimelineStore.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testRelatingToNonExistingEntity() throws IOException {
  TimelineEntity entityToStore = new TimelineEntity();
  entityToStore.setEntityType("TEST_ENTITY_TYPE_1");
  entityToStore.setEntityId("TEST_ENTITY_ID_1");
  entityToStore.setDomainId(TimelineDataManager.DEFAULT_DOMAIN_ID);
  entityToStore.addRelatedEntity("TEST_ENTITY_TYPE_2", "TEST_ENTITY_ID_2");
  TimelineEntities entities = new TimelineEntities();
  entities.addEntity(entityToStore);
  store.put(entities);
  TimelineEntity entityToGet =
      store.getEntity("TEST_ENTITY_ID_2", "TEST_ENTITY_TYPE_2", null);
  Assert.assertNotNull(entityToGet);
  Assert.assertEquals("DEFAULT", entityToGet.getDomainId());
  Assert.assertEquals("TEST_ENTITY_TYPE_1",
      entityToGet.getRelatedEntities().keySet().iterator().next());
  Assert.assertEquals("TEST_ENTITY_ID_1",
      entityToGet.getRelatedEntities().values().iterator().next()
          .iterator().next());
}
 
Example 7
Source File: TimelineStoreTestUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Create a test entity
 */
protected static TimelineEntity createEntity(String entityId, String entityType,
    Long startTime, List<TimelineEvent> events,
    Map<String, Set<String>> relatedEntities,
    Map<String, Set<Object>> primaryFilters,
    Map<String, Object> otherInfo, String domainId) {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(entityId);
  entity.setEntityType(entityType);
  entity.setStartTime(startTime);
  entity.setEvents(events);
  if (relatedEntities != null) {
    for (Entry<String, Set<String>> e : relatedEntities.entrySet()) {
      for (String v : e.getValue()) {
        entity.addRelatedEntity(e.getKey(), v);
      }
    }
  } else {
    entity.setRelatedEntities(null);
  }
  entity.setPrimaryFilters(primaryFilters);
  entity.setOtherInfo(otherInfo);
  entity.setDomainId(domainId);
  return entity;
}
 
Example 8
Source File: ApplicationMaster.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private static void publishApplicationAttemptEvent(
    final TimelineClient timelineClient, String appAttemptId,
    DSEvent appEvent, String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(appAttemptId);
  entity.setEntityType(DSEntity.DS_APP_ATTEMPT.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setEventType(appEvent.toString());
  event.setTimestamp(System.currentTimeMillis());
  entity.addEvent(event);
  try {
    timelineClient.putEntities(entity);
  } catch (YarnException | IOException e) {
    LOG.error("App Attempt "
        + (appEvent.equals(DSEvent.DS_APP_ATTEMPT_START) ? "start" : "end")
        + " event could not be published for "
        + appAttemptId.toString(), e);
  }
}
 
Example 9
Source File: TestLeveldbTimelineStore.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testRelatingToNonExistingEntity() throws IOException {
  TimelineEntity entityToStore = new TimelineEntity();
  entityToStore.setEntityType("TEST_ENTITY_TYPE_1");
  entityToStore.setEntityId("TEST_ENTITY_ID_1");
  entityToStore.setDomainId(TimelineDataManager.DEFAULT_DOMAIN_ID);
  entityToStore.addRelatedEntity("TEST_ENTITY_TYPE_2", "TEST_ENTITY_ID_2");
  TimelineEntities entities = new TimelineEntities();
  entities.addEntity(entityToStore);
  store.put(entities);
  TimelineEntity entityToGet =
      store.getEntity("TEST_ENTITY_ID_2", "TEST_ENTITY_TYPE_2", null);
  Assert.assertNotNull(entityToGet);
  Assert.assertEquals("DEFAULT", entityToGet.getDomainId());
  Assert.assertEquals("TEST_ENTITY_TYPE_1",
      entityToGet.getRelatedEntities().keySet().iterator().next());
  Assert.assertEquals("TEST_ENTITY_ID_1",
      entityToGet.getRelatedEntities().values().iterator().next()
          .iterator().next());
}
 
Example 10
Source File: ATSV15HistoryACLPolicyManager.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public void updateTimelineEntityDomain(Object timelineEntity, String domainId) {
  if (!(timelineEntity instanceof TimelineEntity)) {
    throw new UnsupportedOperationException("Invalid object provided of type"
        + timelineEntity.getClass().getName());
  }
  TimelineEntity entity = (TimelineEntity) timelineEntity;
  entity.setDomainId(domainId);
}
 
Example 11
Source File: JstormMaster.java    From jstorm with Apache License 2.0 5 votes vote down vote up
private static void publishContainerStartEvent(
        final TimelineClient timelineClient, Container container, String domainId,
        UserGroupInformation ugi) {
    final TimelineEntity entity = new TimelineEntity();
    entity.setEntityId(container.getId().toString());
    entity.setEntityType(DSEntity.DS_CONTAINER.toString());
    entity.setDomainId(domainId);
    entity.addPrimaryFilter(JOYConstants.USER, ugi.getShortUserName());
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType(DSEvent.DS_CONTAINER_START.toString());
    event.addEventInfo(JOYConstants.NODE, container.getNodeId().toString());
    event.addEventInfo(JOYConstants.RESOURCES, container.getResource().toString());
    entity.addEvent(event);

    try {
        ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() {
            @Override
            public TimelinePutResponse run() throws Exception {
                return timelineClient.putEntities(entity);
            }
        });
    } catch (Exception e) {
        LOG.error("Container start event could not be published for "
                        + container.getId().toString(),
                e instanceof UndeclaredThrowableException ? e.getCause() : e);
    }
}
 
Example 12
Source File: TestTimelineWebServices.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testPostEntities() throws Exception {
  TimelineEntities entities = new TimelineEntities();
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("test id 1");
  entity.setEntityType("test type 1");
  entity.setStartTime(System.currentTimeMillis());
  entity.setDomainId("domain_id_1");
  entities.addEntity(entity);
  WebResource r = resource();
  // No owner, will be rejected
  ClientResponse response = r.path("ws").path("v1").path("timeline")
      .accept(MediaType.APPLICATION_JSON)
      .type(MediaType.APPLICATION_JSON)
      .post(ClientResponse.class, entities);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  assertEquals(ClientResponse.Status.FORBIDDEN,
      response.getClientResponseStatus());

  response = r.path("ws").path("v1").path("timeline")
      .queryParam("user.name", "tester")
      .accept(MediaType.APPLICATION_JSON)
      .type(MediaType.APPLICATION_JSON)
      .post(ClientResponse.class, entities);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  TimelinePutResponse putResposne =
      response.getEntity(TimelinePutResponse.class);
  Assert.assertNotNull(putResposne);
  Assert.assertEquals(0, putResposne.getErrors().size());
  // verify the entity exists in the store
  response = r.path("ws").path("v1").path("timeline")
      .path("test type 1").path("test id 1")
      .accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  entity = response.getEntity(TimelineEntity.class);
  Assert.assertNotNull(entity);
  Assert.assertEquals("test id 1", entity.getEntityId());
  Assert.assertEquals("test type 1", entity.getEntityType());
}
 
Example 13
Source File: ApplicationMaster.java    From big-c with Apache License 2.0 5 votes vote down vote up
private static void publishContainerStartEvent(
    final TimelineClient timelineClient, Container container, String domainId,
    UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_START.toString());
  event.addEventInfo("Node", container.getNodeId().toString());
  event.addEventInfo("Resources", container.getResource().toString());
  entity.addEvent(event);

  try {
    ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() {
      @Override
      public TimelinePutResponse run() throws Exception {
        return timelineClient.putEntities(entity);
      }
    });
  } catch (Exception e) {
    LOG.error("Container start event could not be published for "
        + container.getId().toString(),
        e instanceof UndeclaredThrowableException ? e.getCause() : e);
  }
}
 
Example 14
Source File: ApplicationMaster.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private static void publishContainerStartEvent(
    final TimelineClient timelineClient, Container container, String domainId,
    UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_START.toString());
  event.addEventInfo("Node", container.getNodeId().toString());
  event.addEventInfo("Resources", container.getResource().toString());
  entity.addEvent(event);

  try {
    ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() {
      @Override
      public TimelinePutResponse run() throws Exception {
        return timelineClient.putEntities(entity);
      }
    });
  } catch (Exception e) {
    LOG.error("Container start event could not be published for "
        + container.getId().toString(),
        e instanceof UndeclaredThrowableException ? e.getCause() : e);
  }
}
 
Example 15
Source File: TestTimelineWebServices.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testPostEntities() throws Exception {
  TimelineEntities entities = new TimelineEntities();
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("test id 1");
  entity.setEntityType("test type 1");
  entity.setStartTime(System.currentTimeMillis());
  entity.setDomainId("domain_id_1");
  entities.addEntity(entity);
  WebResource r = resource();
  // No owner, will be rejected
  ClientResponse response = r.path("ws").path("v1").path("timeline")
      .accept(MediaType.APPLICATION_JSON)
      .type(MediaType.APPLICATION_JSON)
      .post(ClientResponse.class, entities);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  assertEquals(ClientResponse.Status.FORBIDDEN,
      response.getClientResponseStatus());

  response = r.path("ws").path("v1").path("timeline")
      .queryParam("user.name", "tester")
      .accept(MediaType.APPLICATION_JSON)
      .type(MediaType.APPLICATION_JSON)
      .post(ClientResponse.class, entities);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  TimelinePutResponse putResposne =
      response.getEntity(TimelinePutResponse.class);
  Assert.assertNotNull(putResposne);
  Assert.assertEquals(0, putResposne.getErrors().size());
  // verify the entity exists in the store
  response = r.path("ws").path("v1").path("timeline")
      .path("test type 1").path("test id 1")
      .accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  entity = response.getEntity(TimelineEntity.class);
  Assert.assertNotNull(entity);
  Assert.assertEquals("test id 1", entity.getEntityId());
  Assert.assertEquals("test type 1", entity.getEntityType());
}
 
Example 16
Source File: TestTimelineWebServicesWithSSL.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutEntities() throws Exception {
  TestTimelineClient client = new TestTimelineClient();
  try {
    client.init(conf);
    client.start();
    TimelineEntity expectedEntity = new TimelineEntity();
    expectedEntity.setEntityType("test entity type");
    expectedEntity.setEntityId("test entity id");
    expectedEntity.setDomainId("test domain id");
    TimelineEvent event = new TimelineEvent();
    event.setEventType("test event type");
    event.setTimestamp(0L);
    expectedEntity.addEvent(event);

    TimelinePutResponse response = client.putEntities(expectedEntity);
    Assert.assertEquals(0, response.getErrors().size());
    Assert.assertTrue(client.resp.toString().contains("https"));

    TimelineEntity actualEntity = store.getEntity(
        expectedEntity.getEntityId(), expectedEntity.getEntityType(),
        EnumSet.allOf(Field.class));
    Assert.assertNotNull(actualEntity);
    Assert.assertEquals(
        expectedEntity.getEntityId(), actualEntity.getEntityId());
    Assert.assertEquals(
        expectedEntity.getEntityType(), actualEntity.getEntityType());
  } finally {
    client.stop();
    client.close();
  }
}
 
Example 17
Source File: MemoryTimelineStore.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private static TimelineEntity maskFields(
    TimelineEntity entity, EnumSet<Field> fields) {
  // Conceal the fields that are not going to be exposed
  TimelineEntity entityToReturn = new TimelineEntity();
  entityToReturn.setEntityId(entity.getEntityId());
  entityToReturn.setEntityType(entity.getEntityType());
  entityToReturn.setStartTime(entity.getStartTime());
  entityToReturn.setDomainId(entity.getDomainId());
  // Deep copy
  if (fields.contains(Field.EVENTS)) {
    entityToReturn.addEvents(entity.getEvents());
  } else if (fields.contains(Field.LAST_EVENT_ONLY)) {
    entityToReturn.addEvent(entity.getEvents().get(0));
  } else {
    entityToReturn.setEvents(null);
  }
  if (fields.contains(Field.RELATED_ENTITIES)) {
    entityToReturn.addRelatedEntities(entity.getRelatedEntities());
  } else {
    entityToReturn.setRelatedEntities(null);
  }
  if (fields.contains(Field.PRIMARY_FILTERS)) {
    entityToReturn.addPrimaryFilters(entity.getPrimaryFilters());
  } else {
    entityToReturn.setPrimaryFilters(null);
  }
  if (fields.contains(Field.OTHER_INFO)) {
    entityToReturn.addOtherInfo(entity.getOtherInfo());
  } else {
    entityToReturn.setOtherInfo(null);
  }
  return entityToReturn;
}
 
Example 18
Source File: TimelineDataManager.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private static void addDefaultDomainIdIfAbsent(TimelineEntity entity) {
  // be compatible with the timeline data created before 2.6
  if (entity.getDomainId() == null) {
    entity.setDomainId(DEFAULT_DOMAIN_ID);
  }
}
 
Example 19
Source File: TimelineDataManager.java    From big-c with Apache License 2.0 4 votes vote down vote up
private static void addDefaultDomainIdIfAbsent(TimelineEntity entity) {
  // be compatible with the timeline data created before 2.6
  if (entity.getDomainId() == null) {
    entity.setDomainId(DEFAULT_DOMAIN_ID);
  }
}
 
Example 20
Source File: MemoryTimelineStore.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized TimelineEntities getEntities(String entityType, Long limit,
    Long windowStart, Long windowEnd, String fromId, Long fromTs,
    NameValuePair primaryFilter, Collection<NameValuePair> secondaryFilters,
    EnumSet<Field> fields, CheckAcl checkAcl) throws IOException {
  if (limit == null) {
    limit = DEFAULT_LIMIT;
  }
  if (windowStart == null) {
    windowStart = Long.MIN_VALUE;
  }
  if (windowEnd == null) {
    windowEnd = Long.MAX_VALUE;
  }
  if (fields == null) {
    fields = EnumSet.allOf(Field.class);
  }

  Iterator<TimelineEntity> entityIterator = null;
  if (fromId != null) {
    TimelineEntity firstEntity = entities.get(new EntityIdentifier(fromId,
        entityType));
    if (firstEntity == null) {
      return new TimelineEntities();
    } else {
      entityIterator = new TreeSet<TimelineEntity>(entities.values())
          .tailSet(firstEntity, true).iterator();
    }
  }
  if (entityIterator == null) {
    entityIterator = new PriorityQueue<TimelineEntity>(entities.values())
        .iterator();
  }

  List<TimelineEntity> entitiesSelected = new ArrayList<TimelineEntity>();
  while (entityIterator.hasNext()) {
    TimelineEntity entity = entityIterator.next();
    if (entitiesSelected.size() >= limit) {
      break;
    }
    if (!entity.getEntityType().equals(entityType)) {
      continue;
    }
    if (entity.getStartTime() <= windowStart) {
      continue;
    }
    if (entity.getStartTime() > windowEnd) {
      continue;
    }
    if (fromTs != null && entityInsertTimes.get(new EntityIdentifier(
        entity.getEntityId(), entity.getEntityType())) > fromTs) {
      continue;
    }
    if (primaryFilter != null &&
        !matchPrimaryFilter(entity.getPrimaryFilters(), primaryFilter)) {
      continue;
    }
    if (secondaryFilters != null) { // AND logic
      boolean flag = true;
      for (NameValuePair secondaryFilter : secondaryFilters) {
        if (secondaryFilter != null && !matchPrimaryFilter(
            entity.getPrimaryFilters(), secondaryFilter) &&
            !matchFilter(entity.getOtherInfo(), secondaryFilter)) {
          flag = false;
          break;
        }
      }
      if (!flag) {
        continue;
      }
    }
    if (entity.getDomainId() == null) {
      entity.setDomainId(DEFAULT_DOMAIN_ID);
    }
    if (checkAcl == null || checkAcl.check(entity)) {
      entitiesSelected.add(entity);
    }
  }
  List<TimelineEntity> entitiesToReturn = new ArrayList<TimelineEntity>();
  for (TimelineEntity entitySelected : entitiesSelected) {
    entitiesToReturn.add(maskFields(entitySelected, fields));
  }
  Collections.sort(entitiesToReturn);
  TimelineEntities entitiesWrapper = new TimelineEntities();
  entitiesWrapper.setEntities(entitiesToReturn);
  return entitiesWrapper;
}