public UUID apply(EntityData<E> input) { return input.getEntity().getId(); } }).toList();
private Object buildDisplay(List<EntityData<Entity>> data) { StringBuilder builder = new StringBuilder(); builder.append("<ul>"); for (EntityData<Entity> d : data) { builder.append("<li>"); builder.append(d.getEntity().getSlug()); builder.append("</li>"); } builder.append("</ul>"); return builder.toString(); } }
@Override public boolean apply(@Nullable T input) { if (!Child.class.isAssignableFrom(input.getClass())) { throw new RuntimeException("Cannot apply with parent filter to non-child"); } if (parent == null) { return ((Child) input).getParentId() == null; } return parent.getId().equals(((Child) input).getParentId()); } };
public boolean apply(Attachment attachment) { return entity.getEntity().getId().equals(attachment.getParentId()); } }).toList();
@Override public URL create(E entity, Tenant tenant, URLType type) { String path = "/" + getPluralForm(entity) + "/" + entity.getSlug(); switch (type) { case API: path = "/api/" + path; return urlHelper.getTenantPlatformURL(tenant, path); case PUBLIC: default: return urlHelper.getTenantWebURL(tenant, path); } }
public void index(final Entity entity, final Tenant tenant) throws SearchEngineException { try { Map<String, Object> source = entityIndexDocumentPurveyor.purveyDocument(entity, tenant); if (source.keySet().size() > 0) { String entityName = StringUtils.substringAfterLast(entity.getClass().getName(), ".").toLowerCase(); this.logger.debug("Indexing {} with id {}...", entityName, entity.getId()); IndexRequestBuilder builder = this.client.prepareIndex("entities", entityName, entity.getId().toString()).setSource(source); if (tenant != null && !Tenant.class.isAssignableFrom(entity.getClass())) { builder.setParent(tenant.getId().toString()); } IndexResponse response = builder.execute().actionGet(); this.logger.debug("" + response.getType()); } } catch (Exception e) { throw new SearchEngineException("Failed to index entity", e); } }
this.logger.error("Error extracting entity", entity.getSlug(), e); } catch (JsonMappingException e) { this.logger.error("Error extracting entity", entity.getSlug(), e); } catch (JsonParseException e) { this.logger.error("Error extracting entity", entity.getSlug(), e); } catch (JsonProcessingException e) { this.logger.error("Error extracting entity", entity.getSlug(), e); } catch (IOException e) { this.logger.error("Error extracting entity", entity.getSlug(), e); } finally { field.setAccessible(isAccessible); source.put("slug", entity.getSlug());
entityListStore.findListByHintAndParentId("image_gallery", entityData.getEntity().getId());