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


Java Action类代码示例

本文整理汇总了Java中com.opensymphony.xwork2.Action的典型用法代码示例。如果您正苦于以下问题:Java Action类的具体用法?Java Action怎么用?Java Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Action类属于com.opensymphony.xwork2包,在下文中一共展示了Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: intercept

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Override
public String intercept( ActionInvocation invocation )
    throws Exception
{
    Boolean jli = (Boolean) ServletActionContext.getRequest().getSession()
        .getAttribute( LoginInterceptor.JLI_SESSION_VARIABLE );

    if ( jli != null )
    {
        log.debug( "JLI marker is present. Running " + actions.size() + " JLI actions." );

        for ( Action a : actions )
        {
            a.execute();
        }

        ServletActionContext.getRequest().getSession().removeAttribute( LoginInterceptor.JLI_SESSION_VARIABLE );
    }

    return invocation.invoke();
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:22,代码来源:LoginInterceptor.java

示例2: doIntercept

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Override
protected String doIntercept(ActionInvocation actionInvocation) throws Exception {

    HttpServletRequest request= ServletActionContext.getRequest();
    String path=request.getRequestURI();

    Log.d("The path is" + path);

    if(!path.contains("/admin")){

        return actionInvocation.invoke();
    }

    UActionSupport action = (UActionSupport)actionInvocation.getAction();
    Map session = action.getSession();

    if(session.containsKey("adminName")){
        return actionInvocation.invoke();
    }else{
        return Action.LOGIN;
    }

}
 
开发者ID:uustory,项目名称:U8Server,代码行数:24,代码来源:LoginInterceptor.java

示例3: doImport

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
/**
    * Run import if not in progress or already done, otherwise return Wait view
    * 
    * @return 'success'
    * @throws Exception
    *                 When errors occurred
    */
   public String doImport()  {
boolean alreadyDone;
try {
    alreadyDone = isImportAlreadyDone();
} catch (ImporterMetaDataException e) {
   errorMessage = e.getMessage();
   return ERROR;
}
if (importerManager.isInProgress() || alreadyDone) {
    return WAIT;
}
ImportAction.logger.info("doImport");
this.importerManager.importAll();
return Action.SUCCESS;
   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:23,代码来源:ImportAction.java

示例4: execute

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Test
   public void execute() throws Exception {
List<StatsUsage> statsUsageList = new ArrayList<StatsUsage>();
StatsUsage statsUsage1 = new StatsUsage(StatsUsageType.FULLTEXT);
StatsUsage statsUsage2 = new StatsUsage(StatsUsageType.GEOLOC);
StatsUsage statsUsage3 = new StatsUsage(StatsUsageType.STREET);
statsUsage1.setUsage(10L);
statsUsage2.setUsage(20L);
statsUsage3.setUsage(30L);
statsUsageList.add(statsUsage1);
statsUsageList.add(statsUsage2);
statsUsageList.add(statsUsage3);

StatsAction statsAction = new StatsAction();
IStatsUsageDao mockStatsUsageDao = EasyMock.createMock(IStatsUsageDao.class);
EasyMock.expect(mockStatsUsageDao.getAll()).andReturn(statsUsageList).times(2);
EasyMock.replay(mockStatsUsageDao);
statsAction.setStatsUsageDao(mockStatsUsageDao);
String returnString = statsAction.execute();
Assert.assertEquals("statsusage should be loaded when execute is called",statsUsageList,statsAction.getStatsUsages());
Assert.assertEquals(Action.SUCCESS, returnString);
Assert.assertEquals(60L, statsAction.getTotalUsage().longValue());
returnString = statsAction.execute();
Assert.assertEquals("totalusage should not be recursively added for each call to execute", 60L, statsAction.getTotalUsage().longValue());
EasyMock.verify(mockStatsUsageDao);
   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:27,代码来源:StatsActionTest.java

示例5: executeWithCityAndCountryWithNoCityMatches

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Test
   public void executeWithCityAndCountryWithNoCityMatches() throws Exception{
GeocodingAction action = new GeocodingAction();

IFullTextSearchEngine fullTextSearchEngine = EasyMock.createMock(IFullTextSearchEngine.class);
String countryCode = "FR";
String cityName = "city";
FulltextQuery query = new FulltextQuery(cityName,
	Pagination.DEFAULT_PAGINATION, Output.DEFAULT_OUTPUT,
	ONLY_CITY_PLACETYPE, countryCode);
EasyMock.expect(fullTextSearchEngine.executeQuery(query)).andStubReturn(new FulltextResultsDto());
EasyMock.replay(fullTextSearchEngine);
action.setFullTextSearchEngine(fullTextSearchEngine);

action.setCity(cityName);
action.setCountryCode(countryCode);
Assert.assertEquals(Action.SUCCESS,action.execute());
   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:19,代码来源:GeocodingActionTest.java

示例6: execute

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Override
public String execute() {
	if (!userService.isTokenValid(getServiceContext(), username, token)) {
		addFieldError("token", "This username/token combination is not valid.");
	} else {
		try {
			userService.changePassword(getServiceContext(), username, passwordField, confirmPasswordField);
			userService.clearTokens(getServiceContext(), username);
		} catch (ValidationServiceException e) {
			List<ValidationError> errors = e.getFaultInfo().getAttributeErrors();
			for (ValidationError validationError : errors) {
				addFieldError(validationError.getFieldName(), validationError.getOnlineMessage());
			}
		}

	}

	if (hasErrors()) {
		return Action.ERROR;
	}

	return SUCCESS;
}
 
开发者ID:SmarterApp,项目名称:TechnologyReadinessTool,代码行数:24,代码来源:ChangePasswordAcceptAction.java

示例7: executeResult

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
/**
 * Uses getResult to get the final Result and executes it
 * 
 * @throws ConfigurationException
 *             If not result can be found with the returned code
 */
private void executeResult() throws Exception {
	result = createResult();

	String timerKey = "executeResult: " + getResultCode();
	try {
		UtilTimerStack.push(timerKey);
		if (result != null) {
			result.execute(this);
		} else if (resultCode != null && !Action.NONE.equals(resultCode)) {
			throw new ConfigurationException("No result defined for action " + getAction().getClass().getName()
					+ " and result " + getResultCode(), proxy.getConfig());
		} else {
			if (LOG.isDebugEnabled()) {
				LOG.debug("No result returned for action " + getAction().getClass().getName() + " at "
						+ proxy.getConfig().getLocation());
			}
		}
	} finally {
		UtilTimerStack.pop(timerKey);
	}
}
 
开发者ID:cenobites,项目名称:struts2-json-plugin,代码行数:28,代码来源:JsonActionInvocation.java

示例8: findById

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
public String findById(){
	HttpServletRequest request = ServletActionContext.getRequest();
	String  strId = request.getParameter("id");
	if(strId != null && strId.length()> 0){
		Integer id = Integer.valueOf(strId);
		
		SysUser sysUser = this.sysUserService.findById(id);
		resultMap = new HashMap<String,Object>();
		resultMap.put("error", "false");
		resultMap.put("status", "ok");
		resultMap.put("result", sysUser);
		return Action.SUCCESS;
	}else{
		return Action.ERROR;
	}
}
 
开发者ID:huligong1234,项目名称:springbyexample,代码行数:17,代码来源:SysUserJSONAction.java

示例9: execute

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
public String execute() throws Exception{
	error=null;
	try{
		Modules modules=brandService.findModuleByScope(moduleName);
		scope=modules.getScope();
		if("brand".equals(modules.getModuleType())){
			return Action.SUCCESS;
		}
		else if("weibo".equals(modules.getModuleType())){
			return "weibo";
		}else{
			return Action.SUCCESS; //暂时只处理 brand 以及weibo
		}
	}catch(Exception e){
		error="找不到以这个名字命名的module!";
		return Action.SUCCESS;
	}
	
	
}
 
开发者ID:yancykim,项目名称:support,代码行数:21,代码来源:GetScopeAction.java

示例10: execute

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
public String execute() throws Exception{
		
		
//		String timeConfig="0 30 08 ? * *";
//		ResultSet rs=JDBC.query(JDBC.getConnectionSupport(), "select * from t_setting");
//		
//		if(rs.next()){ //如果有数据
//			String time=rs.getString("dailycheck_time");
//			if(time!=null&&!"".equals(time)){
//				timeConfig=time;
//			}
//			
//		}
//		
//		System.out.println(timeConfig);
//		
//		QuartzManager.removeJob("1");
//		QuartzManager.addJob("1","com.yancy.support.action.datacheck.CheckModulesByUserEmailAction", timeConfig);
//		
		//QuartzManager.modifyJobTime("1", "0 43 01 ? * *");
		
		
		return Action.SUCCESS;
		
		
	}
 
开发者ID:yancykim,项目名称:support,代码行数:27,代码来源:TimeAction.java

示例11: execute

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
public String execute() throws Exception{
	
	try{
	solrNum=null;
	dynamodbNum=null;
	//modules=brandService.findModuleByName(moduleName);
	modules=brandService.findModuleByScope(moduleName);
		solrNum=brandService.findSolrNum(modules);
		dynamodbNum=brandService.findDynamoNum(modules);
	}catch(Exception e){
		System.out.println(e.toString());
		e.printStackTrace();
		error="查询出错!";
	}
	

	
	return Action.SUCCESS;
	
}
 
开发者ID:yancykim,项目名称:support,代码行数:21,代码来源:ModuleAction.java

示例12: execute

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
public String execute() throws Exception{
	error=null;
	try{
		//为了判断7天内的曲线趋势,所以选七天前的日期开始
		if(month==0||year==0||day==0){
			year=DateUtil.getTSDA(7)[0];
			month=DateUtil.getTSDA(7)[1];
			day=DateUtil.getTSDA(7)[2];
		}
		weiboAnalyticsList=weiboService.findAnalyticsByScope(scope, month, year, day);
		weiboAnalyticsId=new ArrayList<WeiboAnalyticsId>();
		for(Iterator<WeiboAnalytics> it=weiboAnalyticsList.iterator();it.hasNext();){
			weiboAnalyticsId.add(it.next().getId());
		}
	}catch(Exception e){
		error="没有数据,或查询出错!";
	}
	
	return Action.SUCCESS;
}
 
开发者ID:yancykim,项目名称:support,代码行数:21,代码来源:WeiboAnalyticsAction.java

示例13: testSave

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Test
public void testSave() {
    action.setTempGenomicSource(action.getGenomicSource());
    action.getGenomicSource().setPlatformVendor(PlatformVendorEnum.AFFYMETRIX);
    assertEquals(Action.INPUT, action.save());
    verify(workspaceService, times(1)).clearSession();
    action.getGenomicSource().setPlatformName("Platform name");
    assertEquals(Action.SUCCESS, action.save());
    verify(updater, times(1)).runJob(anyLong());
    studyManagementServiceStub.clear();
    action.getGenomicSource().setId(1L);
    StudyConfiguration studyConfiguration = new StudyConfiguration();
    studyConfiguration.getGenomicDataSources().add(action.getGenomicSource());
    action.getGenomicSource().setStudyConfiguration(studyConfiguration);
    action.setStudyConfiguration(studyConfiguration);
    assertEquals(Action.SUCCESS, action.save());
    assertTrue(studyManagementServiceStub.deleteCalled);
    verify(updater, times(2)).runJob(anyLong());

    // Test platform validation.
    action.getGenomicSource().setPlatformVendor(PlatformVendorEnum.AGILENT);
    action.getGenomicSource().setPlatformName("");
    assertEquals(Action.INPUT, action.save());
    action.getGenomicSource().setPlatformName("Name");
    assertEquals(Action.SUCCESS, action.save());
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:27,代码来源:EditGenomicSourceActionTest.java

示例14: saveSubject

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Test
public void saveSubject() {
    manageQueryAction.setSelectedAction("saveSubjectList");
    manageQueryAction.prepare();
    manageQueryAction.validate();
    assertTrue(manageQueryAction.hasErrors());
    manageQueryAction.clearErrorsAndMessages();
    manageQueryAction.getCurrentStudy().getStudyConfiguration().setStatus(Status.DEPLOYED);
    manageQueryAction.validate();
    assertTrue(manageQueryAction.hasErrors());
    manageQueryAction.clearErrorsAndMessages();
    manageQueryAction.setSubjectListName("Subject list 1");
    manageQueryAction.validate();
    assertFalse(manageQueryAction.hasErrors());
    assertEquals(Action.SUCCESS, manageQueryAction.execute());
    manageQueryAction.setSubjectListVisibleToOthers(true);
    assertEquals(Action.SUCCESS, manageQueryAction.execute());
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:19,代码来源:ManageQueryActionTest.java

示例15: testAddImageAnnotations

import com.opensymphony.xwork2.Action; //导入依赖的package包/类
@Test
public void testAddImageAnnotations() {
    action.clearErrorsAndMessages();
    action.setUploadType(ImageAnnotationUploadType.FILE.getValue());
    assertEquals("display: block;", action.getFileInputCssStyle());
    assertEquals("display: none;", action.getAimInputCssStyle());
    action.setImageAnnotationFile(TestDataFiles.VALID_FILE);
    action.setImageAnnotationFileFileName(TestDataFiles.VALID_FILE.getName());
    assertEquals(Action.SUCCESS, action.addImageAnnotations());

    action.setImageAnnotationFile(TestDataFiles.INVALID_FILE_MISSING_VALUE);
    assertEquals(Action.INPUT, action.addImageAnnotations());
    action.clearErrorsAndMessages();
    action.setImageAnnotationFile(TestDataFiles.INVALID_FILE_DOESNT_EXIST);
    assertEquals(Action.ERROR, action.addImageAnnotations());
    action.clearErrorsAndMessages();
    action.setImageAnnotationFile(null);
    assertEquals(Action.INPUT, action.addImageAnnotations());
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:20,代码来源:EditImagingSourceAnnotationsActionTest.java


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