bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { boolean userAdded = super.init(authenticatedUser, user, publicAdmin, superUser, groups, synchId, debug); if (httpManager == null) { synchronized (this) { if (httpManager == null) { httpManager = new HttpManager("org.bedework.http.client.caldav.CaldavClient"); } } } return userAdded; }
public boolean init(String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException { boolean userAdded = super.init(authenticatedUser, user, publicAdmin, superUser, groups, synchId, debug); if (httpManager == null) { synchronized (this) { if (httpManager == null) { httpManager = new HttpManager("org.bedework.http.client.caldav.CaldavClient"); } } } return userAdded; }
1,119,831
public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { boolean userAdded = super.init(authenticatedUser, user, publicAdmin, superUser, groups, synchId, debug); if (httpManager == null) { synchronized (this) { if (httpManager == null) { httpManager = new HttpManager("org.bedework.http.client.caldav.CaldavClient"); } } } return userAdded; }
public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { boolean userAdded = super.init(authenticatedUser, user, publicAdmin, groups, synchId, debug); if (httpManager == null) { synchronized (this) { if (httpManager == null) { httpManager = new HttpManager("org.bedework.http.client.caldav.CaldavClient"); } } } return userAdded; }
1,119,832
public void addParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar) { LocalSeismogramImpl seis = hseis.getSeismogram(); ChannelId[] channelIds = ((edu.sc.seis.fissuresUtil.xml.XMLDataSet)hseis.getDataSet()).getChannelIds(); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); logger.debug("the original channel_code from the seismogram is "+ seis.getChannelID().channel_code); ChannelId[] channelGroup = channelProxy.retrieve_grouping(channelIds, seis.getChannelID()); System.out.println("THe length of the channel group is "+channelGroup.length); edu.iris.Fissures.Time startTime; edu.iris.Fissures.Time endTime; DataSetSeismogram[] seismograms = new DataSetSeismogram[3]; if(timeConfigRegistrar != null) { startTime = timeConfigRegistrar.getTimeRange().getBeginTime().getFissuresTime(); endTime = timeConfigRegistrar.getTimeRange().getEndTime().getFissuresTime(); } else { startTime = seis.getBeginTime().getFissuresTime(); endTime = seis.getEndTime().getFissuresTime(); } System.out.println("Start Time is "+new MicroSecondDate(startTime)); System.out.println("end Time is "+new MicroSecondDate(endTime)); try { for(int counter = 0; counter < channelGroup.length; counter++) { seismograms[counter] = new DataSetSeismogram(hseis.getDataSet().getSeismogram(getSeismogramName(channelGroup[counter], hseis.getDataSet(), new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime()))), hseis.getDataSet()); //ChannelIdUtil.toStringNoDates(channelGroup[counter])); timeConfigRegistrar.addSeismogram(seismograms[counter]); //hAmpRangeConfigRegistrar.addSeismogram(seismograms if(seismograms[counter] == null) logger.debug(" seismograms["+counter+"] is NULL"); else logger.debug(" seismograms["+counter+"] is NOT NULL"); } } catch(Exception e) { e.printStackTrace(); } boolean horizPlane = isHorizontalPlane( ((LocalSeismogramImpl)seismograms[0].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[1].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[0], seismograms[1], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[0].channel_code+"-"+channelGroup[1].channel_code, horizPlane); //updateTimeRange(); System.out.println(" ADDED THe first seismograme "); horizPlane = isHorizontalPlane(((LocalSeismogramImpl)seismograms[1].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[2].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[1], seismograms[2], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[1].channel_code+"-"+channelGroup[2].channel_code, horizPlane); System.out.println(" ADDED he second SEismograme"); horizPlane = isHorizontalPlane(((LocalSeismogramImpl)seismograms[0].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[2].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[0], seismograms[2], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[0].channel_code+"-"+channelGroup[2].channel_code, horizPlane); System.out.println("Added the third display "); }
public void addParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar) { LocalSeismogramImpl seis = hseis.getSeismogram(); ChannelId[] channelIds = ((edu.sc.seis.fissuresUtil.xml.XMLDataSet)hseis.getDataSet()).getChannelIds(); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); logger.debug("the original channel_code from the seismogram is "+ seis.getChannelID().channel_code); ChannelId[] channelGroup = channelProxy.retrieve_grouping(channelIds, seis.getChannelID()); System.out.println("THe length of the channel group is "+channelGroup.length); edu.iris.Fissures.Time startTime; edu.iris.Fissures.Time endTime; DataSetSeismogram[] seismograms = new DataSetSeismogram[3]; if(timeConfigRegistrar != null) { startTime = timeConfigRegistrar.getTimeRange().getBeginTime().getFissuresTime(); endTime = timeConfigRegistrar.getTimeRange().getEndTime().getFissuresTime(); } else { startTime = seis.getBeginTime().getFissuresTime(); endTime = seis.getEndTime().getFissuresTime(); } System.out.println("Start Time is "+new MicroSecondDate(startTime)); System.out.println("end Time is "+new MicroSecondDate(endTime)); try { for(int counter = 0; counter < channelGroup.length; counter++) { seismograms[counter] = new DataSetSeismogram(hseis.getDataSet().getSeismogram(getSeismogramName(channelGroup[counter], hseis.getDataSet(), new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime()))), hseis.getDataSet()); //ChannelIdUtil.toStringNoDates(channelGroup[counter])); timeConfigRegistrar.addSeismogram(seismograms[counter]); //hAmpRangeConfigRegistrar.addSeismogram(seismograms if(seismograms[counter] == null) logger.debug(" seismograms["+counter+"] is NULL"); else logger.debug(" seismograms["+counter+"] is NOT NULL"); } } catch(Exception e) { e.printStackTrace(); } boolean horizPlane = isHorizontalPlane( ((LocalSeismogramImpl)seismograms[0].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[1].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[0], seismograms[1], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[0].channel_code+"-"+channelGroup[1].channel_code, horizPlane); //updateTimeRange(); System.out.println(" ADDED THe first seismograme "); horizPlane = isHorizontalPlane(((LocalSeismogramImpl)seismograms[1].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[2].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[1], seismograms[2], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[1].channel_code+"-"+channelGroup[2].channel_code, horizPlane); System.out.println(" ADDED he second SEismograme"); horizPlane = isHorizontalPlane(((LocalSeismogramImpl)seismograms[0].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[2].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[0], seismograms[2], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[0].channel_code+"-"+channelGroup[2].channel_code, horizPlane); System.out.println("Added the third display "); }
1,119,833
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = getReqPar(request, "cal"); boolean calid = idstr != null; if (!calid) { idstr = getReqPar(request, "event"); } if (idstr == null) { form.getErr().emit("org.bedework.client.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.badentityid"); return "error"; } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.client.error.noentityid"); return "error"; } int desiredAccess = -1; //boolean defaultAccess = false; if (how.equals("r")) { desiredAccess = PrivilegeDefs.privRead; } else if (how.equals("w")) { desiredAccess = PrivilegeDefs.privWrite; } else if (how.equals("f")) { desiredAccess = PrivilegeDefs.privReadFreeBusy; } else if (how.equals("d")) { //defaultAccess = true; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.client.error.badhow"); return "error"; } String whoTypeStr = request.getParameter("whoType"); int whoType = -1; if (whoTypeStr == null) { whoType = Ace.whoTypeOwner; } else if (whoTypeStr.equals("user")) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("group")) { whoType = Ace.whoTypeGroup; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else if (whoTypeStr.equals("unauth")) { whoType = Ace.whoTypeUnauthenticated; } else if (whoTypeStr.equals("other")) { whoType = Ace.whoTypeOther; } else { form.getErr().emit("org.bedework.client.error.badwhotype"); return "error"; } String who = request.getParameter("who"); if (who != null) { BwUser user = svci.findUser(who); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { who = null; } ArrayList aces = new ArrayList(); aces.add(new Ace(who, false, whoType, Privileges.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, aces); svci.updateCalendar(cal); } else { svci.changeAccess(ev, aces); svci.updateEvent(ev); } return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = getReqPar(request, "cal"); boolean calid = idstr != null; if (!calid) { idstr = getReqPar(request, "event"); } if (idstr == null) { form.getErr().emit("org.bedework.client.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.badentityid"); return "error"; } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.client.error.noentityid"); return "error"; } int desiredAccess = -1; //boolean defaultAccess = false; if (how.equals("r")) { desiredAccess = PrivilegeDefs.privRead; } else if (how.equals("w")) { desiredAccess = PrivilegeDefs.privWrite; } else if (how.equals("f")) { desiredAccess = PrivilegeDefs.privReadFreeBusy; } else if (how.equals("d")) { //defaultAccess = true; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.client.error.badhow"); return "error"; } String whoTypeStr = request.getParameter("whoType"); int whoType = -1; if (whoTypeStr == null) { whoType = Ace.whoTypeOwner; } else if (whoTypeStr.equals("user")) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("group")) { whoType = Ace.whoTypeGroup; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else if (whoTypeStr.equals("unauth")) { whoType = Ace.whoTypeUnauthenticated; } else if (whoTypeStr.equals("other")) { whoType = Ace.whoTypeOther; } else { form.getErr().emit("org.bedework.client.error.badwhotype"); return "error"; } String who = request.getParameter("who"); if (who != null) { BwUser user = svci.findUser(who); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { who = null; } ArrayList aces = new ArrayList(); aces.add(new Ace(who, false, whoType, Privileges.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, aces); svci.updateCalendar(cal); } else { svci.changeAccess(ev, aces); svci.updateEvent(ev); } return "success"; }
1,119,834
private MainFrame() { super(EVI.TITLE); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowListener() { public void windowActivated(WindowEvent arg0) { } public void windowClosed(WindowEvent arg0) { } public void windowClosing(WindowEvent arg0) { Util.askToExit(); } public void windowDeactivated(WindowEvent arg0) { } public void windowDeiconified(WindowEvent arg0) { } public void windowIconified(WindowEvent arg0) { } public void windowOpened(WindowEvent arg0) { } }); pane.setLayout(new BorderLayout()); addComponentListener(new ComponentListener() { public void componentHidden(ComponentEvent arg0) { } public void componentMoved(ComponentEvent arg0) { Point p = new Point(getX(), getY()); MainConfiguration.PROPS.setPoint("gui.topleft", p); } public void componentResized(ComponentEvent arg0) { Dimension d = getSize(); MainConfiguration.PROPS.setDimension("gui.size", d); } public void componentShown(ComponentEvent arg0) { } }); setMainMenuBar(new MenuBar()); setMainToolBar(new ToolBar()); setMainTabBar(new TabBar()); loadIcon(); }
private MainFrame() { super(EVI.TITLE); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowListener() { public void windowActivated(WindowEvent arg0) { } public void windowClosed(WindowEvent arg0) { } public void windowClosing(WindowEvent arg0) { Util.askToExit(); } public void windowDeactivated(WindowEvent arg0) { } public void windowDeiconified(WindowEvent arg0) { } public void windowIconified(WindowEvent arg0) { } public void windowOpened(WindowEvent arg0) { } }); addComponentListener(new ComponentListener() { public void componentHidden(ComponentEvent arg0) { } public void componentMoved(ComponentEvent arg0) { Point p = new Point(getX(), getY()); MainConfiguration.PROPS.setPoint("gui.topleft", p); } public void componentResized(ComponentEvent arg0) { Dimension d = getSize(); MainConfiguration.PROPS.setDimension("gui.size", d); } public void componentShown(ComponentEvent arg0) { } }); setMainMenuBar(new MenuBar()); setMainToolBar(new ToolBar()); setMainTabBar(new TabBar()); loadIcon(); }
1,119,835
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = getReqPar(request, "name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; }
1,119,837
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "retry"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; }
1,119,838
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; }
1,119,839
private JPanel makeProfileConnectPanel() { JPanel p = new JPanel(); p.setBorder(new TitledBorder("Connect Profile")); p.setLayout(new GridLayout(2, 0)); Profile[] profiles = Profile.getProfiles(); String lastProfile = Configuration.getLastProfile(); int selected = 0; for (int i = 0; i < profiles.length; i++) { if (profiles[i].toString().equals(lastProfile)) { selected = i; break; } } final JComboBox profileBox = new JComboBox(profiles); profileBox.setSelectedIndex(selected); final JButton connectButton = new JButton("Connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Configuration.setLastProfile(profileBox.getSelectedItem().toString()); } }); JPanel row, sub; sub = new JPanel(new BorderLayout()); sub.add(profileBox, BorderLayout.CENTER); row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Profile:")); row.add(sub); p.add(row); row = new JPanel(); row.add(connectButton); p.add(row); JPanel tmp1 = new JPanel(new BorderLayout()); tmp1.add(p, BorderLayout.WEST); JPanel tmp2 = new JPanel(new BorderLayout()); tmp2.add(tmp1, BorderLayout.NORTH); return tmp2; }
private JPanel makeProfileConnectPanel() { JPanel p = new JPanel(); p.setBorder(new TitledBorder("Connect Profile")); p.setLayout(new GridLayout(2, 0)); Profile[] profiles = Profile.getProfiles(); String lastProfile = Configuration.getLastProfile(); int selected = -1; for (int i = 0; i < profiles.length; i++) { if (profiles[i].toString().equals(lastProfile)) { selected = i; break; } } final JComboBox profileBox = new JComboBox(profiles); profileBox.setSelectedIndex(selected); final JButton connectButton = new JButton("Connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Configuration.setLastProfile(profileBox.getSelectedItem().toString()); } }); JPanel row, sub; sub = new JPanel(new BorderLayout()); sub.add(profileBox, BorderLayout.CENTER); row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Profile:")); row.add(sub); p.add(row); row = new JPanel(); row.add(connectButton); p.add(row); JPanel tmp1 = new JPanel(new BorderLayout()); tmp1.add(p, BorderLayout.WEST); JPanel tmp2 = new JPanel(new BorderLayout()); tmp2.add(tmp1, BorderLayout.NORTH); return tmp2; }
1,119,840
private JPanel makeProfileConnectPanel() { JPanel p = new JPanel(); p.setBorder(new TitledBorder("Connect Profile")); p.setLayout(new GridLayout(2, 0)); Profile[] profiles = Profile.getProfiles(); String lastProfile = Configuration.getLastProfile(); int selected = 0; for (int i = 0; i < profiles.length; i++) { if (profiles[i].toString().equals(lastProfile)) { selected = i; break; } } final JComboBox profileBox = new JComboBox(profiles); profileBox.setSelectedIndex(selected); final JButton connectButton = new JButton("Connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Configuration.setLastProfile(profileBox.getSelectedItem().toString()); } }); JPanel row, sub; sub = new JPanel(new BorderLayout()); sub.add(profileBox, BorderLayout.CENTER); row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Profile:")); row.add(sub); p.add(row); row = new JPanel(); row.add(connectButton); p.add(row); JPanel tmp1 = new JPanel(new BorderLayout()); tmp1.add(p, BorderLayout.WEST); JPanel tmp2 = new JPanel(new BorderLayout()); tmp2.add(tmp1, BorderLayout.NORTH); return tmp2; }
private JPanel makeProfileConnectPanel() { JPanel p = new JPanel(); p.setBorder(new TitledBorder("Connect Profile")); p.setLayout(new GridLayout(2, 0)); Profile[] profiles = Profile.getProfiles(); String lastProfile = Configuration.getLastProfile(); int selected = 0; for (int i = 0; i < profiles.length; i++) { if (profiles[i].toString().equals(lastProfile)) { selected = i; break; } } final JComboBox profileBox = new JComboBox(profiles); if (selected != -1) { profileBox.setSelectedIndex(selected); } final JButton connectButton = new JButton("Connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Configuration.setLastProfile(profileBox.getSelectedItem().toString()); } }); JPanel row, sub; sub = new JPanel(new BorderLayout()); sub.add(profileBox, BorderLayout.CENTER); row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Profile:")); row.add(sub); p.add(row); row = new JPanel(); row.add(connectButton); p.add(row); JPanel tmp1 = new JPanel(new BorderLayout()); tmp1.add(p, BorderLayout.WEST); JPanel tmp2 = new JPanel(new BorderLayout()); tmp2.add(tmp1, BorderLayout.NORTH); return tmp2; }
1,119,841
public int doEndTag() throws JspException { try { CalendarTag cal = (CalendarTag) findAncestorWithClass(this, CalendarTag.class); if (cal == null) return Tag.EVAL_PAGE; // can't use this String content = null; if (day != null && day >= 1 && day <= 31) { BodyContent body = getBodyContent(); if (body != null) content = body.getString(); logger.debug("Body content: " + content); if (content == null || content.trim().length() == 0) content = null; } CalendarDaySpec spec = new CalendarDaySpec( showLink, link, encodeLink, monthParam, dayParam, yearParam, title, dayClass, dayId, content ); cal.setDaySpec(day, spec); return Tag.EVAL_PAGE; } finally { cleanup(); } }
public int doEndTag() throws JspException { try { CalendarTag cal = (CalendarTag) findAncestorWithClass(this, CalendarTag.class); if (cal == null) return Tag.EVAL_PAGE; // can't use this String content = null; if (day != null && day >= 1 && day <= 31) { BodyContent body = getBodyContent(); if (body != null) content = body.getString(); if (content == null || content.trim().length() == 0) content = null; } CalendarDaySpec spec = new CalendarDaySpec( showLink, link, encodeLink, monthParam, dayParam, yearParam, title, dayClass, dayId, content ); cal.setDaySpec(day, spec); return Tag.EVAL_PAGE; } finally { cleanup(); } }
1,119,842
private boolean executeQueries(SQLQuery query, QueryToSQLBridge bridge, List executedSQLQueries) throws RemoteException { QueryResult queryResult = bridge.executeQueries(query, executedSQLQueries); // check if everything is fine if (queryResult == null || queryResult.isEmpty()) { // nothing to do return false; } // get the design of the report JasperReportBusiness reportBusiness = getReportBusiness(); int designId = ((Integer) parameterMap.get(CURRENT_LAYOUT_ID)).intValue(); JasperDesign design = reportBusiness.getDesign(designId); // synchronize design and result Map designParameters = new HashMap(); designParameters.put(REPORT_HEADLINE_KEY, query.getName()); JasperPrint print = reportBusiness.printSynchronizedReport(queryResult, designParameters, design); // create html report String uri; String format = (String) parameterMap.get(CURRENT_OUTPUT_FORMAT); if (PDF_KEY.equals(format)) { uri = reportBusiness.getPdfReport(print, "report"); } else if (EXCEL_KEY.equals(format)) { uri = reportBusiness.getExcelReport(print, "report"); } else { uri = reportBusiness.getHtmlReport(print, "report"); } // open an extra window with scrollbars getParentPage().setOnLoad("window.open('" + uri + "' , 'newWin', 'width=600,height=400,scrollbars=yes')"); return true; }
private boolean executeQueries(SQLQuery query, QueryToSQLBridge bridge, List executedSQLQueries) throws RemoteException { QueryResult queryResult = bridge.executeQueries(query, executedSQLQueries); // check if everything is fine if (queryResult == null || queryResult.isEmpty()) { // nothing to do return false; } // get the design of the report JasperReportBusiness reportBusiness = getReportBusiness(); int designId = ((Integer) parameterMap.get(CURRENT_LAYOUT_ID)).intValue(); JasperDesign design = reportBusiness.getDesign(designId); // synchronize design and result Map designParameters = new HashMap(); designParameters.put(REPORT_HEADLINE_KEY, query.getName()); JasperPrint print = reportBusiness.printSynchronizedReport(queryResult, designParameters, design); // create html report String uri; String format = (String) parameterMap.get(CURRENT_OUTPUT_FORMAT); if (PDF_KEY.equals(format)) { uri = reportBusiness.getPdfReport(print, "report"); } else if (EXCEL_KEY.equals(format)) { uri = reportBusiness.getExcelReport(print, "report"); } else { uri = reportBusiness.getHtmlReport(print, "report"); } // open an extra window with scrollbars getParentPage().setOnLoad(" openwindow('" + uri + "','IdegaWeb Generated Report','0','0','0','0','0','1','1','1','800','600') "); return true; }
1,119,843
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("AclVO{"); if (!empty()) { sb.append("encoded=["); rewind(); while (hasMore()) { sb.append(getChar()); } sb.append("] "); rewind(); try { if (aces == null) { decode(getEncoded()); } Iterator it = aces.iterator(); while (it.hasNext()) { Ace ace = (Ace)it.next(); sb.append("\n"); sb.append(ace.toString()); } } catch (Throwable t) { error(t); sb.append("Decode exception " + t.getMessage()); } } sb.append("}"); return sb.toString(); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Acl{"); if (!empty()) { sb.append("encoded=["); rewind(); while (hasMore()) { sb.append(getChar()); } sb.append("] "); rewind(); try { if (aces == null) { decode(getEncoded()); } Iterator it = aces.iterator(); while (it.hasNext()) { Ace ace = (Ace)it.next(); sb.append("\n"); sb.append(ace.toString()); } } catch (Throwable t) { error(t); sb.append("Decode exception " + t.getMessage()); } } sb.append("}"); return sb.toString(); }
1,119,844
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; }
1,119,846
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.client.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; }
1,119,847
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.client.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; }
1,119,848
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); }
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ begin = new Date(); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); }
1,119,849
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); }
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_BGR); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); }
1,119,850
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); }
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval;else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; else{ numLeft = requests.size(); break; } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval;else{ afterSeismograms.add(current); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; numLeft = requests.size(); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; logger.debug("image creation thread is finished"); } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval;
1,119,851
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); }
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image total " + imageTotals + " plot total " + plottingTotals); }
1,119,852
public ATObject meta_eval(ATContext ctx) { // TODO Auto-generated method stub return super.meta_eval(ctx); }
public ATObject meta_eval(ATContext ctx) { // TODO Auto-generated method stub return null; }
1,119,853
public ATAbstractGrammar meta_quote(ATContext ctx) { // TODO Auto-generated method stub return super.meta_quote(ctx); }
public ATAbstractGrammar meta_quote(ATContext ctx) { // TODO Auto-generated method stub return null; }
1,119,854
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
1,119,855
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); try { svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
1,119,856
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; } catch (CalFacadeException cfe) { if (CalFacadeException.duplicateGuid.equals(cfe.getMessage())) { form.getErr().emit("org.bedework.client.error.duplicate.guid"); return "duplicate"; } throw cfe; } }
1,119,857
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); svci.addEvent(null, proxy.getTarget(), null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; }
1,119,858
public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } }
public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } }
1,119,859
public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } }
public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl = new Acl(debug); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl = new Acl(debug); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } }
1,119,860
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { CurrentAccess ca = new Acl().evaluateAccess(who, owner.getAccount(), how, encoded, null); if (debug) { log(title + " got " + ca.accessAllowed + " and expected " + expected); } assertEquals(title, expected, ca.accessAllowed); }
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { CurrentAccess ca = new Acl().evaluateAccess(who, owner.getAccount(), how, encoded, null); if (debug) { log(title + " got " + ca.accessAllowed + " and expected " + expected); } assertEquals(title, expected, ca.accessAllowed); }
1,119,862
public void addDisplayKey(String key) { this.displayKeys.add(key); }
public void addDisplayKey(String key) { if(!this.displayKeys.contains(key)) { this.displayKeys.add(key); } }
1,119,863
public OffsetMeanAmpConfig(LocalSeismogram aSeis, MicroSecondTimeRange range){ LocalSeismogramImpl seis = (LocalSeismogramImpl)aSeis; int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); if(min > max) ampRange = new UnitRangeImpl(min, -min, seis.getAmplitudeRange().getUnit()); else ampRange = new UnitRangeImpl(-max, max, seis.getAmplitudeRange().getUnit()); }catch (Exception e) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } }
public OffsetMeanAmpConfig(LocalSeismogram aSeis, MicroSecondTimeRange range){ LocalSeismogramImpl seis = (LocalSeismogramImpl)aSeis; int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); if(min > max) ampRange = new UnitRangeImpl(min, -min, seis.getAmplitudeRange().getUnit()); else ampRange = new UnitRangeImpl(-max, max, seis.getAmplitudeRange().getUnit()); }catch (Exception e) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } }
1,119,864
public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; }
public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; }
1,119,866
public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; }
public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ allNull = false; } } return nonNull; }
1,119,867
public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; }
public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return allNull; }
1,119,868
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage; numLeft = requests.size(); while(numLeft > 0){ synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); } HashMap plotters = currentRequirements.getPlotters(); Dimension size = currentRequirements.getSize(); if(size.height <= 0 || size.width <= 0){ numLeft = requests.size(); break; } synchronized(this){ if(requests.contains(currentPatron)){ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); }else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); currentPatron.setImage(currentImage); } } numLeft = requests.size(); } logger.debug("image creation thread is finished"); }
public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage; numLeft = requests.size(); while(numLeft > 0){ synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); } HashMap plotters = currentRequirements.getPlotters(); if(size.height <= 0 || size.width <= 0){ numLeft = requests.size(); break; } synchronized(this){ if(requests.contains(currentPatron)){ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); }else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); currentPatron.setImage(currentImage); } } numLeft = requests.size(); } logger.debug("image creation thread is finished"); }
1,119,869
public static boolean getBoolProperty(String name) throws CalEnvException { String val = getProperty(name); val = val.toLowerCase(); return "true".equals(val) || "yes".equals(val); }
public boolean getBoolProperty(String name) throws CalEnvException { String val = getProperty(name); val = val.toLowerCase(); return "true".equals(val) || "yes".equals(val); }
1,119,870
public static boolean getGlobalBoolProperty(String name) throws CalEnvException { return getBoolProperty(globalPrefix + name); }
public boolean getGlobalBoolProperty(String name) throws CalEnvException { return getBoolProperty(globalPrefix + name); }
1,119,871
public static int getGlobalIntProperty(String name) throws CalEnvException { return getIntProperty(globalPrefix + name); }
public int getGlobalIntProperty(String name) throws CalEnvException { return getIntProperty(globalPrefix + name); }
1,119,872
public static Object getGlobalObject(String name, Class cl) throws CalEnvException { try { String className = getGlobalProperty(name); Object o = Class.forName(className).newInstance(); if (o == null) { throw new CalEnvException("Class " + className + " not found"); } if (!cl.isInstance(o)) { throw new CalEnvException("Class " + className + " is not a subclass of " + cl.getName()); } return o; } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
public Object getGlobalObject(String name, Class cl) throws CalEnvException { try { String className = getGlobalProperty(name); Object o = Class.forName(className).newInstance(); if (o == null) { throw new CalEnvException("Class " + className + " not found"); } if (!cl.isInstance(o)) { throw new CalEnvException("Class " + className + " is not a subclass of " + cl.getName()); } return o; } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,119,873
public static String getGlobalProperty(String name) throws CalEnvException { return getProperty(globalPrefix + name); }
public String getGlobalProperty(String name) throws CalEnvException { return getProperty(globalPrefix + name); }
1,119,874
public static int getIntProperty(String name) throws CalEnvException { String val = getProperty(name); try { return Integer.valueOf(val).intValue(); } catch (Throwable t) { throw new CalEnvException("Invalid property " + name + " = " + val); } }
public int getIntProperty(String name) throws CalEnvException { String val = getProperty(name); try { return Integer.valueOf(val).intValue(); } catch (Throwable t) { throw new CalEnvException("Invalid property " + name + " = " + val); } }
1,119,875
public static String getOptProperty(String name) throws CalEnvException { String val = getPr().getProperty(name); return val; }
public String getOptProperty(String name) throws CalEnvException { String val = getPr().getProperty(name); return val; }
1,119,876
public static Properties getProperties() throws CalEnvException { return getPr(); }
public Properties getProperties() throws CalEnvException { return getPr(); }
1,119,877
public static String getProperty(String name) throws CalEnvException { String val = getPr().getProperty(name); if (val == null) { throw new CalEnvException("Missing property " + name); } return val; }
public String getProperty(String name) throws CalEnvException { String val = getPr().getProperty(name); if (val == null) { throw new CalEnvException("Missing property " + name); } return val; }
1,119,878
private void getSingleQueryView(IWBundle bundle, IWResourceBundle resourceBundle, String action, IWContext iwc) throws RemoteException { String errorMessage = null; QueryService queryService = getQueryService(); int currentQueryId = ((Integer) parameterMap.get(CURRENT_QUERY_ID)).intValue(); QueryHelper queryHelper = queryService.getQueryHelper(currentQueryId); QueryToSQLBridge bridge = getQueryToSQLBridge(); SQLQuery query = null; try { query = bridge.createQuerySQL(queryHelper, iwc); } catch (QueryGenerationException ex) { String message = "[ReportOverview]: Can't generate query."; System.err.println(message + " Message is: " + ex.getMessage()); ex.printStackTrace(System.err); errorMessage = resourceBundle.getLocalizedString("ro_query_could not_be_created", "Query could not be created"); } // execute query if the query was successfully created if (errorMessage == null) { // // query is dynamic // if (query.isDynamic()) { Map identifierValueMap = query.getIdentifierValueMap(); Map identifierInputDescriptionMap = query.getIdentifierInputDescriptionMap(); boolean calculateAccess = false; boolean containsOnlyAccessVariable = ( (calculateAccess = identifierValueMap.containsKey(USER_ACCESS_VARIABLE)) || (calculateAccess = identifierValueMap.containsKey(GROUP_ACCESS_VARIABLE))) && (identifierValueMap.size() == 1); if (SHOW_SINGLE_QUERY_CHECK_IF_DYNAMIC.equals(action) && ! containsOnlyAccessVariable) { // show input fields showInputFields(query, identifierValueMap, identifierInputDescriptionMap, resourceBundle, iwc); } else { // get the values of the input fields Map modifiedValues = getModifiedIdentiferValueMapByParsingRequest(identifierValueMap, identifierInputDescriptionMap, iwc); if (calculateAccess) { setAccessCondition(modifiedValues, iwc); } query.setIdentifierValueMap(modifiedValues); // show result of query List executedSQLStatements = new ArrayList(); boolean isOkay = executeQueries(query, bridge, executedSQLStatements); addExecutedSQLQueries(executedSQLStatements); if (! isOkay) { errorMessage = resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } // show again the input fields if (errorMessage != null) { addErrorMessage(errorMessage); } if ( ! containsOnlyAccessVariable) { showInputFields(query, modifiedValues, identifierInputDescriptionMap, resourceBundle, iwc); } else { getListOfQueries(bundle, resourceBundle, iwc); } } // // good bye - query is dynamic // return; } // // query is not dynamic // else { List executedSQLStatements = new ArrayList(); boolean isOkay = executeQueries(query, bridge, executedSQLStatements); addExecutedSQLQueries(executedSQLStatements); if (! isOkay) { errorMessage = resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } } } // show list if query is not dynamic and if an error occurred if (errorMessage != null) { addErrorMessage(errorMessage); } getListOfQueries(bundle, resourceBundle, iwc); }
private void getSingleQueryView(IWBundle bundle, IWResourceBundle resourceBundle, String action, IWContext iwc) throws RemoteException { String errorMessage = null; QueryService queryService = getQueryService(); int currentQueryId = ((Integer) parameterMap.get(CURRENT_QUERY_ID)).intValue(); QueryHelper queryHelper = queryService.getQueryHelper(currentQueryId); QueryToSQLBridge bridge = getQueryToSQLBridge(); SQLQuery query = null; try { query = bridge.createQuerySQL(queryHelper, iwc); } catch (QueryGenerationException ex) { String message = "[ReportOverview]: Can't generate query."; System.err.println(message + " Message is: " + ex.getMessage()); ex.printStackTrace(System.err); errorMessage = resourceBundle.getLocalizedString("ro_query_could not_be_created", "Query could not be created"); } // execute query if the query was successfully created if (errorMessage == null) { // // query is dynamic // if (query.isDynamic()) { Map identifierValueMap = query.getIdentifierValueMap(); Map identifierInputDescriptionMap = query.getIdentifierInputDescriptionMap(); boolean calculateAccess = false; boolean containsOnlyAccessVariable = ( (calculateAccess = identifierValueMap.containsKey(USER_ACCESS_VARIABLE)) || (calculateAccess = identifierValueMap.containsKey(GROUP_ACCESS_VARIABLE))) && (identifierValueMap.size() == 1); if (SHOW_SINGLE_QUERY_CHECK_IF_DYNAMIC.equals(action) && ! containsOnlyAccessVariable) { // show input fields showInputFields(query, identifierValueMap, identifierInputDescriptionMap, resourceBundle, iwc); } else { // get the values of the input fields Map modifiedValues = getModifiedIdentiferValueMapByParsingRequest(identifierValueMap, identifierInputDescriptionMap, iwc); if (calculateAccess) { setAccessCondition(modifiedValues, iwc); } query.setIdentifierValueMap(modifiedValues); // show result of query List executedSQLStatements = new ArrayList(); boolean isOkay = executeQueries(query, bridge, executedSQLStatements); if("true".equals(getBundle(iwc).getProperty(ADD_QUERY_SQL_FOR_DEBUG,"false"))){ addExecutedSQLQueries(executedSQLStatements); } if (! isOkay) { errorMessage = resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } // show again the input fields if (errorMessage != null) { addErrorMessage(errorMessage); } if ( ! containsOnlyAccessVariable) { showInputFields(query, modifiedValues, identifierInputDescriptionMap, resourceBundle, iwc); } else { getListOfQueries(bundle, resourceBundle, iwc); } } // // good bye - query is dynamic // return; } // // query is not dynamic // else { List executedSQLStatements = new ArrayList(); boolean isOkay = executeQueries(query, bridge, executedSQLStatements); if("true".equals(getBundle(iwc).getProperty(ADD_QUERY_SQL_FOR_DEBUG,"false"))){ addExecutedSQLQueries(executedSQLStatements); } if (! isOkay) { errorMessage = resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } } } // show list if query is not dynamic and if an error occurred if (errorMessage != null) { addErrorMessage(errorMessage); } getListOfQueries(bundle, resourceBundle, iwc); }
1,119,879
private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { Enumeration en = getNsIntf().getProperties(node); WebdavNsIntf intf = getNsIntf(); while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); intf.generatePropValue(node, prop); } }
private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { Iterator it = getNsIntf().iterateProperties(node); WebdavNsIntf intf = getNsIntf(); while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); intf.generatePropValue(node, prop); } }
1,119,880
private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { Enumeration en = getNsIntf().getProperties(node); WebdavNsIntf intf = getNsIntf(); while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); intf.generatePropValue(node, prop); } }
private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { Enumeration en = getNsIntf().getProperties(node); WebdavNsIntf intf = getNsIntf(); while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); intf.generatePropValue(node, prop); } }
1,119,881
public PropRequest parseProps(Node nd) throws WebdavException { PropRequest pr = new PropRequest(PropRequest.reqProp); pr.props = new ArrayList(); Element[] children = getChildren(nd); for (int i = 0; i < children.length; i++) { Element propnode = children[i]; WebdavProperty prop = new WebdavProperty( new QName(propnode.getNamespaceURI(), propnode.getLocalName()), null); if (debug) { trace("prop: " + prop.getTag()); } addNs(prop.getTag().getNamespaceURI()); pr.props.add(prop); } return pr; }
public PropRequest parseProps(Node nd) throws WebdavException { PropRequest pr = new PropRequest(PropRequest.reqProp); pr.props = new ArrayList(); Element[] children = getChildren(nd); for (int i = 0; i < children.length; i++) { Element propnode = children[i]; WebdavProperty prop = new WebdavProperty( new QName(propnode.getNamespaceURI(), propnode.getLocalName()), null); if (debug) { trace("prop: " + prop.getTag()); } addNs(prop.getTag().getNamespaceURI()); pr.props.add(prop); } return pr; }
1,119,882
public void addUser(BwUser user) throws CalFacadeException { addNewUser(user); calendars.addNewCalendars(); }
public void addUser(BwUser user) throws CalFacadeException { addNewUser(user); calendars.addNewCalendars(user); }
1,119,883
public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; if (authenticatedUser == null) { this.superUser = false; // be safe } BwUser authUser; try { access = new AccessUtil(superUser, debug); objTimestamp = new Timestamp(System.currentTimeMillis()); this.superUser = superUser; this.synchId = synchId; log = Logger.getLogger(getClass()); 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; } ignoreCreator = false; if (authenticatedUser == null) { // Unauthenticated use // Ensure no guest mods// this.readOnly = true; currentMode = CalintfUtil.guestMode; authUser = new BwUser(); this.user = getUser(user); } else {// this.readOnly = false; authUser = getUser(authenticatedUser); if (authUser == null) { /* Add the user to the database. Presumably this is first logon */ getLogger().info("Add new user " + authenticatedUser); addNewUser(new BwUser(authenticatedUser)); authUser = getUser(authenticatedUser); userCreated = true; } if (!publicAdmin) { currentMode = CalintfUtil.userMode; } else { currentMode = CalintfUtil.publicAdminMode; } logon(authUser); getLogger().info("Authenticated user " + authenticatedUser + " logged on"); ignoreCreator = superUser; if (authenticatedUser.equals(user)) { this.user = authUser; } else { this.user = getUser(user); if (this.user == null) { throw new CalFacadeException("User " + user + " does not exist."); } } } authUser.setGroups(groups.getAllGroups(authUser)); access.setAuthUser(authUser); events = new Events(this, access, this.user, debug); calendars = new Calendars(this, access, this.user, debug); categories = new EventProperties(this, access, this.user, "word", BwCategory.class.getName(), "getCategoryRefs", -1, debug); locations = new EventProperties(this, access, this.user, "address", BwLocation.class.getName(), "getLocationRefs", CalFacadeDefs.maxReservedLocationId, debug); sponsors = new EventProperties(this, access, this.user, "name", BwSponsor.class.getName(), "getSponsorRefs", CalFacadeDefs.maxReservedSponsorId, debug); timezones = new CalTimezonesImpl(this, getStats(), publicAdmin, debug); timezones.setDefaultTimeZoneId(getSyspars().getTzid()); if (userCreated) { calendars.addNewCalendars(); } return userCreated; }
public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; if (authenticatedUser == null) { this.superUser = false; // be safe } BwUser authUser; try { access = new AccessUtil(superUser, debug); objTimestamp = new Timestamp(System.currentTimeMillis()); this.superUser = superUser; this.synchId = synchId; log = Logger.getLogger(getClass()); 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; } ignoreCreator = false; if (authenticatedUser == null) { // Unauthenticated use // Ensure no guest mods// this.readOnly = true; currentMode = CalintfUtil.guestMode; authUser = new BwUser(); this.user = getUser(user); } else {// this.readOnly = false; authUser = getUser(authenticatedUser); if (authUser == null) { /* Add the user to the database. Presumably this is first logon */ getLogger().info("Add new user " + authenticatedUser); addNewUser(new BwUser(authenticatedUser)); authUser = getUser(authenticatedUser); userCreated = true; } if (!publicAdmin) { currentMode = CalintfUtil.userMode; } else { currentMode = CalintfUtil.publicAdminMode; } logon(authUser); getLogger().info("Authenticated user " + authenticatedUser + " logged on"); ignoreCreator = superUser; if (authenticatedUser.equals(user)) { this.user = authUser; } else { this.user = getUser(user); if (this.user == null) { throw new CalFacadeException("User " + user + " does not exist."); } } } authUser.setGroups(groups.getAllGroups(authUser)); access.setAuthUser(authUser); events = new Events(this, access, this.user, debug); calendars = new Calendars(this, access, this.user, debug); categories = new EventProperties(this, access, this.user, "word", BwCategory.class.getName(), "getCategoryRefs", -1, debug); locations = new EventProperties(this, access, this.user, "address", BwLocation.class.getName(), "getLocationRefs", CalFacadeDefs.maxReservedLocationId, debug); sponsors = new EventProperties(this, access, this.user, "name", BwSponsor.class.getName(), "getSponsorRefs", CalFacadeDefs.maxReservedSponsorId, debug); timezones = new CalTimezonesImpl(this, getStats(), publicAdmin, debug); timezones.setDefaultTimeZoneId(getSyspars().getTzid()); if (userCreated) { calendars.addNewCalendars(authUser); } return userCreated; }
1,119,884
private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; }
private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isNotDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; }
1,119,885
private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; }
private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsNotDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; }
1,119,886
private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; }
private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsNotDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; }
1,119,887
private ParamFilter parseParamFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } // Only one child - either is-defined | text-match Element child = getOnlyChild(nd); if (debug) { trace("paramFilter element: " + child.getNamespaceURI() + " " + child.getLocalName()); } if (MethodBase.nodeMatches(child, CaldavTags.isDefined)) { return new ParamFilter(name, true); } if (MethodBase.nodeMatches(child, CaldavTags.textMatch)) { TextMatch match = parseTextMatch(child); if (match == null) { return null; } return new ParamFilter(name, match); } status = HttpServletResponse.SC_BAD_REQUEST; return null; }
private ParamFilter parseParamFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } // Only one child - either is-defined | text-match Element child = getOnlyChild(nd); if (debug) { trace("paramFilter element: " + child.getNamespaceURI() + " " + child.getLocalName()); } if (MethodBase.nodeMatches(child, CaldavTags.isNotDefined)) { return new ParamFilter(name, true); } if (MethodBase.nodeMatches(child, CaldavTags.textMatch)) { TextMatch match = parseTextMatch(child); if (match == null) { return null; } return new ParamFilter(name, match); } status = HttpServletResponse.SC_BAD_REQUEST; return null; }
1,119,888
private PropFilter parsePropFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } PropFilter pf = new PropFilter(name); Element[] children = getChildren(nd); boolean idTrTm = false; // flag is-defined | time-range | text-match try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("propFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (idTrTm) { // Only have param-filter* if (MethodBase.nodeMatches(curnode, CaldavTags.paramFilter)) { ParamFilter parf = parseParamFilter(curnode); if (parf == null) { return null; } pf.addParamFilter(parf); } else { status = HttpServletResponse.SC_BAD_REQUEST; return null; } } else { idTrTm = true; // one of is-defined | time-range | text-match if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { pf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { pf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); } else if (MethodBase.nodeMatches(curnode, CaldavTags.textMatch)) { pf.setMatch(parseTextMatch(curnode)); if (pf.getMatch() == null) { return null; } } else { // Effectively is-defined pf.setIsDefined(true);// status = HttpServletResponse.SC_BAD_REQUEST;// return null; } } } } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } return pf; }
private PropFilter parsePropFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } PropFilter pf = new PropFilter(name); Element[] children = getChildren(nd); boolean idTrTm = false; // flag is-defined | time-range | text-match try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("propFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (idTrTm) { // Only have param-filter* if (MethodBase.nodeMatches(curnode, CaldavTags.paramFilter)) { ParamFilter parf = parseParamFilter(curnode); if (parf == null) { return null; } pf.addParamFilter(parf); } else { status = HttpServletResponse.SC_BAD_REQUEST; return null; } } else { idTrTm = true; // one of is-defined | time-range | text-match if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { pf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { pf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); } else if (MethodBase.nodeMatches(curnode, CaldavTags.textMatch)) { pf.setMatch(parseTextMatch(curnode)); if (pf.getMatch() == null) { return null; } } else { // Effectively is-defined pf.setIsDefined(true);// status = HttpServletResponse.SC_BAD_REQUEST;// return null; } } } } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } return pf; }
1,119,889
private PropFilter parsePropFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } PropFilter pf = new PropFilter(name); Element[] children = getChildren(nd); boolean idTrTm = false; // flag is-defined | time-range | text-match try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("propFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (idTrTm) { // Only have param-filter* if (MethodBase.nodeMatches(curnode, CaldavTags.paramFilter)) { ParamFilter parf = parseParamFilter(curnode); if (parf == null) { return null; } pf.addParamFilter(parf); } else { status = HttpServletResponse.SC_BAD_REQUEST; return null; } } else { idTrTm = true; // one of is-defined | time-range | text-match if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { pf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { pf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); } else if (MethodBase.nodeMatches(curnode, CaldavTags.textMatch)) { pf.setMatch(parseTextMatch(curnode)); if (pf.getMatch() == null) { return null; } } else { // Effectively is-defined pf.setIsDefined(true);// status = HttpServletResponse.SC_BAD_REQUEST;// return null; } } } } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } return pf; }
private PropFilter parsePropFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } PropFilter pf = new PropFilter(name); Element[] children = getChildren(nd); boolean idTrTm = false; // flag is-defined | time-range | text-match try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("propFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (idTrTm) { // Only have param-filter* if (MethodBase.nodeMatches(curnode, CaldavTags.paramFilter)) { ParamFilter parf = parseParamFilter(curnode); if (parf == null) { return null; } pf.addParamFilter(parf); } else { status = HttpServletResponse.SC_BAD_REQUEST; return null; } } else { idTrTm = true; // one of is-defined | time-range | text-match if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { pf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); } else if (MethodBase.nodeMatches(curnode, CaldavTags.textMatch)) { pf.setMatch(parseTextMatch(curnode)); if (pf.getMatch() == null) { return null; } } else { // Effectively is-defined // status = HttpServletResponse.SC_BAD_REQUEST;// return null; } } } } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } return pf; }
1,119,890
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
1,119,894
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
1,119,895
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[ntdly-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
1,119,896
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("seis is too short, so no trigger possible"); return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[nlta-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
1,119,897
public void testBinaryIndexSum() throws Exception { // JUnitDoclet begin method binaryIndexSum for ( int i = 0; i<stat.length; i++) { int n=stat[i].getLength()-1; assertEquals("stat["+i+"]", n*(n+1)*(2*n+1)/6, (int)stat[i].binaryIndexSum(0, stat[i].getLength())); } // end of for () // JUnitDoclet end method binaryIndexSum }
public void testBinaryIndexSum() throws Exception { // JUnitDoclet begin method binaryIndexSum for ( int i = 0; i<stat.length; i++) { int n=stat[i].getLength()-1; double sumSquare = 1.0*n*(n+1)*(2*n+1)/6; assertEquals("stat["+i+"]", sumSquare, stat[i].binaryIndexSum(0, stat[i].getLength()), 0.00001*sumSquare); } // end of for () // JUnitDoclet end method binaryIndexSum }
1,119,898
public void testBinarySum() throws Exception { for ( int i = 0; i<stat.length; i++) { int n=stat[i].getLength()-1; double out = stat[i].binarySum(0, intTestData.length); assertEquals("BinarySum", n*(n+1)/2, out, 0.0000001); } // end of for () }
public void testBinarySum() throws Exception { for ( int i = 0; i<stat.length; i++) { int n=stat[i].getLength()-1; double out = stat[i].binarySum(0, stat[i].getLength()); assertEquals("BinarySum", n*(n+1)/2, out, 0.0000001); } // end of for () }
1,119,899
public void testLinearLeastSquares() throws Exception { // JUnitDoclet begin method linearLeastSquares for ( int i = 0; i<stat.length; i++) { double[] out = stat[i].linearLeastSquares(); assertEquals("stat["+i+"]", 0, out[0], 0.0000001); assertEquals("stat["+i+"]", 1, out[1], 0.0000001); } // end of for () // JUnitDoclet end method linearLeastSquares }
public void testLinearLeastSquares() throws Exception { // JUnitDoclet begin method linearLeastSquares for ( int i = 0; i<stat.length; i++) { double[] out = stat[i].linearLeastSquares(); assertEquals("stat["+i+"]", 0, out[0], 0.0000001); assertEquals("stat["+i+"]", 1, out[1], 0.0000001); } // end of for () // JUnitDoclet end method linearLeastSquares }
1,119,900
public void send_request(ClientRequestInfo info) throws ForwardRequest { ServiceContext context = new ServiceContext(id, propBytes); info.add_request_service_context(context, true); }
public void send_request(ClientRequestInfo info) throws ForwardRequest { ServiceContext context = new ServiceContext(ID, propBytes); info.add_request_service_context(context, true); }
1,119,902
protected void checkForLegacySeismograms() { //this supports loading of classic seismogram datasets that were //created before dataset seismograms if(getDataSetSeismogramNames().length == 0) { String[] names = getSeismogramNames(); logger.info("No DataSetSeismograms in dataset "+getName()+", using legacy dataset option: creating DataSetSeismogram per LocalSeismogram. LS length="+names.length); for (int i = 0 ;i < names.length ;i++ ) { URL sacURL = getSeismogramURL(names[i]); if(sacURL != null) { DataSetSeismogram dsstemp = new URLDataSetSeismogram(names[i], sacURL, SeismogramFileTypes.SAC, this); addDataSetSeismogram(dsstemp, new AuditInfo[0]); } } } }
protected void checkForLegacySeismograms() { //this supports loading of classic seismogram datasets that were //created before dataset seismograms if(getDataSetSeismogramNames().length == 0) { String[] names = getSeismogramNames(); logger.info("No DataSetSeismograms in dataset "+getName()+", using legacy dataset option: creating DataSetSeismogram per LocalSeismogram. LS length="+names.length); for (int i = 0 ;i < names.length ;i++ ) { URL sacURL = getSeismogramURL(names[i]); if(sacURL != null) { DataSetSeismogram dsstemp = new URLDataSetSeismogram(names[i], sacURL, SeismogramFileTypes.SAC, this); addDataSetSeismogram(dsstemp, new AuditInfo[0]); } } } }
1,119,903
protected void checkForLegacySeismograms() { //this supports loading of classic seismogram datasets that were //created before dataset seismograms if(getDataSetSeismogramNames().length == 0) { String[] names = getSeismogramNames(); logger.info("No DataSetSeismograms in dataset "+getName()+", using legacy dataset option: creating DataSetSeismogram per LocalSeismogram. LS length="+names.length); for (int i = 0 ;i < names.length ;i++ ) { URL sacURL = getSeismogramURL(names[i]); if(sacURL != null) { DataSetSeismogram dsstemp = new URLDataSetSeismogram(names[i], sacURL, SeismogramFileTypes.SAC, this); addDataSetSeismogram(dsstemp, new AuditInfo[0]); } } } }
protected void checkForLegacySeismograms() { //this supports loading of classic seismogram datasets that were //created before dataset seismograms if(getDataSetSeismogramNames().length == 0) { String[] names = getSeismogramNames(); logger.info("No DataSetSeismograms in dataset "+getName()+", using legacy dataset option: creating DataSetSeismogram per LocalSeismogram. LS length="+names.length); for (int i = 0 ;i < names.length ;i++ ) { URL sacURL = getSeismogramURL(names[i]); if(sacURL != null) { DataSetSeismogram dsstemp = new URLDataSetSeismogram(names[i], sacURL, SeismogramFileTypes.SAC, this, names[i]); addDataSetSeismogram(dsstemp, new AuditInfo[0]); } } } }
1,119,904
public void end(String ns, String name) throws Exception { BwFilter entity = (BwFilter)pop(); globals.filters++; globals.filtersTbl.put(entity); try { if (globals.from2p3px) { /* We are converting filter definitions into calendar definitions. */ BwCalendar cal = new BwCalendar(); cal.setName(fixName(entity.getName())); BwUser calOwner = globals.getPublicUser(); cal.setCreator(calOwner); cal.setOwner(calOwner); cal.setPublick(true); if (entity instanceof BwAndFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } else if (entity instanceof BwCategoryFilter) { BwCategoryFilter catf = (BwCategoryFilter)entity; cal.setCalendarCollection(true); globals.calLeaves.add(entity); globals.catCalTbl.put(catf.getCategory().getId(), cal); } else if (entity instanceof BwCreatorFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwLocationFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwOrFilter) { if (entity.getId() == 2) { if (globals.publicCalRoot != null) { error("Seen two roots " + entity); cal = null; globals.calMapErrors++; } // This is the root globals.publicCalRoot = cal; globals.publicCalRoot.setName(globals.syspars.getPublicCalendarRoot()); globals.publicCalRoot.setPath("/" + globals.syspars.getPublicCalendarRoot()); globals.publicCalRoot.setAccess(globals.getDefaultPublicCalendarsAccess()); } } else if (entity instanceof BwSponsorFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwNotFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } else if (entity instanceof RestoreGlobals.AliasFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } if (cal != null) { cal.setId(globals.nextCalKey); globals.nextCalKey++; globals.calendarsTbl.put(new Integer(cal.getId()), cal); if (entity.getParent() != null) { BwCalendar parent = (BwCalendar)globals.filterToCal.get( new Integer(entity.getParent().getId())); if (parent == null) { error("Missing parent in mapping tbl " + entity); globals.calMapErrors++; } else { cal.setCalendar(parent); cal.setPath(parent.getPath() + "/" + cal.getName()); if (cal.getPath().equals(globals.defaultPublicCalPath)) { globals.defaultPublicCal = cal; } parent.addChild(cal); } } globals.filterToCal.put(new Integer(entity.getId()), cal); } BwUser filterOwner = globals.getFixOwner(); if (filterOwner == null) { error("Filter owner " + globals.fixOwner + " does not exist"); } entity.setOwner(filterOwner); entity.setPublick(true); } if (globals.rintf != null) { trace("About to restore filter " + entity); globals.rintf.restoreFilter(entity); } } catch (Throwable t) { throw new Exception(t); } }
public void end(String ns, String name) throws Exception { BwFilter entity = (BwFilter)pop(); globals.filters++; globals.filtersTbl.put(entity); try { if (globals.from2p3px) { /* We are converting filter definitions into calendar definitions. */ BwCalendar cal = new BwCalendar(); cal.setName(fixName(entity.getName())); BwUser calOwner = globals.getPublicUser(); cal.setCreator(calOwner); cal.setOwner(calOwner); cal.setPublick(true); if (entity instanceof BwAndFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } else if (entity instanceof BwCategoryFilter) { BwCategoryFilter catf = (BwCategoryFilter)entity; cal.setCalendarCollection(true); globals.calLeaves.add(entity); globals.catCalTbl.put(catf.getCategory().getId(), cal); } else if (entity instanceof BwCreatorFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwLocationFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwOrFilter) { if (entity.getId() == 2) { if (globals.publicCalRoot != null) { error("Seen two roots " + entity); cal = null; globals.calMapErrors++; } // This is the root globals.publicCalRoot = cal; globals.publicCalRoot.setName(globals.syspars.getPublicCalendarRoot()); globals.publicCalRoot.setPath("/" + globals.syspars.getPublicCalendarRoot()); globals.publicCalRoot.setAccess(globals.getDefaultPublicCalendarsAccess()); } } else if (entity instanceof BwSponsorFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwNotFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } else if (entity instanceof RestoreGlobals.AliasFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } if (cal != null) { cal.setId(globals.nextCalKey); globals.nextCalKey++; globals.calendarsTbl.put(new Integer(cal.getId()), cal); if (entity.getParent() != null) { BwCalendar parent = (BwCalendar)globals.filterToCal.get( new Integer(entity.getParent().getId())); if (parent == null) { error("Missing parent in mapping tbl " + entity); globals.calMapErrors++; } else { cal.setCalendar(parent); cal.setPath(parent.getPath() + "/" + cal.getName()); if (cal.getPath().equals(globals.defaultPublicCalPath)) { globals.defaultPublicCal = cal; } parent.addChild(cal); } } globals.filterToCal.put(new Integer(entity.getId()), cal); } BwUser filterOwner = globals.getFixOwner(); if (filterOwner == null) { error("Filter owner " + globals.fixOwner + " does not exist"); } entity.setOwner(filterOwner); entity.setPublick(true); } if (globals.rintf != null) { trace("About to restore filter " + entity); globals.rintf.restoreFilter(entity); } } catch (Throwable t) { throw new Exception(t); } }
1,119,905
private void initializeDocument(String name) { _designDoc = new DesignDocument(name); // set A 4 paper size _designDoc.setPageWidth(595); _designDoc.setPageHeight(842); _designDoc.setColumnWidth(540); _designDoc.setColumnSpacing(15); _designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); _designDoc.setColumnCount(1); _designDoc.setPrintOrderVertical(); _designDoc.setOrientationPortrait(); _designDoc.setWhenNoDataTypeAsAllSectionNoDetail(); _designDoc.setIsTitleNewPage(false); _designDoc.setIsSummaryNewPage(false); _designDoc.addParameter(PRM_REPORT_NAME,String.class,true); if (showDate) { _designDoc.addParameter(PRM_DATE, String.class, true); } if (showUser) { _designDoc.addParameter(PRM_USER, String.class, true); } }
private void initializeDocument(String name) { _designDoc = new DesignDocument(name); // set A 4 paper size _designDoc.setPageWidth(595); _designDoc.setPageHeight(842); _designDoc.setColumnWidth(540); _designDoc.setColumnSpacing(15); _designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); _designDoc.setColumnCount(1); _designDoc.setPrintOrderVertical(); _designDoc.setOrientationPortrait(); _designDoc.setWhenNoDataTypeAsAllSectionNoDetail(); _designDoc.setIsTitleNewPage(false); _designDoc.setIsSummaryNewPage(false); _designDoc.addParameter(PRM_REPORT_NAME,String.class,true); if (showDate) { _designDoc.addParameter(PRM_DATE, String.class, true); } if (showUser) { _designDoc.addParameter(PRM_USER, String.class, true); } }
1,119,906
private void initializeDocument(String name) { _designDoc = new DesignDocument(name); // set A 4 paper size _designDoc.setPageWidth(595); _designDoc.setPageHeight(842); _designDoc.setColumnWidth(540); _designDoc.setColumnSpacing(15); _designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); _designDoc.setColumnCount(1); _designDoc.setPrintOrderVertical(); _designDoc.setOrientationPortrait(); _designDoc.setWhenNoDataTypeAsAllSectionNoDetail(); _designDoc.setIsTitleNewPage(false); _designDoc.setIsSummaryNewPage(false); _designDoc.addParameter(PRM_REPORT_NAME,String.class,true); if (showDate) { _designDoc.addParameter(PRM_DATE, String.class, true); } if (showUser) { _designDoc.addParameter(PRM_USER, String.class, true); } }
private void initializeDocument(String name) { _designDoc = new DesignDocument(name); // set A 4 paper size _designDoc.setPageWidth(595); _designDoc.setPageHeight(842); _designDoc.setColumnWidth(540); _designDoc.setColumnSpacing(15); _designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); _designDoc.setColumnCount(1); _designDoc.setPrintOrderVertical(); _designDoc.setOrientationPortrait(); _designDoc.setWhenNoDataTypeAsAllSectionNoDetail(); _designDoc.setIsTitleNewPage(false); _designDoc.setIsSummaryNewPage(false); _designDoc.addParameter(PRM_REPORT_NAME,String.class,true); if (showDate) { _designDoc.addParameter(PRM_DATE, String.class, true); } if (showUser) { _designDoc.addParameter(PRM_USER, String.class, true); } }
1,119,907
public void setIsBlankWhenNull(boolean value){ this.setAttribute(ATTRIBUTE_IS_BLANK_WHEN_NULL, Boolean.toString(value)); }
public void setIsBlankWhenNull(boolean value){ this.setAttribute(ATTRIBUTE_IS_BLANK_WHEN_NULL, String.valueOf(value)); }
1,119,908
public void setIsStretchWithOverflow(boolean value){ this.setAttribute(ATTRIBUTE_IS_STRETCH_WITH_OVERFLOW, Boolean.toString(value)); }
public void setIsStretchWithOverflow(boolean value){ this.setAttribute(ATTRIBUTE_IS_STRETCH_WITH_OVERFLOW, String.valueOf(value)); }
1,119,909
public void setIsPrintRepeatedValues(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_REPEATED_VALUES,Boolean.toString(value)); }
public void setIsPrintRepeatedValues(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_REPEATED_VALUES,String.valueOf(value)); }
1,119,910
public void setIsRemoveLineWhenBlank(boolean value){ this.setAttribute(ATTRIBUTE_IS_REMOVE_LINE_WHEN_BLANK,Boolean.toString(value)); }
public void setIsRemoveLineWhenBlank(boolean value){ this.setAttribute(ATTRIBUTE_IS_REMOVE_LINE_WHEN_BLANK,String.valueOf(value)); }
1,119,911
public void setIsPrintInFirstWholeBand(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND,Boolean.toString(value)); }
public void setIsPrintInFirstWholeBand(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND,String.valueOf(value)); }
1,119,912
public void setIsPrintWhenDetailOverflows(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVERFLOWS,Boolean.toString(value)); }
public void setIsPrintWhenDetailOverflows(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVERFLOWS,String.valueOf(value)); }
1,119,913
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar int id = getIntReqPar(request, "calId", -1); if (id < 0) { ev.setCalendar(svci.getPreferredCalendar()); } else { BwCalendar calendar = svci.getCalendar(id); if (calendar == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); return "notFound"; } ev.setCalendar(calendar); } } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; }
1,119,914
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub != null) && (!sub.getInternalSubscription())) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; }
1,119,915
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; }
1,119,916
private void storeAuthorizationEntry(String encodedCardnumber, Object parentDataPK, Hashtable properties, String authorizationType) throws IDOLookupException, CreateException { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); if (properties.containsKey(PROPERTY_AMOUNT)) auth.setAmount(Double.parseDouble(properties.get(PROPERTY_AMOUNT).toString()));//Double.parseDouble(strAmount)); if (properties.containsKey(PROPERTY_APPROVAL_CODE)) auth.setAuthorizationCode(properties.get(PROPERTY_APPROVAL_CODE).toString());//authCode); if (properties.containsKey(PROPERTY_CARD_BRAND_NAME)) auth.setBrandName(properties.get(PROPERTY_CARD_BRAND_NAME).toString()); if (properties.containsKey(PROPERTY_CC_EXPIRE)) auth.setCardExpires(properties.get(PROPERTY_CC_EXPIRE).toString());//monthExpires+yearExpires); if (properties.containsKey(PROPERTY_CURRENCY_CODE)) auth.setCurrency(properties.get(PROPERTY_CURRENCY_CODE).toString());//currency); if (properties.containsKey(PROPERTY_ERROR_CODE)) auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); if (properties.containsKey(PROPERTY_ERROR_TEXT)) auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); if (properties.containsKey(PROPERTY_TOTAL_RESPONSE)) auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.setTransactionType(authorizationType); auth.setCardNumber(encodedCardnumber); auth.setDate(IWTimestamp.RightNow().getDate()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); }
private void storeAuthorizationEntry(String encodedCardnumber, Object parentDataPK, Hashtable properties, String authorizationType) throws IDOLookupException, CreateException { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); if (properties.containsKey(PROPERTY_AMOUNT)) auth.setAmount(Double.parseDouble(properties.get(PROPERTY_AMOUNT).toString()));//Double.parseDouble(strAmount)); if (properties.containsKey(PROPERTY_APPROVAL_CODE)) auth.setAuthorizationCode(properties.get(PROPERTY_APPROVAL_CODE).toString());//authCode); if (properties.containsKey(PROPERTY_CARD_BRAND_NAME)) auth.setBrandName(properties.get(PROPERTY_CARD_BRAND_NAME).toString()); if (properties.containsKey(PROPERTY_CC_EXPIRE)) auth.setCardExpires(properties.get(PROPERTY_CC_EXPIRE).toString());//monthExpires+yearExpires); if (properties.containsKey(PROPERTY_CURRENCY_CODE)) auth.setCurrency(getCurrencyAbbreviation(properties.get(PROPERTY_CURRENCY_CODE).toString()));//currency); if (properties.containsKey(PROPERTY_ERROR_CODE)) auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); if (properties.containsKey(PROPERTY_ERROR_TEXT)) auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); if (properties.containsKey(PROPERTY_TOTAL_RESPONSE)) auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.setTransactionType(authorizationType); auth.setCardNumber(encodedCardnumber); auth.setDate(IWTimestamp.RightNow().getDate()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); }
1,119,917
public IdeaView(Idea anIdea) { this(anIdea, true); }
public IdeaView(Idea anIdea) { this(anIdea, true); }
1,119,919
public void paint(Graphics g) { paint(g, new Point(0, 0), this); }
public void paint(Graphics g) { paint(g, new Point(0, 0), this, getAngle()); }
1,119,920
private Collection getCategoryCollection(int kind) { try { if (kind == publicEntity) { return calsvci.getPublicCategories(); } if (kind == ownersEntity) { return calsvci.getCategories(); } if (kind == editableEntity) { return calsvci.getEditableCategories(); } // Won't need this with 1.5 throw new Exception("Software error - bad kind " + kind); } catch (Throwable t) { if (debug) { t.printStackTrace(); } err.emit(t); return new Vector(); } }
private Collection getCategoryCollection(int kind) { try { if (kind == publicEntity) { return calsvci.getPublicCategories(); } if (kind == ownersEntity) { return calsvci.getCategories(); } if (kind == editableEntity) { return calsvci.getEditableCategories(); } // Won't need this with 1.5 throw new Exception("Software error - bad kind " + kind); } catch (Throwable t) { if (debug) { t.printStackTrace(); } err.emit(t); return new ArrayList(); } }
1,119,921
public Collection getCurrentSubscriptions() { if (currentSubscriptions == null) { currentSubscriptions = new Vector(); } return currentSubscriptions; }
public Collection getCurrentSubscriptions() { if (currentSubscriptions == null) { currentSubscriptions = new ArrayList(); } return currentSubscriptions; }
1,119,922
public Collection getInstanceOwners() { try { return fetchSvci().getInstanceOwners(); } catch (Throwable t) { err.emit(t); return new Vector(); } }
public Collection getInstanceOwners() { try { return fetchSvci().getInstanceOwners(); } catch (Throwable t) { err.emit(t); return new ArrayList(); } }
1,119,923
private Collection getSponsorCollection(int kind) { try { if (kind == publicEntity) { return calsvci.getPublicSponsors(); } if (kind == ownersEntity) { return calsvci.getSponsors(); } if (kind == editableEntity) { return calsvci.getEditableSponsors(); } // Won't need this with 1.5 throw new Exception("Software error - bad kind " + kind); } catch (Throwable t) { if (debug) { t.printStackTrace(); } err.emit(t); return new Vector(); } }
private Collection getSponsorCollection(int kind) { try { if (kind == publicEntity) { return calsvci.getPublicSponsors(); } if (kind == ownersEntity) { return calsvci.getSponsors(); } if (kind == editableEntity) { return calsvci.getEditableSponsors(); } // Won't need this with 1.5 throw new Exception("Software error - bad kind " + kind); } catch (Throwable t) { if (debug) { t.printStackTrace(); } err.emit(t); return new ArrayList(); } }
1,119,924
public Collection getSubscriptions() { if (subscriptions == null) { subscriptions = new Vector(); } return subscriptions; }
public Collection getSubscriptions() { if (subscriptions == null) { subscriptions = new ArrayList(); } return subscriptions; }
1,119,925
public Collection getSysStats() { if (sysStats == null) { sysStats = new Vector(); } return sysStats; }
public Collection getSysStats() { if (sysStats == null) { sysStats = new ArrayList(); } return sysStats; }
1,119,926
public static void gotoDateView(BwCalAbstractAction action, BwActionForm form, String date, int newViewTypeI, boolean debug) throws Throwable { /* We get a new view if either the date changed or the view changed. */ boolean newView = false; if (debug) { action.logIt("ViewTypeI=" + newViewTypeI); } MyCalendarVO dt; TimeView tv = form.getCurTimeView(); if (newViewTypeI == BedeworkDefs.todayView) { // dt = new MyCalendarVO(new Date(System.currentTimeMillis())); dt = new MyCalendarVO(); newView = true; newViewTypeI = BedeworkDefs.dayView; } else if (date == null) { if (newViewTypeI == BedeworkDefs.dayView) { // selected specific day to display from personal event entry screen. dt = new MyCalendarVO(form.getViewStartDate().getDateTime()); newView = true; } else { if (debug) { action.logIt("No date supplied: go with current date"); } // Just stay here dt = tv.getCurDay(); } } else { if (debug) { action.logIt("Date=" + date + ": go with that"); } dt = new MyCalendarVO(CalFacadeUtil.fromISODate(date)); newView = true; } if ((newViewTypeI >= 0) && (newViewTypeI != form.getCurViewPeriod())) { // Change of view newView = true; } if (newView && (newViewTypeI < 0)) { newViewTypeI = form.getCurViewPeriod(); if (newViewTypeI < 0) { newViewTypeI = BedeworkDefs.defaultView; } } TimeDateComponents viewStart = form.getViewStartDate(); if (!newView) { /* See if we were given an explicit date as view start date components. If so we'll set a new view of the same period as the current. */ String vsdate = viewStart.getDateTime().getDate().substring(0, 8); if (!(vsdate.equals(form.getCurTimeView().getFirstDay().getDateDigits()))) { newView = true; newViewTypeI = form.getCurViewPeriod(); dt = new MyCalendarVO(CalFacadeUtil.fromISODate(vsdate)); } } if (newView) { form.setCurViewPeriod(newViewTypeI); form.setViewMcDate(dt); form.refreshIsNeeded(); } tv = form.getCurTimeView(); // dt = tv.getCurDay(); /** Set first day, month and year */ MyCalendarVO firstDay = tv.getFirstDay(); viewStart.setDay(firstDay.getTwoDigitDay()); viewStart.setMonth(firstDay.getTwoDigitMonth()); viewStart.setYear(firstDay.getFourDigitYear()); form.getEventStartDate().setDateTime(tv.getCurDay().getTime()); form.getEventEndDate().setDateTime(tv.getCurDay().getTime()); }
public static void gotoDateView(BwCalAbstractAction action, BwActionForm form, String date, int newViewTypeI, boolean debug) throws Throwable { /* We get a new view if either the date changed or the view changed. */ boolean newView = false; if (debug) { action.logIt("ViewTypeI=" + newViewTypeI); } MyCalendarVO dt; TimeView tv = form.getCurTimeView(); if (newViewTypeI == BedeworkDefs.todayView) { // dt = new MyCalendarVO(new Date(System.currentTimeMillis())); dt = new MyCalendarVO(); newView = true; newViewTypeI = BedeworkDefs.dayView; } else if (date == null) { if (newViewTypeI == BedeworkDefs.dayView) { // selected specific day to display from personal event entry screen. dt = new MyCalendarVO(form.getViewStartDate().getDateTime()); newView = true; } else { if (debug) { action.logIt("No date supplied: go with current date"); } // Just stay here dt = tv.getCurDay(); } } else { if (debug) { action.logIt("Date=" + date + ": go with that"); } dt = new MyCalendarVO(CalFacadeUtil.fromISODate(date)); newView = true; } if ((newViewTypeI >= 0) && (newViewTypeI != form.getCurViewPeriod())) { // Change of view newView = true; } if (newView && (newViewTypeI < 0)) { newViewTypeI = form.getCurViewPeriod(); if (newViewTypeI < 0) { newViewTypeI = BedeworkDefs.defaultView; } } TimeDateComponents viewStart = form.getViewStartDate(); if (!newView) { /* See if we were given an explicit date as view start date components. If so we'll set a new view of the same period as the current. */ String vsdate = viewStart.getDateTime().getDtval().substring(0, 8); if (debug) { action.logIt("vsdate=" + vsdate); } if (!(vsdate.equals(form.getCurTimeView().getFirstDay().getDateDigits()))) { newView = true; newViewTypeI = form.getCurViewPeriod(); dt = new MyCalendarVO(CalFacadeUtil.fromISODate(vsdate)); } } if (newView) { form.setCurViewPeriod(newViewTypeI); form.setViewMcDate(dt); form.refreshIsNeeded(); } tv = form.getCurTimeView(); // dt = tv.getCurDay(); /** Set first day, month and year */ MyCalendarVO firstDay = tv.getFirstDay(); viewStart.setDay(firstDay.getTwoDigitDay()); viewStart.setMonth(firstDay.getTwoDigitMonth()); viewStart.setYear(firstDay.getFourDigitYear()); form.getEventStartDate().setDateTime(tv.getCurDay().getTime()); form.getEventEndDate().setDateTime(tv.getCurDay().getTime()); }
1,119,927
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "notFound"; } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; BwCalSuite calSuite = null; EventInfo ei = null; BwEvent ev = null; String rpar = getReqPar(request, "guid"); String calPath = getReqPar(request, "calPath"); if (rpar != null) { // Assume event ei = findEvent(request, form); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchevent"); return "doNothing"; } ev = ei.getEvent(); } else if (calPath != null) { // calendar cal = svci.getCalendar(calPath); if (cal == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", calPath); return "notFound"; } } else { String calSuiteName = getReqPar(request, "calSuite"); if (calSuiteName == null) { // bogus request return "notFound"; } calSuite = svci.getCalSuite(calSuiteName); if (calSuite == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendarsuite", calSuite); return "notFound"; } } String whoTypeStr = request.getParameter("whoType"); int whoType = -1; if (whoTypeStr == null) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("owner")) { whoType = Ace.whoTypeOwner; } else if (whoTypeStr.equals("user")) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("group")) { whoType = Ace.whoTypeGroup; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else if (whoTypeStr.equals("unauth")) { whoType = Ace.whoTypeUnauthenticated; } else if (whoTypeStr.equals("other")) { whoType = Ace.whoTypeOther; } else { form.getErr().emit("org.bedework.client.error.badwhotype"); return "error"; } String who = request.getParameter("who"); if (who != null) { BwUser user = svci.findUser(who); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { who = null; } ArrayList aces = new ArrayList(); String how = getReqPar(request, "how"); if (how == null) { form.getErr().emit("org.bedework.client.error.nohowaccess"); return "error"; } char[] howchs = how.toCharArray(); for (int hi = 0; hi < howchs.length; hi++) { char howch = howchs[hi]; boolean found = false; for (int pi = 0; pi <= PrivilegeDefs.privMaxType; pi++) { if (howch == PrivilegeDefs.privEncoding[pi]) { aces.add(new Ace(who, false, whoType, Privileges.makePriv(pi))); found = true; break; } } if (!found) { form.getErr().emit("org.bedework.client.error.badhow"); return "error"; } } if (ev != null) { svci.changeAccess(ev, aces); //svci.updateEvent(ev); } else if (calSuite != null) { svci.changeAccess(calSuite, aces); } else { svci.changeAccess(cal, aces); //svci.updateCalendar(cal); } return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "notFound"; } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; BwCalSuite calSuite = null; EventInfo ei = null; BwEvent ev = null; String rpar = getReqPar(request, "guid"); String calPath = getReqPar(request, "calPath"); if (rpar != null) { // Assume event ei = findEvent(request, form); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchevent"); return "doNothing"; } ev = ei.getEvent(); } else if (calPath != null) { // calendar cal = svci.getCalendar(calPath); if (cal == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", calPath); return "notFound"; } } else { String calSuiteName = getReqPar(request, "calSuiteName"); if (calSuiteName == null) { // bogus request return "notFound"; } calSuite = svci.getCalSuite(calSuiteName); if (calSuite == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendarsuite", calSuite); return "notFound"; } } String whoTypeStr = request.getParameter("whoType"); int whoType = -1; if (whoTypeStr == null) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("owner")) { whoType = Ace.whoTypeOwner; } else if (whoTypeStr.equals("user")) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("group")) { whoType = Ace.whoTypeGroup; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else if (whoTypeStr.equals("unauth")) { whoType = Ace.whoTypeUnauthenticated; } else if (whoTypeStr.equals("other")) { whoType = Ace.whoTypeOther; } else { form.getErr().emit("org.bedework.client.error.badwhotype"); return "error"; } String who = request.getParameter("who"); if (who != null) { BwUser user = svci.findUser(who); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { who = null; } ArrayList aces = new ArrayList(); String how = getReqPar(request, "how"); if (how == null) { form.getErr().emit("org.bedework.client.error.nohowaccess"); return "error"; } char[] howchs = how.toCharArray(); for (int hi = 0; hi < howchs.length; hi++) { char howch = howchs[hi]; boolean found = false; for (int pi = 0; pi <= PrivilegeDefs.privMaxType; pi++) { if (howch == PrivilegeDefs.privEncoding[pi]) { aces.add(new Ace(who, false, whoType, Privileges.makePriv(pi))); found = true; break; } } if (!found) { form.getErr().emit("org.bedework.client.error.badhow"); return "error"; } } if (ev != null) { svci.changeAccess(ev, aces); //svci.updateEvent(ev); } else if (calSuite != null) { svci.changeAccess(calSuite, aces); } else { svci.changeAccess(cal, aces); //svci.updateCalendar(cal); } return "success"; }
1,119,928
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); FontMetrics fm = copy.getFontMetrics(); copy.drawString(title, left+(width-left - right - fm.stringWidth(title))/2, (top+fm.getAscent())/2); } finally { copy.dispose(); } } }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); FontMetrics fm = copy.getFontMetrics(); copy.drawString(title, left+(width-left - right - fm.stringWidth(title))/2, (top+fm.getAscent())/2); } finally { copy.dispose(); } } }
1,119,929
private double getNewAngle(final IdeaView parentView, final IdeaView previousView, final IdeaView view, final IdeaView nextView) { final List<IdeaView> views = parentView.getSubViews(); final double v = view.getV(); double minDiffAngle = Math.PI / 2 / views.size(); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } } } else { double previousAngle = -Math.PI; if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } } } else { double nextAngle = Math.PI; if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } } } return newAngle; }
private double getNewAngle(final IdeaView parentView, final IdeaView previousView, final IdeaView view, final IdeaView nextView) { final List<IdeaView> views = parentView.getSubViews(); final double v = view.getV(); double minDiffAngle = Math.PI / 2 / views.size(); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } } } else { double previousAngle = -Math.PI; if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } } } else { double nextAngle = Math.PI; if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } } } return newAngle; }
1,119,930
private double getNewAngle(final IdeaView parentView, final IdeaView previousView, final IdeaView view, final IdeaView nextView) { final List<IdeaView> views = parentView.getSubViews(); final double v = view.getV(); double minDiffAngle = Math.PI / 2 / views.size(); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } } } else { double previousAngle = -Math.PI; if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } } } else { double nextAngle = Math.PI; if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } } } return newAngle; }
private double getNewAngle(final IdeaView parentView, final IdeaView previousView, final IdeaView view, final IdeaView nextView) { final List<IdeaView> views = parentView.getSubViews(); final double v = view.getV(); double minDiffAngle = Math.PI / 2 / views.size(); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } } } else { double previousAngle = -Math.PI; if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } } } else { double nextAngle = Math.PI; if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } } } return newAngle; }
1,119,931
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(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; //System.out.println("**********************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 == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seis.setAttributes(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); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != 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; }
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(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; //System.out.println("**********************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 == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seis.setAttributes(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); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != 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; }
1,119,932
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(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; //System.out.println("**********************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 == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seis.setAttributes(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); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != 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; }
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(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; //System.out.println("**********************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 == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { SeismogramAttr seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); logger.debug("The &&&&&&&&&&&&&&&&&&& chan_cdoe from dsml file is "+ ((SeismogramAttrImpl)seisAttr).getChannelID().channel_code); seis.setAttributes(seisAttr); logger.debug("The &&&&&&&&&&&&&&&&&&& chan_code after setting is "+ seis.getChannelID().channel_code); } 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); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != 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; }
1,119,933
public void dumpSection(Iterator it) throws Throwable { boolean taggedStart = false; boolean annotations = false; while (it.hasNext()) { BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); } if (annotations) { tagEnd(sectionEventAnnotations); } else { tagEnd(sectionEvents); } }
public void dumpSection(Iterator it) throws Throwable { boolean taggedStart = false; boolean annotations = false; while (it.hasNext()) { BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); } if (annotations) { tagEnd(sectionEventAnnotations); } else { tagEnd(sectionEvents); } }
1,119,934
public void dumpSection(Iterator it) throws Throwable { boolean taggedStart = false; boolean annotations = false; while (it.hasNext()) { BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); } if (annotations) { tagEnd(sectionEventAnnotations); } else { tagEnd(sectionEvents); } }
public void dumpSection(Iterator it) throws Throwable { boolean taggedStart = false; boolean annotations = false; while (it.hasNext()) { BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); } if (annotations) { tagEnd(sectionEventAnnotations); } else { tagEnd(sectionEvents); } }
1,119,935
public static void main(String[] args) throws SQLException, IOException { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCStation jdbcStation = new JDBCStation(conn); boolean verbose = false; for(int i = 1; i < args.length; i++) { if(args[i].equals("-h")) { printHelp(); } } for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; System.out.println(); System.out.println("/---------------Station Code Updater---"); System.out.println(); System.out.println("Verbose messages: ON"); } } for(int i = 1; i < args.length - 1; i++) { if(verbose) { if(args[i].equals("-props")) { String propFileLocation = args[i + 1]; File file = new File(propFileLocation); System.out.println("Properties file location: " + file.getCanonicalPath()); } } } if(verbose) { System.out.println(); System.out.println("\\------------------------------------"); } if(args.length > 0) { String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } } }
public static void main(String[] args) throws SQLException, IOException { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); boolean verbose = false; for(int i = 1; i < args.length; i++) { if(args[i].equals("-h")) { printHelp(); } } for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; System.out.println(); System.out.println("/---------------Station Code Updater---"); System.out.println(); System.out.println("Verbose messages: ON"); } } for(int i = 1; i < args.length - 1; i++) { if(verbose) { if(args[i].equals("-props")) { String propFileLocation = args[i + 1]; File file = new File(propFileLocation); System.out.println("Properties file location: " + file.getCanonicalPath()); } } } if(verbose) { System.out.println(); System.out.println("\\------------------------------------"); } if(args.length > 0) { String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } } }
1,119,936
public static void main(String[] args) throws SQLException, IOException { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCStation jdbcStation = new JDBCStation(conn); boolean verbose = false; for(int i = 1; i < args.length; i++) { if(args[i].equals("-h")) { printHelp(); } } for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; System.out.println(); System.out.println("/---------------Station Code Updater---"); System.out.println(); System.out.println("Verbose messages: ON"); } } for(int i = 1; i < args.length - 1; i++) { if(verbose) { if(args[i].equals("-props")) { String propFileLocation = args[i + 1]; File file = new File(propFileLocation); System.out.println("Properties file location: " + file.getCanonicalPath()); } } } if(verbose) { System.out.println(); System.out.println("\\------------------------------------"); } if(args.length > 0) { String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } } }
public static void main(String[] args) throws SQLException, IOException { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCStation jdbcStation = new JDBCStation(conn); boolean verbose = false; for(int i = 1; i < args.length; i++) { if(args[i].equals("-h")) { printHelp(); } } for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; System.out.println(); System.out.println("/---------------Station Code Updater---"); System.out.println(); System.out.println("Verbose messages: ON"); } } for(int i = 1; i < args.length - 1; i++) { if(verbose) { if(args[i].equals("-props")) { String propFileLocation = args[i + 1]; File file = new File(propFileLocation); System.out.println("Properties file location: " + file.getCanonicalPath()); } } } if(verbose) { System.out.println(); System.out.println("\\------------------------------------"); } if(args.length > 0) { String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } } }
1,119,937
public int doStartTag() throws JspException { if (!PortletServlet.isPortletRequest(pageContext.getRequest())) { return super.doStartTag(); } String urlStr = null; BodyContent bodyContent = pageContext.pushBody(); try { super.doStartTag(); URL url = new URL(bodyContent.getString()); String path = url.getPath(); if (path.endsWith(".rdo")) { setRenderURL("true"); } else if (path.endsWith(".rdo")) { setActionURL("true"); } /* We want a context relative url */ urlStr = url.getFile(); //System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + 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("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr); } catch (MalformedURLException mue) { throw new JspException(mue); } finally { pageContext.popBody(); } TagUtils.getInstance().write(pageContext, urlStr); return (SKIP_BODY); }
public int doStartTag() throws JspException { if (!PortletServlet.isPortletRequest(pageContext.getRequest())) { return super.doStartTag(); } String urlStr = null; BodyContent bodyContent = pageContext.pushBody(); try { super.doStartTag(); URL url = new URL(bodyContent.getString()); 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("RRRRRRRRRRRRRRRRRUrlStr = " + 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("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr); } catch (MalformedURLException mue) { throw new JspException(mue); } finally { pageContext.popBody(); } TagUtils.getInstance().write(pageContext, urlStr); return (SKIP_BODY); }
1,119,938
private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = new String[1]; extensions[0] = "pdf"; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("SAVE as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; }
private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = new String[1]; extensions[0] = "pdf"; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("SAVE as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; }
1,119,939