当前位置: 首页>>代码示例>>Java>>正文


Java MaintenanceDocument.getNewMaintainableObject方法代码示例

本文整理汇总了Java中org.kuali.rice.kns.document.MaintenanceDocument.getNewMaintainableObject方法的典型用法代码示例。如果您正苦于以下问题:Java MaintenanceDocument.getNewMaintainableObject方法的具体用法?Java MaintenanceDocument.getNewMaintainableObject怎么用?Java MaintenanceDocument.getNewMaintainableObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kns.document.MaintenanceDocument的用法示例。


在下文中一共展示了MaintenanceDocument.getNewMaintainableObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:KualiMaintenanceDocumentAction.java

示例2: 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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:MaintenanceDocumentRuleBase.java

示例3: validateGlobalBusinessObjectPersistable

import org.kuali.rice.kns.document.MaintenanceDocument; //导入方法依赖的package包/类
/**
 * This method checks whether this maint doc contains Global Business Objects, and if so, whether the GBOs are in a
 * persistable
 * state. This will return false if this method determines that the GBO will cause a SQL Exception when the document
 * is
 * persisted.
 *
 * @param document
 * @return False when the method determines that the contained Global Business Object will cause a SQL Exception,
 *         and the
 *         document should not be saved. It will return True otherwise.
 */
protected boolean validateGlobalBusinessObjectPersistable(MaintenanceDocument document) {
    boolean success = true;

    if (document.getNewMaintainableObject() == null) {
        return success;
    }
    if (document.getNewMaintainableObject().getDataObject() == null) {
        return success;
    }
    if (!(document.getNewMaintainableObject().getDataObject() instanceof GlobalBusinessObject)) {
        return success;
    }

	return ((GlobalBusinessObject) document.getNewMaintainableObject().getDataObject()).isPersistable();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:MaintenanceDocumentRuleBase.java

示例4: 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);
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:MaintenanceDocumentDictionaryServiceImpl.java

示例5: 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);
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:MaintenanceDocumentDictionaryServiceImpl.java

示例6: 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() );
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:KualiMaintenanceDocumentAction.java

示例7: getAllowsCopy

import org.kuali.rice.kns.document.MaintenanceDocument; //导入方法依赖的package包/类
/**
 * @see org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService#getAllowsCopy(MaintenanceDocument)
 */
public Boolean getAllowsCopy(MaintenanceDocument document) {
    Boolean allowsCopy = Boolean.FALSE;
    if (document != null && document.getNewMaintainableObject() != null) {
        MaintenanceDocumentEntry entry = getMaintenanceDocumentEntry(document.getNewMaintainableObject().getBoClass());
        if (entry != null) {
            allowsCopy = Boolean.valueOf(entry.getAllowsCopy());
        }
    }

    return allowsCopy;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:MaintenanceDocumentDictionaryServiceImpl.java

示例8: parseSearchableAttributeValueForPrimaryKey

import org.kuali.rice.kns.document.MaintenanceDocument; //导入方法依赖的package包/类
/**
 * Creates a searchable attribute value for the given property name out of the document XML
 * @param propertyName the name of the property to return
 * @param businessObjectClass the class of the business object maintained
 * @param document the document XML
 * @return a generated SearchableAttributeValue, or null if a value could not be created
 */
protected DocumentAttribute parseSearchableAttributeValueForPrimaryKey(String propertyName, Class<? extends BusinessObject> businessObjectClass, MaintenanceDocument document) {

    Maintainable maintainable  = document.getNewMaintainableObject();
    PersistableBusinessObject bo = maintainable.getBusinessObject();

    final Object propertyValue = ObjectUtils.getPropertyValue(bo, propertyName);
    if (propertyValue == null) return null;

    final WorkflowAttributePropertyResolutionService propertyResolutionService = KNSServiceLocator
            .getWorkflowAttributePropertyResolutionService();
    DocumentAttribute value = propertyResolutionService.buildSearchableAttribute(businessObjectClass, propertyName, propertyValue);
    return value;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:DataDictionarySearchableAttribute.java

示例9: dataDictionaryValidate

import org.kuali.rice.kns.document.MaintenanceDocument; //导入方法依赖的package包/类
/**
 * This method executes the DataDictionary Validation against the document.
 *
 * @param document
 * @return true if it passes DD validation, false otherwise
 */
protected boolean dataDictionaryValidate(MaintenanceDocument document) {
    LOG.debug("MaintenanceDocument validation beginning");

    // explicitly put the errorPath that the dictionaryValidationService
    // requires
    GlobalVariables.getMessageMap().addToErrorPath("document.newMaintainableObject");

    // document must have a newMaintainable object
    Maintainable newMaintainable = document.getNewMaintainableObject();
    if (newMaintainable == null) {
        GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject");
        throw new ValidationException(
                "Maintainable object from Maintenance Document '" + document.getDocumentTitle() +
                        "' is null, unable to proceed.");
    }

    // document's newMaintainable must contain an object (ie, not null)
    Object dataObject = newMaintainable.getDataObject();
    if (dataObject == null) {
        GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject.");
        throw new ValidationException("Maintainable's component business object is null.");
    }

    // if the Maintainable object is a PBO and there is a legacy maintDefinition
    // then use the old validation methods
    if (newBo instanceof PersistableBusinessObject && CollectionUtils.isNotEmpty(maintDocDictionaryService
            .getMaintainableSections(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName()))) {

        BusinessObject businessObject = (BusinessObject) newBo;

        // run required check from maintenance data dictionary
        maintDocDictionaryService.validateMaintenanceRequiredFields(document);

        //check for duplicate entries in collections if necessary
        maintDocDictionaryService.validateMaintainableCollectionsForDuplicateEntries(document);

        // run the DD DictionaryValidation (non-recursive)
        dictionaryValidationService.validateBusinessObjectOnMaintenanceDocument(businessObject,
                document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());

        // do default (ie, mandatory) existence checks
        dictionaryValidationService.validateDefaultExistenceChecks(businessObject);
    } else {
        GlobalVariables.getMessageMap().addToErrorPath("dataObject");

        dictionaryValidationService.validate(newBo);

        GlobalVariables.getMessageMap().removeFromErrorPath("dataObject");
    }

    // explicitly remove the errorPath we've added
    GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject");

    LOG.debug("MaintenanceDocument validation ending");
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:63,代码来源:MaintenanceDocumentRuleBase.java


注:本文中的org.kuali.rice.kns.document.MaintenanceDocument.getNewMaintainableObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。