本文整理汇总了Java中org.kuali.rice.krad.bo.PersistableBusinessObject类的典型用法代码示例。如果您正苦于以下问题:Java PersistableBusinessObject类的具体用法?Java PersistableBusinessObject怎么用?Java PersistableBusinessObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistableBusinessObject类属于org.kuali.rice.krad.bo包,在下文中一共展示了PersistableBusinessObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataObjectIdentifierString
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DataObjectMetaDataService#getDataObjectIdentifierString
*/
@Override
public String getDataObjectIdentifierString(Object dataObject) {
String identifierString = "";
if (dataObject == null) {
identifierString = "Null";
return identifierString;
}
Class<?> dataObjectClass = dataObject.getClass();
// if Legacy and a PersistableBusinessObject or if not Legacy and implement GlobalLyUnique use the object id field
if ((PersistableBusinessObject.class.isAssignableFrom(
dataObjectClass)) || (!LegacyUtils.useLegacyForObject(dataObject) && GloballyUnique.class
.isAssignableFrom(dataObjectClass))) {
String objectId = ObjectPropertyUtils.getPropertyValue(dataObject, UifPropertyPaths.OBJECT_ID);
if (StringUtils.isBlank(objectId)) {
objectId = UUID.randomUUID().toString();
ObjectPropertyUtils.setPropertyValue(dataObject, UifPropertyPaths.OBJECT_ID, objectId);
}
}
return identifierString;
}
示例2: isRowHideableForMaintenanceDocument
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* Determines whether a business object is hidable on a maintenance document. Hidable means that if the user chose to hide the inactive
* elements in the collection in which the passed in BOs reside, then the BOs would be hidden
*
* @param lineBusinessObject the BO in the new maintainable, should be of type {@link BusinessObject} and {@link Inquirable}
* @param oldLineBusinessObject the corresponding BO in the old maintainable, should be of type {@link BusinessObject} and
* {@link Inquirable}
* @return whether the BOs are eligible to be hidden if the user decides to hide them
*/
protected static boolean isRowHideableForMaintenanceDocument(BusinessObject lineBusinessObject, BusinessObject oldLineBusinessObject) {
if (oldLineBusinessObject != null) {
if ( lineBusinessObject instanceof PersistableBusinessObject ) {
if (((PersistableBusinessObject) lineBusinessObject).isNewCollectionRecord()) {
// new records are never hidden, regardless of active status
return false;
}
}
if (!((Inactivatable) lineBusinessObject).isActive() && !((Inactivatable) oldLineBusinessObject).isActive()) {
// records with an old and new collection elements of NOT active are eligible to be hidden
return true;
}
}
return false;
}
示例3: copyParametersToBO
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
protected void copyParametersToBO(Map<String, String> parameters, PersistableBusinessObject newBO) throws Exception{
for (String parmName : parameters.keySet()) {
String propertyValue = parameters.get(parmName);
if (StringUtils.isNotBlank(propertyValue)) {
String propertyName = parmName;
// set value of property in bo
if (PropertyUtils.isWriteable(newBO, propertyName)) {
Class type = ObjectUtils.easyGetPropertyType(newBO, propertyName);
if (type != null && Formatter.getFormatter(type) != null) {
Formatter formatter = Formatter.getFormatter(type);
Object obj = formatter.convertFromPresentationFormat(propertyValue);
ObjectUtils.setObjectProperty(newBO, propertyName, obj.getClass(), obj);
}
else {
ObjectUtils.setObjectProperty(newBO, propertyName, String.class, propertyValue);
}
}
}
}
}
示例4: processCustomAddCollectionLineBusinessRules
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* This overridden method ...
*
* @see org.kuali.rice.krad.rules.MaintenanceDocumentRuleBase#processCustomAddCollectionLineBusinessRules(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.lang.String, org.kuali.rice.krad.bo.PersistableBusinessObject)
*/
@Override
public boolean processCustomAddCollectionLineBusinessRules(
MaintenanceDocument document, String collectionName,
PersistableBusinessObject line) {
boolean isValid = true;
if(getPersonSectionName().equals(collectionName)){
PersonRuleResponsibility pr = (PersonRuleResponsibility)line;
String name = pr.getPrincipalName();
if(!personExists(name)){
isValid &= false;
this.putFieldError(getPersonSectionName(), "error.document.personResponsibilities.principleDoesNotExist");
}
}else if(getGroupSectionName().equals(collectionName)){
GroupRuleResponsibility gr = (GroupRuleResponsibility)line;
if(!groupExists(gr.getNamespaceCode(), gr.getName())){
isValid &= false;
this.putFieldError(getGroupSectionName(), "error.document.personResponsibilities.groupDoesNotExist");
}
}
return isValid;
}
示例5: processInactivationBlockChecking
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的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;
}
示例6: validateDuplicateIdentifierInDataDictionary
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* This method validates that there should only exist one entry in the collection whose
* fields match the fields specified within the duplicateIdentificationFields in the
* maintenance document data dictionary.
* If the duplicateIdentificationFields is not specified in the DD, by default it would
* allow the addition to happen and return true.
* It will return false if it fails the uniqueness validation.
*
* @param document
* @param collectionName
* @param bo
* @return
*/
protected boolean validateDuplicateIdentifierInDataDictionary(MaintenanceDocument document, String collectionName,
PersistableBusinessObject bo) {
boolean valid = true;
Object maintBo = document.getNewMaintainableObject().getDataObject();
Collection maintCollection = (Collection) ObjectUtils.getPropertyValue(maintBo, collectionName);
List<String> duplicateIdentifier = document.getNewMaintainableObject()
.getDuplicateIdentifierFieldsFromDataDictionary(
document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName(), collectionName);
if (duplicateIdentifier.size() > 0) {
List<String> existingIdentifierString = document.getNewMaintainableObject()
.getMultiValueIdentifierList(maintCollection, duplicateIdentifier);
if (document.getNewMaintainableObject()
.hasBusinessObjectExisted(bo, existingIdentifierString, duplicateIdentifier)) {
valid = false;
GlobalVariables.getMessageMap()
.putError(duplicateIdentifier.get(0), RiceKeyConstants.ERROR_DUPLICATE_ELEMENT, "entries in ",
document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
}
}
return valid;
}
示例7: setNewCollectionLineDefaultValues
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
protected void setNewCollectionLineDefaultValues(String collectionName, PersistableBusinessObject addLine) {
PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(addLine);
for (int i = 0; i < descriptors.length; ++i) {
PropertyDescriptor propertyDescriptor = descriptors[i];
String fieldName = propertyDescriptor.getName();
Class propertyType = propertyDescriptor.getPropertyType();
String value = getMaintenanceDocumentDictionaryService().getCollectionFieldDefaultValue(getDocumentTypeName(),
collectionName, fieldName);
if (value != null) {
try {
ObjectUtils.setObjectProperty(addLine, fieldName, propertyType, value);
}
catch (Exception ex) {
LOG.error("Unable to set default property of collection object: " + "\nobject: " + addLine
+ "\nfieldName=" + fieldName + "\npropertyType=" + propertyType + "\nvalue=" + value, ex);
}
}
}
}
示例8: getForeignKeyFieldName
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Override
public String getForeignKeyFieldName(Class businessObjectClass, String attributeName, String targetName) {
String fkName = "";
// first try DD-based relationships
RelationshipDefinition relationshipDefinition = getDictionaryRelationship(businessObjectClass, attributeName);
if (relationshipDefinition != null) {
List<PrimitiveAttributeDefinition> primitives = relationshipDefinition.getPrimitiveAttributes();
for (PrimitiveAttributeDefinition primitiveAttributeDefinition : primitives) {
if (primitiveAttributeDefinition.getTargetName().equals(targetName)) {
fkName = primitiveAttributeDefinition.getSourceName();
break;
}
}
}
// if we can't find anything in the DD, then try the persistence service
if (StringUtils.isBlank(fkName) && PersistableBusinessObject.class.isAssignableFrom(businessObjectClass)
&& getPersistenceStructureService().isPersistable(businessObjectClass)) {
fkName = getPersistenceStructureService().getForeignKeyFieldName(businessObjectClass, attributeName,
targetName);
}
return fkName;
}
示例9: isBusinessObjectAllowedForSave
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* Returns true if the BusinessObjectService should be permitted to save instances of the given PersistableBusinessObject.
* Implementation checks a configuration parameter for class names of PersistableBusinessObjects that shouldn't be allowed
* to be saved.
*/
protected boolean isBusinessObjectAllowedForSave(PersistableBusinessObject bo) {
if (!illegalBusinessObjectsForSaveInitialized) {
synchronized (this) {
boolean applyCheck = true;
String applyCheckValue = ConfigContext.getCurrentContextConfig().getProperty(KRADConstants.Config.APPLY_ILLEGAL_BUSINESS_OBJECT_FOR_SAVE_CHECK);
if (!StringUtils.isEmpty(applyCheckValue)) {
applyCheck = Boolean.valueOf(applyCheckValue);
}
if (applyCheck) {
String illegalBos = ConfigContext.getCurrentContextConfig().getProperty(KRADConstants.Config.ILLEGAL_BUSINESS_OBJECTS_FOR_SAVE);
if (!StringUtils.isEmpty(illegalBos)) {
String[] illegalBosSplit = illegalBos.split(",");
for (String illegalBo : illegalBosSplit) {
illegalBusinessObjectsForSave.add(illegalBo.trim());
}
}
}
}
illegalBusinessObjectsForSaveInitialized = true;
}
return !illegalBusinessObjectsForSave.contains(bo.getClass().getName());
}
示例10: refreshAllNonUpdatingReferences
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
*
* @see org.kuali.rice.krad.service.PersistenceService#refreshAllNonUpdatingReferences(org.kuali.rice.krad.bo.BusinessObject)
*/
@Override
public void refreshAllNonUpdatingReferences(PersistableBusinessObject bo) {
// get the OJB class-descriptor for the bo class
ClassDescriptor classDescriptor = getClassDescriptor(bo.getClass());
// get a list of all reference-descriptors for that class
Vector references = classDescriptor.getObjectReferenceDescriptors();
// walk through all of the reference-descriptors
for (Iterator iter = references.iterator(); iter.hasNext();) {
ObjectReferenceDescriptor reference = (ObjectReferenceDescriptor) iter.next();
// if its NOT an updateable reference, then lets refresh it
if (reference.getCascadingStore() == ObjectReferenceDescriptor.CASCADE_NONE) {
PersistentField persistentField = reference.getPersistentField();
String referenceName = persistentField.getName();
retrieveReferenceObject(bo, referenceName);
}
}
}
示例11: getReferencesForForeignKey
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.PersistenceService#getReferencesForForeignKey(java.lang.Class,
* java.lang.String)
*/
@Override
public Map getReferencesForForeignKey(Class persistableObjectClass, String attributeName) {
Map referenceClasses = new HashMap();
if (PersistableBusinessObject.class.isAssignableFrom(persistableObjectClass)) {
ClassDescriptor classDescriptor = getClassDescriptor(persistableObjectClass);
Vector objectReferences = classDescriptor.getObjectReferenceDescriptors();
for (Iterator iter = objectReferences.iterator(); iter.hasNext();) {
ObjectReferenceDescriptor referenceDescriptor = (ObjectReferenceDescriptor) iter.next();
/*
* iterate through the fk keys for the reference object and if
* matches the attributeName add the class as a reference
*/
FieldDescriptor[] refFkNames = referenceDescriptor.getForeignKeyFieldDescriptors(classDescriptor);
for (int i = 0; i < refFkNames.length; i++) {
FieldDescriptor fkField = refFkNames[i];
if (fkField.getAttributeName().equals(attributeName)) {
referenceClasses.put(referenceDescriptor.getAttributeName(), referenceDescriptor.getItemClass());
}
}
}
}
return referenceClasses;
}
示例12: delete
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Override
@Transactional
public void delete(Object bo) {
// just need to make sure erasure does not cause this method to attempt to process a list argument
if ( bo instanceof List ) {
delete( (List<PersistableBusinessObject>)bo );
} else {
businessObjectDao.delete(bo);
}
}
示例13: retrieveObjectForMaintenance
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* For the edit or copy actions retrieves the record that is to be
* maintained
*
* <p>
* Based on the persistence metadata for the maintenance object class
* retrieves the primary key values from the given request parameters map
* (if the class is persistable). With those key values attempts to find the
* record using the <code>LookupService</code>.
* </p>
*
* @param document - document instance for the maintenance object
* @param requestParameters - Map of parameters from the request
* @return Object the retrieved old object
*/
protected Object retrieveObjectForMaintenance(MaintenanceDocument document,
Map<String, String[]> requestParameters) {
Map<String, String> keyMap =
buildKeyMapFromRequest(requestParameters, document.getNewMaintainableObject().getDataObjectClass());
Object oldDataObject = document.getNewMaintainableObject().retrieveObjectForEditOrCopy(document, keyMap);
if (oldDataObject == null && !document.getOldMaintainableObject().isExternalBusinessObject()) {
throw new RuntimeException(
"Cannot retrieve old record for maintenance document, incorrect parameters passed on maint url: " +
requestParameters);
}
if (document.getOldMaintainableObject().isExternalBusinessObject()) {
if (oldDataObject == null) {
try {
oldDataObject = document.getOldMaintainableObject().getDataObjectClass().newInstance();
} catch (Exception ex) {
throw new RuntimeException(
"External BO maintainable was null and unable to instantiate for old maintainable object.",
ex);
}
}
populateMaintenanceObjectWithCopyKeyValues(KRADUtils.translateRequestParameterMap(requestParameters),
oldDataObject, document.getOldMaintainableObject());
document.getOldMaintainableObject().prepareExternalBusinessObject((PersistableBusinessObject) oldDataObject);
oldDataObject = document.getOldMaintainableObject().getDataObject();
}
return oldDataObject;
}
示例14: testRefreshReferenceObject
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Test
public void testRefreshReferenceObject() throws Exception {
PersistableBusinessObject object = newNonLegacyPersistableBusinessObject();
lda.refreshReferenceObject(object, "blah");
verify(kradLegacyDataAdapter).refreshReferenceObject(eq(object), eq("blah"));
verifyZeroInteractions(knsLegacyDataAdapter);
}
示例15: testRefreshReferenceObject_Legacy
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Test
public void testRefreshReferenceObject_Legacy() throws Exception {
enableLegacy();
PersistableBusinessObject object = newLegacyObject();
lda.refreshReferenceObject(object, "blah");
verify(knsLegacyDataAdapter).refreshReferenceObject(eq(object), eq("blah"));
verifyZeroInteractions(kradLegacyDataAdapter);
}