01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.loader;
06:
07: import com.opensymphony.workflow.util.XMLizable;
08:
09: import java.io.PrintWriter;
10: import java.io.Serializable;
11: import java.io.StringWriter;
12:
13: /**
14: * User: hani
15: * Date: May 28, 2003
16: * Time: 12:44:54 AM
17: */
18: public abstract class AbstractDescriptor implements XMLizable,
19: Serializable {
20: //~ Instance fields ////////////////////////////////////////////////////////
21:
22: private AbstractDescriptor parent;
23: private boolean hasId = false;
24: private int entityId;
25: private int id;
26:
27: //~ Methods ////////////////////////////////////////////////////////////////
28:
29: public void setEntityId(int entityId) {
30: this .entityId = entityId;
31: }
32:
33: public int getEntityId() {
34: return entityId;
35: }
36:
37: public void setId(int id) {
38: this .id = id;
39: hasId = true;
40: }
41:
42: public int getId() {
43: return id;
44: }
45:
46: public void setParent(AbstractDescriptor parent) {
47: this .parent = parent;
48: }
49:
50: public AbstractDescriptor getParent() {
51: return parent;
52: }
53:
54: public String asXML() {
55: StringWriter stringWriter = new StringWriter();
56: PrintWriter writer = new PrintWriter(stringWriter);
57: this .writeXML(writer, 0);
58: writer.close();
59:
60: return stringWriter.toString();
61: }
62:
63: public boolean hasId() {
64: return hasId;
65: }
66: }
|