public List<EntityData> findEntitesByTags(String[] tags, String[] prefixes, boolean matchAll, Search search, Map<String, Object> params) { if (tagSearchService != null) { requestStorage.setRequestValues(params); List<EntityData> results = tagSearchService.findEntitesByTags(tags, prefixes, matchAll, search); requestStorage.reset(); return results; } else { log.warn("No tagSearchService defined"); return new ArrayList<EntityData>(); } }
requestStorage.setRequestValue(RequestStorage.ReservedKeys._requestEntityReference.name(), view.getEntityReference().toString()); requestStorage.setRequestValue(RequestStorage.ReservedKeys._requestOrigin.name(), RequestStorage.RequestOrigin.REST.name()); requestStorage.setRequestValue(RequestStorage.ReservedKeys._requestActive.name(), true); setResponseHeaders(view, res, requestStorage.getStorageMapCopy(), null); requestStorage.getStorageMapCopy(true, false, true, true) ); } catch (SecurityException se) { Search search = RequestUtils.makeSearchFromRequestParams(requestStorage.getStorageMapCopy(true, false, true, true)); // leave out headers)); entities = entityBrokerManager.getEntitiesData(ref, search, requestStorage.getStorageMapCopy()); formattable.formatOutput(ref, format, entities, requestStorage.getStorageMapCopy(), outputStream); handled = true; entityEncodingManager.internalOutputFormatter(ref, format, entities, requestStorage.getStorageMapCopy(), outputStream, view); deleteable.deleteEntity(view.getEntityReference(), requestStorage.getStorageMapCopy()); res.setStatus(HttpServletResponse.SC_NO_CONTENT); handled = true; format, inputStream, requestStorage.getStorageMapCopy()); handled = true; String createdId = createable.createEntity(view.getEntityReference(), entity, requestStorage.getStorageMapCopy()); if (createdId == null || "".equals(createdId)) { throw new IllegalStateException("Could not get the createdId from the newly created entity for ("+view+"), please ensure the provider is returning a non-null and non-empty value from the create method, if the item was not created then an exception should have been thrown"); updateable.updateEntity(view.getEntityReference(), entity, requestStorage.getStorageMapCopy());
requestStorage.setStoredValue(entry.getKey(), entry.getValue()); } catch (IllegalArgumentException e) { log.warn("EntityRedirectsManager: Had to skip key (" + entry.getKey() + ") while adding keys to request storage: " + e);
requestStorage.setRequestValue(RequestStorage.ReservedKeys._requestEntityReference.name(), view.getEntityReference().toString()); requestStorage.setRequestValue(RequestStorage.ReservedKeys._requestOrigin.name(), RequestStorage.RequestOrigin.REST.name()); requestStorage.setRequestValue(RequestStorage.ReservedKeys._requestActive.name(), true); setResponseHeaders(view, res, requestStorage.getStorageMapCopy(), null); requestStorage.getStorageMapCopy(true, false, true, true) ); } catch (SecurityException se) { Search search = RequestUtils.makeSearchFromRequestParams(requestStorage.getStorageMapCopy(true, false, true, true)); // leave out headers)); entities = entityBrokerManager.getEntitiesData(ref, search, requestStorage.getStorageMapCopy()); formattable.formatOutput(ref, format, entities, requestStorage.getStorageMapCopy(), outputStream); handled = true; entityEncodingManager.internalOutputFormatter(ref, format, entities, requestStorage.getStorageMapCopy(), outputStream, view); deleteable.deleteEntity(view.getEntityReference(), requestStorage.getStorageMapCopy()); res.setStatus(HttpServletResponse.SC_NO_CONTENT); handled = true; format, inputStream, requestStorage.getStorageMapCopy()); handled = true; String createdId = createable.createEntity(view.getEntityReference(), entity, requestStorage.getStorageMapCopy()); if (createdId == null || "".equals(createdId)) { throw new IllegalStateException("Could not get the createdId from the newly created entity for ("+view+"), please ensure the provider is returning a non-null and non-empty value from the create method, if the item was not created then an exception should have been thrown"); updateable.updateEntity(view.getEntityReference(), entity, requestStorage.getStorageMapCopy());
requestStorage.setStoredValue(entry.getKey(), entry.getValue()); } catch (IllegalArgumentException e) { log.warn("EntityRedirectsManager: Had to skip key (" + entry.getKey() + ") while adding keys to request storage: " + e);
public List<?> fetchEntities(String prefix, Search search, Map<String, Object> params) { EntityReference ref = new EntityReference(prefix, ""); List<?> l = null; try { requestStorage.setRequestValues(params); if (params == null) { params = new HashMap<String, Object>(); } l = entityBrokerManager.fetchEntities(ref, search, params); } finally { requestStorage.reset(); } return l; }
public List<EntityData> getEntities(String prefix, Search search, Map<String, Object> params) { EntityReference ref = new EntityReference(prefix, ""); List<EntityData> data = null; try { requestStorage.setRequestValues(params); if (params == null) { params = new HashMap<String, Object>(); } data = entityBrokerManager.getEntitiesData(ref, search, params); } finally { requestStorage.reset(); } return data; }
public List<EntityData> browseEntities(String prefix, Search search, String userReference, String associatedReference, String parentReference, Map<String, Object> params) { EntityReference parentRef = null; if (parentReference != null) { parentRef = entityBrokerManager.parseReference(parentReference); } List<EntityData> data = null; try { requestStorage.setRequestValues(params); if (params == null) { params = new HashMap<String, Object>(); } data = entityBrokerManager.browseEntities(prefix, search, userReference, associatedReference, parentRef, params); } finally { requestStorage.reset(); } return data; }
public Object translateInputToEntity(String reference, String format, InputStream input, Map<String, Object> params) { EntityReference ref = entityBrokerManager.parseReference(reference); if (ref == null) { throw new IllegalArgumentException("Cannot output formatted entity, entity reference is invalid: " + reference); } Object entity = null; if (entityBrokerManager.getEntityRESTProvider() != null) { try { requestStorage.setRequestValues(params); if (params == null) { params = new HashMap<String, Object>(); } entity = entityBrokerManager.getEntityRESTProvider().translateInputToEntity(ref, format, input, params); } finally { requestStorage.reset(); } } else { throw new UnsupportedOperationException("No provider to handle translateInputToEntity for ("+reference+","+format+")"); } return entity; }
public void formatAndOutputEntity(String reference, String format, List<?> entities, OutputStream output, Map<String, Object> params) { EntityReference ref = entityBrokerManager.parseReference(reference); if (ref == null) { throw new IllegalArgumentException("Cannot output formatted entity, entity reference is invalid: " + reference); } if (entityBrokerManager.getEntityRESTProvider() != null) { try { requestStorage.setRequestValues(params); // convert entities to entity data list List<EntityData> data = entityBrokerManager.convertToEntityData(entities, ref); if (params == null) { params = new HashMap<String, Object>(); } entityBrokerManager.getEntityRESTProvider().formatAndOutputEntity(ref, format, data, output, params); } finally { requestStorage.reset(); } } else { throw new UnsupportedOperationException("No provider to handle formatAndOutputEntity for ("+reference+","+format+")"); } }
if (entityBrokerManager.getEntityRESTProvider() != null) { try { requestStorage.setRequestValues(params); if (params == null) { params = new HashMap<String, Object>(0); } EntityView view = entityBrokerManager.parseEntityURL(reference); requestStorage.reset();