01: package org.drools.brms.client.rpc;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.Date;
20:
21: import com.google.gwt.user.client.rpc.IsSerializable;
22:
23: /**
24: * This is the DTO for a versionable asset's meta data.
25: * ie basically everything except the payload.
26: */
27: public class MetaData implements IsSerializable {
28:
29: public String name = "";
30: public String description = "";
31:
32: public String title = "";
33: public String status = "";
34:
35: public Date lastModifiedDate;
36: public String lastContributor = "";
37: public long versionNumber;
38:
39: public Date createdDate;
40:
41: public String packageName = "";
42: public String[] categories = new String[0];
43:
44: public String format = "";
45: public String type = "";
46: public String creator = "";
47: public String externalSource = "";
48: public String subject = "";
49: public String externalRelation = "";
50: public String rights = "";
51: public String coverage = "";
52: public String publisher = "";
53: public String checkinComment = "";
54:
55: public Date dateEffective;
56: public Date dateExpired;
57:
58: /**
59: * Remove a category.
60: * @param idx The index of the cat to remove.
61: */
62: public void removeCategory(int idx) {
63: String[] newList = new String[categories.length - 1];
64: int newIdx = 0;
65: for (int i = 0; i < categories.length; i++) {
66:
67: if (i != idx) {
68: newList[newIdx] = categories[i];
69: newIdx++;
70: }
71:
72: }
73: this .categories = newList;
74: }
75:
76: /**
77: * Add the given cat to the end of the cat list.
78: */
79: public void addCategory(String cat) {
80: for (int i = 0; i < this .categories.length; i++) {
81: if (categories[i].equals(cat))
82: return;
83: }
84: String[] list = this .categories;
85: String[] newList = new String[list.length + 1];
86:
87: for (int i = 0; i < list.length; i++) {
88: newList[i] = list[i];
89: }
90: newList[list.length] = cat;
91:
92: this.categories = newList;
93: }
94:
95: }
|