本文整理汇总了Java中org.kuali.rice.coreservice.api.parameter.Parameter类的典型用法代码示例。如果您正苦于以下问题:Java Parameter类的具体用法?Java Parameter怎么用?Java Parameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parameter类属于org.kuali.rice.coreservice.api.parameter包,在下文中一共展示了Parameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
@RequestMapping(params = "methodToCall=update")
public ModelAndView update(@ModelAttribute("KualiForm") UifFormBase form) {
ParameterForm parameterForm = (ParameterForm) form;
String applicationId = KRADConstants.DEFAULT_PARAMETER_APPLICATION_ID;
String namespaceCode = parameterForm.getNamespaceCode();
String componentCode = parameterForm.getComponentCode();
String parameterName = parameterForm.getParameterName();
Parameter parameter = null;
if (StringUtils.isNotBlank(applicationId) && StringUtils.isNotBlank(namespaceCode)
&& StringUtils.isNotBlank(componentCode) && StringUtils.isNotBlank(parameterName)) {
ParameterKey key = ParameterKey.create(applicationId, namespaceCode, componentCode, parameterName);
parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(key);
}
if (parameter != null) {
Parameter.Builder builder = Parameter.Builder.create(parameter);
builder.setValue(parameterForm.getParameterValue());
CoreServiceApiServiceLocator.getParameterRepositoryService().updateParameter(builder.build());
}
return getModelAndView(form);
}
示例2: testRetrieveParameter
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
@Test
/**
* tests {@link org.kuali.rice.coreservice.framework.parameter.ParameterService#getParameter(String, String, String)}
*/
public void testRetrieveParameter() throws Exception {
String namespaceCode = "KR-NS";
String parameterDetailTypeCode = "Lookup";
String parameterName = "RESULTS_LIMIT";
String parameterValue = "200";
Parameter resultsLimitParam = CoreFrameworkServiceLocator.getParameterService().getParameter(namespaceCode, parameterDetailTypeCode, parameterName);
assertNotNull("RESULTS_LIMIT should be non-null", resultsLimitParam);
assertEquals(parameterValue, resultsLimitParam.getValue());
String detailType = resultsLimitParam.getComponentCode();
assertNotNull("Should have a detail type: " + detailType);
}
示例3: getRecordsPerPage
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
public int getRecordsPerPage() {
if ( recordsPerPage == -1 ) {
Parameter param = CoreFrameworkServiceLocator.getParameterService().getParameter(KimConstants.NAMESPACE_CODE, KRADConstants.DetailTypes.DOCUMENT_DETAIL_TYPE, MAX_MEMBERS_PER_PAGE_PARM);
if ( param != null ) {
try {
recordsPerPage = Integer.parseInt( param.getValue() );
} catch ( NumberFormatException ex ) {
LOG.error( "Unable to parse parameter " + KimConstants.NAMESPACE_CODE+"/"+ KRADConstants.DetailTypes.DOCUMENT_DETAIL_TYPE+"/"+MAX_MEMBERS_PER_PAGE_PARM + "(+"+param.getValue()+") as an int - defaulting to 1." );
recordsPerPage = 1;
}
} else {
LOG.error( "Unable to find " + KimConstants.NAMESPACE_CODE+"/"+ KRADConstants.DetailTypes.DOCUMENT_DETAIL_TYPE+"/"+MAX_MEMBERS_PER_PAGE_PARM + " - defaulting to 1." );
recordsPerPage = 1;
}
}
return recordsPerPage;
}
示例4: testParameterServiceImpl
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
@Test
public void testParameterServiceImpl() throws Exception{
setupParameterBoDataObjectAndSave();
ParameterKey parameterKey = ParameterKey.create(APP_ID, "TST_NM_SPACE", "TST", "TST_PARAM");
Parameter parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().
getParameter(parameterKey);
assertTrue("Parameter fetched correctly after save", parameter != null &&
StringUtils.equals(parameter.getName(),"TST_PARAM"));
String value = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameterValueAsString(parameterKey);
assertTrue("Parameter value fetched correctly", StringUtils.equals(parameter.getValue(),value));
ParameterBo modifiedParam = ParameterBo.from(parameter);
modifiedParam.setValue("new value");
CoreServiceApiServiceLocator.getParameterRepositoryService().updateParameter(ParameterBo.to(modifiedParam));
value = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameterValueAsString(parameterKey);
assertTrue("Parameter value fetched correctly", StringUtils.equals(modifiedParam.getValue(),value));
}
示例5: createParameter
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
@Override
@Transactional
public Parameter createParameter(Parameter parameter) {
if (parameter == null) {
throw new RiceIllegalArgumentException("parameter is null");
}
final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName());
final Parameter existing = getParameter(key);
if (existing != null && existing.getApplicationId().equals(parameter.getApplicationId())) {
throw new RiceIllegalStateException("the parameter to create already exists: " + parameter);
}
//Parameter flush needed here to accomodate the fact that the version number is not set until flush
//and the immediate transform of the object loses its JPA context
ParameterBo parameterBo = getDataObjectService().save(ParameterBo.from(parameter), PersistenceOption.FLUSH);
return ParameterBo.to(parameterBo);
}
示例6: updateParameter
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
@Override
@Transactional
public Parameter updateParameter(Parameter parameter) {
if (parameter == null) {
throw new RiceIllegalArgumentException("parameter is null");
}
final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName());
final Parameter existing = getParameter(key);
if (existing == null) {
throw new RiceIllegalStateException("the parameter does not exist: " + parameter);
}
final Parameter toUpdate;
if (!existing.getApplicationId().equals(parameter.getApplicationId())) {
final Parameter.Builder builder = Parameter.Builder.create(parameter);
builder.setApplicationId(existing.getApplicationId());
toUpdate = builder.build();
} else {
toUpdate = parameter;
}
return ParameterBo.to(getDataObjectService().save(ParameterBo.from(toUpdate)));
}
示例7: findParameters
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
@Override
public ParameterQueryResults findParameters(QueryByCriteria queryByCriteria) {
if (queryByCriteria == null) {
throw new RiceIllegalArgumentException("queryByCriteria is null");
}
QueryResults<ParameterBo> results = dataObjectService.findMatching(ParameterBo.class, queryByCriteria);
ParameterQueryResults.Builder builder = ParameterQueryResults.Builder.create();
builder.setMoreResultsAvailable(results.isMoreResultsAvailable());
builder.setTotalRowCount(results.getTotalRowCount());
final List<Parameter> ims = new ArrayList<Parameter>();
for (ParameterBo bo : results.getResults()) {
ims.add(ParameterBo.to(bo));
}
builder.setResults(ims);
return builder.build();
}
示例8: initialize
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public synchronized void initialize() {
checkState(!initialized, "Already initialized");
parameterService = CoreFrameworkServiceLocator.getParameterService();
Optional<Parameter> parameter = Optional.fromNullable(parameterService.getParameter(namespace, component, name));
if (!parameter.isPresent() && runOnMissingParameter) {
parameter = Optional.of(createParameter());
}
runonce = isRunOnce(parameter);
showConfig(parameter);
initialized = true;
}
示例9: lockUnlockDocuments
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
private void lockUnlockDocuments(boolean locked) {
for (String documentType : lockedDocuments) {
Class<? extends Document> documentClass = dataDictionaryService.getDocumentClassByTypeName(documentType);
if (parameterService.parameterExists(documentClass, OLEConstants.DOCUMENT_LOCKOUT_PARM_NM)) {
Parameter existingParam = parameterService.getParameter(documentClass, OLEConstants.DOCUMENT_LOCKOUT_PARM_NM);
Parameter.Builder updatedParam = Builder.create(existingParam);
updatedParam.setValue(locked ? "Y" : "N");
parameterService.updateParameter(updatedParam.build());
} else {
String namespace = KRADServiceLocatorWeb.getKualiModuleService().getNamespaceCode(documentClass);
String detailType = KRADServiceLocatorWeb.getKualiModuleService().getComponentCode(documentClass);
Parameter.Builder newParam = Builder.create(OLEConstants.APPLICATION_NAMESPACE_CODE, namespace, detailType, OLEConstants.DOCUMENT_LOCKOUT_PARM_NM, ParameterType.Builder.create(OleParameterConstants.PARAMETER_CONFIG_TYPE_CODE));
newParam.setValue("Y");
newParam.setDescription(OLEConstants.DOCUMENT_LOCKOUT_PARM_DESC);
parameterService.createParameter(newParam.build());
}
}
}
示例10: buildRunParameterSearchKeyMap
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
/**
* Used by setInitiatedRunParameter to build a Map of search keys to obtain the exact needed Run parameter from the database.
*
* @return A Map<String,Object> where the Objects are the attributes of the Run parameter
*/
private Map<String, Object> buildRunParameterSearchKeyMap() {
Map<String, Object> pkMapForParameter = new HashMap<String, Object>();
// Set up a list of all the field names and values of the fields in the Parameter object.
Map<String, Object> fieldNamesValuesForParameter = new HashMap<String, Object>();
fieldNamesValuesForParameter.put("parameterNamespaceCode", PurapConstants.PURAP_NAMESPACE);
fieldNamesValuesForParameter.put("parameterDetailTypeCode", RUN_INDICATOR_PARAMETER_NAMESPACE_STEP);
fieldNamesValuesForParameter.put("parameterName", Job.STEP_RUN_PARM_NM);
fieldNamesValuesForParameter.put("parameterConstraintCode", RUN_INDICATOR_PARAMETER_ALLOWED);
fieldNamesValuesForParameter.put("parameterTypeCode", RUN_INDICATOR_PARAMETER_TYPE);
// get the primary keys and assign them to values
List<String> parameterPKFields = psService.getPrimaryKeys(Parameter.class);
for (String pkFieldName : parameterPKFields) {
pkMapForParameter.put(pkFieldName, fieldNamesValuesForParameter.get(pkFieldName));
}
return pkMapForParameter;
}
示例11: loadDefaultIngestProfile
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
public List<String> loadDefaultIngestProfile( boolean forceLoad ) throws Exception {
if ( forceLoad || parameterService.getParameterValueAsBoolean(OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, LOAD_DEFAULT_INGEST_POLICIES_IND, Boolean.TRUE) ) {
LOG.info("Starting Load of Default Ingest Profiles");
URL resource = getClass().getResource(fileName);
File file = new File(resource.toURI());
String fileContent = new FileUtil().readFile(file);
List<String> policies= oleKrmsBuilder.persistKrmsFromFileContent(fileContent);
LOG.info("Completed Load of Default Ingest Profiles");
Parameter existingParameter = parameterService.getParameter(OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, LOAD_DEFAULT_INGEST_POLICIES_IND);
if ( existingParameter != null ) {
Parameter.Builder updatedParameter = Parameter.Builder.create(existingParameter);
updatedParameter.setValue("N");
parameterService.updateParameter(updatedParameter.build());
} else {
Parameter.Builder newParameter = Parameter.Builder.create(OLEConstants.APPL_ID, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, LOAD_DEFAULT_INGEST_POLICIES_IND, ParameterType.Builder.create("CONFG"));
newParameter.setDescription( "Set to 'Y' to have the application ingest the default circulation policies upon next startup." );
newParameter.setValue("N");
parameterService.createParameter(newParameter.build());
}
return policies;
}
return Collections.emptyList();
}
示例12: unpackWorkflows
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
public void unpackWorkflows( boolean forceLoad ) {
if ( forceLoad || parameterService.getParameterValueAsBoolean(OLEConstants.OLE_NMSPC, OLEConstants.OLE_CMPNT, LOAD_DEFAULT_WORKFLOW_IND, Boolean.TRUE) ) {
LOG.info("Starting Load of Default Workflows");
workflowFileHandler.execute();
LOG.info("Completed Load of Default Workflows");
Parameter existingParameter = parameterService.getParameter(OLEConstants.OLE_NMSPC, OLEConstants.OLE_CMPNT, LOAD_DEFAULT_WORKFLOW_IND);
if ( existingParameter != null ) {
Parameter.Builder updatedParameter = Parameter.Builder.create(existingParameter);
updatedParameter.setValue("N");
parameterService.updateParameter(updatedParameter.build());
} else {
Parameter.Builder newParameter = Parameter.Builder.create(OLEConstants.APPL_ID, OLEConstants.OLE_NMSPC, OLEConstants.OLE_CMPNT, LOAD_DEFAULT_WORKFLOW_IND, ParameterType.Builder.create("CONFG"));
newParameter.setDescription( "Set to 'Y' to have the application ingest the default circulation policies upon next startup." );
newParameter.setValue("N");
parameterService.createParameter(newParameter.build());
}
}
}
示例13: testValidateAccountingInfo
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
/**
*
* This method tests {@link ExpenseImportByTravelerService#validateAccountingInfo(TemProfile, AgencyStagingData)}
*/
@Test
@ConfigureContext(shouldCommitTransactions = false)
public void testValidateAccountingInfo() {
AgencyStagingData agency = createAgencyStagingData();
TemProfile profile = createTemProfile();
// parameter is defaulted to 6000, but there are no valid combos that
// will work with 6000. Set it to 5000 for testing purposes.
Parameter param = parameterService.getParameter(TemParameterConstants.TEM_ALL.class, AgencyMatchProcessParameter.TRAVEL_CREDIT_CARD_AIRFARE_OBJECT_CODE);
Parameter.Builder builder = Parameter.Builder.create(param);
builder.setValue("5000");
parameterService.updateParameter(builder.build());
// success case
expenseImportByTravelerService.validateAccountingInfo(agency);
assertTrue(agency.getErrorCode().equals(AgencyStagingDataErrorCodes.AGENCY_NO_ERROR));
assertTrue(agency.getTripAccountingInformation().size()==1);
TripAccountingInformation accountingInfo = agency.getTripAccountingInformation().get(0);
assertTrue(StringUtils.equals(accountingInfo.getTripAccountNumber(), profile.getDefaultAccount()));
assertTrue(StringUtils.equals(accountingInfo.getTripSubAccountNumber(), profile.getDefaultSubAccount()));
assertTrue(StringUtils.equals(accountingInfo.getProjectCode(), profile.getDefaultProjectCode()));
}
示例14: lockUnlockDocuments
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
private void lockUnlockDocuments(boolean locked) {
for(String documentType : lockedDocuments) {
Class<? extends Document> documentClass = dataDictionaryService.getDocumentClassByTypeName(documentType);
if(parameterService.parameterExists(documentClass , KFSConstants.DOCUMENT_LOCKOUT_PARM_NM)) {
Parameter existingParam = parameterService.getParameter( documentClass, KFSConstants.DOCUMENT_LOCKOUT_PARM_NM );
Parameter.Builder updatedParam = Builder.create(existingParam);
updatedParam.setValue( locked?"Y":"N" );
parameterService.updateParameter(updatedParam.build());
} else {
String namespace = KRADServiceLocatorWeb.getKualiModuleService().getNamespaceCode(documentClass);
String detailType = KRADServiceLocatorWeb.getKualiModuleService().getComponentCode(documentClass);
Parameter.Builder newParam = Builder.create(KFSConstants.APPLICATION_NAMESPACE_CODE, namespace, detailType, KFSConstants.DOCUMENT_LOCKOUT_PARM_NM, ParameterType.Builder.create(KfsParameterConstants.PARAMETER_CONFIG_TYPE_CODE) );
newParam.setValue("Y");
newParam.setDescription(KFSConstants.DOCUMENT_LOCKOUT_PARM_DESC);
parameterService.createParameter(newParam.build());
}
}
}
示例15: buildRunParameterSearchKeyMap
import org.kuali.rice.coreservice.api.parameter.Parameter; //导入依赖的package包/类
/**
* Used by setInitiatedRunParameter to build a Map of search keys to obtain the exact needed Run parameter from the database.
*
* @return A Map<String,Object> where the Objects are the attributes of the Run parameter
*/
private Map<String, Object> buildRunParameterSearchKeyMap() {
Map<String, Object> pkMapForParameter = new HashMap<String, Object>();
// Set up a list of all the field names and values of the fields in the Parameter object.
Map<String, Object> fieldNamesValuesForParameter = new HashMap<String, Object>();
fieldNamesValuesForParameter.put("parameterNamespaceCode", PurapConstants.PURAP_NAMESPACE);
fieldNamesValuesForParameter.put("parameterDetailTypeCode", RUN_INDICATOR_PARAMETER_NAMESPACE_STEP);
fieldNamesValuesForParameter.put("parameterName", Job.STEP_RUN_PARM_NM);
fieldNamesValuesForParameter.put("parameterConstraintCode", RUN_INDICATOR_PARAMETER_ALLOWED);
fieldNamesValuesForParameter.put("parameterTypeCode", RUN_INDICATOR_PARAMETER_TYPE);
// get the primary keys and assign them to values
List<String> parameterPKFields = psService.getPrimaryKeys(Parameter.class);
for (String pkFieldName : parameterPKFields) {
pkMapForParameter.put(pkFieldName, fieldNamesValuesForParameter.get(pkFieldName));
}
return pkMapForParameter;
}