IndexDroolsAction.java
package com.test.action.view.drools;
import com.opensymphony.xwork2.ActionSupport;
public class IndexDroolsAction extends ActionSupport {
public String execute() {
return SUCCESS;
}
}
IndexDroolsProcessAction.java
package com.test.action.view.drools;
import org.apache.log4j.Logger;
import com.opensymphony.xwork2.ActionSupport;
import com.test.drools.Drools;
public class IndexDroolsProcessAction extends ActionSupport {
final static Logger logger = Logger.getLogger(IndexDroolsProcessAction.class);
private Drools drools = null;
public int status = 0;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Drools getDrools() {
return drools;
}
public void setDrools(Drools drools) {
this.drools = drools;
}
public String execute() {
logger.debug("status : " + status);
try {
this.drools.run(status);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return SUCCESS;
}
}
FiatViewProcessAction.java
package com.test.action.view.fiat;
import java.security.Principal;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.test.logic.service.BookService;
public class FiatViewProcessAction extends ActionSupport {
static Logger logger = Logger.getLogger(FiatViewProcessAction.class);
private BookService bookService = null;
public BookService getBookService() {
return bookService;
}
public void setBookService(BookService bookService) {
this.bookService = bookService;
}
public String execute() {
String result = ERROR;
logger.debug("FiatViewProcessAction executing ...");
ActionContext ac = ActionContext.getContext();
HttpServletRequest request =
(HttpServletRequest)ac.get(ServletActionContext.HTTP_REQUEST);
logger.debug("AuthType : " + request.getAuthType());
Principal p = request.getUserPrincipal();
if(p != null) {
logger.debug("Principal : " + p.getName());
if(p.getName().indexOf("admin") > 0) {
result = SUCCESS;
}
} else {
result = ERROR;
}
return result;
}
}
IndexFreeAction.java
package com.test.action.view.free;
import com.opensymphony.xwork2.ActionSupport;
public class IndexFreeAction extends ActionSupport {
public String execute() {
return SUCCESS;
}
}
IndexFreeProcessAction.java
package com.test.action.view.free;
import com.opensymphony.xwork2.ActionSupport;
public class IndexFreeProcessAction extends ActionSupport {
public String execute() {
return SUCCESS;
}
}
UploadViewAction.java
package com.test.action.view.upload;
import com.opensymphony.xwork2.ActionSupport;
public class UploadViewAction extends ActionSupport {
public String execute() {
return SUCCESS;
}
}
UploadViewProcessAction.java
package com.test.action.view.upload;
import java.io.File;
import com.opensymphony.xwork2.ActionSupport;
public class UploadViewProcessAction extends ActionSupport {
private String contentType;
private File upload;
private String fileName;
private String caption;
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public File getUpload() {
return upload;
}
public void setUpload(File upload) {
this.upload = upload;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public String execute() {
return SUCCESS;
}
}