@Test public void testSpaceCopyCache() { Space srcSpace = new SimpleSpace(); Space clonedSpace1 = cloner.cloneSpace(srcSpace); Space clonedSpace2 = cloner.cloneSpace(srcSpace); assertEquals(clonedSpace1, clonedSpace2); }
@Override public Space cloneSpace(Space src) { String id = src.getId(); Space clone = spaceClones.get(id); if (clone != null) { return clone; } clone = activityRepository.newSpace(); clone.setName(namePrefix + " " + src.getName()); clone.setDescription(src.getDescription()); clone.setMetadata(src.getMetadata()); for (Space subspace : src.getSpaces()) { Space subspaceClone = cloneSpace(subspace); clone.addSpace(subspaceClone); } for (LiveActivityGroup group : src.getActivityGroups()) { LiveActivityGroup groupClone = cloneLiveActivityGroup(group); clone.addActivityGroup(groupClone); } spaceClones.put(id, clone); return clone; }
StandardInteractiveSpacesDomainCloner implements InteractiveSpacesDomainCloner { @Override public Space cloneSpace(Space src) { String id = src.getId(); Space clone = spaceClones.get(id); if (clone != null) { return clone; } clone = activityRepository.newSpace(); clone.setName(namePrefix + " " + src.getName()); clone.setDescription(src.getDescription()); clone.setMetadata(src.getMetadata()); for (Space subspace : src.getSpaces()) { Space subspaceClone = cloneSpace(subspace); clone.addSpace(subspaceClone); } for (LiveActivityGroup group : src.getActivityGroups()) { LiveActivityGroup groupClone = cloneLiveActivityGroup(group); clone.addActivityGroup(groupClone); } spaceClones.put(id, clone); return clone; } }
StandardInteractiveSpacesDomainCloner implements InteractiveSpacesDomainCloner { @Override public Space cloneSpace(Space src) { String id = src.getId(); Space clone = spaceClones.get(id); if (clone != null) { return clone; } clone = activityRepository.newSpace(); clone.setName(namePrefix + " " + src.getName()); clone.setDescription(src.getDescription()); clone.setMetadata(src.getMetadata()); for (Space subspace : src.getSpaces()) { Space subspaceClone = cloneSpace(subspace); clone.addSpace(subspaceClone); } for (LiveActivityGroup group : src.getActivityGroups()) { LiveActivityGroup groupClone = cloneLiveActivityGroup(group); clone.addActivityGroup(groupClone); } spaceClones.put(id, clone); return clone; } StandardInteractiveSpacesDomainCloner(ActivityRepository activityRepository); }
StandardInteractiveSpacesDomainCloner implements InteractiveSpacesDomainCloner { @Override public Space cloneSpace(Space src) { String id = src.getId(); Space clone = spaceClones.get(id); if (clone != null) { return clone; } clone = activityRepository.newSpace(); clone.setName(namePrefix + " " + src.getName()); clone.setDescription(src.getDescription()); clone.setMetadata(src.getMetadata()); for (Space subspace : src.getSpaces()) { Space subspaceClone = cloneSpace(subspace); clone.addSpace(subspaceClone); } for (LiveActivityGroup group : src.getActivityGroups()) { LiveActivityGroup groupClone = cloneLiveActivityGroup(group); clone.addActivityGroup(groupClone); } spaceClones.put(id, clone); return clone; } StandardInteractiveSpacesDomainCloner(ActivityRepository activityRepository); @Override void setNamePrefix(String namePrefix); @Override void setControllerMap(Map<SpaceController, SpaceController> controllerMap); @Override void saveClones(); @Override LiveActivity cloneLiveActivity(LiveActivity src); @Override LiveActivity getClonedLiveActivity(String srcId); @Override ActivityConfiguration cloneConfiguration(ActivityConfiguration src); @Override LiveActivityGroup cloneLiveActivityGroup(LiveActivityGroup src); @Override LiveActivityGroup getClonedLiveActivityGroup(String srcId); @Override Space cloneSpace(Space src); @Override Space getClonedSpace(String srcId); }
StandardInteractiveSpacesDomainCloner implements InteractiveSpacesDomainCloner { @Override public Space cloneSpace(Space src) { String id = src.getId(); Space clone = spaceClones.get(id); if (clone != null) { return clone; } clone = activityRepository.newSpace(); clone.setName(namePrefix + " " + src.getName()); clone.setDescription(src.getDescription()); clone.setMetadata(src.getMetadata()); for (Space subspace : src.getSpaces()) { Space subspaceClone = cloneSpace(subspace); clone.addSpace(subspaceClone); } for (LiveActivityGroup group : src.getActivityGroups()) { LiveActivityGroup groupClone = cloneLiveActivityGroup(group); clone.addActivityGroup(groupClone); } spaceClones.put(id, clone); return clone; } StandardInteractiveSpacesDomainCloner(ActivityRepository activityRepository); @Override void setNamePrefix(String namePrefix); @Override void setControllerMap(Map<SpaceController, SpaceController> controllerMap); @Override void saveClones(); @Override LiveActivity cloneLiveActivity(LiveActivity src); @Override LiveActivity getClonedLiveActivity(String srcId); @Override ActivityConfiguration cloneConfiguration(ActivityConfiguration src); @Override LiveActivityGroup cloneLiveActivityGroup(LiveActivityGroup src); @Override LiveActivityGroup getClonedLiveActivityGroup(String srcId); @Override Space cloneSpace(Space src); @Override Space getClonedSpace(String srcId);  }