rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
public boolean init(String authenticatedUser,
public boolean init(String url, String authenticatedUser,
public boolean init(String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; try { objTimestamp = new Timestamp(System.currentTimeMillis()); this.synchId = synchId; if ((synchId != null) && publicAdmin) { throw new CalFacadeException("synch only valid for non admin"); } } catch (Throwable t) { throw new CalFacadeException(t); } if (user == null) { user = authenticatedUser; } return userCreated; }
this.url = url;
public boolean init(String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; try { objTimestamp = new Timestamp(System.currentTimeMillis()); this.synchId = synchId; if ((synchId != null) && publicAdmin) { throw new CalFacadeException("synch only valid for non admin"); } } catch (Throwable t) { throw new CalFacadeException(t); } if (user == null) { user = authenticatedUser; } return userCreated; }
throw new CalFacadeException("User " + val + " does not exist.");
throw new CalFacadeException(CalFacadeException.noSuchAccount, val);
public void setUser(String val) throws CalFacadeException { refreshEvents(); user = getUser(val); if (this.user == null) { throw new CalFacadeException("User " + val + " does not exist."); } logon(user); if (debug) { log.debug("User " + val + " set in calintf"); } }
temp = new String[0];
temp = new String[1];
private void updateParameterNameCache(String paramName) { String[] temp = parameterNameCache; if(temp == null) { temp = new String[0]; temp[0] = paramName; } else { temp = new String[parameterNameCache.length + 1]; System.arraycopy(parameterNameCache,0, temp, 0, parameterNameCache.length); temp[parameterNameCache.length] = paramName; } parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length); }
parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length);
parameterNameCache = temp;
private void updateParameterNameCache(String paramName) { String[] temp = parameterNameCache; if(temp == null) { temp = new String[0]; temp[0] = paramName; } else { temp = new String[parameterNameCache.length + 1]; System.arraycopy(parameterNameCache,0, temp, 0, parameterNameCache.length); temp[parameterNameCache.length] = paramName; } parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length); }
if (isPublicAdmin() || isGuest()) {
if (isGuest()) {
Calintf getCal() throws CalFacadeException { if (cali != null) { return cali; } try { cali = (Calintf)CalEnv.getGlobalObject("calintfclass", Calintf.class); } catch (Throwable t) { throw new CalFacadeException(t); } try { cali.open(); // Just for the user interactions cali.beginTransaction(); boolean userCreated = cali.init(pars.getAuthUser(), pars.getUser(), pars.getPublicAdmin(), pars.isSuperUser(), getGroups(), pars.getSynchId(), debug); // Prepare for call below. publicUserAccount = cali.getSyspars().getPublicUser(); BwUser auth; if (isPublicAdmin() || isGuest()) { auth = getPublicUser(); } else { auth = cali.getUser(pars.getAuthUser()); } dbi = new CalSvcDb(this, auth); if (userCreated) { // Add preferences BwPreferences prefs = new BwPreferences(); BwCalendar cal = cali.getDefaultCalendar(); prefs.setOwner(auth); prefs.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); setupOwnedEntity(sub); prefs.addSubscription(sub); // Add default subscription for trash calendar. cal = cali.getTrashCalendar(); sub = BwSubscription.makeSubscription(cal, cal.getName(), false, false, false); setupOwnedEntity(sub); prefs.addSubscription(sub); dbi.updatePreferences(prefs); } return cali; } finally { cali.endTransaction(); cali.close(); } }
} if (debug) { trace("Got auth user object " + auth);
Calintf getCal() throws CalFacadeException { if (cali != null) { return cali; } try { cali = (Calintf)CalEnv.getGlobalObject("calintfclass", Calintf.class); } catch (Throwable t) { throw new CalFacadeException(t); } try { cali.open(); // Just for the user interactions cali.beginTransaction(); boolean userCreated = cali.init(pars.getAuthUser(), pars.getUser(), pars.getPublicAdmin(), pars.isSuperUser(), getGroups(), pars.getSynchId(), debug); // Prepare for call below. publicUserAccount = cali.getSyspars().getPublicUser(); BwUser auth; if (isPublicAdmin() || isGuest()) { auth = getPublicUser(); } else { auth = cali.getUser(pars.getAuthUser()); } dbi = new CalSvcDb(this, auth); if (userCreated) { // Add preferences BwPreferences prefs = new BwPreferences(); BwCalendar cal = cali.getDefaultCalendar(); prefs.setOwner(auth); prefs.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); setupOwnedEntity(sub); prefs.addSubscription(sub); // Add default subscription for trash calendar. cal = cali.getTrashCalendar(); sub = BwSubscription.makeSubscription(cal, cal.getName(), false, false, false); setupOwnedEntity(sub); prefs.addSubscription(sub); dbi.updatePreferences(prefs); } return cali; } finally { cali.endTransaction(); cali.close(); } }
row.add(browser);
row.add(sub);
private void addBrowser(JPanel p) { JPanel row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Browser:")); row.add(browser); p.add(row); }
row.add(loggingDir);
row.add(sub);
private void addLoggingDir(JPanel p) { JPanel row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Logging Directory:")); row.add(loggingDir); p.add(row); }
return getFont(key, new Font("SansSerif", 12, Font.PLAIN));
return getFont(key, new Font("SansSerif", Font.PLAIN, 12));
public Font getFont(String key) { return getFont(key, new Font("SansSerif", 12, Font.PLAIN)); }
BwAdminGroup entity = (BwAdminGroup)pop();
public void end(String ns, String name) throws Exception { try { BwAdminGroup entity = (BwAdminGroup)pop(); if (entity.getGroupOwner() == null) { error("Missing group owner for admin group " + entity); return; } if (entity.getOwner() == null) { error("Missing owner for admin group " + entity); return; } globals.adminGroups++; if (globals.rintf != null) { globals.rintf.restoreAdminGroup(entity); } if (globals.from2p3px) { globals.getSuperGroup().addGroupMember(entity); } } catch (Throwable t) { throw new Exception(t); } }
error("Unable to restore admin group " + entity);
public void end(String ns, String name) throws Exception { try { BwAdminGroup entity = (BwAdminGroup)pop(); if (entity.getGroupOwner() == null) { error("Missing group owner for admin group " + entity); return; } if (entity.getOwner() == null) { error("Missing owner for admin group " + entity); return; } globals.adminGroups++; if (globals.rintf != null) { globals.rintf.restoreAdminGroup(entity); } if (globals.from2p3px) { globals.getSuperGroup().addGroupMember(entity); } } catch (Throwable t) { throw new Exception(t); } }
}
public void appendEvents(EventAccessOperations[] appendEvents) { ProxyEventAccessOperations[] tmp = new ProxyEventAccessOperations[events.length + appendEvents.length]; System.arraycopy(events, 0, tmp, 0, events.length); System.arraycopy(appendEvents, 0, tmp, events.length, appendEvents.length); this.events = tmp; fireTableDataChanged(); fireEventDataAppended(events); }
ProxyEventAccessOperations[] eaos = new ProxyEventAccessOperations[getRowCount()]; for (int i = 0; i < getRowCount(); i++) { eaos[i] = BulletproofVestFactory.vestEventAccess(getEventForRow(i)); } return eaos;
synchronized(events) { return events; }
public EventAccessOperations[] getAllEvents() { ProxyEventAccessOperations[] eaos = new ProxyEventAccessOperations[getRowCount()]; for (int i = 0; i < getRowCount(); i++) { eaos[i] = BulletproofVestFactory.vestEventAccess(getEventForRow(i)); } return eaos; }
}
public EventAccessOperations getEventForRow(int row) { if (isRowCached(row)) { return (EventAccessOperations)cachedEvents.get(events[row]); } else { ProxyEventAccessOperations cache = (ProxyEventAccessOperations)backgrounded.get(events[row]); if (cache == null) { cache = (ProxyEventAccessOperations)cachedEvents.get(events[row]); } return cache; } }
return events.length;
return getAllEvents().length;
public int getRowCount() { return events.length; }
for (int i = 0; i < getRowCount(); i++) { EventAccessOperations eao = getEventForRow(i); if (eao.equals(event)) { return i; } }
synchronized(events) { EventAccessOperations[] copyEvents = getAllEvents(); for (int i = 0; i < copyEvents.length; i++) { if (event.equals(copyEvents[i])) { return i; } } }
public int getRowForEvent(EventAccessOperations event) { for (int i = 0; i < getRowCount(); i++) { EventAccessOperations eao = getEventForRow(i); if (eao.equals(event)) { return i; } } return -1; }
}
public boolean isRowCached(int row) { if (backgrounded.containsKey(events[row])) { return false; } if (!cachedEvents.containsKey(events[row])) { // load in background ProxyEventAccessOperations cache = BulletproofVestFactory.vestEventAccess(events[row]); backgrounded.put(events[row], cache); rowNumber.put(events[row], new Integer(row)); EventLoader backLoader = new EventLoader(((CacheEvent)cache.getWrappedEventAccess(CacheEvent.class)), this); WorkerThreadPool.getDefaultPool().invokeLater(backLoader); return false; } else { return true; } }
this.events = events; cachedEvents.clear(); rowNumber.clear(); fireEventDataCleared(); fireTableDataChanged(); fireEventDataChanged(events);
synchronized(events) { this.events = events; cachedEvents.clear(); rowNumber.clear(); for (int i = 0; i < events.length; i++) { events[i] = BulletproofVestFactory.vestEventAccess(events[i]); } } fireEventDataCleared(); fireTableDataChanged(); fireEventDataChanged(events);
public void updateEvents(EventAccessOperations[] events) { this.events = events; cachedEvents.clear(); rowNumber.clear(); fireEventDataCleared(); fireTableDataChanged(); fireEventDataChanged(events); }
public EventAccessOperations getWrappedEventAccess(Class wrappedClass){ if(getClass().equals(wrappedClass)) { return this; } if(getWrappedEventAccess().getClass().equals(wrappedClass)){ return getWrappedEventAccess(); }else if(getWrappedEventAccess().getClass().equals(ProxyEventAccessOperations.class)){ return ((ProxyEventAccessOperations)getWrappedEventAccess()).getWrappedEventAccess(wrappedClass); } throw new IllegalArgumentException("This doesn't contain an Event of class " + wrappedClass);
public EventAccessOperations getWrappedEventAccess(){ return event;
public EventAccessOperations getWrappedEventAccess(Class wrappedClass){ if(getClass().equals(wrappedClass)) { return this; } if(getWrappedEventAccess().getClass().equals(wrappedClass)){ return getWrappedEventAccess(); }else if(getWrappedEventAccess().getClass().equals(ProxyEventAccessOperations.class)){ return ((ProxyEventAccessOperations)getWrappedEventAccess()).getWrappedEventAccess(wrappedClass); } throw new IllegalArgumentException("This doesn't contain an Event of class " + wrappedClass); }
userRootCal.setAccess(globals.getDefaultPersonalAccess());
public void end(String ns, String name) throws Exception { if (!globals.from2p3px) { // Not converting return; } try { /* We are converting filter definitions into calendar definitions. */ if (globals.rintf != null) { globals.rintf.restoreCalendars(globals.publicCalRoot); } // Ensure public user in user table. globals.getPublicUser(); /* Create a root level user calendar collection. */ BwCalendar userRootCal = new BwCalendar(); userRootCal.setId(globals.nextCalKey); globals.nextCalKey++; userRootCal.setName(globals.syspars.getUserCalendarRoot()); userRootCal.setPath("/" + globals.syspars.getUserCalendarRoot()); userRootCal.setCreator(globals.getPublicUser()); userRootCal.setOwner(globals.getPublicUser()); if (globals.rintf != null) { globals.rintf.restoreCalendars(userRootCal); } Iterator it = globals.usersTbl.values().iterator(); while (it.hasNext()) { BwUser u = (BwUser)it.next(); makeUserCals(u, userRootCal); } } catch (Throwable t) { throw new Exception(t); } }
globals.trashCalendars.put(new Integer(u.getId()), cal);
private void makeUserCals(BwUser u, BwCalendar userRootCal) throws Throwable { /* Create a user collection */ /* Create a folder for the user */ BwCalendar ucal = new BwCalendar(); ucal.setId(globals.nextCalKey); globals.nextCalKey++; ucal.setName(u.getAccount()); ucal.setPath(userRootCal.getPath() + "/" + u.getAccount()); ucal.setCreator(u); ucal.setOwner(u); ucal.setCalendar(userRootCal); userRootCal.addChild(ucal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setId(globals.nextCalKey); globals.nextCalKey++; cal.setName(globals.syspars.getUserDefaultCalendar()); cal.setPath(ucal.getPath() + "/" + cal.getName()); cal.setCreator(u); cal.setOwner(u); cal.setCalendar(ucal); cal.setCalendarCollection(true); ucal.addChild(cal); globals.calendarsTbl.put(new Integer(cal.getId()), cal); globals.defaultCalendars.put(new Integer(u.getId()), cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setId(globals.nextCalKey); globals.nextCalKey++; cal.setName(globals.syspars.getDefaultTrashCalendar()); cal.setPath(ucal.getPath() + "/" + cal.getName()); cal.setCreator(u); cal.setOwner(u); cal.setCalendar(ucal); cal.setCalendarCollection(true); ucal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setId(globals.nextCalKey); globals.nextCalKey++; cal.setName(globals.syspars.getUserInbox()); cal.setPath(ucal.getPath() + "/" + cal.getName()); cal.setCreator(u); cal.setOwner(u); cal.setCalendar(ucal); cal.setCalendarCollection(true); ucal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setId(globals.nextCalKey); globals.nextCalKey++; cal.setName(globals.syspars.getUserOutbox()); cal.setPath(ucal.getPath() + "/" + cal.getName()); cal.setCreator(u); cal.setOwner(u); cal.setCalendar(ucal); cal.setCalendarCollection(true); ucal.addChild(cal); if (globals.rintf != null) { globals.rintf.restoreCalendars(ucal); globals.rintf.fixUserEventsCal(u, cal); globals.rintf.update(u); } }
System.out.println("length of listeners[]: " + listeners.length);
private void fireZoomChanged(ZoomEvent ze){ // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); System.out.println("length of listeners[]: " + listeners.length); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { System.out.println("fireZoomChanged listener informed"); if (listeners[i]==ZoomListener.class) { // Lazily create the event: if (ze != null){ ((ZoomListener)listeners[i+1]).zoom(ze); } } } }
System.out.println("fireZoomChanged listener informed");
private void fireZoomChanged(ZoomEvent ze){ // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); System.out.println("length of listeners[]: " + listeners.length); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { System.out.println("fireZoomChanged listener informed"); if (listeners[i]==ZoomListener.class) { // Lazily create the event: if (ze != null){ ((ZoomListener)listeners[i+1]).zoom(ze); } } } }
System.out.println("mouseClicked in ZoomEvent");
public void mouseClicked(MouseEvent e){ System.out.println("mouseClicked in ZoomEvent"); if (isActive()){ LatLonPoint llp = mapBean.getCoordinates(e); mapBean.center(new CenterEvent(this, llp.getLatitude(), llp.getLongitude())); zoom(); } }
form.getEvent().copyTo(evcopy);
ei.getEvent().shallowCopyTo(evcopy);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
form.setEvent(evcopy);
evcopy.setGuid(null); if (debug) { BwLocation l = evcopy.getLocation(); if (l == null) { debugMsg("Copied event has null location"); } else { debugMsg("Copied event has location with id " + l.getId()); } } ei.setEvent(evcopy); form.setEventInfo(ei); resetEvent(form);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
if (!validateEvent(form)) {
if (!validateEvent(form, svci, event, form.getErr())) {
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
BwEvent ev = form.getEvent(); ev.setPublick(true);
event.setPublick(true);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
svci.addEvent(ev, null);
svci.addEvent(event, null);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
svci.updateEvent(ev);
svci.updateEvent(event);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar());
updateAuthPrefs(form, event.getCategories(), event.getSponsor(), event.getLocation(), event.getCalendar());
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
form.resetEvent(); form.assignAddingEvent(false);
resetEvent(form);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
form.assignAddingEvent(false);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.fetchSvci(); if (!validateEvent(form)) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci();
private boolean validateEvent(PEActionForm form, CalSvcI svci, BwEvent event, MessageEmit err) throws Throwable { boolean ok = validateEventCategory(form, svci, event, err);
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci(); if (!form.validateEventSponsor()) { ok = false; } if (!form.validateEventLocation()) { ok = false; } if (!form.validateEventCalendar()) { ok = false; } if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, ev, true, // descriptionRequired form.getErr()); } return ok; }
if (!form.validateEventSponsor()) {
if (!validateEventSponsor(form, svci, event, err)) {
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci(); if (!form.validateEventSponsor()) { ok = false; } if (!form.validateEventLocation()) { ok = false; } if (!form.validateEventCalendar()) { ok = false; } if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, ev, true, // descriptionRequired form.getErr()); } return ok; }
if (!form.validateEventLocation()) {
if (!validateEventLocation(form, svci, event, err)) {
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci(); if (!form.validateEventSponsor()) { ok = false; } if (!form.validateEventLocation()) { ok = false; } if (!form.validateEventCalendar()) { ok = false; } if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, ev, true, // descriptionRequired form.getErr()); } return ok; }
if (!form.validateEventCalendar()) {
if (!validateEventCalendar(form, svci, event, err)) {
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci(); if (!form.validateEventSponsor()) { ok = false; } if (!form.validateEventLocation()) { ok = false; } if (!form.validateEventCalendar()) { ok = false; } if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, ev, true, // descriptionRequired form.getErr()); } return ok; }
if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) {
if (!form.getEventDates().updateEvent(event, svci.getTimezones())) {
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci(); if (!form.validateEventSponsor()) { ok = false; } if (!form.validateEventLocation()) { ok = false; } if (!form.validateEventCalendar()) { ok = false; } if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, ev, true, // descriptionRequired form.getErr()); } return ok; }
ok = BwWebUtil.validateEvent(svci, ev, true, form.getErr());
ok = BwWebUtil.validateEvent(svci, event, true, err);
private boolean validateEvent(PEActionForm form) throws Throwable { boolean ok = form.validateEventCategory(); BwEvent ev = form.getEvent(); CalSvcI svci = form.fetchSvci(); if (!form.validateEventSponsor()) { ok = false; } if (!form.validateEventLocation()) { ok = false; } if (!form.validateEventCalendar()) { ok = false; } if (!form.getEventDates().updateEvent(ev, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, ev, true, // descriptionRequired form.getErr()); } return ok; }
if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; }
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException {
private boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException {
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException { /** Do some checks first */ String authUser = String.valueOf(form.getCurrentUser()); if (!publicAdmin) { /* We're never allowed to switch identity as a user client. */ if (!authUser.equals(String.valueOf(user))) { return false; } } else if (user == null) { throw new CalFacadeException("Null user parameter for public admin."); } CalSvcI svci = BwWebUtil.getCalSvcI(request); /** Make some checks to see if this is an old - restarted session. If so discard the svc interface */ if (svci != null) { if (!svci.isOpen()) { svci = null; info(".Svci interface discarded from old session"); } } if (svci != null) { /* Already there and already opened */ if (debug) { debugMsg("CalSvcI-- Obtained from session for user " + svci.getUser()); } } else { if (debug) { debugMsg(".CalSvcI-- get new object for user " + user); } /* create a call back object so the filter can open the service interface */ BwCallback cb = new Callback(form); HttpSession hsess = request.getSession(); hsess.setAttribute(BwCallback.cbAttrName, cb); String runAsUser = user; try { svci = new CalSvc(); if (publicAdmin || (user == null)) { runAsUser = form.getEnv().getAppProperty("run.as.user"); } CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, form.getEnv().getAppPrefix(), publicAdmin, false, // caldav null, // synchId debug); svci.init(pars); BwWebUtil.setCalSvcI(request, svci); form.setCalSvcI(svci); cb.in(true); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } } form.assignUserVO((BwUser)svci.getUser().clone()); if (publicAdmin) { canSwitch = canSwitch || ((access & UserAuth.contentAdminUser) != 0) || ((access & UserAuth.superUser) != 0); BwUser u = svci.getUser(); if (u == null) { throw new CalFacadeException("Null user for public admin."); } String curUser = u.getAccount(); if (!canSwitch && !user.equals(curUser)) { /** Trying to switch but not allowed */ return false; } if (!user.equals(curUser)) { /** Switching user */ svci.setUser(user); curUser = user; } form.assignCurrentAdminUser(curUser); } return true; }
CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser,
CalSvcIPars pars = new CalSvcIPars(user, runAsUser,
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException { /** Do some checks first */ String authUser = String.valueOf(form.getCurrentUser()); if (!publicAdmin) { /* We're never allowed to switch identity as a user client. */ if (!authUser.equals(String.valueOf(user))) { return false; } } else if (user == null) { throw new CalFacadeException("Null user parameter for public admin."); } CalSvcI svci = BwWebUtil.getCalSvcI(request); /** Make some checks to see if this is an old - restarted session. If so discard the svc interface */ if (svci != null) { if (!svci.isOpen()) { svci = null; info(".Svci interface discarded from old session"); } } if (svci != null) { /* Already there and already opened */ if (debug) { debugMsg("CalSvcI-- Obtained from session for user " + svci.getUser()); } } else { if (debug) { debugMsg(".CalSvcI-- get new object for user " + user); } /* create a call back object so the filter can open the service interface */ BwCallback cb = new Callback(form); HttpSession hsess = request.getSession(); hsess.setAttribute(BwCallback.cbAttrName, cb); String runAsUser = user; try { svci = new CalSvc(); if (publicAdmin || (user == null)) { runAsUser = form.getEnv().getAppProperty("run.as.user"); } CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, form.getEnv().getAppPrefix(), publicAdmin, false, // caldav null, // synchId debug); svci.init(pars); BwWebUtil.setCalSvcI(request, svci); form.setCalSvcI(svci); cb.in(true); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } } form.assignUserVO((BwUser)svci.getUser().clone()); if (publicAdmin) { canSwitch = canSwitch || ((access & UserAuth.contentAdminUser) != 0) || ((access & UserAuth.superUser) != 0); BwUser u = svci.getUser(); if (u == null) { throw new CalFacadeException("Null user for public admin."); } String curUser = u.getAccount(); if (!canSwitch && !user.equals(curUser)) { /** Trying to switch but not allowed */ return false; } if (!user.equals(curUser)) { /** Switching user */ svci.setUser(user); curUser = user; } form.assignCurrentAdminUser(curUser); } return true; }
protected int getAccess(HttpServletRequest req, MessageResources messages) throws CalFacadeException {
private int getAccess(HttpServletRequest req, MessageResources messages) throws CalFacadeException {
protected int getAccess(HttpServletRequest req, MessageResources messages) throws CalFacadeException { int access = 0; /** This form works with broken containers. */ if (req.isUserInRole( getMessages().getMessage("org.bedework.role.admin"))) { access += UserAuth.superUser; } if (req.isUserInRole( getMessages().getMessage("org.bedework.role.contentadmin"))) { access += UserAuth.contentAdminUser; } if (req.isUserInRole( getMessages().getMessage("org.bedework.role.alert"))) { access += UserAuth.alertUser; } if (req.isUserInRole( getMessages().getMessage("org.bedework.role.owner"))) { access += UserAuth.publicEventUser; } /** This is how it out to look if (req.isUserInRole("admin")) { access += UserAuth.superUser; } if (req.isUserInRole("contentadmin")) { access += UserAuth.contentAdminUser; } if (req.isUserInRole("alert")) { access += UserAuth.alertUser; } if (req.isUserInRole("owner")) { access += UserAuth.publicEventUser; } */ return access; }
/** This is how it out to look
/** This is how it ought to look
protected int getAccess(HttpServletRequest req, MessageResources messages) throws CalFacadeException { int access = 0; /** This form works with broken containers. */ if (req.isUserInRole( getMessages().getMessage("org.bedework.role.admin"))) { access += UserAuth.superUser; } if (req.isUserInRole( getMessages().getMessage("org.bedework.role.contentadmin"))) { access += UserAuth.contentAdminUser; } if (req.isUserInRole( getMessages().getMessage("org.bedework.role.alert"))) { access += UserAuth.alertUser; } if (req.isUserInRole( getMessages().getMessage("org.bedework.role.owner"))) { access += UserAuth.publicEventUser; } /** This is how it out to look if (req.isUserInRole("admin")) { access += UserAuth.superUser; } if (req.isUserInRole("contentadmin")) { access += UserAuth.contentAdminUser; } if (req.isUserInRole("alert")) { access += UserAuth.alertUser; } if (req.isUserInRole("owner")) { access += UserAuth.publicEventUser; } */ return access; }
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable {
private synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable {
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(request, form); String appName = env.getAppProperty("name"); String appRoot = env.getAppProperty("root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("hour24")); form.setMinIncrement(env.getAppIntProperty("minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
/*
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(request, form); String appName = env.getAppProperty("name"); String appRoot = env.getAppProperty("root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("hour24")); form.setMinIncrement(env.getAppIntProperty("minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
*/
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(request, form); String appName = env.getAppProperty("name"); String appRoot = env.getAppProperty("root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("hour24")); form.setMinIncrement(env.getAppIntProperty("minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();}
public void paint(Graphics g){ if(overSizedImage == null || overSizedImage.get() == null){ logger.debug("the image is null and is being recreated"); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();} this.createImage(); return; } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); Graphics2D g2 = (Graphics2D)g; if(displayTime == timeConfig.getTimeRange().getInterval().getValue()){ double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * overSize.getWidth(); g2.drawImage(((Image)overSizedImage.get()), AffineTransform.getTranslateInstance(-offset, 0.0), null); if(redo) this.createImage(); redo = false; } else{ double scale = displayTime/timeConfig.getTimeRange().getInterval().getValue(); double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * (overSize.getWidth() * scale); AffineTransform tx = AffineTransform.getTranslateInstance(-offset, 0.0); tx.scale(scale, 1); g2.drawImage(((Image)overSizedImage.get()), tx, null); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();} this.createImage(); } }
double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * overSize.getWidth(); g2.drawImage(((Image)overSizedImage.get()), AffineTransform.getTranslateInstance(-offset, 0.0), null);
synchronized(this){ double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * overSize.getWidth(); g2.drawImage(((Image)overSizedImage.get()), AffineTransform.getTranslateInstance(-offset, 0.0), null); }
public void paint(Graphics g){ if(overSizedImage == null || overSizedImage.get() == null){ logger.debug("the image is null and is being recreated"); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();} this.createImage(); return; } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); Graphics2D g2 = (Graphics2D)g; if(displayTime == timeConfig.getTimeRange().getInterval().getValue()){ double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * overSize.getWidth(); g2.drawImage(((Image)overSizedImage.get()), AffineTransform.getTranslateInstance(-offset, 0.0), null); if(redo) this.createImage(); redo = false; } else{ double scale = displayTime/timeConfig.getTimeRange().getInterval().getValue(); double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * (overSize.getWidth() * scale); AffineTransform tx = AffineTransform.getTranslateInstance(-offset, 0.0); tx.scale(scale, 1); g2.drawImage(((Image)overSizedImage.get()), tx, null); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();} this.createImage(); } }
double scale = displayTime/timeConfig.getTimeRange().getInterval().getValue(); double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * (overSize.getWidth() * scale); AffineTransform tx = AffineTransform.getTranslateInstance(-offset, 0.0); tx.scale(scale, 1); g2.drawImage(((Image)overSizedImage.get()), tx, null); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();}
synchronized(this){ double scale = displayTime/timeConfig.getTimeRange().getInterval().getValue(); double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * (overSize.getWidth() * scale); AffineTransform tx = AffineTransform.getTranslateInstance(-offset, 0.0); tx.scale(scale, 1); g2.drawImage(((Image)overSizedImage.get()), tx, null); displayInterval = timeConfig.getTimeRange().getInterval(); }
public void paint(Graphics g){ if(overSizedImage == null || overSizedImage.get() == null){ logger.debug("the image is null and is being recreated"); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();} this.createImage(); return; } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); Graphics2D g2 = (Graphics2D)g; if(displayTime == timeConfig.getTimeRange().getInterval().getValue()){ double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * overSize.getWidth(); g2.drawImage(((Image)overSizedImage.get()), AffineTransform.getTranslateInstance(-offset, 0.0), null); if(redo) this.createImage(); redo = false; } else{ double scale = displayTime/timeConfig.getTimeRange().getInterval().getValue(); double offset = (beginTime - overBeginTime)/ (double)(overTimeInterval) * (overSize.getWidth() * scale); AffineTransform tx = AffineTransform.getTranslateInstance(-offset, 0.0); tx.scale(scale, 1); g2.drawImage(((Image)overSizedImage.get()), tx, null); synchronized(this){ displayInterval = timeConfig.getTimeRange().getInterval();} this.createImage(); } }
overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); overEndTime = overTimeRange.getEndTime().getMicroSecondTime();
overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(3); displayTime = displayInterval.getValue();
public synchronized void setImage(Image newImage){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); overTimeInterval = overEndTime - overBeginTime; displayTime = displayInterval.getValue(); overSizedImage = new SoftReference(newImage); repaint(); }
overTimeInterval = overEndTime - overBeginTime; displayTime = displayInterval.getValue();
overTimeInterval = overTimeRange.getEndTime().getMicroSecondTime() - overBeginTime;
public synchronized void setImage(Image newImage){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); overTimeInterval = overEndTime - overBeginTime; displayTime = displayInterval.getValue(); overSizedImage = new SoftReference(newImage); repaint(); }
displayInterval.add(b.subtract(beginTime));
public void setAllBeginTime(MicroSecondDate b){ beginTime = b; Iterator e = seismos.keySet().iterator(); while(e.hasNext()) seismos.put(e.next(), b); this.updateTimeSyncListeners(); }
displayInterval.add(b.subtract(beginTime));
public void setBeginTime(MicroSecondDate b){ beginTime = b; this.updateTimeSyncListeners(); }
repaintRequired();
public void zoomIn() { zoom *= 1.5; }
repaintRequired();
public void zoomOut() { zoom /= 1.5; }
this.calSuite = calSuite;
public CalSvcIPars(String authUser, String user, String envPrefix, boolean publicAdmin, boolean caldav, String synchId, boolean debug) { this.authUser = authUser; this.user = user; this.envPrefix = envPrefix; this.publicAdmin = publicAdmin; this.caldav = caldav; this.synchId = synchId; this.debug = debug; }
getCalSuite(),
public Object clone() { CalSvcIPars pars = new CalSvcIPars(getAuthUser(), getUser(), getEnvPrefix(), getPublicAdmin(), getCaldav(), getSynchId(), getDebug()); return pars; }
sb.append(", calSuite="); sb.append(getCalSuite());
public String toString() { StringBuffer sb = new StringBuffer("CalSvcIPars{"); sb.append("authUser="); sb.append(getAuthUser()); sb.append(", user="); sb.append(getUser()); sb.append(", publicAdmin="); sb.append(getPublicAdmin()); sb.append(", caldav="); sb.append(getCaldav()); sb.append(", synchid="); sb.append(getSynchId()); sb.append(", debug="); sb.append(getDebug()); sb.append("}"); return sb.toString(); }
public AbstractDb (String directoryName, String databaseName){ this.directoryName = directoryName; this.databaseName = databaseName; }
public AbstractDb () {}
public AbstractDb (String directoryName, String databaseName){ this.directoryName = directoryName; this.databaseName = databaseName; }
return getMSLWrapper(new CreateOutputPin_3006Command(req));
return getMSLWrapper(new OutputPin3CreateCommand(req));
protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.OutputPin_3006 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallAction_Result()); } return getMSLWrapper(new CreateOutputPin_3006Command(req)); } if (UMLElementTypes.InputPin_3007 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getInvocationAction_Argument()); } return getMSLWrapper(new CreateInputPin_3007Command(req)); } if (UMLElementTypes.InputPin_3008 == req.getElementType()) { CallOperationAction container = (CallOperationAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getTarget() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallOperationAction_Target()); } return getMSLWrapper(new CreateInputPin_3008Command(req)); } return super.getCreateCommand(req); }
return getMSLWrapper(new CreateInputPin_3007Command(req));
return getMSLWrapper(new InputPin4CreateCommand(req));
protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.OutputPin_3006 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallAction_Result()); } return getMSLWrapper(new CreateOutputPin_3006Command(req)); } if (UMLElementTypes.InputPin_3007 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getInvocationAction_Argument()); } return getMSLWrapper(new CreateInputPin_3007Command(req)); } if (UMLElementTypes.InputPin_3008 == req.getElementType()) { CallOperationAction container = (CallOperationAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getTarget() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallOperationAction_Target()); } return getMSLWrapper(new CreateInputPin_3008Command(req)); } return super.getCreateCommand(req); }
CallOperationAction container = (CallOperationAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getTarget() != null) { return super.getCreateCommand(req); }
protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.OutputPin_3006 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallAction_Result()); } return getMSLWrapper(new CreateOutputPin_3006Command(req)); } if (UMLElementTypes.InputPin_3007 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getInvocationAction_Argument()); } return getMSLWrapper(new CreateInputPin_3007Command(req)); } if (UMLElementTypes.InputPin_3008 == req.getElementType()) { CallOperationAction container = (CallOperationAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getTarget() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallOperationAction_Target()); } return getMSLWrapper(new CreateInputPin_3008Command(req)); } return super.getCreateCommand(req); }
return getMSLWrapper(new CreateInputPin_3008Command(req));
return getMSLWrapper(new InputPin5CreateCommand(req));
protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.OutputPin_3006 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallAction_Result()); } return getMSLWrapper(new CreateOutputPin_3006Command(req)); } if (UMLElementTypes.InputPin_3007 == req.getElementType()) { if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getInvocationAction_Argument()); } return getMSLWrapper(new CreateInputPin_3007Command(req)); } if (UMLElementTypes.InputPin_3008 == req.getElementType()) { CallOperationAction container = (CallOperationAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getTarget() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getCallOperationAction_Target()); } return getMSLWrapper(new CreateInputPin_3008Command(req)); } return super.getCreateCommand(req); }
public int sendRequest(String method, String url, String user, String pw,
public int sendRequest(String method, String url,
public int sendRequest(String method, String url, String user, String pw, Header[] hdrs, String depth, String contentType, int contentLen, byte[] content) throws Throwable { int sz = 0; if (content != null) { sz = content.length; } if (debug) { debugMsg("About to send request: method=" + method + " contentLen=" + contentLen + " content.length=" + sz); } client.setMethodName(method, url); HttpMethod meth = client.getMethod(); if (meth instanceof DepthHttpMethod) { ((DepthHttpMethod)meth).setDepth(depth); } if (user != null) { String upw = user + ":" + pw; meth.setRequestHeader("Authorization", "Basic " + new String(new BASE64Encoder().encode (upw.getBytes()))); } if (hdrs != null) { for (int i = 0; i < hdrs.length; i++) { meth.setRequestHeader(hdrs[i]); } } if (contentType == null) { contentType = "text/xml"; } if (content != null) { client.setContent(content, contentType); } status = client.execute(); return status; }
int sz = 0; if (content != null) { sz = content.length; } if (debug) { debugMsg("About to send request: method=" + method + " contentLen=" + contentLen + " content.length=" + sz); } client.setMethodName(method, url); HttpMethod meth = client.getMethod(); if (meth instanceof DepthHttpMethod) { ((DepthHttpMethod)meth).setDepth(depth); } if (user != null) { String upw = user + ":" + pw; meth.setRequestHeader("Authorization", "Basic " + new String(new BASE64Encoder().encode (upw.getBytes()))); } if (hdrs != null) { for (int i = 0; i < hdrs.length; i++) { meth.setRequestHeader(hdrs[i]); } } if (contentType == null) { contentType = "text/xml"; } if (content != null) { client.setContent(content, contentType); } status = client.execute(); return status;
return sendRequest(method, url, null, null, hdrs, depth, contentType, contentLen, content);
public int sendRequest(String method, String url, String user, String pw, Header[] hdrs, String depth, String contentType, int contentLen, byte[] content) throws Throwable { int sz = 0; if (content != null) { sz = content.length; } if (debug) { debugMsg("About to send request: method=" + method + " contentLen=" + contentLen + " content.length=" + sz); } client.setMethodName(method, url); HttpMethod meth = client.getMethod(); if (meth instanceof DepthHttpMethod) { ((DepthHttpMethod)meth).setDepth(depth); } if (user != null) { String upw = user + ":" + pw; meth.setRequestHeader("Authorization", "Basic " + new String(new BASE64Encoder().encode (upw.getBytes()))); } if (hdrs != null) { for (int i = 0; i < hdrs.length; i++) { meth.setRequestHeader(hdrs[i]); } } if (contentType == null) { contentType = "text/xml"; } if (content != null) { client.setContent(content, contentType); } status = client.execute(); return status; }
logger.debug("getting the seismogram fromt the cache");
logger.debug("getting the seismogram from the cache");
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); Object obj = seismogramCache.get(name); if(obj instanceof SoftReference) { SoftReference softReference = (SoftReference)obj; LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) { logger.debug("**********NO NULL WHILE GETTING FROM RHT CACHE"); return seis; } else { logger.debug("********** GARBAGE COLLECTED SO SEISMOGRAM NOT IN MEWMOERY"); seismogramCache.remove(name); } } else return (LocalSeismogramImpl)obj; } // end of if (seismogramCache.containsKey(name)) //logger.debug("The name of the data set is "+getName()); //logger.debug("The name of the seismogram is "+name); String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //logger.debug("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") //logger.debug("IN GET SEISMOGRAM The base str is "+base.toString()); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); SeismogramAttr seisAttr = null; if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else // Property[] props = seis.getProperties();// Property[] newProps = // new Property[1+props.length+numDSProps];// System.arraycopy(props, 0, newProps, 0, props.length);// for (int i=0; i<propList.getLength(); i++) {// Element propElement = (Element)propList.item(i);// newProps[props.length+i] = // new Property(xpath.eval(propElement, "name/text()").str(),// xpath.eval(propElement, "value/text()").str());// } // end of for// newProps[newProps.length-1] = new Property(seisNameKey,// name);// seis.setProperties(newProps); URL sacURL = new URL(base, urlString); //logger.debug("The sacUrl is "+sacURL.toString()); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis; if (seisAttr != null) { seis = SacToFissures.getSeismogram(sac, seisAttr); } else { seis = SacToFissures.getSeismogram(sac); } // end of else if (seis != null) { logger.debug("***************************************************CACHING SOFTREFERENCE AS THE SEISMOGRAM IS NOT NULL"); seismogramCache.put(name, new SoftReference(seis)); } // end of if (seis != null) else logger.debug("****************************************THE SEISMOGRAM RETURNED IS NULL"); return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; }
logger.debug("***************************************************CACHING SOFTREFERENCE AS THE SEISMOGRAM IS NOT NULL");
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); Object obj = seismogramCache.get(name); if(obj instanceof SoftReference) { SoftReference softReference = (SoftReference)obj; LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) { logger.debug("**********NO NULL WHILE GETTING FROM RHT CACHE"); return seis; } else { logger.debug("********** GARBAGE COLLECTED SO SEISMOGRAM NOT IN MEWMOERY"); seismogramCache.remove(name); } } else return (LocalSeismogramImpl)obj; } // end of if (seismogramCache.containsKey(name)) //logger.debug("The name of the data set is "+getName()); //logger.debug("The name of the seismogram is "+name); String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //logger.debug("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") //logger.debug("IN GET SEISMOGRAM The base str is "+base.toString()); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); SeismogramAttr seisAttr = null; if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else // Property[] props = seis.getProperties();// Property[] newProps = // new Property[1+props.length+numDSProps];// System.arraycopy(props, 0, newProps, 0, props.length);// for (int i=0; i<propList.getLength(); i++) {// Element propElement = (Element)propList.item(i);// newProps[props.length+i] = // new Property(xpath.eval(propElement, "name/text()").str(),// xpath.eval(propElement, "value/text()").str());// } // end of for// newProps[newProps.length-1] = new Property(seisNameKey,// name);// seis.setProperties(newProps); URL sacURL = new URL(base, urlString); //logger.debug("The sacUrl is "+sacURL.toString()); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis; if (seisAttr != null) { seis = SacToFissures.getSeismogram(sac, seisAttr); } else { seis = SacToFissures.getSeismogram(sac); } // end of else if (seis != null) { logger.debug("***************************************************CACHING SOFTREFERENCE AS THE SEISMOGRAM IS NOT NULL"); seismogramCache.put(name, new SoftReference(seis)); } // end of if (seis != null) else logger.debug("****************************************THE SEISMOGRAM RETURNED IS NULL"); return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; }
else logger.debug("****************************************THE SEISMOGRAM RETURNED IS NULL");
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); Object obj = seismogramCache.get(name); if(obj instanceof SoftReference) { SoftReference softReference = (SoftReference)obj; LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) { logger.debug("**********NO NULL WHILE GETTING FROM RHT CACHE"); return seis; } else { logger.debug("********** GARBAGE COLLECTED SO SEISMOGRAM NOT IN MEWMOERY"); seismogramCache.remove(name); } } else return (LocalSeismogramImpl)obj; } // end of if (seismogramCache.containsKey(name)) //logger.debug("The name of the data set is "+getName()); //logger.debug("The name of the seismogram is "+name); String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //logger.debug("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") //logger.debug("IN GET SEISMOGRAM The base str is "+base.toString()); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); SeismogramAttr seisAttr = null; if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else // Property[] props = seis.getProperties();// Property[] newProps = // new Property[1+props.length+numDSProps];// System.arraycopy(props, 0, newProps, 0, props.length);// for (int i=0; i<propList.getLength(); i++) {// Element propElement = (Element)propList.item(i);// newProps[props.length+i] = // new Property(xpath.eval(propElement, "name/text()").str(),// xpath.eval(propElement, "value/text()").str());// } // end of for// newProps[newProps.length-1] = new Property(seisNameKey,// name);// seis.setProperties(newProps); URL sacURL = new URL(base, urlString); //logger.debug("The sacUrl is "+sacURL.toString()); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis; if (seisAttr != null) { seis = SacToFissures.getSeismogram(sac, seisAttr); } else { seis = SacToFissures.getSeismogram(sac); } // end of else if (seis != null) { logger.debug("***************************************************CACHING SOFTREFERENCE AS THE SEISMOGRAM IS NOT NULL"); seismogramCache.put(name, new SoftReference(seis)); } // end of if (seis != null) else logger.debug("****************************************THE SEISMOGRAM RETURNED IS NULL"); return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; }
return addDisplay(dss, DisplayUtils.getSeismogramNames(dss));
return addDisplay(dss, globalRegistrar, new RMeanAmpConfig(dss));
public BasicSeismogramDisplay addDisplay(DataSetSeismogram[] dss){ return addDisplay(dss, DisplayUtils.getSeismogramNames(dss)); }
public VerticalSeismogramDisplay(MouseForwarder mouseForwarder, MouseMotionForwarder motionForwarder, VerticalSeismogramDisplay parent){ output.setTimeZone(TimeZone.getTimeZone("GMT")); this.mouseForwarder = mouseForwarder; this.motionForwarder = motionForwarder; super.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); sorter = new SeismogramSorter(); if(parent != null){ this.originalVisible = parent.getOriginalVisibility(); this.parent = parent; }else{ this.originalVisible = true; }
public VerticalSeismogramDisplay(MouseForwarder mouseForwarder, MouseMotionForwarder motionForwarder){ this(mouseForwarder, motionForwarder, null);
public VerticalSeismogramDisplay(MouseForwarder mouseForwarder, MouseMotionForwarder motionForwarder, VerticalSeismogramDisplay parent){ output.setTimeZone(TimeZone.getTimeZone("GMT")); this.mouseForwarder = mouseForwarder; this.motionForwarder = motionForwarder; super.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); sorter = new SeismogramSorter(); if(parent != null){ this.originalVisible = parent.getOriginalVisibility(); this.parent = parent; }else{ this.originalVisible = true; } }
r.getUser(), r.getPw(), r.getHeaders(),
r.getUser(), r.getPw(), r.getHeaders(), 0,
private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; }
resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(),
resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0,
private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; }
/*
private void init() throws Throwable { /* addUser(new UserInfo("testuser01", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm")); addUser(new UserInfo("testuser01", "bedework", "johnsa", "localhost", 8080, false, "/ucaldav/user/johnsa")); */ addUser(new UserInfo("testuser02", "bedework", "testuser02", "www.bedework.org", 80, false, "/ucaldav/user/testuser02")); addUser(new UserInfo("testuser03", "bedework", "testuser03", "www.bedework.org", 80, false, "/ucaldav/user/testuser03")); getSvci(); // }
addUser(new UserInfo("testuser03", "bedework", "testuser03",
*/ addUser(new UserInfo("douglm", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm")); /* addUser(new UserInfo("testuser02", "bedework", "testuser02",
private void init() throws Throwable { /* addUser(new UserInfo("testuser01", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm")); addUser(new UserInfo("testuser01", "bedework", "johnsa", "localhost", 8080, false, "/ucaldav/user/johnsa")); */ addUser(new UserInfo("testuser02", "bedework", "testuser02", "www.bedework.org", 80, false, "/ucaldav/user/testuser02")); addUser(new UserInfo("testuser03", "bedework", "testuser03", "www.bedework.org", 80, false, "/ucaldav/user/testuser03")); getSvci(); // }
"/ucaldav/user/testuser03"));
"/ucaldav/user/testuser02")); addUser(new UserInfo("testuser08", "bedework", "testuser08", "www.bedework.org", 80, false, "/ucaldav/user/testuser08")); */
private void init() throws Throwable { /* addUser(new UserInfo("testuser01", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm")); addUser(new UserInfo("testuser01", "bedework", "johnsa", "localhost", 8080, false, "/ucaldav/user/johnsa")); */ addUser(new UserInfo("testuser02", "bedework", "testuser02", "www.bedework.org", 80, false, "/ucaldav/user/testuser02")); addUser(new UserInfo("testuser03", "bedework", "testuser03", "www.bedework.org", 80, false, "/ucaldav/user/testuser03")); getSvci(); // }
req.addContentLine(" <C:time-range start=\"20060521T131358Z\""); req.addContentLine(" end=\"20060528T131358Z\"/>");
req.addContentLine(" <C:time-range start=\"20060601T131358Z\""); req.addContentLine(" end=\"20060631T131358Z\"/>");
private Req makeFreeBusyRequest(Date start, Date end, UserInfo ui) throws Throwable { Req req; if (ui.authUser == null) { req = new Req(); } else { req = new Req(ui.authUser, ui.authPw); } req.setUrl(ui.url); req.setContentType("text/xml"); req.setMethod("REPORT"); req.addHeader("Depth", "0"); req.addContentLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); req.addContentLine("<C:free-busy-query xmlns:C=\"urn:ietf:params:xml:ns:caldav\">");// req.addContentLine(" <C:time-range start=\"" +// CalFacadeUtil.isoDateTimeUTC(start) + "\"");// req.addContentLine(" end=\"" +// CalFacadeUtil.isoDateTimeUTC(end) + "\"/>"); req.addContentLine(" <C:time-range start=\"20060521T131358Z\""); req.addContentLine(" end=\"20060528T131358Z\"/>"); req.addContentLine("</C:free-busy-query>"); return req; }
int pieceSize = SPD / numPieces;
double pieceSize = PIXELS / (double)numPieces;
private static PlottableChunk[] breakIntoPieces(PlottableChunk original, int numPieces) { PlottableChunk[] pieces = new PlottableChunk[numPieces]; int pieceSize = SPD / numPieces; for(int i = 0; i < pieces.length; i++) { int startPoint = i * pieceSize; int stopPoint = (i + 1) * pieceSize; if(i == pieces.length - 1) { stopPoint = SPD; } pieces[i] = makeSubPlottable(original, startPoint, stopPoint - startPoint); } return pieces; }
int startPoint = i * pieceSize; int stopPoint = (i + 1) * pieceSize;
int startPixel = (int)Math.floor(i * pieceSize); int stopPixel = (int)Math.floor((i + 1) * pieceSize);
private static PlottableChunk[] breakIntoPieces(PlottableChunk original, int numPieces) { PlottableChunk[] pieces = new PlottableChunk[numPieces]; int pieceSize = SPD / numPieces; for(int i = 0; i < pieces.length; i++) { int startPoint = i * pieceSize; int stopPoint = (i + 1) * pieceSize; if(i == pieces.length - 1) { stopPoint = SPD; } pieces[i] = makeSubPlottable(original, startPoint, stopPoint - startPoint); } return pieces; }
stopPoint = SPD;
stopPixel = PIXELS;
private static PlottableChunk[] breakIntoPieces(PlottableChunk original, int numPieces) { PlottableChunk[] pieces = new PlottableChunk[numPieces]; int pieceSize = SPD / numPieces; for(int i = 0; i < pieces.length; i++) { int startPoint = i * pieceSize; int stopPoint = (i + 1) * pieceSize; if(i == pieces.length - 1) { stopPoint = SPD; } pieces[i] = makeSubPlottable(original, startPoint, stopPoint - startPoint); } return pieces; }
pieces[i] = makeSubPlottable(original, startPoint, stopPoint - startPoint);
pieces[i] = makeSubPlottable(original, startPixel, stopPixel - startPixel);
private static PlottableChunk[] breakIntoPieces(PlottableChunk original, int numPieces) { PlottableChunk[] pieces = new PlottableChunk[numPieces]; int pieceSize = SPD / numPieces; for(int i = 0; i < pieces.length; i++) { int startPoint = i * pieceSize; int stopPoint = (i + 1) * pieceSize; if(i == pieces.length - 1) { stopPoint = SPD; } pieces[i] = makeSubPlottable(original, startPoint, stopPoint - startPoint); } return pieces; }
int numPoints) {
int numPixels) {
private static PlottableChunk makeSubPlottable(PlottableChunk orig, int startPoint, int numPoints) { Plottable subPlott = new Plottable(copy(orig.getData().x_coor, startPoint, numPoints), copy(orig.getData().y_coor, startPoint, numPoints)); return new PlottableChunk(subPlott, startPoint, 1, 2000, PIXELS, orig.getChannel()); }
numPoints),
numPixels * 2),
private static PlottableChunk makeSubPlottable(PlottableChunk orig, int startPoint, int numPoints) { Plottable subPlott = new Plottable(copy(orig.getData().x_coor, startPoint, numPoints), copy(orig.getData().y_coor, startPoint, numPoints)); return new PlottableChunk(subPlott, startPoint, 1, 2000, PIXELS, orig.getChannel()); }
numPoints)); return new PlottableChunk(subPlott, startPoint, 1, 2000, PIXELS, orig.getChannel());
numPixels * 2)); PlottableChunk chunk = new PlottableChunk(subPlott, startPoint, 1, 2000, PIXELS, orig.getChannel()); return chunk;
private static PlottableChunk makeSubPlottable(PlottableChunk orig, int startPoint, int numPoints) { Plottable subPlott = new Plottable(copy(orig.getData().x_coor, startPoint, numPoints), copy(orig.getData().y_coor, startPoint, numPoints)); return new PlottableChunk(subPlott, startPoint, 1, 2000, PIXELS, orig.getChannel()); }
System.out.println(out[0]);
public void testPutThenGet() throws SQLException, IOException { plottDb.put(new PlottableChunk[] {data}); PlottableChunk[] out = plottDb.get(data.getTimeRange(), data.getChannel(), data.getPixelsPerDay()); System.out.println(out[0]); assertEquals(data, out[0]); }
public static LocalSeismogramImpl createSpike(MicroSecondDate time, TimeInterval traceLength, int samplesPerSpike, ChannelId id) { return createRaggedSpike(time, traceLength, samplesPerSpike, 0, id);
public static LocalSeismogramImpl createSpike() { return createSpike(ClockUtil.now());
public static LocalSeismogramImpl createSpike(MicroSecondDate time, TimeInterval traceLength, int samplesPerSpike, ChannelId id) { return createRaggedSpike(time, traceLength, samplesPerSpike, 0, id); }
logger.debug("Making plottable for seis starting at " + seis.getBeginTime() + " lasting for " + seis.getTimeInterval() + " with " + seis.getNumPoints() + " points"); logger.debug("The plottable is supposed to cover " + tr + " at " + pixelsPerDay);
public static Plottable makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int pixelsPerDay) throws CodecException { logger.debug("Making plottable for seis starting at " + seis.getBeginTime() + " lasting for " + seis.getTimeInterval() + " with " + seis.getNumPoints() + " points"); logger.debug("The plottable is supposed to cover " + tr + " at " + pixelsPerDay); if(tr.getEndTime().before(seis.getEndTime()) || tr.getBeginTime().after(seis.getEndTime())) { int[] empty = new int[0]; return new Plottable(empty, empty); } //Calculating the number of plottable pixels to cover the full time // range double pixelPeriod = 1 / (double)pixelsPerDay;//in days TimeInterval trInt = (TimeInterval)tr.getInterval() .convertTo(UnitImpl.DAY); double exactNumPixels = trInt.divideBy(pixelPeriod).getValue(); //always round up since a partial pixel means the caller requested data // in that pixel int numPixels = (int)Math.ceil(exactNumPixels); TimeInterval pointPeriod = (TimeInterval)seis.getSampling() .getPeriod() .convertTo(UnitImpl.DAY); double pointsPerPixel = pixelPeriod / pointPeriod.getValue(); int startPoint = getPoint(seis, tr.getBeginTime()); int endPoint = startPoint + (int)(pointsPerPixel * numPixels); int startPixel = 0; if(startPoint < 0) { //Requested time begins before seis, scoot up the start pixel up startPixel = (int)Math.floor((startPoint * -1) / pointsPerPixel); numPixels -= startPixel; } if(endPoint > seis.getNumPoints()) { //Requested time ends after seis, scoot the end pixel back int pointShift = endPoint - seis.getNumPoints(); numPixels -= (int)Math.floor(pointShift / pointsPerPixel); endPoint = seis.getNumPoints(); } int[][] pixels = new int[2][numPixels * 2]; int pixelPoint = startPoint < 0 ? 0 : startPoint; for(int i = 0; i < numPixels; i++) { int pos = 2 * i; int nextPos = pos + 1; pixels[0][pos] = startPixel + i; pixels[0][nextPos] = pixels[0][pos]; int nextPixelPoint = startPoint + (int)((pixels[0][pos] + 1) * pointsPerPixel); if(i == numPixels - 1) { nextPixelPoint = endPoint; } QuantityImpl min = seis.getMinValue(pixelPoint, nextPixelPoint); pixels[1][pos] = (int)min.getValue(); QuantityImpl max = seis.getMaxValue(pixelPoint, nextPixelPoint); pixels[1][nextPos] = (int)max.getValue(); pixelPoint = nextPixelPoint; } return new Plottable(pixels[0], pixels[1]); }
} else if (path.endsWith(".gdo")) { setResourceURL("true");
protected String calculateURL() throws JspException { String urlStr = super.calculateURL(); if (!PortletServlet.isPortletRequest(pageContext.getRequest())) { return urlStr; } try { URL url = new URL(urlStr); String path = url.getPath(); if (path.endsWith(".rdo")) { setRenderURL("true"); } else if (path.endsWith(".do")) { setActionURL("true"); } /* We want a context relative url */ urlStr = url.getFile(); //System.out.println("LLLLLLLLLLLLLLLLLLUrlStr = " + urlStr); /* Drop the context */ int pos = urlStr.indexOf('/'); if (pos > 0) { urlStr = urlStr.substring(pos); } urlStr = TagsSupport.getURL(pageContext, urlStr, urlType); /* remove embedded anchor because calendar xsl stylesheet * adds extra parameters later during transformation */ pos = urlStr.indexOf('#'); if (pos > -1) { urlStr = urlStr.substring(0, pos); } /* Remove bedework dummy request parameter - * it's an encoded form of ?b=de */ urlStr = urlStr.replaceAll(bedeworkDummyPar, ""); //Generate valid xml markup for transformationthrow new urlStr = urlStr.replaceAll("&", "&amp;"); //System.out.println("LLLLLLLLLLLLLLLLLLLLLLLUrlStr = " + urlStr); } catch (MalformedURLException mue) { throw new JspException(mue); } return urlStr; }
BwFreeBusy fb = svci.getFreeBusy(null, user,
BwFreeBusy fb = svci.getFreeBusy(null, null, user,
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { BwUser user; CalSvcI svci = form.fetchSvci(); gotoDateView(this, form, form.getDate(), form.getViewTypeI(), debug); String userId = getReqPar(request, "userid"); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } MyCalendarVO scal; Calendar start; Calendar end; Calendar endDay; String st = getReqPar(request, "start"); if (st == null) { /* Set period and start from the current timeview */ TimeView tv = form.getCurTimeView(); scal = tv.getFirstDay(); Locale loc = scal.getCalInfo().getLocale(); // XXX Locale /* Essentially clone so that thbe calculations below don't mess up * the time view. */ scal = new MyCalendarVO(scal.getTime(), loc); start = scal.getCalendar(); end = tv.getLastDay().getTomorrow().getCalendar(); } else { Locale loc = Locale.getDefault(); // XXX Locale Date jdt = CalFacadeUtil.fromISODate(st); scal = new MyCalendarVO(jdt, loc); scal = scal.getFirstDayOfThisWeek(); start = scal.getCalendar(); //BwDateTime startDt = form.getEventStartDate().getDateTime(); end = scal.getNextWeek().getCalendar(); } endDay = scal.getTomorrow().getCalendar(); int interval = getIntReqPar(request, "interval", 1); if (interval <= 0) { form.getErr().emit("org.bedework.client.error.badinterval"); return "error"; } String intunitStr = getReqPar(request, "intunit"); BwDuration dur = new BwDuration(); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { dur.setMinutes(interval); } else if ("hours".equals(intunitStr)) { dur.setHours(interval); } else if ("days".equals(intunitStr)) { dur.setDays(interval); } else if ("weeks".equals(intunitStr)) { dur.setWeeks(interval); } else { form.getErr().emit("org.bedework.client.error.badintervalunit"); return "error"; } } else { dur.setHours(interval); } //int maxRequests = 1000; CalTimezones tzs = svci.getTimezones(); Collection freeBusy = new ArrayList(); /* Get the free busy in daily chunks and process for display */ while (start.before(end)) { Date sdt = start.getTime(); Date edt = endDay.getTime(); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + edt); } try { BwFreeBusy fb = svci.getFreeBusy(null, user, CalFacadeUtil.getDateTime(sdt, false, false, tzs), CalFacadeUtil.getDateTime(edt, false, false, tzs), dur, true); FormattedFreeBusy ffb = new FormattedFreeBusy(fb); freeBusy.add(ffb); start.add(Calendar.DAY_OF_MONTH, 1); endDay.add(Calendar.DAY_OF_MONTH, 1); } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess"); return "noAccess"; } } form.assignFreeBusy(freeBusy); return "success"; }
form.getMsg().emit("org.bedework.message.userinfo.updated");
form.getMsg().emit("org.bedework.client.message.userinfo.updated");
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { /** Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; }// CalSvcI svci = form.getCalSvcI(); /** We are just updating from the current form values. */ BwUserInfo ui = validateUserInfo(form); if (ui == null) { return "retry"; } if (debug) { debugMsg("Update userInfo " + ui); } //svci.getUserAuth().updateUser(au); form.getMsg().emit("org.bedework.message.userinfo.updated"); return "continue"; }
System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue());
public synchronized void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; if(!recalculateValues) { recalculateValues = false; System.out.println(" DRAWING THE PARTICLE MOTION WITHOUT RECALCULATING THE VALUES"); graphics2D.draw(particleMotion.getShape()); return; } logger.debug("IN DRAW PARTICLE MOTION"); Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); //AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; //AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } //drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.registrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } System.out.println("*************** Beofore getting PlottableSimple"); Date utilStartTime = Calendar.getInstance().getTime(); int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension);*/ /*SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); */ int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension);*/ SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); */ int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Date drawStartTime = Calendar.getInstance().getTime(); Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); Date drawEndTime = Calendar.getInstance().getTime(); System.out.println("The PATH TIME is *********** "+(drawEndTime.getTime() - drawStartTime.getTime())); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); // System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
System.out.println("*************** Beofore getting PlottableSimple");
public synchronized void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; if(!recalculateValues) { recalculateValues = false; System.out.println(" DRAWING THE PARTICLE MOTION WITHOUT RECALCULATING THE VALUES"); graphics2D.draw(particleMotion.getShape()); return; } logger.debug("IN DRAW PARTICLE MOTION"); Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); //AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; //AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } //drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.registrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } System.out.println("*************** Beofore getting PlottableSimple"); Date utilStartTime = Calendar.getInstance().getTime(); int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension);*/ /*SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); */ int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension);*/ SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); */ int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Date drawStartTime = Calendar.getInstance().getTime(); Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); Date drawEndTime = Calendar.getInstance().getTime(); System.out.println("The PATH TIME is *********** "+(drawEndTime.getTime() - drawStartTime.getTime())); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); // System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime()));
public synchronized void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; if(!recalculateValues) { recalculateValues = false; System.out.println(" DRAWING THE PARTICLE MOTION WITHOUT RECALCULATING THE VALUES"); graphics2D.draw(particleMotion.getShape()); return; } logger.debug("IN DRAW PARTICLE MOTION"); Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); //AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; //AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } //drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.registrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } System.out.println("*************** Beofore getting PlottableSimple"); Date utilStartTime = Calendar.getInstance().getTime(); int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension);*/ /*SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); */ int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension);*/ SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); */ int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Date drawStartTime = Calendar.getInstance().getTime(); Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); Date drawEndTime = Calendar.getInstance().getTime(); System.out.println("The PATH TIME is *********** "+(drawEndTime.getTime() - drawStartTime.getTime())); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); // System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
System.out.println("The PATH TIME is *********** "+(drawEndTime.getTime() - drawStartTime.getTime()));
public synchronized void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; if(!recalculateValues) { recalculateValues = false; System.out.println(" DRAWING THE PARTICLE MOTION WITHOUT RECALCULATING THE VALUES"); graphics2D.draw(particleMotion.getShape()); return; } logger.debug("IN DRAW PARTICLE MOTION"); Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); //AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; //AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } //drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.registrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } System.out.println("*************** Beofore getting PlottableSimple"); Date utilStartTime = Calendar.getInstance().getTime(); int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension);*/ /*SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); */ int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension);*/ SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); */ int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Date drawStartTime = Calendar.getInstance().getTime(); Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); Date drawEndTime = Calendar.getInstance().getTime(); System.out.println("The PATH TIME is *********** "+(drawEndTime.getTime() - drawStartTime.getTime())); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); // System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
System.out.println("After setting the shape");
public synchronized void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; if(!recalculateValues) { recalculateValues = false; System.out.println(" DRAWING THE PARTICLE MOTION WITHOUT RECALCULATING THE VALUES"); graphics2D.draw(particleMotion.getShape()); return; } logger.debug("IN DRAW PARTICLE MOTION"); Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); //AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; //AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } //drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.registrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } System.out.println("*************** Beofore getting PlottableSimple"); Date utilStartTime = Calendar.getInstance().getTime(); int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension);*/ /*SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); */ int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension);*/ SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); */ int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Date drawStartTime = Calendar.getInstance().getTime(); Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); Date drawEndTime = Calendar.getInstance().getTime(); System.out.println("The PATH TIME is *********** "+(drawEndTime.getTime() - drawStartTime.getTime())); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); // System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
System.out.println("Before returning from the getParticleMotionPath");
public synchronized Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;} GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); } for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); } /*for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); }*/ System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }
System.out.println("ENd of the for");
public synchronized void paintComponent(Graphics g) { // if(setSelected == 1) g.setColor(Color.red); //else if(setSelected == 2) g.setColor(getBackground()); if(displayKeys.size() == 0) return; Graphics2D graphics2D = (Graphics2D)g; logger.debug("IN PAINT COMPONENT"); vunitRangeImpl = new UnitRangeImpl(getMinVerticalAmplitude(), getMaxVerticalAmplitude(), UnitImpl.COUNT); hunitRangeImpl = new UnitRangeImpl(getMinHorizontalAmplitude(), getMaxHorizontalAmplitude(), UnitImpl.COUNT);// particleMotionDisplay.updateHorizontalAmpScale(hunitRangeImpl);// particleMotionDisplay.updateVerticalAmpScale(vunitRangeImpl); if(startPoint != null && endPoint != null) { graphics2D.setColor(Color.yellow); //logger.debug("Start Point "+startPoint.getX()+" "+startPoint.getY()); //logger.debug("End Point "+endPoint.getX()+" "+endPoint.getY()); java.awt.geom.Rectangle2D.Double rect = new java.awt.geom.Rectangle2D.Double(startPoint.getX(), startPoint.getY(), endPoint.getX() - startPoint.getX(), endPoint.getY() - startPoint.getY()); graphics2D.fill(rect); graphics2D.draw(rect); } int size = displays.size(); //first draw the azimuth if one of the display is horizontal plane for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); if(!displayKeys.contains(particleMotion.key)) continue; drawAzimuth(particleMotion, graphics2D); } Date startTime = Calendar.getInstance().getTime(); // graphics2D.setStroke(new BasicStroke(1.5f)); for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; if(particleMotion.isSelected()) continue; drawParticleMotion(particleMotion, graphics2D); }//end of for System.out.println("ENd of the for"); for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; //drawAzimuth(particleMotion, graphics2D); if(particleMotion.isSelected()) { particleMotion.setSelected(false); drawParticleMotion(particleMotion, g); } } graphics2D.setStroke(new BasicStroke(1.0f)); Date endTime = Calendar.getInstance().getTime(); System.out.println("THE TIME TAKEN IS ********** "+ (endTime.getTime() - startTime.getTime())); }
System.out.println("THE TIME TAKEN IS ********** "+ (endTime.getTime() - startTime.getTime()));
public synchronized void paintComponent(Graphics g) { // if(setSelected == 1) g.setColor(Color.red); //else if(setSelected == 2) g.setColor(getBackground()); if(displayKeys.size() == 0) return; Graphics2D graphics2D = (Graphics2D)g; logger.debug("IN PAINT COMPONENT"); vunitRangeImpl = new UnitRangeImpl(getMinVerticalAmplitude(), getMaxVerticalAmplitude(), UnitImpl.COUNT); hunitRangeImpl = new UnitRangeImpl(getMinHorizontalAmplitude(), getMaxHorizontalAmplitude(), UnitImpl.COUNT);// particleMotionDisplay.updateHorizontalAmpScale(hunitRangeImpl);// particleMotionDisplay.updateVerticalAmpScale(vunitRangeImpl); if(startPoint != null && endPoint != null) { graphics2D.setColor(Color.yellow); //logger.debug("Start Point "+startPoint.getX()+" "+startPoint.getY()); //logger.debug("End Point "+endPoint.getX()+" "+endPoint.getY()); java.awt.geom.Rectangle2D.Double rect = new java.awt.geom.Rectangle2D.Double(startPoint.getX(), startPoint.getY(), endPoint.getX() - startPoint.getX(), endPoint.getY() - startPoint.getY()); graphics2D.fill(rect); graphics2D.draw(rect); } int size = displays.size(); //first draw the azimuth if one of the display is horizontal plane for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); if(!displayKeys.contains(particleMotion.key)) continue; drawAzimuth(particleMotion, graphics2D); } Date startTime = Calendar.getInstance().getTime(); // graphics2D.setStroke(new BasicStroke(1.5f)); for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; if(particleMotion.isSelected()) continue; drawParticleMotion(particleMotion, graphics2D); }//end of for System.out.println("ENd of the for"); for(int counter = 0; counter < displays.size(); counter++) { ParticleMotion particleMotion = (ParticleMotion)displays.get(counter); //if(!getDisplayKey().equals(particleMotion.key)) continue; if(!displayKeys.contains(particleMotion.key)) continue; //drawAzimuth(particleMotion, graphics2D); if(particleMotion.isSelected()) { particleMotion.setSelected(false); drawParticleMotion(particleMotion, g); } } graphics2D.setStroke(new BasicStroke(1.0f)); Date endTime = Calendar.getInstance().getTime(); System.out.println("THE TIME TAKEN IS ********** "+ (endTime.getTime() - startTime.getTime())); }
buffer.append("&").append(propertyName).append("=").append(URLEncoder.encode(propertyValue, "UTF-8"));
buffer.append("&").append(propertyName).append("=").append(URLEncoder.encode(propertyValue, "ISO-8859-1"));
private void appendProperty(StringBuffer buffer, String propertyName, String propertyValue) throws UnsupportedEncodingException { if (propertyValue != null) { buffer.append("&").append(propertyName).append("=").append(URLEncoder.encode(propertyValue, "UTF-8")); } }