本文整理汇总了Java中org.kuali.rice.krad.service.KRADServiceLocatorWeb.getInactivationBlockingDetectionService方法的典型用法代码示例。如果您正苦于以下问题:Java KRADServiceLocatorWeb.getInactivationBlockingDetectionService方法的具体用法?Java KRADServiceLocatorWeb.getInactivationBlockingDetectionService怎么用?Java KRADServiceLocatorWeb.getInactivationBlockingDetectionService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.service.KRADServiceLocatorWeb
的用法示例。
在下文中一共展示了KRADServiceLocatorWeb.getInactivationBlockingDetectionService方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processInactivationBlockChecking
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; //导入方法依赖的package包/类
/**
* Given a InactivationBlockingMetadata, which represents a relationship that may block inactivation of a BO, it
* determines whether there
* is a record that violates the blocking definition
*
* @param maintenanceDocument
* @param inactivationBlockingMetadata
* @return true iff, based on the InactivationBlockingMetadata, the maintenance document should be allowed to route
*/
protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument,
InactivationBlockingMetadata inactivationBlockingMetadata) {
String inactivationBlockingDetectionServiceBeanName =
inactivationBlockingMetadata.getInactivationBlockingDetectionServiceBeanName();
if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
inactivationBlockingDetectionServiceBeanName =
KRADServiceLocatorWeb.DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE;
}
InactivationBlockingDetectionService inactivationBlockingDetectionService =
KRADServiceLocatorWeb.getInactivationBlockingDetectionService(
inactivationBlockingDetectionServiceBeanName);
boolean foundBlockingRecord = inactivationBlockingDetectionService.detectBlockingRecord(
newDataObject, inactivationBlockingMetadata);
if (foundBlockingRecord) {
putInactivationBlockingErrorOnPage(maintenanceDocument, inactivationBlockingMetadata);
}
return !foundBlockingRecord;
}
示例2: processInactivationBlockChecking
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; //导入方法依赖的package包/类
/**
* Given a InactivationBlockingMetadata, which represents a relationship that may block inactivation of a BO, it
* determines whether there
* is a record that violates the blocking definition
*
* @param maintenanceDocument
* @param inactivationBlockingMetadata
* @return true iff, based on the InactivationBlockingMetadata, the maintenance document should be allowed to route
*/
protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument,
InactivationBlockingMetadata inactivationBlockingMetadata) {
if (newBo instanceof PersistableBusinessObject) {
String inactivationBlockingDetectionServiceBeanName =
inactivationBlockingMetadata.getInactivationBlockingDetectionServiceBeanName();
if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
inactivationBlockingDetectionServiceBeanName =
KRADServiceLocatorWeb.DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE;
}
InactivationBlockingDetectionService inactivationBlockingDetectionService = KRADServiceLocatorWeb
.getInactivationBlockingDetectionService(inactivationBlockingDetectionServiceBeanName);
boolean foundBlockingRecord = inactivationBlockingDetectionService
.hasABlockingRecord((PersistableBusinessObject) newBo, inactivationBlockingMetadata);
if (foundBlockingRecord) {
putInactivationBlockingErrorOnPage(maintenanceDocument, inactivationBlockingMetadata);
}
return !foundBlockingRecord;
}
return true;
}
示例3: listAllBlockerRecords
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; //导入方法依赖的package包/类
@Override
public List<String> listAllBlockerRecords(BusinessObject blockedBo, InactivationBlockingMetadata inactivationBlockingMetadata) {
String inactivationBlockingDetectionServiceBeanName = inactivationBlockingMetadata.getInactivationBlockingDetectionServiceBeanName();
if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
inactivationBlockingDetectionServiceBeanName = KRADServiceLocatorWeb.DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE;
}
InactivationBlockingDetectionService inactivationBlockingDetectionService = KRADServiceLocatorWeb
.getInactivationBlockingDetectionService(inactivationBlockingDetectionServiceBeanName);
Collection<BusinessObject> collection = inactivationBlockingDetectionService.listAllBlockerRecords(blockedBo, inactivationBlockingMetadata);
Map<String, Formatter> formatters = getFormattersForPrimaryKeyFields(inactivationBlockingMetadata.getBlockingReferenceBusinessObjectClass());
List<String> displayValues = new ArrayList<String>();
List<String> pkFieldNames = getLegacyDataAdapter().listPrimaryKeyFieldNames(inactivationBlockingMetadata.getBlockingReferenceBusinessObjectClass());
Person user = GlobalVariables.getUserSession().getPerson();
for (BusinessObject element : collection) {
StringBuilder buf = new StringBuilder();
// the following method will return a restriction for all DD-defined attributes
BusinessObjectRestrictions businessObjectRestrictions = getBusinessObjectAuthorizationService().getLookupResultRestrictions(element, user);
for (int i = 0; i < pkFieldNames.size(); i++) {
String pkFieldName = pkFieldNames.get(i);
Object value = KradDataServiceLocator.getDataObjectService().wrap(element).getPropertyValueNullSafe(pkFieldName);
String displayValue = null;
if (!businessObjectRestrictions.hasRestriction(pkFieldName)) {
Formatter formatter = formatters.get(pkFieldName);
if (formatter != null) {
displayValue = (String) formatter.format(value);
}
else {
displayValue = String.valueOf(value);
}
}
else {
FieldRestriction fieldRestriction = businessObjectRestrictions.getFieldRestriction(pkFieldName);
if (fieldRestriction.isMasked() || fieldRestriction.isPartiallyMasked()) {
MaskFormatter maskFormatter = fieldRestriction.getMaskFormatter();
displayValue = maskFormatter.maskValue(value);
}
else {
// there was a restriction, but we did not know how to obey it.
LOG.warn("Restriction was defined for class: " + element.getClass() + " field name: " + pkFieldName + ", but it was not honored by the inactivation blocking display framework");
}
}
buf.append(displayValue);
if (i < pkFieldNames.size() - 1) {
buf.append(" - ");
}
}
displayValues.add(buf.toString());
}
return displayValues;
}
示例4: displayAllBlockingRecords
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; //导入方法依赖的package包/类
@Override
public List<String> displayAllBlockingRecords(Object blockedBo, InactivationBlockingMetadata inactivationBlockingMetadata) {
String inactivationBlockingDetectionServiceBeanName = inactivationBlockingMetadata.getInactivationBlockingDetectionServiceBeanName();
if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
inactivationBlockingDetectionServiceBeanName = KRADServiceLocatorWeb.DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE;
}
InactivationBlockingDetectionService inactivationBlockingDetectionService = KRADServiceLocatorWeb
.getInactivationBlockingDetectionService(inactivationBlockingDetectionServiceBeanName);
Collection<?> collection = inactivationBlockingDetectionService.detectAllBlockingRecords(blockedBo, inactivationBlockingMetadata);
Map<String, Formatter> formatters = getFormattersForPrimaryKeyFields(inactivationBlockingMetadata.getBlockingReferenceBusinessObjectClass());
List<String> displayValues = new ArrayList<String>();
List<String> pkFieldNames = getLegacyDataAdapter().listPrimaryKeyFieldNames(inactivationBlockingMetadata.getBlockingReferenceBusinessObjectClass());
Person user = GlobalVariables.getUserSession().getPerson();
for (Object element : collection) {
StringBuilder buf = new StringBuilder();
// the following method will return a restriction for all DD-defined attributes
BusinessObjectRestrictions businessObjectRestrictions = getBusinessObjectAuthorizationService().getLookupResultRestrictions(element, user);
for (int i = 0; i < pkFieldNames.size(); i++) {
String pkFieldName = pkFieldNames.get(i);
Object value = KradDataServiceLocator.getDataObjectService().wrap(element).getPropertyValueNullSafe(pkFieldName);
String displayValue = null;
if (!businessObjectRestrictions.hasRestriction(pkFieldName)) {
Formatter formatter = formatters.get(pkFieldName);
if (formatter != null) {
displayValue = (String) formatter.format(value);
}
else {
displayValue = String.valueOf(value);
}
}
else {
FieldRestriction fieldRestriction = businessObjectRestrictions.getFieldRestriction(pkFieldName);
if (fieldRestriction.isMasked() || fieldRestriction.isPartiallyMasked()) {
MaskFormatter maskFormatter = fieldRestriction.getMaskFormatter();
displayValue = maskFormatter.maskValue(value);
}
else {
// there was a restriction, but we did not know how to obey it.
LOG.warn("Restriction was defined for class: " + element.getClass() + " field name: " + pkFieldName + ", but it was not honored by the inactivation blocking display framework");
}
}
buf.append(displayValue);
if (i < pkFieldNames.size() - 1) {
buf.append(" - ");
}
}
displayValues.add(buf.toString());
}
return displayValues;
}