rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
acl.decode(aclString.toCharArray()); acl.merge(entAccess.toCharArray());
acl.decode(entAccess.toCharArray()); acl.merge(aclString.toCharArray());
private char[] getAclChars(BwShareableDbentity ent) throws CalFacadeException { if (ent instanceof BwShareableContainedDbentity) { BwCalendar container; if (ent instanceof BwCalendar) { container = (BwCalendar)ent; } else { container = ((BwShareableContainedDbentity)ent).getCalendar(); } String path = container.getPath(); PathInfo pi = pathInfoMap.getInfo(path); if (pi == null) { pi = getPathInfo(container); pathInfoMap.putInfo(path, pi); } char[] aclChars = pi.encoded; if (ent instanceof BwCalendar) { return aclChars; } /* Create a merged access string from the entity access and the * container access */ String entAccess = ent.getAccess(); if (entAccess == null) { // Nomerge needed return aclChars; } try { Acl acl = new Acl(); acl.decode(aclChars); acl.merge(entAccess.toCharArray()); return acl.getEncoded(); } catch (Throwable t) { throw new CalFacadeException(t); } } /* This is a way of making other objects sort of shareable. * The objects are locations, sponsors and categories. * * We store the default access in the owner principal and manipulate that to give * us some degree of sharing. * * In effect, the owner becomes the container for the object. */ String aclString = null; String entAccess = ent.getAccess(); BwUser owner = ent.getOwner(); if (ent instanceof BwCategory) { aclString = owner.getCategoryAccess(); } else if (ent instanceof BwLocation) { aclString = owner.getLocationAccess(); } else if (ent instanceof BwSponsor) { aclString = owner.getSponsorAccess(); } if (aclString == null) { if (entAccess == null) { if (ent.getPublick()) { return access.getDefaultPublicAccess().toCharArray(); } return access.getDefaultPersonalAccess().toCharArray(); } return entAccess.toCharArray(); } if (entAccess == null) { return aclString.toCharArray(); } try { Acl acl = new Acl(); acl.decode(aclString.toCharArray()); acl.merge(entAccess.toCharArray()); return acl.getEncoded(); } catch (Throwable t) { throw new CalFacadeException(t); } }
System.out.println(listener);
public void addEQSelectionListener(EQSelectionListener listener) { System.out.println(listener); listenerList.add(EQSelectionListener.class, listener); EventAccessOperations[] selectedEvents = getSelectedEvents(); if (selectedEvents.length > 0) { listener.eqSelectionChanged(new EQSelectionEvent(this, getSelectedEvents())); } }
System.out.println(eqSelectionEvent.getEvents());
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized (circles) { System.out.println(eqSelectionEvent.getEvents()); Iterator it = circles.iterator(); while (it.hasNext()) { OMEvent current = (OMEvent) it.next(); System.out.println(current.getEvent()); if (current.getEvent().equals(eqSelectionEvent.getEvents()[0])) { selected = current; } else { deselected.add(current); } } } if (selected != null) { selected.select(); synchronized (circles) { circles.moveIndexedToTop(circles.indexOf(selected)); } Iterator it = deselected.iterator(); while (it.hasNext()) { ((OMEvent) it.next()).deselect(); } } }
System.out.println(current.getEvent());
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized (circles) { System.out.println(eqSelectionEvent.getEvents()); Iterator it = circles.iterator(); while (it.hasNext()) { OMEvent current = (OMEvent) it.next(); System.out.println(current.getEvent()); if (current.getEvent().equals(eqSelectionEvent.getEvents()[0])) { selected = current; } else { deselected.add(current); } } } if (selected != null) { selected.select(); synchronized (circles) { circles.moveIndexedToTop(circles.indexOf(selected)); } Iterator it = deselected.iterator(); while (it.hasNext()) { ((OMEvent) it.next()).deselect(); } } }
Map daoBackingMap = new HashMap(); daoBackingMap.put("edalquist", user1); daoBackingMap.put("awp9", user2); daoBackingMap.put("erider", user3);
protected void setUp() throws Exception { this.stubDao = new ComplexStubPersonAttributeDao(); super.setUp(); Map user1 = new HashMap(); user1.put("phone", "777-7777"); user1.put("displayName", "Display Name"); Map user2 = new HashMap(); user2.put("phone", "888-8888"); user2.put("displayName", ""); Map user3 = new HashMap(); user3.put("phone", "666-6666"); user3.put("givenName", "Howard"); Map daoBackingMap = new HashMap(); daoBackingMap.put("edalquist", user1); daoBackingMap.put("awp9", user2); daoBackingMap.put("erider", user3); this.stubDao.setBackingMap(daoBackingMap); this.stubDao.setDefaultAttributeName(defaultAttr); super.setUp(); }
dao.getUserAttributes("edalquist");
Map result = dao.getUserAttributes("edalquist"); this.validateUser1(result);
public void testCacheStats() { CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(new HashMap()); assertEquals("Query count incorrect", 0, dao.getQueries()); assertEquals("Miss count incorrect", 0, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 1, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 2, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 3, dao.getQueries()); assertEquals("Miss count incorrect", 2, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 4, dao.getQueries()); assertEquals("Miss count incorrect", 3, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 5, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 6, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 7, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); }
dao.getUserAttributes("edalquist");
result = dao.getUserAttributes("edalquist"); this.validateUser1(result);
public void testCacheStats() { CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(new HashMap()); assertEquals("Query count incorrect", 0, dao.getQueries()); assertEquals("Miss count incorrect", 0, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 1, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 2, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 3, dao.getQueries()); assertEquals("Miss count incorrect", 2, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 4, dao.getQueries()); assertEquals("Miss count incorrect", 3, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 5, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 6, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 7, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); }
dao.getUserAttributes("nobody");
result = dao.getUserAttributes("nobody"); assertNull(result);
public void testCacheStats() { CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(new HashMap()); assertEquals("Query count incorrect", 0, dao.getQueries()); assertEquals("Miss count incorrect", 0, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 1, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 2, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 3, dao.getQueries()); assertEquals("Miss count incorrect", 2, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 4, dao.getQueries()); assertEquals("Miss count incorrect", 3, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 5, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 6, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 7, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); }
dao.getUserAttributes("awp9");
result = dao.getUserAttributes("awp9"); this.validateUser2(result);
public void testCacheStats() { CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(new HashMap()); assertEquals("Query count incorrect", 0, dao.getQueries()); assertEquals("Miss count incorrect", 0, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 1, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 2, dao.getQueries()); assertEquals("Miss count incorrect", 1, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 3, dao.getQueries()); assertEquals("Miss count incorrect", 2, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 4, dao.getQueries()); assertEquals("Miss count incorrect", 3, dao.getMisses()); dao.getUserAttributes("nobody"); assertEquals("Query count incorrect", 5, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("awp9"); assertEquals("Query count incorrect", 6, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); dao.getUserAttributes("edalquist"); assertEquals("Query count incorrect", 7, dao.getQueries()); assertEquals("Miss count incorrect", 4, dao.getMisses()); }
dao.getUserAttributes("edalquist");
Map result = dao.getUserAttributes("edalquist"); this.validateUser1(result);
public void testCaching() { Map cacheMap = new HashMap(); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap = new HashMap(); queryMap.put(defaultAttr, "edalquist"); queryMap.put("name.first", "Eric"); queryMap.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); }
dao.getUserAttributes("edalquist");
result = dao.getUserAttributes("edalquist"); this.validateUser1(result);
public void testCaching() { Map cacheMap = new HashMap(); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap = new HashMap(); queryMap.put(defaultAttr, "edalquist"); queryMap.put("name.first", "Eric"); queryMap.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); }
dao.getUserAttributes("nobody");
result = dao.getUserAttributes("nobody"); assertNull(result);
public void testCaching() { Map cacheMap = new HashMap(); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap = new HashMap(); queryMap.put(defaultAttr, "edalquist"); queryMap.put("name.first", "Eric"); queryMap.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); }
dao.getUserAttributes(queryMap);
result = dao.getUserAttributes(queryMap); this.validateUser1(result);
public void testCaching() { Map cacheMap = new HashMap(); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setDefaultAttributeName(defaultAttr); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap = new HashMap(); queryMap.put(defaultAttr, "edalquist"); queryMap.put("name.first", "Eric"); queryMap.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); }
dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size());
Map result = dao.getUserAttributes("edalquist"); assertNull(result); assertEquals("Incorrect number of items in cache", 0, cacheMap.size());
public void testMulipleAttributeKeys() { Map cacheMap = new HashMap(); Set keyAttrs = new HashSet(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setCacheKeyAttributes(keyAttrs); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); Map queryMap1 = new HashMap(); queryMap1.put(defaultAttr, "edalquist"); queryMap1.put("name.first", "Eric"); queryMap1.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap2 = new HashMap(); queryMap2.put("name.first", "John"); queryMap2.put("name.last", "Doe"); dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); }
dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size());
result = dao.getUserAttributes("nobody"); assertNull(result); assertEquals("Incorrect number of items in cache", 0, cacheMap.size());
public void testMulipleAttributeKeys() { Map cacheMap = new HashMap(); Set keyAttrs = new HashSet(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setCacheKeyAttributes(keyAttrs); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); Map queryMap1 = new HashMap(); queryMap1.put(defaultAttr, "edalquist"); queryMap1.put("name.first", "Eric"); queryMap1.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap2 = new HashMap(); queryMap2.put("name.first", "John"); queryMap2.put("name.last", "Doe"); dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); }
dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size());
result = dao.getUserAttributes("edalquist"); assertNull(result); assertEquals("Incorrect number of items in cache", 0, cacheMap.size());
public void testMulipleAttributeKeys() { Map cacheMap = new HashMap(); Set keyAttrs = new HashSet(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setCacheKeyAttributes(keyAttrs); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); Map queryMap1 = new HashMap(); queryMap1.put(defaultAttr, "edalquist"); queryMap1.put("name.first", "Eric"); queryMap1.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap2 = new HashMap(); queryMap2.put("name.first", "John"); queryMap2.put("name.last", "Doe"); dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); }
dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size());
result = dao.getUserAttributes(queryMap1); this.validateUser1(result); assertEquals("Incorrect number of items in cache", 1, cacheMap.size());
public void testMulipleAttributeKeys() { Map cacheMap = new HashMap(); Set keyAttrs = new HashSet(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setCacheKeyAttributes(keyAttrs); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); Map queryMap1 = new HashMap(); queryMap1.put(defaultAttr, "edalquist"); queryMap1.put("name.first", "Eric"); queryMap1.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap2 = new HashMap(); queryMap2.put("name.first", "John"); queryMap2.put("name.last", "Doe"); dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); }
dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size());
result = dao.getUserAttributes(queryMap2); assertNull(result); assertEquals("Incorrect number of items in cache", 2, cacheMap.size());
public void testMulipleAttributeKeys() { Map cacheMap = new HashMap(); Set keyAttrs = new HashSet(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setCacheKeyAttributes(keyAttrs); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); Map queryMap1 = new HashMap(); queryMap1.put(defaultAttr, "edalquist"); queryMap1.put("name.first", "Eric"); queryMap1.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap2 = new HashMap(); queryMap2.put("name.first", "John"); queryMap2.put("name.last", "Doe"); dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); }
dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size());
result = dao.getUserAttributes(queryMap1); this.validateUser1(result); assertEquals("Incorrect number of items in cache", 2, cacheMap.size());
public void testMulipleAttributeKeys() { Map cacheMap = new HashMap(); Set keyAttrs = new HashSet(); keyAttrs.add("name.first"); keyAttrs.add("name.last"); CachingPersonAttributeDaoImpl dao = new CachingPersonAttributeDaoImpl(); dao.setCachedPersonAttributesDao(this.stubDao); dao.setCacheKeyAttributes(keyAttrs); dao.setUserInfoCache(cacheMap); assertEquals("Incorrect number of items in cache", 0, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("nobody"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); dao.getUserAttributes("edalquist"); assertEquals("Incorrect number of items in cache", 1, cacheMap.size()); Map queryMap1 = new HashMap(); queryMap1.put(defaultAttr, "edalquist"); queryMap1.put("name.first", "Eric"); queryMap1.put("name.last", "Dalquist"); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 2, cacheMap.size()); Map queryMap2 = new HashMap(); queryMap2.put("name.first", "John"); queryMap2.put("name.last", "Doe"); dao.getUserAttributes(queryMap2); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); dao.getUserAttributes(queryMap1); assertEquals("Incorrect number of items in cache", 3, cacheMap.size()); }
progress.update(60, "Modules: Analyzing commandline arguments...");
progress.update(60, "GUI: Creating main frame..."); try { initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(65, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(75, "Modules: Analyzing commandline arguments...");
private EVI(String[] args) { ProgressFrame progress = new ProgressFrame(); progress.update(5, "Configuration: Loading..."); try { MainConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(15, "GUI: Setting Look and Feel..."); try { setLookAndFeel(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(25, "Modules: Loading list..."); try { ModuleConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(35, "Modules: Loading JARs..."); try { loadModules(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(50, "Modules: Checking dependencies..."); try { checkModuleDependencies(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(55, "Modules: Loading auto-start list..."); try { ModuleAutoStartConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(60, "Modules: Analyzing commandline arguments..."); try { startArgRelatedModules(args); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(65, "GUI: Creating main frame..."); try { initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(76, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(88, "GUI: making visible..."); try { makeVisible(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(100, "Dickerchen"); }
progress.update(65, "GUI: Creating main frame...");
private EVI(String[] args) { ProgressFrame progress = new ProgressFrame(); progress.update(5, "Configuration: Loading..."); try { MainConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(15, "GUI: Setting Look and Feel..."); try { setLookAndFeel(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(25, "Modules: Loading list..."); try { ModuleConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(35, "Modules: Loading JARs..."); try { loadModules(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(50, "Modules: Checking dependencies..."); try { checkModuleDependencies(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(55, "Modules: Loading auto-start list..."); try { ModuleAutoStartConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(60, "Modules: Analyzing commandline arguments..."); try { startArgRelatedModules(args); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(65, "GUI: Creating main frame..."); try { initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(76, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(88, "GUI: making visible..."); try { makeVisible(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(100, "Dickerchen"); }
initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc);
String[] murks = new String[] { "Eva Valder", "Naja", "egal", }; for (int i = 0; i <= murks.length; i++) { progress.update(85 + i, murks[i]); Thread.sleep(100); } } catch (Exception exc) {
private EVI(String[] args) { ProgressFrame progress = new ProgressFrame(); progress.update(5, "Configuration: Loading..."); try { MainConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(15, "GUI: Setting Look and Feel..."); try { setLookAndFeel(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(25, "Modules: Loading list..."); try { ModuleConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(35, "Modules: Loading JARs..."); try { loadModules(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(50, "Modules: Checking dependencies..."); try { checkModuleDependencies(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(55, "Modules: Loading auto-start list..."); try { ModuleAutoStartConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(60, "Modules: Analyzing commandline arguments..."); try { startArgRelatedModules(args); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(65, "GUI: Creating main frame..."); try { initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(76, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(88, "GUI: making visible..."); try { makeVisible(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(100, "Dickerchen"); }
progress.update(76, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(88, "GUI: making visible...");
progress.update(91, "GUI: making visible...");
private EVI(String[] args) { ProgressFrame progress = new ProgressFrame(); progress.update(5, "Configuration: Loading..."); try { MainConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(15, "GUI: Setting Look and Feel..."); try { setLookAndFeel(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(25, "Modules: Loading list..."); try { ModuleConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(35, "Modules: Loading JARs..."); try { loadModules(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(50, "Modules: Checking dependencies..."); try { checkModuleDependencies(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(55, "Modules: Loading auto-start list..."); try { ModuleAutoStartConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(60, "Modules: Analyzing commandline arguments..."); try { startArgRelatedModules(args); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(65, "GUI: Creating main frame..."); try { initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(76, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(88, "GUI: making visible..."); try { makeVisible(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(100, "Dickerchen"); }
progress.update(100, "Dickerchen");
progress.update(100, "Have fun!");
private EVI(String[] args) { ProgressFrame progress = new ProgressFrame(); progress.update(5, "Configuration: Loading..."); try { MainConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(15, "GUI: Setting Look and Feel..."); try { setLookAndFeel(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(25, "Modules: Loading list..."); try { ModuleConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(35, "Modules: Loading JARs..."); try { loadModules(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(50, "Modules: Checking dependencies..."); try { checkModuleDependencies(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(55, "Modules: Loading auto-start list..."); try { ModuleAutoStartConfiguration.load(); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(60, "Modules: Analyzing commandline arguments..."); try { startArgRelatedModules(args); } catch (Exception exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(65, "GUI: Creating main frame..."); try { initMainFrame(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(76, "Modules: Auto-starting..."); try { autoStartModules(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(88, "GUI: making visible..."); try { makeVisible(); } catch (Throwable exc) { ExceptionDialog.show("Unexcepted exception caught while loading", exc); } progress.update(100, "Dickerchen"); }
if (modules[i].handlesProtocol(protocol)) { ModuleFactory.newInstance(modules[i],
if (modules[j].handlesProtocol(protocol)) { ModuleFactory.newInstance(modules[j],
private void startArgRelatedModules(String[] args) { if (args == null) { return; } ModuleContainer[] modules = ModuleLoader.getLoadedModules(); for (int i = 0; i < args.length; i++) { String arg = args[i]; try { URL url = new URL(arg); String protocol = url.getProtocol(); for (int j = 0; j < modules.length; j++) { if (modules[i].handlesProtocol(protocol)) { ModuleFactory.newInstance(modules[i], new Object[] { url }); } } } catch (Exception exc) { } } }
exc.printStackTrace();
private void startArgRelatedModules(String[] args) { if (args == null) { return; } ModuleContainer[] modules = ModuleLoader.getLoadedModules(); for (int i = 0; i < args.length; i++) { String arg = args[i]; try { URL url = new URL(arg); String protocol = url.getProtocol(); for (int j = 0; j < modules.length; j++) { if (modules[i].handlesProtocol(protocol)) { ModuleFactory.newInstance(modules[i], new Object[] { url }); } } } catch (Exception exc) { } } }
timeConfig.addTimeSyncListener(this); timeFinder = timeConfig.getTimeFinder();
public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, (MicroSecondDate)seismos.get(current)); } timeConfig = newTimeConfig; timeConfig.addTimeSyncListener(this); timeFinder = timeConfig.getTimeFinder(); }
System.out.println("The radiobutton selected is "+ ((AbstractButton)ae.getItem()).getText());
System.out.println("$$&$&%$&%$&$&&$$&$&$&$&%^&$%&$^$&%&$^&$^%&$%^&$The radiobutton selected is "+ ((AbstractButton)ae.getItem()).getText());
public void itemStateChanged(ItemEvent ae) { if(ae.getStateChange() == ItemEvent.SELECTED) { System.out.println("The radiobutton selected is "+ ((AbstractButton)ae.getItem()).getText()); view.addDisplayKey(((AbstractButton)ae.getItem()).getText()); } else if(ae.getStateChange() == ItemEvent.DESELECTED){ System.out.println("The radiobutton UN SELECTED is "+ ((AbstractButton)ae.getItem()).getText()); view.removeDisplaykey(((AbstractButton)ae.getItem()).getText()); } //view.setDisplayKey(ae.getActionCommand()); repaint(); }
setHorizontalTitle(view.getSelectedParticleMotion()[0].hseis.getSeismogram().getName()); setVerticalTitle(view.getSelectedParticleMotion()[0].vseis.getSeismogram().getName()); view.updateTimeRange();
public void itemStateChanged(ItemEvent ae) { if(ae.getStateChange() == ItemEvent.SELECTED) { System.out.println("The radiobutton selected is "+ ((AbstractButton)ae.getItem()).getText()); view.addDisplayKey(((AbstractButton)ae.getItem()).getText()); } else if(ae.getStateChange() == ItemEvent.DESELECTED){ System.out.println("The radiobutton UN SELECTED is "+ ((AbstractButton)ae.getItem()).getText()); view.removeDisplaykey(((AbstractButton)ae.getItem()).getText()); } //view.setDisplayKey(ae.getActionCommand()); repaint(); }
new BottomTitleBorder(hseis.getSeismogram().getName());
new BottomTitleBorder("X - axis Title");
public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, hAmpConfigRegistrar.getAmpRange(hseis)); vAmpScaleMap = new AmpScaleMapper(50, 4, vAmpConfigRegistrar.getAmpRange(hseis)); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder(hseis.getSeismogram().getName()); vTitleBorder = new CenterTitleBorder(hseis.getSeismogram().getName()); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), hTitleBorder), // BorderFactory.createCompoundBorder(hTitleBorder, // vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this)); t.start(); }
new CenterTitleBorder(hseis.getSeismogram().getName());
new LeftTitleBorder("Y - axis Title");
public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, hAmpConfigRegistrar.getAmpRange(hseis)); vAmpScaleMap = new AmpScaleMapper(50, 4, vAmpConfigRegistrar.getAmpRange(hseis)); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder(hseis.getSeismogram().getName()); vTitleBorder = new CenterTitleBorder(hseis.getSeismogram().getName()); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), hTitleBorder), // BorderFactory.createCompoundBorder(hTitleBorder, // vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this)); t.start(); }
hTitleBorder),
public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, hAmpConfigRegistrar.getAmpRange(hseis)); vAmpScaleMap = new AmpScaleMapper(50, 4, vAmpConfigRegistrar.getAmpRange(hseis)); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder(hseis.getSeismogram().getName()); vTitleBorder = new CenterTitleBorder(hseis.getSeismogram().getName()); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), hTitleBorder), // BorderFactory.createCompoundBorder(hTitleBorder, // vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this)); t.start(); }
BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)),
public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, hAmpConfigRegistrar.getAmpRange(hseis)); vAmpScaleMap = new AmpScaleMapper(50, 4, vAmpConfigRegistrar.getAmpRange(hseis)); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder(hseis.getSeismogram().getName()); vTitleBorder = new CenterTitleBorder(hseis.getSeismogram().getName()); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), hTitleBorder), // BorderFactory.createCompoundBorder(hTitleBorder, // vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this)); t.start(); }
public void addAzimuthLine(double degrees) {
public synchronized void addAzimuthLine(double degrees) {
public void addAzimuthLine(double degrees) { view.addAzimuthLine(degrees); }
public void addParticleMotionDisplay(DataSetSeismogram hseis,
public synchronized void addParticleMotionDisplay(DataSetSeismogram hseis,
public void addParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, false, false, this)); t.start(); }
false,
buttonPanel,
public void addParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, false, false, this)); t.start(); }
logger.debug("############################### Starting the Thread");
public void addParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; Thread t = new Thread(new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, false, false, this)); t.start(); }
public void addSector(double degreeone, double degreetwo) {
public synchronized void addSector(double degreeone, double degreetwo) {
public void addSector(double degreeone, double degreetwo) { view.addSector(degreeone, degreetwo); }
public void displayBackAzimuth(edu.sc.seis.fissuresUtil.xml.DataSet dataset, ChannelId chanId) {
public synchronized void displayBackAzimuth(edu.sc.seis.fissuresUtil.xml.DataSet dataset, ChannelId chanId) {
public void displayBackAzimuth(edu.sc.seis.fissuresUtil.xml.DataSet dataset, ChannelId chanId) { edu.sc.seis.fissuresUtil.cache.CacheEvent cacheEvent = ((edu.sc.seis.fissuresUtil.xml.XMLDataSet)dataset).getEvent(); Channel channel = ((edu.sc.seis.fissuresUtil.xml.XMLDataSet)dataset).getChannel(chanId); if(cacheEvent != null) { try { Origin origin = cacheEvent.get_preferred_origin(); Station station = channel.my_site.my_station; double azimuth = SphericalCoords.azimuth(station.my_location.latitude, station.my_location.longitude, origin.my_location.latitude, origin.my_location.longitude); double angle = 90 - azimuth; addAzimuthLine(angle); addSector(angle+5, angle-5); } catch(NoPreferredOrigin npoe) { logger.debug("no preferred origin"); } } }
checkBoxes[0].setSelected(true);
initialButton = checkBoxes[0];
public void formCheckBoxPanel(ChannelId[] channelGroup) { //radioPanel.removeAll(); ArrayList arrayList = new ArrayList(); for(int counter = 0; counter < channelGroup.length; counter++) { for(int subcounter = counter+1; subcounter < channelGroup.length; subcounter++) { String labelStr = getOrientationName(channelGroup[counter].channel_code)+"-"+ getOrientationName(channelGroup[subcounter].channel_code); JCheckBox radioButton = new JCheckBox(labelStr); radioButton.setActionCommand(labelStr); radioButton.addItemListener(new RadioButtonListener()); arrayList.add(radioButton); } } JCheckBox[] checkBoxes = new JCheckBox[arrayList.size()]; checkBoxes = (JCheckBox[])arrayList.toArray(checkBoxes); checkBoxes[0].setSelected(true); view.setDisplayKey(checkBoxes[0].getText()); for(int counter = 0; counter < channelGroup.length; counter++) { radioPanel.add(checkBoxes[counter]); } radioPanel.setVisible(true); }
radioButtons[0].setSelected(true);
initialButton = radioButtons[0];
public void formRadioSetPanel(ChannelId[] channelGroup) { //radioPanel.removeAll(); ArrayList arrayList = new ArrayList(); for(int counter = 0; counter < channelGroup.length; counter++) { for(int subcounter = counter + 1; subcounter < channelGroup.length; subcounter++) { String labelStr = getOrientationName(channelGroup[counter].channel_code)+"-"+ getOrientationName(channelGroup[subcounter].channel_code); JRadioButton radioButton = new JRadioButton(labelStr); radioButton.setActionCommand(labelStr); radioButton.addItemListener(new RadioButtonListener()); arrayList.add(radioButton); } } JRadioButton[] radioButtons = new JRadioButton[arrayList.size()]; radioButtons = (JRadioButton[])arrayList.toArray(radioButtons); radioButtons[0].setSelected(true); ButtonGroup buttonGroup = new ButtonGroup(); view.setDisplayKey(radioButtons[0].getText()); for(int counter = 0; counter < channelGroup.length; counter++) { buttonGroup.add(radioButtons[counter]); radioPanel.add(radioButtons[counter]); } radioPanel.setVisible(true); }
public ParticleMotionView getView() {
public synchronized ParticleMotionView getView() {
public ParticleMotionView getView() { return this.view; }
public void resize() {
public synchronized void resize() {
public void resize() { Dimension dim = view.getSize(); logger.debug("view coordinates before width = "+view.getSize().width+" height = "+view.getSize().height); Insets insets = view.getInsets(); int width = particleDisplayPanel.getSize().width; int height = particleDisplayPanel.getSize().height; width = width - particleDisplayPanel.getInsets().left - particleDisplayPanel.getInsets().right; height = height - particleDisplayPanel.getInsets().top - particleDisplayPanel.getInsets().bottom; if(width < height) { particleDisplayPanel.setSize(new Dimension(particleDisplayPanel.getSize().width, width + particleDisplayPanel.getInsets().top + particleDisplayPanel.getInsets().bottom)); } else { particleDisplayPanel.setSize(new Dimension(height + particleDisplayPanel.getInsets().left + particleDisplayPanel.getInsets().right, particleDisplayPanel.getSize().height)); } view.resize(); logger.debug("view coordinates are width = "+view.getSize().width+" height = "+view.getSize().height); logger.debug("view insets left = "+insets.left+" right = "+insets.right); logger.debug("view insets top = "+insets.top+" bottom = "+insets.bottom); logger.debug("display after width = "+getSize().width+" height = "+getSize().height); if(hAmpScaleMap != null) { hAmpScaleMap.setTotalPixels(dim.width - insets.left - insets.right); vAmpScaleMap.setTotalPixels(dim.height - insets.top - insets.bottom); } repaint(); }//
particleDisplayPanel.setSize(new Dimension(particleDisplayPanel.getSize().width, width + particleDisplayPanel.getInsets().top + particleDisplayPanel.getInsets().bottom));
logger.debug("After particleDisplayPanel. setSize()");
public void resize() { Dimension dim = view.getSize(); logger.debug("view coordinates before width = "+view.getSize().width+" height = "+view.getSize().height); Insets insets = view.getInsets(); int width = particleDisplayPanel.getSize().width; int height = particleDisplayPanel.getSize().height; width = width - particleDisplayPanel.getInsets().left - particleDisplayPanel.getInsets().right; height = height - particleDisplayPanel.getInsets().top - particleDisplayPanel.getInsets().bottom; if(width < height) { particleDisplayPanel.setSize(new Dimension(particleDisplayPanel.getSize().width, width + particleDisplayPanel.getInsets().top + particleDisplayPanel.getInsets().bottom)); } else { particleDisplayPanel.setSize(new Dimension(height + particleDisplayPanel.getInsets().left + particleDisplayPanel.getInsets().right, particleDisplayPanel.getSize().height)); } view.resize(); logger.debug("view coordinates are width = "+view.getSize().width+" height = "+view.getSize().height); logger.debug("view insets left = "+insets.left+" right = "+insets.right); logger.debug("view insets top = "+insets.top+" bottom = "+insets.bottom); logger.debug("display after width = "+getSize().width+" height = "+getSize().height); if(hAmpScaleMap != null) { hAmpScaleMap.setTotalPixels(dim.width - insets.left - insets.right); vAmpScaleMap.setTotalPixels(dim.height - insets.top - insets.bottom); } repaint(); }//
logger.debug("Before view .resize()##############################");
public void resize() { Dimension dim = view.getSize(); logger.debug("view coordinates before width = "+view.getSize().width+" height = "+view.getSize().height); Insets insets = view.getInsets(); int width = particleDisplayPanel.getSize().width; int height = particleDisplayPanel.getSize().height; width = width - particleDisplayPanel.getInsets().left - particleDisplayPanel.getInsets().right; height = height - particleDisplayPanel.getInsets().top - particleDisplayPanel.getInsets().bottom; if(width < height) { particleDisplayPanel.setSize(new Dimension(particleDisplayPanel.getSize().width, width + particleDisplayPanel.getInsets().top + particleDisplayPanel.getInsets().bottom)); } else { particleDisplayPanel.setSize(new Dimension(height + particleDisplayPanel.getInsets().left + particleDisplayPanel.getInsets().right, particleDisplayPanel.getSize().height)); } view.resize(); logger.debug("view coordinates are width = "+view.getSize().width+" height = "+view.getSize().height); logger.debug("view insets left = "+insets.left+" right = "+insets.right); logger.debug("view insets top = "+insets.top+" bottom = "+insets.bottom); logger.debug("display after width = "+getSize().width+" height = "+getSize().height); if(hAmpScaleMap != null) { hAmpScaleMap.setTotalPixels(dim.width - insets.left - insets.right); vAmpScaleMap.setTotalPixels(dim.height - insets.top - insets.bottom); } repaint(); }//
public void setAmplitudeRange(AmpConfigRegistrar amplitudeRange) {
public synchronized void setAmplitudeRange(AmpConfigRegistrar amplitudeRange) {
public void setAmplitudeRange(AmpConfigRegistrar amplitudeRange) { this.hAmpConfigRegistrar = amplitudeRange; this.vAmpConfigRegistrar = amplitudeRange; }
public void setZoomIn(boolean value) {
public synchronized void setZoomIn(boolean value) {
public void setZoomIn(boolean value) { view.setZoomIn(value); }
public void setZoomOut(boolean value) {
public synchronized void setZoomOut(boolean value) {
public void setZoomOut(boolean value) { view.setZoomOut(value); }
public void updateTimeRange() {
public synchronized void updateTimeRange() {
public void updateTimeRange() { view.updateTimeRange(); }
int id = keyId.getVal();
int id = categoryId.getVal();
public boolean validateEventCategory() throws Throwable { int id = keyId.getVal(); if (id <= 0) { if (getEnv().getAppBoolProperty("app.categoryOptional")) { return true; } err.emit("org.bedework.client.error.missingfield", "Category"); return false; } try { BwCategory k = getCalSvcI().getCategory(id); if (k == null) { err.emit("org.bedework.client.error.missingcategory", id); return false; } if (!keyId.getChanged()) { return true; }// oldCategory = getEvent().getCategory(0); /* Currently we replace the only category if it exists */ BwEvent ev = getEvent(); ev.clearCategories(); ev.addCategory(k); setCategory(k); return true; } catch (Throwable t) { err.emit(t); return false; } }
if (!keyId.getChanged()) {
if (!categoryId.getChanged()) {
public boolean validateEventCategory() throws Throwable { int id = keyId.getVal(); if (id <= 0) { if (getEnv().getAppBoolProperty("app.categoryOptional")) { return true; } err.emit("org.bedework.client.error.missingfield", "Category"); return false; } try { BwCategory k = getCalSvcI().getCategory(id); if (k == null) { err.emit("org.bedework.client.error.missingcategory", id); return false; } if (!keyId.getChanged()) { return true; }// oldCategory = getEvent().getCategory(0); /* Currently we replace the only category if it exists */ BwEvent ev = getEvent(); ev.clearCategories(); ev.addCategory(k); setCategory(k); return true; } catch (Throwable t) { err.emit(t); return false; } }
System.out.println("in timer");
public void actionPerformed(ActionEvent evt) { adjustModel(); System.out.println("in timer"); }
System.out.println("starting ticker because idea changed");
public void repaintRequired() { timeChanged = System.currentTimeMillis(); System.out.println("starting ticker because idea changed"); ticker.start(); }
System.out.println("stopped ticker");
private Point2D tweakIdeas(final List<IdeaView> views, final Point2D c, final double initAngle, final boolean hasParent) { if (views.size() == 0) { return new Point2D.Double(0.0, 0.0); } double mass = 2000.0 / (points.size() * Math.sqrt((double)points.size())); double totForceX = 0.0; double totForceY = 0.0; if (timeChanged == 0) { timeChanged = System.currentTimeMillis(); } long now = System.currentTimeMillis(); double maxSpeed = 0.0; if ((now - timeChanged) < (MAX_MOVE_TIME_SECS * 1000.0)) { maxSpeed = MAX_SPEED - ((now - timeChanged) * MAX_SPEED / 1000.0 / MAX_MOVE_TIME_SECS); } else { ticker.stop(); System.out.println("stopped ticker"); } synchronized(views) { double minDiffAngle = Math.PI / 2 / views.size(); for (int i = 0; i < views.size(); i++) { IdeaView previousView = null; IdeaView nextView = null; IdeaView view = views.get(i); if (i > 0) { previousView = views.get(i - 1); } if (i < views.size() - 1) { nextView = views.get(i + 1); } Point2D point = getPoint(view, c, initAngle); double forceX = 0.0; double forceY = 0.0; for(Point2D other: points) { double dirX = point.getX() - other.getX(); double dirY = point.getY() - other.getY(); double dSquare = point.distanceSq(other); if (dSquare > 0.000001) { double unitFactor = point.distance(other); forceX += (dirX / unitFactor) * (mass * mass / dSquare); if (forceX > 1.0) { forceX = 1.0; } if (forceX < -1.0) { forceX = -1.0; } forceY += (dirY / unitFactor) * (mass * mass / dSquare); if (forceY > 1.0) { forceY = 1.0; } if (forceY < -1.0) { forceY = -1.0; } } } Point2D p2 = getPoint(view, ORIGIN, initAngle); Point2D tf = tweakIdeas(view.getSubViews(), point, view.getAngle() + initAngle, true); forceX += tf.getX(); forceY += tf.getY(); double sideForce = (p2.getY() * forceX) + (-p2.getX() * forceY); totForceX += forceX; totForceY += forceY; double v = view.getV(); v += sideForce / mass; v *= 0.90; if (v > maxSpeed) { v = maxSpeed; } if (v < -maxSpeed) { v = -maxSpeed; } view.setV(v); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } v = view.getV(); } } else { double previousAngle = -Math.PI; if (!hasParent) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } v = view.getV(); } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } v = view.getV(); } } else { double nextAngle = Math.PI; if (!hasParent) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } v = view.getV(); } } view.setAngle(newAngle); } } return new Point2D.Double(totForceX, totForceY); }
lobby.meta_defineField(AGSymbol.alloc("at"), atNS);
lobby.meta_defineField(AGSymbol.jAlloc("at"), atNS);
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at"));
ATObject at = lobby.meta_select(lobby, AGSymbol.jAlloc("at"));
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
ATObject test = at.meta_select(at, AGSymbol.alloc("test"));
ATObject test = at.meta_select(at, AGSymbol.jAlloc("test"));
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
ATObject result = test.meta_select(test, AGSymbol.alloc("file1"));
ATObject result = test.meta_select(test, AGSymbol.jAlloc("file1"));
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue);
assertTrue(test.meta_respondsTo(AGSymbol.jAlloc("file1")).asNativeBoolean().javaValue);
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue);
assertTrue(test.meta_respondsTo(AGSymbol.jAlloc("file2")).asNativeBoolean().javaValue);
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~")));
ATObject fileScope = test.meta_select(test, AGSymbol.jAlloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.jAlloc("~")));
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y")));
assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.jAlloc("y")));
public void testNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_defineField(AGSymbol.alloc("at"), atNS); // now, try to select the 'at' slot from the lobby ATObject at = lobby.meta_select(lobby, AGSymbol.alloc("at")); // the at slot should equal a namespace object assertTrue(at instanceof NATNamespace); assertEquals("<ns:/at>", at.meta_print().javaValue); ATObject test = at.meta_select(at, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file1 which should load file1 and return 1 ATObject result = test.meta_select(test, AGSymbol.alloc("file1")); assertEquals(NATNumber.ONE, result); // ensure file1 is now really bound to 1 in the namespace 'test' assertTrue(test.meta_respondsTo(AGSymbol.alloc("file1")).asNativeBoolean().javaValue); // normally, by loading file1, file2 should have been loaded as well: assertTrue(test.meta_respondsTo(AGSymbol.alloc("file2")).asNativeBoolean().javaValue); // test.file2 should be a normaly object with a ~ slot bound to test ATObject fileScope = test.meta_select(test, AGSymbol.alloc("file2")); assertEquals(test, fileScope.meta_select(fileScope, AGSymbol.alloc("~"))); // test.file2.y should equal nil assertEquals(NATNil._INSTANCE_, fileScope.meta_select(fileScope, AGSymbol.alloc("y"))); } catch (InterpreterException e) { fail(e.getMessage()); } }
lobby.meta_assignField(lobby, AGSymbol.alloc("at"), atNS);
lobby.meta_assignField(lobby, AGSymbol.jAlloc("at"), atNS);
public void testReverseNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_assignField(lobby, AGSymbol.alloc("at"), atNS); // select '/.at.test' ATObject test = atNS.meta_select(atNS, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file2 which should load file2 and raise an error // because ~.file2.x in file1.at will result in evaluating nil.x try { test.meta_select(test, AGSymbol.alloc("file2")); } catch(XSelectorNotFound e) { if (e.selector_.equals(AGSymbol.alloc("x")) && e.inObject_.equals(NATNil._INSTANCE_)) { // ok System.out.println("[expected]: "+e.getMessage()); } else throw e; } } catch (InterpreterException e) { fail(e.getMessage()); } }
ATObject test = atNS.meta_select(atNS, AGSymbol.alloc("test"));
ATObject test = atNS.meta_select(atNS, AGSymbol.jAlloc("test"));
public void testReverseNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_assignField(lobby, AGSymbol.alloc("at"), atNS); // select '/.at.test' ATObject test = atNS.meta_select(atNS, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file2 which should load file2 and raise an error // because ~.file2.x in file1.at will result in evaluating nil.x try { test.meta_select(test, AGSymbol.alloc("file2")); } catch(XSelectorNotFound e) { if (e.selector_.equals(AGSymbol.alloc("x")) && e.inObject_.equals(NATNil._INSTANCE_)) { // ok System.out.println("[expected]: "+e.getMessage()); } else throw e; } } catch (InterpreterException e) { fail(e.getMessage()); } }
test.meta_select(test, AGSymbol.alloc("file2"));
test.meta_select(test, AGSymbol.jAlloc("file2"));
public void testReverseNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_assignField(lobby, AGSymbol.alloc("at"), atNS); // select '/.at.test' ATObject test = atNS.meta_select(atNS, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file2 which should load file2 and raise an error // because ~.file2.x in file1.at will result in evaluating nil.x try { test.meta_select(test, AGSymbol.alloc("file2")); } catch(XSelectorNotFound e) { if (e.selector_.equals(AGSymbol.alloc("x")) && e.inObject_.equals(NATNil._INSTANCE_)) { // ok System.out.println("[expected]: "+e.getMessage()); } else throw e; } } catch (InterpreterException e) { fail(e.getMessage()); } }
if (e.selector_.equals(AGSymbol.alloc("x")) && e.inObject_.equals(NATNil._INSTANCE_)) {
if (e.selector_.equals(AGSymbol.jAlloc("x")) && e.inObject_.equals(NATNil._INSTANCE_)) {
public void testReverseNamespaces() { try { NATObject lobby = Evaluator.getLobbyNamespace(); // create the namespace 'at' bound to the path /tmp/at NATNamespace atNS = new NATNamespace("/at", at_); // bind the name 'at' to the atNS namespace in the lobby lobby.meta_assignField(lobby, AGSymbol.alloc("at"), atNS); // select '/.at.test' ATObject test = atNS.meta_select(atNS, AGSymbol.alloc("test")); // the test slot should equal a namespace object assertTrue(test instanceof NATNamespace); assertEquals("<ns:/at/test>", test.meta_print().javaValue); // select at.test.file2 which should load file2 and raise an error // because ~.file2.x in file1.at will result in evaluating nil.x try { test.meta_select(test, AGSymbol.alloc("file2")); } catch(XSelectorNotFound e) { if (e.selector_.equals(AGSymbol.alloc("x")) && e.inObject_.equals(NATNil._INSTANCE_)) { // ok System.out.println("[expected]: "+e.getMessage()); } else throw e; } } catch (InterpreterException e) { fail(e.getMessage()); } }
public NATNamespace(String name, String path, ATObject parentNamespace) { super(parentNamespace, OBJLexicalRoot._INSTANCE_, NATObject._SHARES_A_);
public NATNamespace(String name, String path, ATObject parentNamespace) throws NATException { super(OBJDynamicRoot._INSTANCE_, OBJLexicalRoot._INSTANCE_, NATObject._SHARES_A_);
public NATNamespace(String name, String path, ATObject parentNamespace) { super(parentNamespace, OBJLexicalRoot._INSTANCE_, NATObject._SHARES_A_); name_ = name; path_ = path; }
this.meta_defineField(_CURNS_SYM_, this); this.meta_defineField(_SUPNS_SYM_, parentNamespace);
public NATNamespace(String name, String path, ATObject parentNamespace) { super(parentNamespace, OBJLexicalRoot._INSTANCE_, NATObject._SHARES_A_); name_ = name; path_ = path; }
public abstract void setSuperUser(boolean val);
public abstract void setSuperUser(boolean val) throws CalFacadeException;
public abstract void setSuperUser(boolean val);
EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate();
er.setEntity(it.next());
public static Collection getPeriodsEvents(GetPeriodsPars pars) throws CalFacadeException { ArrayList al = new ArrayList(); //long millis = System.currentTimeMillis(); if (pars.endDt != null) { pars.startDt = pars.endDt.copy(pars.tzcache); } pars.endDt = pars.startDt.addDuration(pars.dur, pars.tzcache); String start = pars.startDt.getDate(); String end = pars.endDt.getDate(); //if (debug) { // debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); //} Iterator it = pars.events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. /* if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); }*/ al.add(ei); } } return al; }
int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start);
int evstSt = er.start.compareTo(start); int evendSt = er.end.compareTo(start);
public static Collection getPeriodsEvents(GetPeriodsPars pars) throws CalFacadeException { ArrayList al = new ArrayList(); //long millis = System.currentTimeMillis(); if (pars.endDt != null) { pars.startDt = pars.endDt.copy(pars.tzcache); } pars.endDt = pars.startDt.addDuration(pars.dur, pars.tzcache); String start = pars.startDt.getDate(); String end = pars.endDt.getDate(); //if (debug) { // debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); //} Iterator it = pars.events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. /* if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); }*/ al.add(ei); } } return al; }
((evstSt >= 0) && (evStart.compareTo(end) < 0)) ||
((evstSt >= 0) && (er.start.compareTo(end) < 0)) ||
public static Collection getPeriodsEvents(GetPeriodsPars pars) throws CalFacadeException { ArrayList al = new ArrayList(); //long millis = System.currentTimeMillis(); if (pars.endDt != null) { pars.startDt = pars.endDt.copy(pars.tzcache); } pars.endDt = pars.startDt.addDuration(pars.dur, pars.tzcache); String start = pars.startDt.getDate(); String end = pars.endDt.getDate(); //if (debug) { // debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); //} Iterator it = pars.events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. /* if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); }*/ al.add(ei); } } return al; }
((evendSt > 0) && (evEnd.compareTo(end) < 0))) {
((evendSt > 0) && (er.end.compareTo(end) < 0))) {
public static Collection getPeriodsEvents(GetPeriodsPars pars) throws CalFacadeException { ArrayList al = new ArrayList(); //long millis = System.currentTimeMillis(); if (pars.endDt != null) { pars.startDt = pars.endDt.copy(pars.tzcache); } pars.endDt = pars.startDt.addDuration(pars.dur, pars.tzcache); String start = pars.startDt.getDate(); String end = pars.endDt.getDate(); //if (debug) { // debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); //} Iterator it = pars.events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. /* if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); }*/ al.add(ei); } } return al; }
al.add(ei);
al.add(er.entity);
public static Collection getPeriodsEvents(GetPeriodsPars pars) throws CalFacadeException { ArrayList al = new ArrayList(); //long millis = System.currentTimeMillis(); if (pars.endDt != null) { pars.startDt = pars.endDt.copy(pars.tzcache); } pars.endDt = pars.startDt.addDuration(pars.dur, pars.tzcache); String start = pars.startDt.getDate(); String end = pars.endDt.getDate(); //if (debug) { // debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); //} Iterator it = pars.events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. /* if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); }*/ al.add(ei); } } return al; }
System.out.println(current.getStart());
public void paintComponent(Graphics g){ if(updating){ return; } Graphics2D g2 = (Graphics2D)g; synchronized(this){ Dimension size = getSize(); int width = size.width; int height = size.height; if(displayRemove != null){ g2.setColor(Color.WHITE); g2.fill(new Rectangle2D.Float(0,0, width, height)); displayRemove.draw(g2, size, curTimeEvent, curAmpEvent); } Iterator it = curLayoutEvent.iterator(); double curYPos = 0; while(it.hasNext()){ LayoutData current = (LayoutData)it.next(); System.out.println(current.getStart()); double midPoint = current.getStart() * height + ((current.getEnd() - current.getStart()) * height)/2; int drawHeight = (int)((current.getEnd() - current.getStart())*height * scaling); double neededYPos = midPoint - drawHeight/2; double translate = neededYPos - curYPos; g2.translate(0, translate); curYPos = neededYPos; Dimension drawSize = new Dimension(width, drawHeight); DrawableSeismogram cur = (DrawableSeismogram)dssPlotter.get(current.getSeis()); cur.draw(g2, drawSize, curTimeEvent, curAmpEvent); cur.drawName(g2, 0, drawHeight/2); } } }
form.getMsg().emit("org.bedework.message.added.events", 1);
form.getMsg().emit("org.bedework.client.message.added.events", 1);
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; int calId = getIntReqPar(request, "calId", -1); if (calId >= 0) { cal = svci.getCalendar(calId); } if (cal == null) { if (getPublicAdmin(form)) { // Must specify a calendar for public events form.getErr().emit("org.bedework.client.error.missingcalendar"); return "retry"; } // Use preferred calendar cal = svci.getPreferredCalendar(); } FormFile upFile = form.getUploadFile(); if (upFile == null) { // Just forget it return "success"; } String fileName = upFile.getFileName(); if ((fileName == null) || (fileName.length() == 0)) { return "retry"; } try { // To catch some of the parser errors InputStream is = upFile.getInputStream(); IcalTranslator trans = new IcalTranslator(svci.getIcalCallback(), debug); Collection objs = trans.fromIcal(cal, new InputStreamReader(is)); Iterator it = objs.iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof EventInfo) { EventInfo ei = (EventInfo)o; BwEvent ev = ei.getEvent(); if (ei.getNewEvent()) { svci.addEvent(cal, ev, ei.getOverrides()); } else { svci.updateEvent(ev); } } } } catch (CalFacadeException cfe) { form.getErr().emit(cfe.getMessage(), cfe.getExtra()); return "baddata"; } form.getMsg().emit("org.bedework.message.added.events", 1); return "success"; }
if (keyId == null) {
if (categoryId == null) {
public int getOriginalCategoryId() { if (keyId == null) { return 0; } return keyId.getOriginalVal(); }
return keyId.getOriginalVal();
return categoryId.getOriginalVal();
public int getOriginalCategoryId() { if (keyId == null) { return 0; } return keyId.getOriginalVal(); }
keyId.setA(val);
categoryId.setA(val);
public void setCategoryId(int val) { if (val >= 0) { keyId.setA(val); } }
keyId.setB(val);
categoryId.setB(val);
public void setPrefCategoryId(int val) { if (val >= 0) { keyId.setB(val); } }
this.report = new RT130Report(); this.propParser = pp;
public RT130FileHandler(Properties props, List rt130FileHandlerFlags) throws FileNotFoundException, IOException, ParseException { PropParser pp = new PropParser(props); flags = rt130FileHandlerFlags; checkFlagsForIncompatibleSettings(); LeapSecondApplier.addLeapSeconds(pp.getPath(LeapSecondApplier.LEAP_SECOND_FILE)); LeapSecondApplier.addCorrections(pp.getPath(LeapSecondApplier.POWER_UP_TIMES)); ncFile = new NCFile(pp.getPath(NCFile.NC_FILE_LOC)); logger.debug("NC file location: " + ncFile.getCanonicalPath()); String xyFileLoc = pp.getPath(XYReader.XY_FILE_LOC); logger.debug("XY file location: " + xyFileLoc); this.report = new RT130Report(); this.propParser = pp; this.props = props; stationLocations = XYReader.read(new BufferedReader(new FileReader(xyFileLoc))); Map dataStreamToSampleRate = new HashMap(); for(int i = 1; i < 7; i++) { if(props.containsKey(RT130ToLocalSeismogram.DATA_STREAM + i)) { dataStreamToSampleRate.put(new Integer(i - 1), new Integer(pp.getInt(RT130ToLocalSeismogram.DATA_STREAM + i))); } } netAttr = PopulationProperties.getNetworkAttr(props); toSeismogram = new RT130ToLocalSeismogram(ncFile, stationLocations, dataStreamToSampleRate, netAttr); rtFileReader = new RT130FileReader(); }
Map dataStreamToSampleRate = new HashMap(); for(int i = 1; i < 7; i++) { if(props.containsKey(RT130ToLocalSeismogram.DATA_STREAM + i)) { dataStreamToSampleRate.put(new Integer(i - 1), new Integer(pp.getInt(RT130ToLocalSeismogram.DATA_STREAM + i))); } }
Map dataStreamToSampleRate = RT130ToLocalSeismogram.makeDataStreamToSampleRate(props, pp);
public RT130FileHandler(Properties props, List rt130FileHandlerFlags) throws FileNotFoundException, IOException, ParseException { PropParser pp = new PropParser(props); flags = rt130FileHandlerFlags; checkFlagsForIncompatibleSettings(); LeapSecondApplier.addLeapSeconds(pp.getPath(LeapSecondApplier.LEAP_SECOND_FILE)); LeapSecondApplier.addCorrections(pp.getPath(LeapSecondApplier.POWER_UP_TIMES)); ncFile = new NCFile(pp.getPath(NCFile.NC_FILE_LOC)); logger.debug("NC file location: " + ncFile.getCanonicalPath()); String xyFileLoc = pp.getPath(XYReader.XY_FILE_LOC); logger.debug("XY file location: " + xyFileLoc); this.report = new RT130Report(); this.propParser = pp; this.props = props; stationLocations = XYReader.read(new BufferedReader(new FileReader(xyFileLoc))); Map dataStreamToSampleRate = new HashMap(); for(int i = 1; i < 7; i++) { if(props.containsKey(RT130ToLocalSeismogram.DATA_STREAM + i)) { dataStreamToSampleRate.put(new Integer(i - 1), new Integer(pp.getInt(RT130ToLocalSeismogram.DATA_STREAM + i))); } } netAttr = PopulationProperties.getNetworkAttr(props); toSeismogram = new RT130ToLocalSeismogram(ncFile, stationLocations, dataStreamToSampleRate, netAttr); rtFileReader = new RT130FileReader(); }
toSeismogram = new RT130ToLocalSeismogram(ncFile, stationLocations, dataStreamToSampleRate, netAttr);
public RT130FileHandler(Properties props, List rt130FileHandlerFlags) throws FileNotFoundException, IOException, ParseException { PropParser pp = new PropParser(props); flags = rt130FileHandlerFlags; checkFlagsForIncompatibleSettings(); LeapSecondApplier.addLeapSeconds(pp.getPath(LeapSecondApplier.LEAP_SECOND_FILE)); LeapSecondApplier.addCorrections(pp.getPath(LeapSecondApplier.POWER_UP_TIMES)); ncFile = new NCFile(pp.getPath(NCFile.NC_FILE_LOC)); logger.debug("NC file location: " + ncFile.getCanonicalPath()); String xyFileLoc = pp.getPath(XYReader.XY_FILE_LOC); logger.debug("XY file location: " + xyFileLoc); this.report = new RT130Report(); this.propParser = pp; this.props = props; stationLocations = XYReader.read(new BufferedReader(new FileReader(xyFileLoc))); Map dataStreamToSampleRate = new HashMap(); for(int i = 1; i < 7; i++) { if(props.containsKey(RT130ToLocalSeismogram.DATA_STREAM + i)) { dataStreamToSampleRate.put(new Integer(i - 1), new Integer(pp.getInt(RT130ToLocalSeismogram.DATA_STREAM + i))); } } netAttr = PopulationProperties.getNetworkAttr(props); toSeismogram = new RT130ToLocalSeismogram(ncFile, stationLocations, dataStreamToSampleRate, netAttr); rtFileReader = new RT130FileReader(); }
NCReader reader = new NCReader(netAttr, stationLocations); reader.load(new FileInputStream(pp.getPath(NCFile.NC_FILE_LOC))); chanCreator = new DASChannelCreator(netAttr, new RT130SamplingFinder(rtFileReader), reader.getSites()); toSeismogram = new RT130ToLocalSeismogram(chanCreator, dataStreamToSampleRate); double nominalLengthOfData = Double.parseDouble(pp.getString("nominalLengthOfData")); acceptableLengthOfData = (nominalLengthOfData + (nominalLengthOfData * 0.05));
public RT130FileHandler(Properties props, List rt130FileHandlerFlags) throws FileNotFoundException, IOException, ParseException { PropParser pp = new PropParser(props); flags = rt130FileHandlerFlags; checkFlagsForIncompatibleSettings(); LeapSecondApplier.addLeapSeconds(pp.getPath(LeapSecondApplier.LEAP_SECOND_FILE)); LeapSecondApplier.addCorrections(pp.getPath(LeapSecondApplier.POWER_UP_TIMES)); ncFile = new NCFile(pp.getPath(NCFile.NC_FILE_LOC)); logger.debug("NC file location: " + ncFile.getCanonicalPath()); String xyFileLoc = pp.getPath(XYReader.XY_FILE_LOC); logger.debug("XY file location: " + xyFileLoc); this.report = new RT130Report(); this.propParser = pp; this.props = props; stationLocations = XYReader.read(new BufferedReader(new FileReader(xyFileLoc))); Map dataStreamToSampleRate = new HashMap(); for(int i = 1; i < 7; i++) { if(props.containsKey(RT130ToLocalSeismogram.DATA_STREAM + i)) { dataStreamToSampleRate.put(new Integer(i - 1), new Integer(pp.getInt(RT130ToLocalSeismogram.DATA_STREAM + i))); } } netAttr = PopulationProperties.getNetworkAttr(props); toSeismogram = new RT130ToLocalSeismogram(ncFile, stationLocations, dataStreamToSampleRate, netAttr); rtFileReader = new RT130FileReader(); }
LocalSeismogramImpl[] seismogramArray = toSeismogram.ConvertRT130ToLocalSeismogram(seismogramDataPacketArray);
LocalSeismogramImpl[] seismogramArray = toSeismogram.convert(seismogramDataPacketArray);
private TimeInterval processSingleRefTekWithKnownChannel(String fileLoc, String fileName, Channel knownChannel, String unitIdNumber) throws IOException { TimeInterval totalSeismogramTime = new TimeInterval(0, UnitImpl.MILLISECOND); PacketType[] seismogramDataPacketArray = null; try { seismogramDataPacketArray = rtFileReader.processRT130Data(fileLoc, false); } catch(RT130FormatException e) { report.addFileFormatException(fileLoc, fileName + " seems to be an invalid rt130 file." + "\n" + e.getMessage()); logger.error(fileName + " seems to be an invalid rt130 file." + "\n" + e.getMessage()); return totalSeismogramTime; } LocalSeismogramImpl[] seismogramArray = toSeismogram.ConvertRT130ToLocalSeismogram(seismogramDataPacketArray); for(int i = 0; i < seismogramArray.length; i++) { // Add one sample period to end time on purpose. addSeismogramToReport(knownChannel, seismogramArray[i].getBeginTime(), seismogramArray[i].getEndTime() .add(seismogramArray[i].getSampling() .getPeriod())); if(flags.contains(RT130FileHandlerFlag.FULL)) { // Add one sample period to end time on purpose. TimeInterval seismogramTime = new TimeInterval(seismogramArray[i].getBeginTime(), seismogramArray[i].getEndTime() .add(seismogramArray[i].getSampling() .getPeriod())); totalSeismogramTime = totalSeismogramTime.add(seismogramTime); } } return totalSeismogramTime; }
this.getRootElement().setAttribute(ATTRIBUTE_IS_SUMMARY_NEW_PAGE,Boolean.toString(value));
this.getRootElement().setAttribute(ATTRIBUTE_IS_SUMMARY_NEW_PAGE,String.valueOf(value));
public void setIsSummaryNewPage(boolean value){ this.getRootElement().setAttribute(ATTRIBUTE_IS_SUMMARY_NEW_PAGE,Boolean.toString(value)); }
TimezonesImpl(boolean debug, BwUser user, RestoreIntf ri)
TimezonesImpl(boolean debug, BwUser user, RestoreGlobals globals)
TimezonesImpl(boolean debug, BwUser user, RestoreIntf ri) throws CalFacadeException { super(debug, user); this.ri = ri; // Force fetch of timezones //lookup("not-a-timezone"); }
this.ri = ri;
this.globals = globals;
TimezonesImpl(boolean debug, BwUser user, RestoreIntf ri) throws CalFacadeException { super(debug, user); this.ri = ri; // Force fetch of timezones //lookup("not-a-timezone"); }
initSystemTimeZones();
TimezonesImpl(boolean debug, BwUser user, RestoreIntf ri) throws CalFacadeException { super(debug, user); this.ri = ri; // Force fetch of timezones //lookup("not-a-timezone"); }
BwTimeZone btz = new BwTimeZone(); btz.setTzid(tzid); btz.setPublick(getPublick()); btz.setOwner(getUser()); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:- sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); btz.setVtimezone(sb.toString()); try { ri.restoreTimezone(btz); } catch (Throwable t) { throw new CalFacadeException(t); }
saveTZ(tzid, vtz, false, getUser());
public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ super.saveTimeZone(tzid, vtz); BwTimeZone btz = new BwTimeZone(); btz.setTzid(tzid); btz.setPublick(getPublick()); btz.setOwner(getUser()); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); btz.setVtimezone(sb.toString()); try { ri.restoreTimezone(btz); } catch (Throwable t) { throw new CalFacadeException(t); } }
public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String captureProperties) throws CreditCardAuthorizationException {
public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, Object parentDataPK, String captureProperties) throws CreditCardAuthorizationException {
public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String captureProperties) throws CreditCardAuthorizationException { IWTimestamp stamp = IWTimestamp.RightNow(); strCCNumber = cardnumber; strCCExpire = yearExpires+monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); try { StringBuffer logText = new StringBuffer(); Hashtable properties = doRefund(getAmountWithExponents(amount), parseResponse(captureProperties)); logText.append("\nRefund successful").append("\nAuthorization Code = "+properties.get(PROPERTY_APPROVAL_CODE)); logText.append("\nAction Code = "+properties.get(PROPERTY_ACTION_CODE).toString()); logger.info(logText.toString()); return properties.get(PROPERTY_APPROVAL_CODE).toString(); } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = "+e.getErrorMessage()); logText.append("\nNumber = "+e.getErrorNumber()); logText.append("\nDisplay error = "+e.getDisplayError()); logger.info(logText.toString()); throw e; } catch (NullPointerException n) { throw new CreditCardAuthorizationException(n); } }
Hashtable properties = doRefund(getAmountWithExponents(amount), parseResponse(captureProperties)); logText.append("\nRefund successful").append("\nAuthorization Code = "+properties.get(PROPERTY_APPROVAL_CODE)); logText.append("\nAction Code = "+properties.get(PROPERTY_ACTION_CODE).toString()); logger.info(logText.toString()); return properties.get(PROPERTY_APPROVAL_CODE).toString(); } catch (CreditCardAuthorizationException e) {
Hashtable capturePropertiesHash = parseResponse(captureProperties); Hashtable properties = doRefund(getAmountWithExponents(amount), capturePropertiesHash, parentDataPK); String authCode = properties.get(PROPERTY_APPROVAL_CODE).toString(); logText.append("\nRefund successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + properties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(null); auth.setCardExpires(monthExpires+yearExpires); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); e.printStackTrace(); if (authCode != null) { return authCode; } else { throw new CreditCardAuthorizationException(e); } } return authCode; } catch (CreditCardAuthorizationException e) {
public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String captureProperties) throws CreditCardAuthorizationException { IWTimestamp stamp = IWTimestamp.RightNow(); strCCNumber = cardnumber; strCCExpire = yearExpires+monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); try { StringBuffer logText = new StringBuffer(); Hashtable properties = doRefund(getAmountWithExponents(amount), parseResponse(captureProperties)); logText.append("\nRefund successful").append("\nAuthorization Code = "+properties.get(PROPERTY_APPROVAL_CODE)); logText.append("\nAction Code = "+properties.get(PROPERTY_ACTION_CODE).toString()); logger.info(logText.toString()); return properties.get(PROPERTY_APPROVAL_CODE).toString(); } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = "+e.getErrorMessage()); logText.append("\nNumber = "+e.getErrorNumber()); logText.append("\nDisplay error = "+e.getDisplayError()); logger.info(logText.toString()); throw e; } catch (NullPointerException n) { throw new CreditCardAuthorizationException(n); } }
System.out.println("referenceNumber => "+strReferenceNumber);
public String doSale(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException { try { IWTimestamp stamp = IWTimestamp.RightNow(); strName = nameOnCard; strCCNumber = cardnumber; strCCExpire = yearExpires+monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); strReferenceNumber = convertStringToNumbers(referenceNumber); StringBuffer logText = new StringBuffer(); System.out.println("referenceNumber => "+strReferenceNumber); Hashtable returnedProperties = getFirstResponse(); String authCode = null; if (returnedProperties != null) { logText.append("Authorization successful"); Hashtable returnedCaptureProperties = finishTransaction(returnedProperties); if (returnedCaptureProperties != null && returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString() != null) { //System.out.println("Approval Code = "+returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString()); authCode = returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString();//returnedCaptureProperties; logText.append("\nCapture successful").append("\nAuthorization Code = "+authCode); logText.append("\nAction Code = "+returnedCaptureProperties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(returnedCaptureProperties.get(PROPERTY_CARD_BRAND_NAME).toString()); auth.setCardExpires(strCCExpire); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(returnedCaptureProperties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(returnedCaptureProperties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); auth.setServerResponse(returnedCaptureProperties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); throw new CreditCardAuthorizationException(e); } } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = "+e.getErrorMessage()); logText.append("\nNumber = "+e.getErrorNumber()); logText.append("\nDisplay error = "+e.getDisplayError()); logger.info(logText.toString()); throw e; } }
auth.setCardExpires(strCCExpire);
auth.setCardExpires(monthExpires+yearExpires);
public String doSale(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException { try { IWTimestamp stamp = IWTimestamp.RightNow(); strName = nameOnCard; strCCNumber = cardnumber; strCCExpire = yearExpires+monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); strReferenceNumber = convertStringToNumbers(referenceNumber); StringBuffer logText = new StringBuffer(); System.out.println("referenceNumber => "+strReferenceNumber); Hashtable returnedProperties = getFirstResponse(); String authCode = null; if (returnedProperties != null) { logText.append("Authorization successful"); Hashtable returnedCaptureProperties = finishTransaction(returnedProperties); if (returnedCaptureProperties != null && returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString() != null) { //System.out.println("Approval Code = "+returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString()); authCode = returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString();//returnedCaptureProperties; logText.append("\nCapture successful").append("\nAuthorization Code = "+authCode); logText.append("\nAction Code = "+returnedCaptureProperties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(returnedCaptureProperties.get(PROPERTY_CARD_BRAND_NAME).toString()); auth.setCardExpires(strCCExpire); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(returnedCaptureProperties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(returnedCaptureProperties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); auth.setServerResponse(returnedCaptureProperties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); throw new CreditCardAuthorizationException(e); } } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = "+e.getErrorMessage()); logText.append("\nNumber = "+e.getErrorNumber()); logText.append("\nDisplay error = "+e.getDisplayError()); logger.info(logText.toString()); throw e; } }
private Hashtable finishTransaction(Hashtable properties) throws KortathjonustanAuthorizationException{ System.out.println(" ------ CAPTURE ------");
private Hashtable finishTransaction(Hashtable properties) throws KortathjonustanAuthorizationException {
private Hashtable finishTransaction(Hashtable properties) throws KortathjonustanAuthorizationException{ System.out.println(" ------ CAPTURE ------"); Hashtable captureProperties = new Hashtable(); try { StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); addProperties(strPostData, properties); String strResponse = null; SSLClient client = getSSLClient(); //System.out.println("strPostData [ "+strPostData.toString()+" ]"); try { strResponse = client.sendRequest(REQUEST_TYPE_CAPTURE, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [ "+strResponse+" ]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { captureProperties = parseResponse(strResponse); captureProperties.put(PROPERTY_CARD_BRAND_NAME, properties.get(PROPERTY_CARD_BRAND_NAME)); if (CODE_AUTHORIZATOIN_APPROVED.equals(captureProperties.get(PROPERTY_ACTION_CODE))) { return captureProperties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(captureProperties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(captureProperties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(captureProperties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return captureProperties; }
StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); addProperties(strPostData, properties); String strResponse = null; SSLClient client = getSSLClient(); try { strResponse = client.sendRequest(REQUEST_TYPE_CAPTURE, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { captureProperties = parseResponse(strResponse); captureProperties.put(PROPERTY_CARD_BRAND_NAME, properties.get(PROPERTY_CARD_BRAND_NAME)); if (CODE_AUTHORIZATOIN_APPROVED.equals(captureProperties.get(PROPERTY_ACTION_CODE))) { return captureProperties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(captureProperties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(captureProperties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(captureProperties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { e.printStackTrace();
strResponse = client.sendRequest(REQUEST_TYPE_CAPTURE, strPostData.toString());
private Hashtable finishTransaction(Hashtable properties) throws KortathjonustanAuthorizationException{ System.out.println(" ------ CAPTURE ------"); Hashtable captureProperties = new Hashtable(); try { StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); addProperties(strPostData, properties); String strResponse = null; SSLClient client = getSSLClient(); //System.out.println("strPostData [ "+strPostData.toString()+" ]"); try { strResponse = client.sendRequest(REQUEST_TYPE_CAPTURE, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [ "+strResponse+" ]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { captureProperties = parseResponse(strResponse); captureProperties.put(PROPERTY_CARD_BRAND_NAME, properties.get(PROPERTY_CARD_BRAND_NAME)); if (CODE_AUTHORIZATOIN_APPROVED.equals(captureProperties.get(PROPERTY_ACTION_CODE))) { return captureProperties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(captureProperties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(captureProperties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(captureProperties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return captureProperties; }
catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 [" + strResponse + "]"); cce.setErrorNumber("-"); throw cce; } else { captureProperties = parseResponse(strResponse); captureProperties.put(PROPERTY_CARD_BRAND_NAME, properties.get(PROPERTY_CARD_BRAND_NAME)); if (CODE_AUTHORIZATOIN_APPROVED.equals(captureProperties.get(PROPERTY_ACTION_CODE))) { return captureProperties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(captureProperties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(captureProperties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(captureProperties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
private Hashtable finishTransaction(Hashtable properties) throws KortathjonustanAuthorizationException{ System.out.println(" ------ CAPTURE ------"); Hashtable captureProperties = new Hashtable(); try { StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); addProperties(strPostData, properties); String strResponse = null; SSLClient client = getSSLClient(); //System.out.println("strPostData [ "+strPostData.toString()+" ]"); try { strResponse = client.sendRequest(REQUEST_TYPE_CAPTURE, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [ "+strResponse+" ]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { captureProperties = parseResponse(strResponse); captureProperties.put(PROPERTY_CARD_BRAND_NAME, properties.get(PROPERTY_CARD_BRAND_NAME)); if (CODE_AUTHORIZATOIN_APPROVED.equals(captureProperties.get(PROPERTY_ACTION_CODE))) { return captureProperties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(captureProperties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(captureProperties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(captureProperties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return captureProperties; }
System.out.println(" ------ REQUEST ------");
private Hashtable getFirstResponse() throws KortathjonustanAuthorizationException { Hashtable properties = null; System.out.println(" ------ REQUEST ------"); //long lStartTime = System.currentTimeMillis(); try { SSLClient client = getSSLClient(); StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_SITE, SITE);//"site=22" appendProperty(strPostData, PROPERTY_USER, USER); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); appendProperty(strPostData, PROPERTY_ACCEPTOR_TERM_ID, ACCEPTOR_TERM_ID); appendProperty(strPostData, PROPERTY_ACCEPTOR_IDENT, ACCEPTOR_IDENTIFICATION); appendProperty(strPostData, PROPERTY_CC_NUMBER, strCCNumber); appendProperty(strPostData, PROPERTY_CC_EXPIRE, strCCExpire); appendProperty(strPostData, PROPERTY_AMOUNT, strAmount); appendProperty(strPostData, PROPERTY_CURRENCY_CODE, strCurrencyCode); appendProperty(strPostData, PROPERTY_CURRENCY_EXPONENT, strCurrencyExponent); appendProperty(strPostData, PROPERTY_CARDHOLDER_NAME, strName); appendProperty(strPostData, PROPERTY_REFERENCE_ID, strReferenceNumber); appendProperty(strPostData, PROPERTY_CURRENT_DATE, strCurrentDate); appendProperty(strPostData, PROPERTY_CC_VERIFY_CODE, strCCVerify); addDefautProperties(strPostData); String strResponse = null; //System.out.println("Request [" + strPostData.toString() + "]"); try { strResponse = client.sendRequest(REQUEST_TYPE_AUTHORIZATION, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [" + strResponse + "]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { properties = parseResponse(strResponse); if (CODE_AUTHORIZATOIN_APPROVED.equals(properties.get(PROPERTY_ACTION_CODE))) { return properties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(properties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(properties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("UnsupportedEncodingException"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } }
StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_SITE, SITE); appendProperty(strPostData, PROPERTY_USER, USER); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); appendProperty(strPostData, PROPERTY_ACCEPTOR_TERM_ID, ACCEPTOR_TERM_ID); appendProperty(strPostData, PROPERTY_ACCEPTOR_IDENT, ACCEPTOR_IDENTIFICATION); appendProperty(strPostData, PROPERTY_CC_NUMBER, strCCNumber); appendProperty(strPostData, PROPERTY_CC_EXPIRE, strCCExpire); appendProperty(strPostData, PROPERTY_AMOUNT, strAmount); appendProperty(strPostData, PROPERTY_CURRENCY_CODE, strCurrencyCode); appendProperty(strPostData, PROPERTY_CURRENCY_EXPONENT, strCurrencyExponent); appendProperty(strPostData, PROPERTY_CARDHOLDER_NAME, strName); appendProperty(strPostData, PROPERTY_REFERENCE_ID, strReferenceNumber); appendProperty(strPostData, PROPERTY_CURRENT_DATE, strCurrentDate); appendProperty(strPostData, PROPERTY_CC_VERIFY_CODE, strCCVerify); addDefautProperties(strPostData); String strResponse = null;
StringBuffer strPostData = new StringBuffer(); appendProperty(strPostData, PROPERTY_SITE, SITE); appendProperty(strPostData, PROPERTY_USER, USER); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); appendProperty(strPostData, PROPERTY_ACCEPTOR_TERM_ID, ACCEPTOR_TERM_ID); appendProperty(strPostData, PROPERTY_ACCEPTOR_IDENT, ACCEPTOR_IDENTIFICATION); appendProperty(strPostData, PROPERTY_CC_NUMBER, strCCNumber); appendProperty(strPostData, PROPERTY_CC_EXPIRE, strCCExpire); appendProperty(strPostData, PROPERTY_AMOUNT, strAmount); appendProperty(strPostData, PROPERTY_CURRENCY_CODE, strCurrencyCode); appendProperty(strPostData, PROPERTY_CURRENCY_EXPONENT, strCurrencyExponent); appendProperty(strPostData, PROPERTY_CARDHOLDER_NAME, strName); appendProperty(strPostData, PROPERTY_REFERENCE_ID, strReferenceNumber); appendProperty(strPostData, PROPERTY_CURRENT_DATE, strCurrentDate); appendProperty(strPostData, PROPERTY_CC_VERIFY_CODE, strCCVerify); addDefautProperties(strPostData);
private Hashtable getFirstResponse() throws KortathjonustanAuthorizationException { Hashtable properties = null; System.out.println(" ------ REQUEST ------"); //long lStartTime = System.currentTimeMillis(); try { SSLClient client = getSSLClient(); StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_SITE, SITE);//"site=22" appendProperty(strPostData, PROPERTY_USER, USER); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); appendProperty(strPostData, PROPERTY_ACCEPTOR_TERM_ID, ACCEPTOR_TERM_ID); appendProperty(strPostData, PROPERTY_ACCEPTOR_IDENT, ACCEPTOR_IDENTIFICATION); appendProperty(strPostData, PROPERTY_CC_NUMBER, strCCNumber); appendProperty(strPostData, PROPERTY_CC_EXPIRE, strCCExpire); appendProperty(strPostData, PROPERTY_AMOUNT, strAmount); appendProperty(strPostData, PROPERTY_CURRENCY_CODE, strCurrencyCode); appendProperty(strPostData, PROPERTY_CURRENCY_EXPONENT, strCurrencyExponent); appendProperty(strPostData, PROPERTY_CARDHOLDER_NAME, strName); appendProperty(strPostData, PROPERTY_REFERENCE_ID, strReferenceNumber); appendProperty(strPostData, PROPERTY_CURRENT_DATE, strCurrentDate); appendProperty(strPostData, PROPERTY_CC_VERIFY_CODE, strCCVerify); addDefautProperties(strPostData); String strResponse = null; //System.out.println("Request [" + strPostData.toString() + "]"); try { strResponse = client.sendRequest(REQUEST_TYPE_AUTHORIZATION, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [" + strResponse + "]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { properties = parseResponse(strResponse); if (CODE_AUTHORIZATOIN_APPROVED.equals(properties.get(PROPERTY_ACTION_CODE))) { return properties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(properties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(properties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("UnsupportedEncodingException"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } }
try { strResponse = client.sendRequest(REQUEST_TYPE_AUTHORIZATION, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; }
String strResponse = null;
private Hashtable getFirstResponse() throws KortathjonustanAuthorizationException { Hashtable properties = null; System.out.println(" ------ REQUEST ------"); //long lStartTime = System.currentTimeMillis(); try { SSLClient client = getSSLClient(); StringBuffer strPostData= new StringBuffer(); appendProperty(strPostData, PROPERTY_SITE, SITE);//"site=22" appendProperty(strPostData, PROPERTY_USER, USER); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); appendProperty(strPostData, PROPERTY_ACCEPTOR_TERM_ID, ACCEPTOR_TERM_ID); appendProperty(strPostData, PROPERTY_ACCEPTOR_IDENT, ACCEPTOR_IDENTIFICATION); appendProperty(strPostData, PROPERTY_CC_NUMBER, strCCNumber); appendProperty(strPostData, PROPERTY_CC_EXPIRE, strCCExpire); appendProperty(strPostData, PROPERTY_AMOUNT, strAmount); appendProperty(strPostData, PROPERTY_CURRENCY_CODE, strCurrencyCode); appendProperty(strPostData, PROPERTY_CURRENCY_EXPONENT, strCurrencyExponent); appendProperty(strPostData, PROPERTY_CARDHOLDER_NAME, strName); appendProperty(strPostData, PROPERTY_REFERENCE_ID, strReferenceNumber); appendProperty(strPostData, PROPERTY_CURRENT_DATE, strCurrentDate); appendProperty(strPostData, PROPERTY_CC_VERIFY_CODE, strCCVerify); addDefautProperties(strPostData); String strResponse = null; //System.out.println("Request [" + strPostData.toString() + "]"); try { strResponse = client.sendRequest(REQUEST_TYPE_AUTHORIZATION, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [" + strResponse + "]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 ["+strResponse+"]"); cce.setErrorNumber("-"); throw cce; }else { properties = parseResponse(strResponse); if (CODE_AUTHORIZATOIN_APPROVED.equals(properties.get(PROPERTY_ACTION_CODE))) { return properties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(properties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(properties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("UnsupportedEncodingException"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } }