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.Attachment;
021: import info.jtrac.domain.Config;
022: import info.jtrac.domain.Counts;
023: import info.jtrac.domain.CountsHolder;
024: import info.jtrac.domain.Item;
025: import info.jtrac.domain.ItemSearch;
026: import info.jtrac.domain.Metadata;
027: import info.jtrac.domain.Space;
028: import info.jtrac.domain.SpaceSequence;
029: import info.jtrac.domain.User;
030: import info.jtrac.domain.Field;
031: import info.jtrac.domain.History;
032: import info.jtrac.domain.ItemItem;
033: import info.jtrac.domain.UserSpaceRole;
034: import java.util.Collection;
035:
036: import java.util.List;
037:
038: /**
039: * Jtrac DAO Interface
040: * all database access operations
041: */
042: public interface JtracDao {
043:
044: void storeItem(Item item);
045:
046: Item loadItem(long id);
047:
048: History loadHistory(long id);
049:
050: void storeHistory(History history);
051:
052: List<Item> findItems(long sequenceNum, String prefixCode);
053:
054: List<Item> findItems(ItemSearch itemSearch);
055:
056: List<AbstractItem> findAllItems();
057:
058: void removeItem(Item item);
059:
060: void removeItemItem(ItemItem itemItem);
061:
062: //===========================================
063: int loadCountOfRecordsHavingFieldNotNull(Space space, Field field);
064:
065: int bulkUpdateFieldToNull(Space space, Field field);
066:
067: int loadCountOfRecordsHavingFieldWithValue(Space space,
068: Field field, int optionKey);
069:
070: int bulkUpdateFieldToNullForValue(Space space, Field field,
071: int optionKey);
072:
073: int loadCountOfRecordsHavingStatus(Space space, int status);
074:
075: int bulkUpdateStatusToOpen(Space space, int status);
076:
077: int bulkUpdateRenameSpaceRole(Space space, String oldRoleKey,
078: String newRoleKey);
079:
080: int bulkUpdateDeleteSpaceRole(Space space, String roleKey);
081:
082: int bulkUpdateDeleteItemsForSpace(Space space);
083:
084: //========================================================
085: void storeAttachment(Attachment attachment);
086:
087: //===========================================
088: void storeMetadata(Metadata metadata);
089:
090: Metadata loadMetadata(long id);
091:
092: //===========================================
093: void storeSpace(Space space);
094:
095: Space loadSpace(long id);
096:
097: List<Space> findSpacesByPrefixCode(String prefixCode);
098:
099: List<Space> findAllSpaces();
100:
101: List<Space> findSpacesWhereGuestAllowed();
102:
103: void removeSpace(Space space);
104:
105: //===========================================
106: SpaceSequence loadSpaceSequence(long id);
107:
108: void storeSpaceSequence(SpaceSequence spaceSequence);
109:
110: //===========================================
111: void storeUser(User user);
112:
113: User loadUser(long id);
114:
115: void removeUser(User user);
116:
117: List<User> findAllUsers();
118:
119: List<User> findUsersMatching(String searchText, String searchOn);
120:
121: List<User> findUsersByLoginName(String loginName);
122:
123: List<User> findUsersByEmail(String email);
124:
125: List<User> findUsersForSpace(long spaceId);
126:
127: List<UserSpaceRole> findUserRolesForSpace(long spaceId);
128:
129: List<User> findUsersWithRoleForSpace(long spaceId, String roleKey);
130:
131: List<User> findUsersForSpaceSet(Collection<Space> spaces);
132:
133: int loadCountOfHistoryInvolvingUser(User user);
134:
135: //===========================================
136: UserSpaceRole loadUserSpaceRole(long id);
137:
138: void removeUserSpaceRole(UserSpaceRole userSpaceRole);
139:
140: //===========================================
141: CountsHolder loadCountsForUser(User user);
142:
143: Counts loadCountsForUserSpace(User user, Space space);
144:
145: //===========================================
146: List<Config> findAllConfig();
147:
148: void storeConfig(Config config);
149:
150: Config loadConfig(String key);
151:
152: }
|