Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ObjectAction extends ActionSupport {
- /** Serial version UID. */
- private static final long serialVersionUID = 8225105390632222245L;
- /** The current object*/
- private Object object;
- /** The object's identifier selected by the user */
- private Long objectId;
- /** The attachedObject that was edited/added */
- private AttachedObject attachedObject;
- /** The object service. */
- @Autowired
- private ObjectService objectService;
- private ArrayList<String> objectTypes;
- /**
- * Displays the selected object in the object form.
- *
- * @return the result string.
- */
- public String load() {
- Long id = 0l;
- if (objectId != null) {
- id = objectId;
- } else if (attachedObject.getObject() != null) {
- objectTypes = new ArrayList<String>();
- ObjectType[] allTypes = ObjectType.values();
- for (ObjectType objectType : allTypes) {
- objectTypes.add(objectType.toString());
- }
- id = attachtObject.getObject().getId();
- }
- if (id == (long) 0) {
- return ERROR;
- } else {
- exam = objectService.loadObject(id);
- return SUCCESS;
- }
- }
- @Override
- public void validate() {
- // If the object is not set, the object ID has to be set.
- if (object == null && objectId == null) {
- if (attachedObject == null) {
- addActionError(getText("msg.selectExam"));
- }
- }
- }
- public void setObjectService(ObjectService objectService) {
- this.objectService = objectService;
- }
- public Long getObjectId() {
- return objectId;
- }
- public void setObjectId(Long objectId) {
- this.objectId = objectId;
- }
- public Object getObject() {
- return object;
- }
- public void setObject(Object object){
- this.object = object;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement