本文整理汇总了Java中org.kuali.rice.kns.document.MaintenanceDocument类的典型用法代码示例。如果您正苦于以下问题:Java MaintenanceDocument类的具体用法?Java MaintenanceDocument怎么用?Java MaintenanceDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaintenanceDocument类属于org.kuali.rice.kns.document包,在下文中一共展示了MaintenanceDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleInactiveRecordDisplay
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Turns on (or off) the inactive record display for a maintenance collection.
*/
public ActionForward toggleInactiveRecordDisplay(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) form;
MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();
Maintainable oldMaintainable = document.getOldMaintainableObject();
Maintainable newMaintainable = document.getNewMaintainableObject();
String collectionName = extractCollectionName(request, KRADConstants.TOGGLE_INACTIVE_METHOD);
if (collectionName == null) {
LOG.error("Unable to get find collection name in request.");
throw new RuntimeException("Unable to get find collection class in request.");
}
String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE);
boolean showInactive = Boolean.parseBoolean(StringUtils.substringBetween(parameterName, KRADConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL, "."));
oldMaintainable.setShowInactiveRecords(collectionName, showInactive);
newMaintainable.setShowInactiveRecords(collectionName, showInactive);
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
示例2: clearPrimaryKeyFields
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* This method clears the value of the primary key fields on a Business Object.
*
* @param document - document to clear the pk fields on
*/
protected void clearPrimaryKeyFields(MaintenanceDocument document) {
// get business object being maintained and its keys
PersistableBusinessObject bo = document.getNewMaintainableObject().getBusinessObject();
List<String> keyFieldNames = KRADServiceLocatorWeb.getLegacyDataAdapter().listPrimaryKeyFieldNames(bo.getClass());
for (String keyFieldName : keyFieldNames) {
try {
ObjectUtils.setObjectProperty(bo, keyFieldName, null);
}
catch (Exception e) {
LOG.error("Unable to clear primary key field: " + e.getMessage());
throw new RuntimeException("Unable to clear primary key field: " + e.getMessage());
}
}
bo.setObjectId(null);
bo.setVersionNumber(new Long(1));
}
示例3: processInactivationBlockChecking
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Determines whether this document has been inactivation blocked
*
* @param maintenanceDocument
* @return true iff there is NOTHING that blocks this record
*/
protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument) {
if (isDocumentInactivatingBusinessObject(maintenanceDocument)) {
Class boClass = maintenanceDocument.getNewMaintainableObject().getDataObjectClass();
Set<InactivationBlockingMetadata> inactivationBlockingMetadatas =
ddService.getAllInactivationBlockingDefinitions(boClass);
if (inactivationBlockingMetadatas != null) {
for (InactivationBlockingMetadata inactivationBlockingMetadata : inactivationBlockingMetadatas) {
// for the purposes of maint doc validation, we only need to look for the first blocking record
// we found a blocking record, so we return false
if (!processInactivationBlockChecking(maintenanceDocument, inactivationBlockingMetadata)) {
return false;
}
}
}
}
return true;
}
示例4: validateMaintenanceDocument
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* This method checks to make sure the document is a valid maintenanceDocument, and has the necessary values
* populated such that
* it will not cause exceptions in later routing or business rules testing.
*
* This is not a business rules test.
*
* @param maintenanceDocument - document to be tested
* @return whether maintenance doc passes
* @throws org.kuali.rice.krad.exception.ValidationException
*
*/
protected boolean validateMaintenanceDocument(MaintenanceDocument maintenanceDocument) {
boolean success = true;
Maintainable newMaintainable = maintenanceDocument.getNewMaintainableObject();
// document must have a newMaintainable object
if (newMaintainable == null) {
throw new ValidationException(
"Maintainable object from Maintenance Document '" + maintenanceDocument.getDocumentTitle() +
"' is null, unable to proceed.");
}
// document's newMaintainable must contain an object (ie, not null)
if (newMaintainable.getDataObject() == null) {
throw new ValidationException("Maintainable's component data object is null.");
}
return success;
}
示例5: setupBaseConvenienceObjects
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.rules.MaintenanceDocumentRule#setupBaseConvenienceObjects(org.kuali.rice.krad.maintenance.MaintenanceDocument)
*/
public void setupBaseConvenienceObjects(MaintenanceDocument document) {
// setup oldAccount convenience objects, make sure all possible sub-objects are populated
oldBo = document.getOldMaintainableObject().getDataObject();
if (oldBo != null && oldBo instanceof PersistableBusinessObject) {
((PersistableBusinessObject) oldBo).refreshNonUpdateableReferences();
}
// setup newAccount convenience objects, make sure all possible sub-objects are populated
newBo = document.getNewMaintainableObject().getDataObject();
if (newBo instanceof PersistableBusinessObject) {
((PersistableBusinessObject) newBo).refreshNonUpdateableReferences();
}
boClass = document.getNewMaintainableObject().getDataObjectClass();
// call the setupConvenienceObjects in the subclass, if a subclass exists
setupConvenienceObjects();
}
示例6: processAfterCopy
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Set the new collection records back to true so they can be deleted (copy
* should act like new)
*
* @see KualiMaintainableImpl#processAfterCopy()
*/
@Override
public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> parameters) {
try {
// This was the only remaining use of this method, as the operation with the wrapper
// below is not necessarily safe to use in all situations, I am calling it here
// from within the document code where we know it's safe:
KradDataServiceLocator.getDataObjectService().wrap(businessObject).materializeReferencedObjectsToDepth(2
, MaterializeOption.COLLECTIONS, MaterializeOption.UPDATE_UPDATABLE_REFS);
KRADServiceLocatorWeb.getLegacyDataAdapter().setObjectPropertyDeep(businessObject, KRADPropertyConstants.NEW_COLLECTION_RECORD,
boolean.class, true);
// ObjectUtils.setObjectPropertyDeep(businessObject, KRADPropertyConstants.NEW_COLLECTION_RECORD,
// boolean.class, true, 2);
} catch (Exception e) {
LOG.error("unable to set newCollectionRecord property: " + e.getMessage(), e);
throw new RuntimeException("unable to set newCollectionRecord property: " + e.getMessage(), e);
}
}
示例7: validateMaintenanceRequiredFields
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* @see org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService#validateMaintenanceRequiredFields(org.kuali.rice.krad.maintenance.MaintenanceDocument)
*/
public void validateMaintenanceRequiredFields(MaintenanceDocument document) {
Maintainable newMaintainableObject = document.getNewMaintainableObject();
if (newMaintainableObject == null) {
LOG.error("New maintainable is null");
throw new RuntimeException("New maintainable is null");
}
List<MaintainableSectionDefinition> maintainableSectionDefinitions = getMaintainableSections(getDocumentTypeName(newMaintainableObject.getBoClass()));
for (MaintainableSectionDefinition maintainableSectionDefinition : maintainableSectionDefinitions) {
for (MaintainableItemDefinition maintainableItemDefinition : maintainableSectionDefinition.getMaintainableItems()) {
// validate fields
if (maintainableItemDefinition instanceof MaintainableFieldDefinition) {
validateMaintainableFieldRequiredFields((MaintainableFieldDefinition) maintainableItemDefinition, newMaintainableObject.getBusinessObject(), maintainableItemDefinition.getName());
}
// validate collections
else if (maintainableItemDefinition instanceof MaintainableCollectionDefinition) {
validateMaintainableCollectionsRequiredFields(newMaintainableObject.getBusinessObject(), (MaintainableCollectionDefinition) maintainableItemDefinition);
}
}
}
}
示例8: validateMaintainableCollectionsAddLineRequiredFields
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* calls code to generate error messages if maintainableFields within any collections or sub-collections are marked as required
*
* @param document
* @param businessObject
* @param collectionName
* @param maintainableCollectionDefinition
* @param depth
*/
private void validateMaintainableCollectionsAddLineRequiredFields(MaintenanceDocument document, PersistableBusinessObject businessObject, String collectionName, MaintainableCollectionDefinition maintainableCollectionDefinition, int depth) {
if ( depth == 0 ) {
GlobalVariables.getMessageMap().addToErrorPath("add");
}
// validate required fields on fields withing collection definition
PersistableBusinessObject element = document.getNewMaintainableObject().getNewCollectionLine( collectionName );
GlobalVariables.getMessageMap().addToErrorPath(collectionName);
for (MaintainableFieldDefinition maintainableFieldDefinition : maintainableCollectionDefinition.getMaintainableFields()) {
final String fieldName = maintainableFieldDefinition.getName();
validateMaintainableFieldRequiredFields(maintainableFieldDefinition, element, fieldName);
}
GlobalVariables.getMessageMap().removeFromErrorPath(collectionName);
if ( depth == 0 ) {
GlobalVariables.getMessageMap().removeFromErrorPath("add");
}
}
示例9: createNewKualiMaintenanceForm
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Creates a KualiMaintenanceForm with the given rule template inside of its RuleBaseValues instance.
*
* @param rtName The rule template to use.
*/
private void createNewKualiMaintenanceForm(String rtName) {
// Initialize the required variables.
final KualiMaintenanceForm kmForm = new KualiMaintenanceForm();
final MaintenanceDocument maintDoc = new MaintenanceDocumentBase();
final Maintainable oldMaint = new RoutingRuleMaintainable();
final Maintainable newMaint = new RoutingRuleMaintainable();
final RuleBaseValues rbValues = new RuleBaseValues();
// Setup the rule base and the maintainables.
rbValues.setRuleTemplate(KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName(rtName));
oldMaint.setBusinessObject(rbValues);
oldMaint.setBoClass(rbValues.getClass());
newMaint.setBusinessObject(rbValues);
newMaint.setBoClass(rbValues.getClass());
// Setup the maintenance document and the maintenance form.
maintDoc.setOldMaintainableObject(oldMaint);
maintDoc.setNewMaintainableObject(newMaint);
kmForm.setDocument(maintDoc);
KNSGlobalVariables.setKualiForm(kmForm);
}
示例10: getSections
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Override the getSections method on this maintainable so that the Section Containing the various Rule Attributes
* can be dynamically generated based on the RuleTemplate which is selected.
*/
@Override
public List getSections(MaintenanceDocument document, Maintainable oldMaintainable) {
// since the child lists are not repopulated upon loading the objects, we need to re-load them manually so the section
// generation functions.
if ( getNewRule(document) != null ) {
getNewRule(document).setRuleTemplate( getDataObjectService().find(RuleTemplateBo.class, getNewRule(document).getRuleTemplateId() ) );
}
if ( getOldRule(document) != null ) {
getOldRule(document).setRuleTemplate( getDataObjectService().find(RuleTemplateBo.class, getOldRule(document).getRuleTemplateId() ) );
}
List<Section> sections = super.getSections(document, oldMaintainable);
return WebRuleUtils.customizeSections(getThisRule(), sections, false);
}
示例11: validateMaintainableCollectionsForDuplicateEntries
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* default implementation checks for duplicats based on keys of objects only
*
* @see org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService#validateMaintainableCollectionsForDuplicateEntries(org.kuali.rice.krad.maintenance.MaintenanceDocument)
*/
public void validateMaintainableCollectionsForDuplicateEntries(MaintenanceDocument document) {
Maintainable newMaintainableObject = document.getNewMaintainableObject();
if (newMaintainableObject == null) {
LOG.error("New maintainable is null");
throw new RuntimeException("New maintainable is null");
}
List<MaintainableSectionDefinition> maintainableSectionDefinitions = getMaintainableSections(getDocumentTypeName(newMaintainableObject.getBoClass()));
for (MaintainableSectionDefinition maintainableSectionDefinition : maintainableSectionDefinitions) {
for (MaintainableItemDefinition maintainableItemDefinition : maintainableSectionDefinition.getMaintainableItems()) {
// validate collections
if (maintainableItemDefinition instanceof MaintainableCollectionDefinition) {
validateMaintainableCollectionsForDuplicateEntries(newMaintainableObject.getBusinessObject(), (MaintainableCollectionDefinition) maintainableItemDefinition);
}
}
}
}
示例12: processAfterCopy
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Pre-populates the ID field of the new PermissionBo to be created.
*
* @see org.kuali.rice.kns.maintenance.KualiMaintainableImpl#saveBusinessObject()
*/
@Override
public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> parameters) {
super.processAfterCopy(document,parameters);
GenericPermissionBo permissionBo = (GenericPermissionBo) document.getNewMaintainableObject().getDataObject();
initializePermissionId(permissionBo);
permissionBo.setVersionNumber(null);
}
示例13: docHandler
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* Handles creating and loading of documents.
*/
@Override
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward af = super.docHandler(mapping, form, request, response);
if (af.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME))
{
return af;
}
KualiMaintenanceForm kualiMaintenanceForm = (KualiMaintenanceForm) form;
if (KewApiConstants.ACTIONLIST_COMMAND.equals(kualiMaintenanceForm.getCommand()) || KewApiConstants.DOCSEARCH_COMMAND.equals(kualiMaintenanceForm.getCommand()) || KewApiConstants.SUPERUSER_COMMAND.equals(kualiMaintenanceForm.getCommand()) || KewApiConstants.HELPDESK_ACTIONLIST_COMMAND.equals(kualiMaintenanceForm.getCommand()) && kualiMaintenanceForm.getDocId() != null) {
if (kualiMaintenanceForm.getDocument() instanceof MaintenanceDocument) {
kualiMaintenanceForm.setReadOnly(true);
kualiMaintenanceForm.setMaintenanceAction(((MaintenanceDocument) kualiMaintenanceForm.getDocument()).getNewMaintainableObject().getMaintenanceAction());
//Retrieving the FileName from BO table
Maintainable tmpMaintainable = ((MaintenanceDocument) kualiMaintenanceForm.getDocument()).getNewMaintainableObject();
if(tmpMaintainable.getBusinessObject() instanceof PersistableAttachment) {
PersistableAttachment bo = (PersistableAttachment) getBusinessObjectService().retrieve(tmpMaintainable.getBusinessObject());
if (bo != null) {
request.setAttribute("fileName", bo.getFileName());
}
}
}
else {
LOG.error("Illegal State: document is not a maintenance document");
throw new IllegalArgumentException("Document is not a maintenance document");
}
}
else if (KewApiConstants.INITIATE_COMMAND.equals(kualiMaintenanceForm.getCommand())) {
kualiMaintenanceForm.setReadOnly(false);
return setupMaintenance(mapping, form, request, response, KRADConstants.MAINTENANCE_NEW_ACTION);
}
else {
LOG.error("We should never have gotten to here");
throw new IllegalArgumentException("docHandler called with invalid parameters");
}
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
示例14: clearUnauthorizedNewFields
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* This method is used as part of the Copy functionality, to clear any field values that the user making the copy does not have
* permissions to modify. This will prevent authorization errors on a copy.
*
* @param document - document to be adjusted
*/
protected void clearUnauthorizedNewFields(MaintenanceDocument document) {
// get a reference to the current user
Person user = GlobalVariables.getUserSession().getPerson();
// get a new instance of MaintenanceDocumentAuthorizations for this context
MaintenanceDocumentRestrictions maintenanceDocumentRestrictions = getBusinessObjectAuthorizationService().getMaintenanceDocumentRestrictions(document, user);
document.getNewMaintainableObject().clearBusinessObjectOfRestrictedValues(maintenanceDocumentRestrictions);
}
示例15: doProcessingAfterPost
import org.kuali.rice.kns.document.MaintenanceDocument; //导入依赖的package包/类
/**
* This method does all special processing on a document that should happen on each HTTP post (ie, save, route, approve, etc).
*
* @param form
*/
@SuppressWarnings("unchecked")
protected void doProcessingAfterPost( KualiForm form, HttpServletRequest request ) {
MaintenanceDocument document = (MaintenanceDocument) ((KualiMaintenanceForm)form).getDocument();
Maintainable maintainable = document.getNewMaintainableObject();
Object bo = maintainable.getBusinessObject();
getBusinessObjectService().linkUserFields(bo);
maintainable.processAfterPost(document, request.getParameterMap() );
}