public List getResources(ContentCollection collection) { boolean goin = in(); try { if (resolver != null && goin) { return resolver.getResources(collection); } else { // limit to those whose reference path (based on id) // matches // the // collection id final String target = collection.getId(); /* * // read all the records, then filter them to accept only * those in this collection // Note: this is not desirable, as * the read is linear to the database site -ggolden List rv = * m_resourceStore.getSelectedResources( new Filter() { public * boolean accept(Object o) { // o is a String, the resource id * return StringUtil.referencePath((String) o).equals(target); } } ); */ // read the records with a where clause to let the // database // select // those in this collection return m_resourceStore.getAllResourcesWhere("IN_COLLECTION", target); } } finally { out(); } } // getResources
public void commitResource(ContentResourceEdit edit) throws ServerOverloadException { // keep the body out of the XML boolean goin = in(); try { if (resolver != null && goin) { resolver.commitResource(edit); } else { BaseResourceEdit redit = (BaseResourceEdit) edit; if (redit.m_contentStream != null) { } else if (redit.m_body != null) { } else { } m_resourceStore.commitResource(edit); } resourceCache.remove(edit.getId()); } finally { out(); } }
public ContentResource getResource(String id) throws TypeException { if (id == null || id.trim().length() == 0) { return null; } ContentResource cr = (ContentResource) resourceCache.get(id); if (cr != null) { return cr; } boolean goin = in(); try { if (resolver != null && goin) { cr = (ContentResource) resolver.getResource(id); return (ContentResource) resourceCache.put(id, cr); } else { Entity ce = m_resourceStore.getResource(id); if (ce != null) { if (!(ce instanceof ContentResource)) { // CHS tries to see if urls not ending in a / are resources first if (log.isDebugEnabled()) log.debug("=================RESORUCE is not a RESOURCE " + id); } else { cr = (ContentResource) ce; } } else { } return (ContentResource) resourceCache.put(id, cr); } } finally { out(); } }
public void cancelCollection(ContentCollectionEdit edit) { boolean goin = in(); try { if (resolver != null && goin) { resolver.cancelCollection(edit); } else { m_collectionStore.cancelResource(edit); } collectionCache.remove(edit.getId()); } finally { out(); } }
/** update xml and store the body of file TODO storing of body content is not used now. */ public void commitDeleteResource(ContentResourceEdit edit, String uuid) { resourceCache.remove(edit.getId()); boolean goin = in(); try { if (resolver != null && goin) { resolver.commitDeleteResource(edit, uuid); } else { m_resourceDeleteStore.commitDeleteResource(edit, uuid); } } finally { out(); } }
public List getFlatResources(String collectionId) { List rv = null; boolean goin = in(); try { if (resolver != null && goin) { rv = resolver.getFlatResources(collectionId); } else { rv = m_resourceStore.getAllResourcesWhereLike("IN_COLLECTION", collectionId + "%"); } return rv; } finally { out(); } }
/** Add resource to content_resouce_delete table for user deleted resources */ public ContentResourceEdit putDeleteResource(String id, String uuid, String userId) { resourceCache.remove(id); boolean goin = in(); try { if (resolver != null && goin) { return (ContentResourceEdit) resolver.putDeleteResource(id, uuid, userId); } else { return (ContentResourceEdit) m_resourceDeleteStore.putDeleteResource(id, uuid, userId, null); } } finally { out(); } }
public ContentResourceEdit putResource(String id) { if (id == null || id.trim().length() == 0) { return null; } boolean goin = in(); try { if (resolver != null && goin) { return (ContentResourceEdit) resourceCache.put(id, resolver.putResource(id)); } else { return (ContentResourceEdit) resourceCache.put(id, m_resourceStore.putResource(id, null)); } } finally { out(); } }
public void cancelResource(ContentResourceEdit edit) { boolean goin = in(); try { if (resolver != null && goin) { resolver.cancelResource(edit); } else { // clear the memory image of the body byte[] body = ((BaseResourceEdit) edit).m_body; ((BaseResourceEdit) edit).m_body = null; m_resourceStore.cancelResource(edit); } resourceCache.remove(edit.getId()); } finally { out(); } }
public void removeResource(ContentResourceEdit edit) { // delete the body boolean goin = in(); try { if (resolver != null && goin) { resolver.removeResource(edit); } else { m_resourceStore.removeResource(edit); } resourceCache.remove(edit.getId()); } finally { out(); } }
public Collection<String> getMemberResourceIds(String collectionId) { if (collectionId == null || collectionId.trim().length() == 0) { return new ArrayList<String>(); } List list = null; boolean goin = in(); try { if (resolver != null && goin) { return resolver.getMemberResourceIds(collectionId); } else { return m_collectionStore.getMemberResourceIds(collectionId); } } finally { out(); } }
/** * @param id * @return */ public String getUuid(String id) { if (id == null || id.trim().length() == 0) { return null; } List list = null; boolean goin = in(); try { try { if (resolver != null && goin) { return resolver.getUuid(id); } } catch (OperationDelegationException e) { } return m_resourceStore.getUuid(id); } finally { out(); } }
/** * @param id * @param uuid */ public void setResourceUuid(String resourceId, String uuid) { if (resourceId == null || resourceId.trim().length() == 0) { return; } List list = null; boolean goin = in(); try { if (resolver != null && goin) { try { resolver.setResourceUuid(resourceId, uuid); } catch (OperationDelegationException e) { } } m_resourceStore.setResourceUuid(resourceId, uuid); } finally { out(); } }
public int getMemberCount(String collectionId) { if (collectionId == null || collectionId.trim().length() == 0) { return 0; } boolean goin = in(); try { if (resolver != null && goin) { return resolver.getMemberCount(collectionId); } else { return m_collectionStore.getMemberCount(collectionId); } } finally { out(); } }
/** * @param thisResource * @param new_id * @return * @throws ServerOverloadException * @throws IdUsedException * @throws TypeException * @throws IdUnusedException */ public String moveResource(ContentResourceEdit thisResource, String new_id) throws IdUnusedException, TypeException, IdUsedException, ServerOverloadException { if (thisResource == null || new_id == null || new_id.trim().length() == 0) { return null; } List list = null; boolean goin = in(); try { try { if (resolver != null && goin) { return resolver.moveResource(thisResource, new_id); } } catch (OperationDelegationException e) { } return m_resourceStore.moveResource(thisResource, new_id); } finally { out(); } }
/** Collections * */ public boolean checkCollection(String id) { if (id == null || id.trim().length() == 0) { return false; } ContentCollection cc = (ContentCollection) collectionCache.get(id); if (cc != null) { return true; } boolean goin = in(); try { if (resolver != null && goin) { return resolver.checkCollection(id); } else { return m_collectionStore.checkResource(id); } } finally { out(); } }
/** Resources * */ public boolean checkResource(String id) { if (id == null || id.trim().length() == 0) { return false; } ContentResource cr = (ContentResource) resourceCache.get(id); if (cr != null) { return true; } boolean goin = in(); try { if (resolver != null && goin) { return resolver.checkResource(id); } else { return m_resourceStore.checkResource(id); } } finally { out(); } }
public ContentCollection getCollection(String id) { if (id == null || id.trim().length() == 0) { return null; } ContentCollection cc = (ContentCollection) collectionCache.get(id); if (cc != null) { return cc; } boolean goin = in(); try { if (resolver != null && goin) { cc = resolver.getCollection(id); return (ContentCollection) collectionCache.put(id, cc); } else { cc = (ContentCollection) m_collectionStore.getResource(id); return (ContentCollection) collectionCache.put(id, cc); } } finally { out(); } }
public ContentCollectionEdit editCollection(String id) { if (id == null || id.trim().length() == 0) { return null; } try { ContentCollectionEdit cce = (ContentCollectionEdit) collectionCache.get(id); if (cce != null) { return cce; } } catch (Exception ex) { } boolean goin = in(); try { if (resolver != null && goin) { return (ContentCollectionEdit) collectionCache.put(id, resolver.editCollection(id)); } else { return (ContentCollectionEdit) collectionCache.put(id, m_collectionStore.editResource(id)); } } finally { out(); } }
public ContentResourceEdit editResource(String id) { if (id == null || id.trim().length() == 0) { return null; } try { ContentResourceEdit cr = (ContentResourceEdit) resourceCache.get(id); if (cr != null) { return cr; } } catch (Exception ex) { } boolean goin = in(); try { if (resolver != null && goin) { return (ContentResourceEdit) resourceCache.put(id, resolver.editResource(id)); } else { return (ContentResourceEdit) resourceCache.put(id, m_resourceStore.editResource(id)); } } finally { out(); } }
/** Open and be ready to read / write. */ public void open() { m_collectionStore.open(); m_resourceStore.open(); m_resourceDeleteStore.open(); }
/** Close. */ public void close() { m_collectionStore.close(); m_resourceStore.close(); m_resourceDeleteStore.close(); }