- Added system columns to web service results sets to provide association details where appropriate

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3552 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2006-08-21 09:22:13 +00:00
parent 1c3e883216
commit 04f64235e3
4 changed files with 30 additions and 3 deletions

View File

@@ -111,7 +111,7 @@ public class AssociatedQuerySession extends AbstractQuerySession
// get the data for the row and build up the columns structure
Map<QName, Serializable> props = nodeService
.getProperties(childNodeRef);
NamedValue[] columns = new NamedValue[props.size()];
NamedValue[] columns = new NamedValue[props.size()+1];
int col = 0;
for (QName propName : props.keySet())
{
@@ -119,6 +119,9 @@ public class AssociatedQuerySession extends AbstractQuerySession
col++;
}
// Now add the system columns containing the association details
columns[col] = new NamedValue(SYS_COL_ASSOC_TYPE, Boolean.FALSE, assoc.getTypeQName().toString(), null);
ResultSetRow row = new ResultSetRow();
row.setRowIndex(x);
row.setNode(rowNode);

View File

@@ -97,7 +97,7 @@ public class ChildrenQuerySession extends AbstractQuerySession
// create columns for all the properties of the node
// get the data for the row and build up the columns structure
Map<QName, Serializable> props = nodeService.getProperties(childNodeRef);
NamedValue[] columns = new NamedValue[props.size()];
NamedValue[] columns = new NamedValue[props.size()+4];
int col = 0;
for (QName propName : props.keySet())
{
@@ -105,6 +105,15 @@ public class ChildrenQuerySession extends AbstractQuerySession
col++;
}
// Now add the system columns containing the association details
columns[col] = new NamedValue(SYS_COL_ASSOC_TYPE, Boolean.FALSE, assoc.getTypeQName().toString(), null);
col++;
columns[col] = new NamedValue(SYS_COL_ASSOC_NAME, Boolean.FALSE, assoc.getQName().toString(), null);
col++;
columns[col] = new NamedValue(SYS_COL_IS_PRIMARY, Boolean.FALSE, Boolean.toString(assoc.isPrimary()), null);
col++;
columns[col] = new NamedValue(SYS_COL_NTH_SIBLING, Boolean.FALSE, Integer.toString(assoc.getNthSibling()), null);
ResultSetRow row = new ResultSetRow();
row.setRowIndex(x);
row.setNode(rowNode);

View File

@@ -97,7 +97,7 @@ public class ParentsQuerySession extends AbstractQuerySession
// create columns for all the properties of the node
// get the data for the row and build up the columns structure
Map<QName, Serializable> props = nodeService.getProperties(parentNodeRef);
NamedValue[] columns = new NamedValue[props.size()];
NamedValue[] columns = new NamedValue[props.size()+4];
int col = 0;
for (QName propName : props.keySet())
{
@@ -105,6 +105,15 @@ public class ParentsQuerySession extends AbstractQuerySession
col++;
}
// Now add the system columns containing the association details
columns[col] = new NamedValue(SYS_COL_ASSOC_TYPE, Boolean.FALSE, assoc.getTypeQName().toString(), null);
col++;
columns[col] = new NamedValue(SYS_COL_ASSOC_NAME, Boolean.FALSE, assoc.getQName().toString(), null);
col++;
columns[col] = new NamedValue(SYS_COL_IS_PRIMARY, Boolean.FALSE, Boolean.toString(assoc.isPrimary()), null);
col++;
columns[col] = new NamedValue(SYS_COL_NTH_SIBLING, Boolean.FALSE, Integer.toString(assoc.getNthSibling()), null);
ResultSetRow row = new ResultSetRow();
row.setRowIndex(x);
row.setNode(rowNode);

View File

@@ -30,6 +30,12 @@ import org.alfresco.service.namespace.NamespaceService;
*/
public interface QuerySession extends Serializable
{
/** System column namess */
public static String SYS_COL_ASSOC_TYPE = "associationType";
public static String SYS_COL_ASSOC_NAME = "associationName";
public static String SYS_COL_IS_PRIMARY = "isPrimary";
public static String SYS_COL_NTH_SIBLING = "nthSibling";
/**
* Retrieves the id this query session can be identified as
*