001: /*
002: * Copyright 2002-2005 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package info.jtrac;
018:
019: import info.jtrac.domain.AbstractItem;
020: import info.jtrac.domain.Config;
021: import info.jtrac.domain.Counts;
022: import info.jtrac.domain.CountsHolder;
023: import info.jtrac.domain.Field;
024: import info.jtrac.domain.History;
025: import info.jtrac.domain.Item;
026: import info.jtrac.domain.ItemItem;
027: import info.jtrac.domain.ItemSearch;
028: import info.jtrac.domain.Metadata;
029: import info.jtrac.domain.Space;
030: import info.jtrac.domain.User;
031: import info.jtrac.domain.UserSpaceRole;
032:
033: import java.util.List;
034: import java.util.Map;
035:
036: import org.acegisecurity.userdetails.UserDetailsService;
037: import org.apache.wicket.markup.html.form.upload.FileUpload;
038:
039: /**
040: * Jtrac main business interface (Service Layer)
041: */
042: public interface Jtrac extends UserDetailsService {
043:
044: // TODO remove Wicket dep with FileUpload
045: void storeItem(Item item, FileUpload fileUpload);
046:
047: void updateItem(Item item, User user);
048:
049: void storeHistoryForItem(long itemId, History history,
050: FileUpload fileUpload);
051:
052: Item loadItem(long id);
053:
054: Item loadItemByRefId(String refId);
055:
056: History loadHistory(long id);
057:
058: List<Item> findItems(ItemSearch itemSearch);
059:
060: List<AbstractItem> findAllItems();
061:
062: void removeItem(Item item);
063:
064: void removeItemItem(ItemItem itemItem);
065:
066: //========================================================
067: int loadCountOfRecordsHavingFieldNotNull(Space space, Field field);
068:
069: int bulkUpdateFieldToNull(Space space, Field field);
070:
071: int loadCountOfRecordsHavingFieldWithValue(Space space,
072: Field field, int optionKey);
073:
074: int bulkUpdateFieldToNullForValue(Space space, Field field,
075: int optionKey);
076:
077: int loadCountOfRecordsHavingStatus(Space space, int status);
078:
079: int bulkUpdateStatusToOpen(Space space, int status);
080:
081: int bulkUpdateRenameSpaceRole(Space space, String oldRoleKey,
082: String newRoleKey);
083:
084: int bulkUpdateDeleteSpaceRole(Space space, String roleKey);
085:
086: //========================================================
087: void storeUser(User user);
088:
089: void storeUser(User user, String password, boolean sendNotifications);
090:
091: void removeUser(User user);
092:
093: User loadUser(long id);
094:
095: User loadUser(String loginName);
096:
097: List<User> findAllUsers();
098:
099: List<User> findUsersMatching(String searchText, String searchOn);
100:
101: List<User> findUsersForSpace(long spaceId);
102:
103: List<UserSpaceRole> findUserRolesForSpace(long spaceId);
104:
105: List<User> findUsersWithRoleForSpace(long spaceId, String roleKey);
106:
107: List<User> findUsersForUser(User user);
108:
109: List<User> findUnallocatedUsersForSpace(long spaceId);
110:
111: int loadCountOfHistoryInvolvingUser(User user);
112:
113: //========================================================
114: CountsHolder loadCountsForUser(User user);
115:
116: Counts loadCountsForUserSpace(User user, Space space);
117:
118: //========================================================
119: void storeSpace(Space space);
120:
121: Space loadSpace(long id);
122:
123: Space loadSpace(String prefixCode);
124:
125: List<Space> findAllSpaces();
126:
127: List<Space> findSpacesWhereGuestAllowed();
128:
129: List<Space> findUnallocatedSpacesForUser(long userId);
130:
131: void removeSpace(Space space);
132:
133: //========================================================
134: void storeUserSpaceRole(User user, Space space, String roleKey);
135:
136: UserSpaceRole loadUserSpaceRole(long id);
137:
138: void removeUserSpaceRole(UserSpaceRole userSpaceRole);
139:
140: //========================================================
141: void storeMetadata(Metadata metadata);
142:
143: Metadata loadMetadata(long id);
144:
145: //========================================================
146: String generatePassword();
147:
148: String encodeClearText(String clearText);
149:
150: Map<String, String> getLocales();
151:
152: String getDefaultLocale();
153:
154: String getJtracHome();
155:
156: int getAttachmentMaxSizeInMb();
157:
158: int getSessionTimeoutInMinutes();
159:
160: //========================================================
161: Map<String, String> loadAllConfig();
162:
163: void storeConfig(Config config);
164:
165: String loadConfig(String param);
166:
167: //========================================================
168: void rebuildIndexes();
169:
170: void index(AbstractItem item);
171:
172: void clearIndexes();
173:
174: boolean validateTextSearchQuery(String text);
175:
176: //========================================================
177: void executeHourlyTask();
178:
179: void executePollingTask();
180:
181: //========================================================
182: String getReleaseVersion();
183:
184: String getReleaseTimestamp();
185:
186: }
|