FileDocCategorySizeDatePackage
CascadeDeleteNotSupportedForManyMany.javaAPI DocGlassfish v2 API3967Fri May 04 22:33:40 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2

CascadeDeleteNotSupportedForManyMany

public class CascadeDeleteNotSupportedForManyMany extends CmrFieldTest
cascade-delete tag is not supported for many-many relationships
author
Sheetal Vartak
version

Fields Summary
Constructors Summary
Methods Summary
protected booleanrunIndividualCmrTest(Descriptor descriptor, RelationRoleDescriptor role, java.lang.Class c, com.sun.enterprise.tools.verifier.Result result)
run an individual verifier test of a declated cmr field of the class

param
entity the descriptor for the entity bean containing the cmp-field
param
info the descriptor for the declared cmr field
param
c the class owning the cmp field
parma
r the result object to use to put the test results in
return
true if the test passed

	boolean isMany = false;
	boolean isPartnerMany = false;
	boolean cascadeDelete = false;
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

	isMany = role.getIsMany();
	isPartnerMany = (role.getPartner()).getIsMany();
	cascadeDelete = role.getCascadeDelete();
	if(isMany && isPartnerMany && cascadeDelete) {
	    addErrorDetails(result, compName);
	    result.addErrorDetails(smh.getLocalString
		   (getClass().getName() + ".failed",
		    "Error: cascade-delete should not be supported for many-many relationships. Please check Relationship Role [{0}]",
	            new Object[] {role.getName()}));
	    return false;
	} else {
	     result.addGoodDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
	    result.addGoodDetails(smh.getLocalString
	           (getClass().getName() + ".passed",
		    "cascade-delete is not supported for many-many relationships. Test passed.",
	            new Object[] {}));
	    return true;
	}