2.过滤

过滤 代码

import java.util.Locale;

import wt.org.WTPrincipal;
import wt.session.SessionHelper;
import wt.util.WTException;

import com.ptc.core.ui.validation.DefaultUIComponentValidator;
import com.ptc.core.ui.validation.UIValidationCriteria;
import com.ptc.core.ui.validation.UIValidationKey;
import com.ptc.core.ui.validation.UIValidationResult;
import com.ptc.core.ui.validation.UIValidationResultSet;
import com.ptc.core.ui.validation.UIValidationStatus;

public class UIComponentValidator extends DefaultUIComponentValidator {

public UIValidationResultSet performFullPreValidation(UIValidationKey validationKey,
UIValidationCriteria arg1, Locale arg2) {
UIValidationResultSet resultSet = new UIValidationResultSet();
WTPrincipal wtp = null;
try {
wtp = SessionHelper.manager.getPrincipal();
} catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if ( (wtp.getName()).equals( "Administrator" ) ) {
System.out.println( "Administrator");
resultSet.addResult(new UIValidationResult(validationKey, UIValidationStatus.ENABLED));
} else {
resultSet.addResult(new UIValidationResult(validationKey, UIValidationStatus.DISABLED)); //hidden是对其隐藏                                                                         而DISABLED是看的见不能用
}
return resultSet;
}
     
}


命令//xconfmanager -s wt.services/svc/default/com.ptc.core.ui.validation.UIComponentValidator/test/null/0=ext.code.UIComponentValidator/duplicate -t codebase/service.properties -p

你可能感兴趣的:(过滤)