private void configureComments(CatalogConfiguration catCfg,
AsnIndexReference indexRef,
String name) {
StringAttributeMap catParams = catCfg.getParameters();
AsnOperations ops = this.operations;
AsnOperation op;
if (indexRef.getEnabled()) {
int maxLength = Val.chkInt(catParams.getValue("assertion."+name+".maxLength"),4000);
String valueFilterClass = Val.chkStr(catParams.getValue("assertion."+name+".valueFilterClass"));
if (valueFilterClass.length() == 0) {
valueFilterClass = null;
}
AsnAuthPolicy authForRead = new AsnAuthPolicy();
authForRead.setAllowNonLocalResourceIds(this.allowNonLocalResourceIds);
authForRead.setAuthenticationRequired(false);
authForRead.setQueryPrincipals(new AsnPrincipals());
authForRead.getQueryPrincipals().add(AsnConstants.PRINCIPAL_ANY);
// create the assertion set
AsnAssertionSet asnSet = new AsnAssertionSet(name);
String actionPfx = asnSet.getURNPrefix();
// set the index reference
asnSet.setIndexReference(indexRef.duplicate());
// set the default authentication/authorization policy
asnSet.setAuthPolicy(new AsnAuthPolicy());
asnSet.getAuthPolicy().setAllowNonLocalResourceIds(this.allowNonLocalResourceIds);
asnSet.getAuthPolicy().setAuthenticationRequired(true);
asnSet.getAuthPolicy().setCreatePrincipals(new AsnPrincipals());
asnSet.getAuthPolicy().getCreatePrincipals().add(AsnConstants.PRINCIPAL_ANY);
asnSet.getAuthPolicy().setDeletePrincipals(new AsnPrincipals());
asnSet.getAuthPolicy().getDeletePrincipals().add(AsnConstants.PRINCIPAL_OWNER);
asnSet.getAuthPolicy().getDeletePrincipals().add(AsnConstants.PRINCIPAL_ADMINISTRATOR);
asnSet.getAuthPolicy().setEnableDisablePrincipals(new AsnPrincipals());
asnSet.getAuthPolicy().getEnableDisablePrincipals().add(AsnConstants.PRINCIPAL_ADMINISTRATOR);
asnSet.getAuthPolicy().setUpdatePrincipals(new AsnPrincipals());
asnSet.getAuthPolicy().getUpdatePrincipals().add(AsnConstants.PRINCIPAL_OWNER);
asnSet.getAuthPolicy().setQueryPrincipals(new AsnPrincipals());
asnSet.getAuthPolicy().getQueryPrincipals().add(AsnConstants.PRINCIPAL_ANY);
asnSet.getAuthPolicy().setMultiplePerUserSubjectPredicate(false);
// value type
asnSet.setValueType(new AsnValueType());
asnSet.getValueType().setAnalyzePriorToIndexing(true);
asnSet.getValueType().setMaxCharacters(maxLength);
asnSet.getValueType().setRdfPredicate(asnSet.getURNPrefix());
asnSet.getValueType().setRdfValueField("rdf.comment.value");
asnSet.getValueType().setRequired(true);
asnSet.getValueType().setValueFilterClass(valueFilterClass);
asnSet.getValueType().setValueTypeName(AsnValueType.VALUE_TYPENAME_FREE);
// value
AsnValue asnValue = new AsnValue();
asnValue.setValueType(asnSet.getValueType().duplicate());
// query a comment by assertion id
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnCommentHandler");
op.setSubject(new AsnSubject(asnSet.getAssertionIdPrefix()));
op.setPredicate(new AsnPredicate(actionPfx+":query"));
op.setAuthPolicy(authForRead.duplicate());
ops.add(op);
// query comments associated with a resource
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnCommentHandler");
op.setSubject(new AsnSubject(AsnConstants.SUBJECT_PREFIX_RESOURCEID));
op.setPredicate(new AsnPredicate(actionPfx+":query"));
op.setAuthPolicy(authForRead.duplicate());
ops.add(op);
// create
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnCreateHandler");
op.setSubject(new AsnSubject(AsnConstants.SUBJECT_PREFIX_RESOURCEID));
op.setPredicate(new AsnPredicate(actionPfx+":create"));
op.getAuthPolicy().setMultiplePerUserSubjectPredicate(true);
op.setValue(asnValue.duplicate());
ops.add(op);
// update
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnUpdateHandler");
op.setSubject(new AsnSubject(asnSet.getAssertionIdPrefix()));
op.setPredicate(new AsnPredicate(actionPfx+":update"));
op.setValue(asnValue.duplicate());
ops.add(op);
// delete
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnDeleteHandler");
op.setSubject(new AsnSubject(asnSet.getAssertionIdPrefix()));
op.setPredicate(new AsnPredicate(actionPfx+":delete"));
ops.add(op);
// enable
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnEnableHandler");
op.setSubject(new AsnSubject(asnSet.getAssertionIdPrefix()));
op.setPredicate(new AsnPredicate(actionPfx+":enable"));
ops.add(op);
// disable
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnDisableHandler");
op.setSubject(new AsnSubject(asnSet.getAssertionIdPrefix()));
op.setPredicate(new AsnPredicate(actionPfx+":disable"));
ops.add(op);
// UI resources
op = new AsnOperation(asnSet);
op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnUIResourcesHandler");
op.setSubject(new AsnSubject(asnSet.getURNPrefix()));
op.getSubject().setRequiresValuePart(false);
op.setPredicate(new AsnPredicate(actionPfx+":uiresources"));
op.setAuthPolicy(authForRead.duplicate());
ops.add(op);
AsnProperty uiResources = new AsnProperty(
asnSet.getURNPrefix(),asnSet.getURNPrefix()+":uiresources",null);
op.setUIResources(uiResources);
String pfx = asnSet.getURNPrefix()+":uiresource";
uiResources.getChildren().add(new AsnUIResource(
pfx+":maxLength",null,""+maxLength));
uiResources.getChildren().add(new AsnUIResource(