ALF-9799 Avoid links and wiki container node wrapping, and handle the case of a listing before any writes (so the container has yet to be created)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29627 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-08-09 11:32:14 +00:00
parent 422e1e7f20
commit ed3e2125e5
5 changed files with 40 additions and 26 deletions

View File

@@ -24,12 +24,11 @@ import java.util.Map;
import org.alfresco.query.PagingRequest;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.activities.ActivityService;
import org.alfresco.service.cmr.links.LinkInfo;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.wiki.WikiPageInfo;
@@ -64,8 +63,8 @@ public abstract class AbstractWikiWebScript extends DeclarativeWebScript
protected NodeService nodeService;
protected SiteService siteService;
protected WikiService wikiService;
protected PersonService personService;
protected ActivityService activityService;
protected ServiceRegistry serviceRegistry;
public void setNodeService(NodeService nodeService)
{
@@ -82,16 +81,16 @@ public abstract class AbstractWikiWebScript extends DeclarativeWebScript
this.wikiService = wikiService;
}
public void setPersonService(PersonService personService)
{
this.personService = personService;
}
public void setActivityService(ActivityService activityService)
{
this.activityService = activityService;
}
public void setServiceRegistry(ServiceRegistry serviceRegistry)
{
this.serviceRegistry = serviceRegistry;
}
protected String getOrNull(JSONObject json, String key) throws JSONException
{
@@ -195,9 +194,9 @@ public abstract class AbstractWikiWebScript extends DeclarativeWebScript
return "";
}
// Script Node needed of the person
NodeRef person = serviceRegistry.getPersonService().getPerson(username);
return new ScriptNode(person, serviceRegistry);
// Will turn into a Script Node needed of the person
NodeRef person = personService.getPerson(username);
return person;
}
protected Map<String, Object> renderWikiPage(WikiPageInfo page)

View File

@@ -142,9 +142,18 @@ public class WikiPageListGet extends AbstractWikiWebScript
}
else
{
// Find the container (if it's been created yet)
container = siteService.getContainer(
site.getShortName(), WikiServiceImpl.WIKI_COMPONENT
);
if(container == null)
{
// Brand new site, no write operations on links have happened
// Fudge it for now with the site itself, the first write call
// will have the container created
container = site.getNodeRef();
}
}
// All done