本文整理汇总了Java中org.kuali.rice.krad.bo.PersistableBusinessObject类的典型用法代码示例。如果您正苦于以下问题:Java PersistableBusinessObject类的具体用法?Java PersistableBusinessObject怎么用?Java PersistableBusinessObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistableBusinessObject类属于org.kuali.rice.krad.bo包,在下文中一共展示了PersistableBusinessObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:KNSLegacyDataAdapterImpl.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:SectionBridge.java
示例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);
}
}
}
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:KualiMaintenanceDocumentAction.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:RoutingRuleMaintainableBusRule.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:34,代码来源:MaintenanceDocumentRuleBase.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:MaintenanceDocumentRuleBase.java
示例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);
}
}
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:KualiMaintainableImpl.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:BusinessObjectMetaDataServiceImpl.java
示例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());
}
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:BusinessObjectServiceImpl.java
示例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);
}
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:PersistenceServiceOjbImpl.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:PersistenceStructureServiceOjbImpl.java
示例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);
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:BusinessObjectServiceImpl.java
示例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;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:48,代码来源:MaintenanceDocumentServiceImpl.java
示例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);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:LegacyDataAdapterImplTest.java
示例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);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:LegacyDataAdapterImplTest.java
示例16: testGetReferenceIfExists
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Test
public void testGetReferenceIfExists() throws Exception {
PersistableBusinessObject object = newNonLegacyPersistableBusinessObject();
lda.getReferenceIfExists(object, "blah");
verify(kradLegacyDataAdapter).getReferenceIfExists(eq(object), eq("blah"));
verifyZeroInteractions(knsLegacyDataAdapter);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:LegacyDataAdapterImplTest.java
示例17: validateBusinessObjectForSave
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
protected void validateBusinessObjectForSave(PersistableBusinessObject bo) {
if (bo == null) {
throw new IllegalArgumentException("Object passed in is null");
}
if (!isBusinessObjectAllowedForSave(bo)) {
throw new IllegalArgumentException("Object passed in is a BusinessObject but has been restricted from save operations according to configuration parameter '" + KRADConstants.Config.ILLEGAL_BUSINESS_OBJECTS_FOR_SAVE);
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:BusinessObjectServiceImpl.java
示例18: testAllForeignKeyValuesPopulatedForReference
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Test
public void testAllForeignKeyValuesPopulatedForReference() throws Exception {
PersistableBusinessObject object = newNonLegacyPersistableBusinessObject();
lda.allForeignKeyValuesPopulatedForReference(object, "blah");
verify(kradLegacyDataAdapter).allForeignKeyValuesPopulatedForReference(eq(object), eq("blah"));
verifyZeroInteractions(knsLegacyDataAdapter);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:LegacyDataAdapterImplTest.java
示例19: countObjectsWithIdentitcalKey
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
/**
* Compares a business object with a Collection of {@link PersistableBusinessObject}s to count how many have the
* same key as the BO.
*
* @param collection - The collection of items to check
* @param bo - The BO whose keys we are looking for in the collection
* @return how many have the same keys
*/
public static int countObjectsWithIdentitcalKey(Collection<? extends PersistableBusinessObject> collection,
PersistableBusinessObject bo) {
// todo: genericize collectionContainsObjectWithIdentitcalKey() to leverage this method?
int n = 0;
for (PersistableBusinessObject item : collection) {
if (equalByKeys(item, bo)) {
n++;
}
}
return n;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:ObjectUtils.java
示例20: prepClassDescriptor
import org.kuali.rice.krad.bo.PersistableBusinessObject; //导入依赖的package包/类
@Override
public void prepClassDescriptor(Class<? extends PersistableBusinessObject> businessObjectClass, Set<String> attributeNames) {
ClassDescriptor classDescriptor = getClassDescriptor(businessObjectClass);
for (String attributeName : attributeNames) {
classDescriptor.getFieldDescriptorByName(attributeName).setFieldConversionClassName(
FieldConversionDefaultImpl.class.getName());
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:PostDataLoadEncryptionServiceImpl.java
注:本文中的org.kuali.rice.krad.bo.PersistableBusinessObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论