Subversion Repositories SmartDukaan

Rev

Rev 110 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 110 Rev 199
Line 181... Line 181...
181
		
181
		
182
		return this.entitiesbycategory.get(new Long(categoryID));
182
		return this.entitiesbycategory.get(new Long(categoryID));
183
	}
183
	}
184
	
184
	
185
	/**
185
	/**
186
	 * Convienience method to add new Entity 
186
	 * Convenience method to add new Entity 
187
	 * 
187
	 * 
188
	 * @param newEntity
188
	 * @param newEntity
189
	 * @throws Exception 
189
	 * @throws Exception 
190
	 */
190
	 */
191
	public void addEntity(Entity newEntity) throws Exception {
191
	public void addEntity(Entity newEntity) throws Exception {
Line 205... Line 205...
205
		
205
		
206
		catentities.add(newEntity);
206
		catentities.add(newEntity);
207
		this.entitiesbycategory.put(new Long(newEntity.getCategoryID()), 
207
		this.entitiesbycategory.put(new Long(newEntity.getCategoryID()), 
208
				catentities);
208
				catentities);
209
	}
209
	}
-
 
210
 
-
 
211
	
-
 
212
	/**
-
 
213
	 * Convenience method to add new Entity 
-
 
214
	 * 
-
 
215
	 * @param newEntity
-
 
216
	 * @throws Exception 
-
 
217
	 */
-
 
218
	public void updateEntity(Entity newEntity) throws Exception {
-
 
219
		if(this.entities == null) {
-
 
220
			this.getEntities();
-
 
221
		}
-
 
222
		
-
 
223
		this.entities.remove(new Long(newEntity.getID()));
-
 
224
		
-
 
225
		// Keep index by category ID
-
 
226
		List<Entity> catentities = 
-
 
227
			this.entitiesbycategory.get(newEntity.getCategoryID());
-
 
228
		
-
 
229
		// As it is the reference, remove(obj) should work
-
 
230
		catentities.remove(newEntity);
-
 
231
		
-
 
232
		this.addEntity(newEntity);
-
 
233
	}
210
	
234
	
211
	/**
235
	/**
212
	 * Returns expand form of entity object. All references are resolved into 
236
	 * Returns expand form of entity object. All references are resolved into 
213
	 * corresponding detail object
237
	 * corresponding detail object
214
	 * 
238
	 *