rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
comp.update(file, false); | if (comp != null) { comp.update(file, false); } | public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } |
URL dirURL = new URL(base, directory.getName()); | URL dirURL = new URL(base, directory.getName()+"/"); | void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); dataset = new XMLDataSet(docBuilder, base, "genid"+Math.round(Math.random()*Integer.MAX_VALUE), dsName, userName); Iterator it = paramRefs.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName, "Added parameter "+key); try { URL dirURL = new URL(base, directory.getName()); dataset.addParameterRef(new URL(dirURL, (String)paramRefs.get(key)), key, audit); } catch (MalformedURLException e) { //can't happen? e.printStackTrace(); System.err.println("Caught exception on parameterRef " +key+", continuing..."); } // end of try-catch } // end of while (it.hasNext()) File[] sacFiles = directory.listFiles(); //SacTimeSeries sac = new SacTimeSeries(); for (int i=0; i<sacFiles.length; i++) { if (excludes.contains(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) if (paramRefs.containsValue(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) try { //sac.read(sacFiles[i].getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from sacFiles[i].getCanonicalPath()"); URL seisURL = new URL(base, sacFiles[i].getName()); dataset.addSeismogramRef(seisURL, sacFiles[i].getName(), new Property[0], new ParameterRef[0], audit); } catch (Exception e) { e.printStackTrace(); System.err.println("Caught exception on " +sacFiles[i].getName()+", continuing..."); } // end of try-catch } // end of for (int i=0; i<sacFiles.length; i++) } |
System.out.println("returning true"); | public boolean isSelectionSelected(int currx, int curry) { if( (currx > (endx - 10) && currx < (endx + 10) && curry >= beginy && curry <= endy) || (currx > (beginx - 10) && currx < (beginx + 10) && curry >= beginy && curry <= endy) ) { System.out.println("returning true"); return true; } System.out.println("return false"); return false; } |
|
System.out.println("return false"); | public boolean isSelectionSelected(int currx, int curry) { if( (currx > (endx - 10) && currx < (endx + 10) && curry >= beginy && curry <= endy) || (currx > (beginx - 10) && currx < (beginx + 10) && curry >= beginy && curry <= endy) ) { System.out.println("returning true"); return true; } System.out.println("return false"); return false; } |
|
form.initFields(); form.setEvent(null); | initFields(form); | public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(false); form.assignAddingEvent(true); form.resetEvent(); return "continue"; } |
form.resetEvent(); | public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(false); form.assignAddingEvent(true); form.resetEvent(); return "continue"; } |
|
*/ | public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /* Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } Groups adgrps = form.fetchSvci().getGroups(); form.assignChoosingGroup(false); // reset boolean add = form.getAddingAdmingroup(); BwAdminGroup updgrp = form.getUpdAdminGroup(); if (updgrp == null) { // That's not right return "done"; } CalSvcI svci = form.fetchSvci(); if (request.getParameter("addGroupMember") != null) { /** Add a user to the group we are updating. */ String mbr = form.getUpdGroupMember(); if (mbr != null) { BwUser u = svci.findUser(mbr); if (u == null) { u = new BwUser(mbr); svci.addUser(u); u = svci.findUser(mbr); } /* Ensure the authorised user exists - create an entry if not * * @param val BwUser account */ UserAuth uauth = svci.getUserAuth(); BwAuthUser au = uauth.getUser(u.getAccount()); if ((au != null) && (au.getUsertype() == UserAuth.noPrivileges)) { return "notAllowed"; } if (au == null) { au = new BwAuthUser(u, UserAuth.publicEventUser); uauth.updateUser(au); } adgrps.addMember(updgrp, u); } } else if (request.getParameter("removeGroupMember") != null) { /** Remove a user from the group we are updating. */ String mbr = form.getUpdGroupMember(); if (mbr != null) { BwUser u = form.fetchSvci().findUser(mbr); if (u != null) { adgrps.removeMember(updgrp, u); } } } else if (add) { if (!validateNewAdminGroup(form)) { return "retry"; } adgrps.addGroup(updgrp); } else { if (!validateAdminGroup(form)) { return "retry"; } if (debug) { debugMsg("About to update " + updgrp); } adgrps.updateGroup(updgrp); } /** Refetch the group */ updgrp = (BwAdminGroup)adgrps.findGroup(updgrp.getAccount()); adgrps.getMembers(updgrp); form.setUpdAdminGroup(updgrp); form.getMsg().emit("org.bedework.client.message.admingroup.updated"); return "continue"; } |
|
str = getReqPar(request, "email"); if (str != null) { prefs.setEmail(str); } | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); BwPreferences prefs; /* Refetch the prefs */ if (getPublicAdmin(form)) { /* Fetch a given users preferences */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; // First line of defence } BwUser user = findUser(request, form); if (user == null) { return "notFound"; } prefs = svc.getUserPrefs(user); } else { prefs = svc.getUserPrefs(); } String str = getReqPar(request, "preferredView"); if (str != null) { if (svc.findView(str) == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", str); return "notFound"; } prefs.setPreferredView(str); } str = getReqPar(request, "viewPeriod"); if (str != null) { prefs.setPreferredViewPeriod(form.validViewPeriod(str)); } str = getReqPar(request, "skin"); if (str != null) { prefs.setSkinName(str); } str = getReqPar(request, "skinStyle"); if (str != null) { prefs.setSkinStyle(str); } svc.updateUserPrefs(prefs); form.getMsg().emit("org.bedework.client.message.prefs.updated"); return "success"; } |
|
JTextPane pane = new JTextPane(doc); | public Console() { final PrintStream oldOut = System.out; final PrintStream oldErr = System.err; final SimpleAttributeSet attr = new SimpleAttributeSet(); final DefaultStyledDocument doc = new DefaultStyledDocument(); StyleConstants.setFontFamily(attr, "Monospaced"); PrintStream newOut = new PrintStream(new OutputStream() { public void write(int i) throws IOException { oldOut.write(i); try { StyleConstants.setForeground(attr, Color.BLACK); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } }); System.setOut(newOut); PrintStream newErr = new PrintStream(new OutputStream() { public void write(int i) throws IOException { oldErr.write(i); try { StyleConstants.setForeground(attr, Color.RED); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } }); System.setErr(newErr); JTextPane pane = new JTextPane(doc); pane.setEditable(false); RightClickMenu.addRightClickMenu(pane); setLayout(new BorderLayout()); setBorder(new TitledBorder("Console")); add(new JScrollPane(pane)); } |
|
pane.setCaretPosition(doc.getLength()); | public void write(int i) throws IOException { oldOut.write(i); try { StyleConstants.setForeground(attr, Color.BLACK); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } |
|
pane.setCaretPosition(doc.getLength()); | public void write(int i) throws IOException { oldErr.write(i); try { StyleConstants.setForeground(attr, Color.RED); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } |
|
testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); | testScope.meta_defineField(AGSymbol.jAlloc("symbol"), symbol); | public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); } |
AGSymbol.alloc("echo:"), | AGSymbol.jAlloc("echo:"), | public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); } |
AGSymbol.alloc("doesNotUnderstandX"), | AGSymbol.jAlloc("doesNotUnderstandX"), | public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); } |
AGSymbol.alloc("nativeException"), | AGSymbol.jAlloc("nativeException"), | public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); } |
AGSymbol.alloc("echo:"), | AGSymbol.jAlloc("echo:"), | public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } } |
AGSymbol.alloc("doesNotUnderstandX"), | AGSymbol.jAlloc("doesNotUnderstandX"), | public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } } |
AGSymbol.alloc("nativeException"), | AGSymbol.jAlloc("nativeException"), | public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } } |
if (globals.inOwnerKey) { return; } | public void end(String ns, String name) throws Exception { field(name); } |
|
return true; } if (name.equals("owner-key")) { | protected boolean ownedEntityTags(BwOwnedDbentity entity, String name) throws Exception { if (taggedEntityId(entity, name)) { return true; } if (name.equals("owner")) { entity.setOwner(userFld()); return true; } if (name.equals("public")) { entity.setPublick(booleanFld()); return true; } return false; } |
|
sorter = new SeismogramSorter(); | sorter = new AlphaSeisSorter(); | public VerticalSeismogramDisplay(MouseForwarder mouseForwarder, MouseMotionForwarder motionForwarder){ this.mouseForwarder = mouseForwarder; this.motionForwarder = motionForwarder; seismograms = new JLayeredPane(); seismograms.setLayout(new BoxLayout(seismograms, BoxLayout.Y_AXIS)); this.getViewport().add(seismograms); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); sorter = new SeismogramSorter(); } |
}} | creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, first.getName() + " " + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } selectionWindow.getContentPane().add(selectionDisplay); Toolkit tk = Toolkit.getDefaultToolkit(); selectionWindow.setLocation(tk.getScreenSize().width, tk.getScreenSize().height); selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getCurrentSelection().getInternalConfig(); LocalSeismogramImpl first = ((LocalSeismogramImpl)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig(first, tr.getTimeRange((LocalSeismogram)first))); ar.visibleAmpCalc(tr); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, first.getName() + " " + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } } } | public void createSelectionDisplay(BasicSeismogramDisplay creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder); }} |
sorter = new SeismogramSorter(); | sorter = new AlphaSeisSorter(); | public void removeAll(){ logger.debug("removing all displays"); this.stopImageCreation(); seismograms.removeAll(); remove(seismograms); basicDisplays = new LinkedList(); sorter = new SeismogramSorter(); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); repaint(); } |
clicked.remove(me); | clicked.remove(); | public void removeSeismogram(MouseEvent me){ BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); clicked.remove(me); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((SeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); } |
}else if(current.hasNewData()){ setAmpRange(current.getDSS()); changed = true; | protected AmpEvent calculateAmp(){ Iterator e = ampData.keySet().iterator(); boolean changed = false; while(e.hasNext()){ AmpConfigData current = (AmpConfigData)ampData.get(e.next()); //checks for the time update equaling the old time if(current.setTime(getTime(current.getDSS()))){ //checks if the new time changes the amp range if(setAmpRange(current.getDSS())){ // only generates a new amp event if the amp ranges change changed = true; } } } if(changed || currentAmpEvent == null){ recalculateAmp(); } return currentAmpEvent; } |
|
if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } LocalSeismogramImpl seis = (LocalSeismogramImpl)data.getSeismograms()[0]; | if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } LocalSeismogramImpl seis = data.getSeismograms()[0]; | private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } // end of if () LocalSeismogramImpl seis = (LocalSeismogramImpl)data.getSeismograms()[0]; int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[1] < 0 || seisIndex[0] >= seis.getNumPoints()) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = data.getStatistics(seis).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff; double maxToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[1]); double minToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[0]); if(maxToMeanDiff > minToMeanDiff){ meanDiff = maxToMeanDiff; }else{ meanDiff = minToMeanDiff; } data.setCalcIndex(seisIndex); double min = minMaxMean[2] - meanDiff; double max = minMaxMean[2] + meanDiff; return data.setCleanRange(new UnitRangeImpl(min, max, UnitImpl.COUNT)); } |
BwPreferences p = new BwPreferences(); | BwPreferences prefs = new BwPreferences(); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
p.setId(nextId); | prefs.setId(nextId); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
p.setOwner(o); | prefs.setOwner(o); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
addSubscription(p, globals.publicUser, cal, true); | addSubscription(prefs, globals.publicUser, cal, true); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
p.setDefaultCalendar(cal); | prefs.setDefaultCalendar(cal); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
true, true, false); | false, false, false); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
p.addSubscription(sub); | prefs.addSubscription(sub); curView = new BwView(); curView.setName(globals.syspars.getDefaultUserViewName()); curView.addSubscription(defSub); curView.setOwner(o); prefs.addView(curView); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
addSubscription(p, o, cal, true); | addSubscription(prefs, o, cal, true); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
globals.rintf.restoreUserPrefs(p); | globals.rintf.restoreUserPrefs(prefs); | private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } } |
globals.getTzcache(); | void open() throws Throwable { if (globals.rintf == null) {// globals.rintf = new JdbcRestore(); globals.rintf = new HibRestore(globals.debug); globals.rintf.init(url, driver, id, pw, globals); globals.rintf.open(); } if (globals.from2p3px) { // System prefs are set up by run time pars globals.rintf.restoreSyspars(globals.syspars); } } |
|
globals.sysparsSetDefaultUserQuota = true; | boolean processArgs(String[] args) throws Throwable { if (args == null) { return true; } for (int i = 0; i < args.length; i++) { if (args[i].equals("")) { // null arg generated by ant } else if (args[i].equals("-debug")) { globals.debug = true; } else if (args[i].equals("-ndebug")) { globals.debug = false; } else if (args[i].equals("-debugentity")) { globals.debugEntity = true; } else if (args[i].equals("-ndebugentity")) { globals.debugEntity = false; } else if (args[i].equals("-noarg")) { globals.debug = false; } else if (argpar("-supergroup", args, i)) { i++; globals.superGroupName = args[i]; } else if (argpar("-defaultpubliccal", args, i)) { i++; globals.defaultPublicCalPath = args[i]; trace("Setting null event calendars to " + args[i]); } else if (argpar("-fixOwner", args, i)) { i++; globals.fixOwnerAccount = args[i]; } else if (args[i].equals("-from2p3px")) { globals.from2p3px = true; } else if (argpar("-d", args, i)) { i++; driver = args[i]; } else if (argpar("-i", args, i)) { i++; id = args[i]; } else if (argpar("-p", args, i)) { i++; pw = args[i]; } else if (argpar("-u", args, i)) { i++; url = args[i]; } else if (argpar("-f", args, i)) { i++; fileName = args[i]; } else if (argpar("-timezones", args, i)) { i++; globals.timezonesFilename = args[i]; /* System parameters */ } else if (argpar("-sysname", args, i)) { i++; globals.syspars.setName(args[i]); } else if (argpar("-tzid", args, i)) { i++; globals.syspars.setTzid(args[i]); } else if (argpar("-sysid", args, i)) { i++; globals.syspars.setSystemid(args[i]); } else if (argpar("-publiccalroot", args, i)) { i++; globals.syspars.setPublicCalendarRoot(args[i]); } else if (argpar("-usercalroot", args, i)) { i++; globals.syspars.setUserCalendarRoot(args[i]); } else if (argpar("-defusercal", args, i)) { i++; globals.syspars.setUserDefaultCalendar(args[i]); } else if (argpar("-deftrashcal", args, i)) { i++; globals.syspars.setDefaultTrashCalendar(args[i]); } else if (argpar("-definbox", args, i)) { i++; globals.syspars.setUserInbox(args[i]); } else if (argpar("-defoutbox", args, i)) { i++; globals.syspars.setUserOutbox(args[i]); } else if (argpar("-defuview", args, i)) { i++; globals.syspars.setDefaultUserViewName(args[i]); } else if (argpar("-pu", args, i)) { i++; globals.syspars.setPublicUser(args[i]); } else if (argpar("-dirbrowsing-disallowed", args, i)) { i++; globals.syspars.setDirectoryBrowsingDisallowed("true".equals(args[i])); } else if (argpar("-httpconnsperuser", args, i)) { i++; globals.syspars.setHttpConnectionsPerUser(intPar(args[i])); } else if (argpar("-httpconnsperhost", args, i)) { i++; globals.syspars.setHttpConnectionsPerHost(intPar(args[i])); } else if (argpar("-httpconns", args, i)) { i++; globals.syspars.setHttpConnections(intPar(args[i])); } else if (argpar("-defuquota", args, i)) { i++; globals.syspars.setDefaultUserQuota(longPar(args[i])); } else if (argpar("-userauthClass", args, i)) { i++; globals.syspars.setUserauthClass(args[i]); } else if (argpar("-mailerClass", args, i)) { i++; globals.syspars.setMailerClass(args[i]); } else if (argpar("-admingroupsClass", args, i)) { i++; globals.syspars.setAdmingroupsClass(args[i]); } else if (argpar("-usergroupsClass", args, i)) { i++; globals.syspars.setUsergroupsClass(args[i]); } else { error("Illegal argument: '" + args[i] + "'"); usage(); return false; } } return true; } |
|
LinkedList staList = (LinkedList)stationMap.get(selected[i]); out.addAll(staList); | LinkedList staList = (LinkedList)stationMap.get(((Station)selected[i]).name); out.addAll(staList); | public Station[] getSelectedStations(){ LinkedList out = new LinkedList(); Object[] selected = stationList.getSelectedValues(); for ( int i=0; i<selected.length; i++) { LinkedList staList = (LinkedList)stationMap.get(selected[i]); out.addAll(staList); } // end of for () return (Station[])out.toArray(new Station[0]); } |
int index0 = index - 5; int index1 = index + 5; | int max = list.getLastVisibleIndex() - list.getFirstVisibleIndex(); int index0 = index - max / 3; int index1 = index + max / 3; | private void scrollToPlayingFile() { File file = playlist.getPlayingFile(); DefaultListModel listModel = playlist.getListModel(); if (file == null || listModel == null) { return; } int index = listModel.indexOf(file); if (index != -1) { int index0 = index - 5; int index1 = index + 5; while (index0 < 0) { index0++; } while (index1 >= playlist.size()) { index1--; } Rectangle r = list.getCellBounds(index0, index1); list.scrollRectToVisible(r); list.repaint(); } } |
Rectangle r = list.getCellBounds(index0, index1); | Point p0 = indexToLocation(index0); Point p1 = indexToLocation(index1); int x = p0.x; int y = p0.y; int width = p1.x - x; int height = p1.y - y; Rectangle r = new Rectangle(x, y, width, height); | private void scrollToPlayingFile() { File file = playlist.getPlayingFile(); DefaultListModel listModel = playlist.getListModel(); if (file == null || listModel == null) { return; } int index = listModel.indexOf(file); if (index != -1) { int index0 = index - 5; int index1 = index + 5; while (index0 < 0) { index0++; } while (index1 >= playlist.size()) { index1--; } Rectangle r = list.getCellBounds(index0, index1); list.scrollRectToVisible(r); list.repaint(); } } |
CalSvcI svc = form.fetchSvci(); | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); form.setSubscriptions(svc.getSubscriptions()); return "success"; } |
|
form.setSubscriptions(svc.getSubscriptions()); | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); form.setSubscriptions(svc.getSubscriptions()); return "success"; } |
|
public boolean checkRead(AccessPrincipal who, String owner, char[] aclChars) | public CurrentAccess checkRead(AccessPrincipal who, String owner, char[] aclChars) | public boolean checkRead(AccessPrincipal who, String owner, char[] aclChars) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, privSetRead, aclChars); } |
public boolean checkReadWrite(AccessPrincipal who, String owner, char[] aclChars) | public CurrentAccess checkReadWrite(AccessPrincipal who, String owner, char[] aclChars) | public boolean checkReadWrite(AccessPrincipal who, String owner, char[] aclChars) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, privSetReadWrite, aclChars); } |
public boolean evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, String aclString) | public CurrentAccess evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, String aclString) | public boolean evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, String aclString) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, how, aclString.toCharArray()); } |
if (netdcgiven.length == 1 || ! showNetworks) { | if ( ! showNetworks) { | public void setNetworkDCs(NetworkDCOperations[] netdcgiven) { netdc = netdcgiven; channels.clear(); sites.clear(); clearStations(); networks.clear(); for (int i=0; i<netdcgiven.length; i++) { NetworkLoader networkLoader = new NetworkLoader(netdcgiven[i]); if (netdcgiven.length == 1 || ! showNetworks) { networkLoader.setDoSelect(true); } else { networkLoader.setDoSelect(false); } // end of else networkLoader.start(); } // end of for (int i=0; i<netdcgiven.length; i++) } |
int pixelIndex = 0; | public static int[][] compressXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, Dimension size) throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; } |
|
out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); | out[1][numAdded+1] = getMaxValue(tempYvalues, 0, j-1); | public static int[][] compressXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, Dimension size) throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; } |
LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; | protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; /*double pointsPerPixel = tr.getInterval().divideBy(seis.getSampling().getPeriod()).getValue() / size.width; if(pointsPerPixel < 3 ){ return getPlottableSimpl(seis, ampRange, tr, size); }else{*/ int[][] uncomp = compressXvalues(seismogram, tr, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][2 * size.width]; int j = 0, startIndex = 0, xvalue = 0, endIndex = 0; if(uncomp[0].length != 0) xvalue = uncomp[0][0]; for(int i = 0; i < uncomp[0].length; i++) { if(uncomp[0][i] != xvalue) { endIndex = i - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; j = j + 2; startIndex = endIndex + 1; xvalue = uncomp[0][i]; } } if(xvalue != 0) { startIndex = uncomp[0].length - 1; endIndex = uncomp[0].length - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; j = j + 2; } int temp[][] = new int[2][j]; System.arraycopy(comp[0], 0, temp[0], 0, j); System.arraycopy(comp[1], 0, temp[1], 0, j); return temp; } |
|
comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); | comp[1][j+1] = getMaxValue(uncomp[1], startIndex, endIndex); | protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; /*double pointsPerPixel = tr.getInterval().divideBy(seis.getSampling().getPeriod()).getValue() / size.width; if(pointsPerPixel < 3 ){ return getPlottableSimpl(seis, ampRange, tr, size); }else{*/ int[][] uncomp = compressXvalues(seismogram, tr, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][2 * size.width]; int j = 0, startIndex = 0, xvalue = 0, endIndex = 0; if(uncomp[0].length != 0) xvalue = uncomp[0][0]; for(int i = 0; i < uncomp[0].length; i++) { if(uncomp[0][i] != xvalue) { endIndex = i - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; j = j + 2; startIndex = endIndex + 1; xvalue = uncomp[0][i]; } } if(xvalue != 0) { startIndex = uncomp[0].length - 1; endIndex = uncomp[0].length - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; j = j + 2; } int temp[][] = new int[2][j]; System.arraycopy(comp[0], 0, temp[0], 0, j); System.arraycopy(comp[1], 0, temp[1], 0, j); return temp; } |
double tmpDouble; | public static LocalSeismogramImpl createCustomSineWave(){ int[] dataBits = new int[1200]; double tmpDouble; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(0 + i*Math.PI*1/20.0)*1000); } return createTestData("Sine Wave", dataBits, new edu.iris.Fissures.Time("19911015T163000.000Z", -1)); } |
|
double tmpDouble; | public static LocalSeismogramImpl createHighSineWave(double phase, double hertz) { int[] dataBits = new int[120]; double tmpDouble; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(phase + i*Math.PI*hertz/20.0)*1000.0+500); } return createTestData("Sine Wave, phase "+phase+" hertz "+hertz, dataBits); } |
|
double tmpDouble; | public static LocalSeismogramImpl createLowSineWave(double phase, double hertz) { int[] dataBits = new int[120]; double tmpDouble; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(phase + i*Math.PI*hertz/20.0)*1000.0-500); } return createTestData("Sine Wave, phase "+phase+" hertz "+hertz, dataBits); } |
|
LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; | protected static void scaleYvalues(int[][] comp, LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size) { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); for( int i =0 ; i < comp[1].length; i++) { comp[1][i] = Math.round((float)(linearInterp(yMin, 0, yMax, size.height, comp[1][i]))); } } |
|
styles.add(NotationFactory.eINSTANCE.createDrawerStyle()); | protected List createStyles(View view) { List styles = new ArrayList(); styles.add(NotationFactory.eINSTANCE.createDrawerStyle()); styles.add(NotationFactory.eINSTANCE.createSortingStyle()); styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); return styles; } |
|
creator.getInternalRegistrar().shaleTime(0, 1); | private void addGroupedSelection(Selection creator, VerticalSeismogramDisplay reaper){ DataSetSeismogram[] creatorSeismos = creator.getSeismograms(); DataSetSeismogram[][] componentSorted = DisplayUtils.getComponents(creatorSeismos); Arrival[] parentArrivals = creator.getParent().getArrivals(); for(int i = 0; i < componentSorted.length; i++){ if(componentSorted[i].length > 0){ ((TimeConfig)creator.getInternalRegistrar()).add(componentSorted[i]); BasicSeismogramDisplay newDisplay = threeSelectionDisplay.addDisplay(componentSorted[i], (TimeConfig)creator.getInternalRegistrar()); creator.addDisplay(newDisplay); if(parentArrivals != null){ newDisplay.addFlags(parentArrivals); } } } Iterator g = basicDisplays.iterator(); while(g.hasNext()){ BasicSeismogramDisplay current = ((BasicSeismogramDisplay)g.next()); DataSetSeismogram[] basicDisplaySeismos = current.getSeismograms(); for(int i = 0; i < componentSorted.length; i++){ for(int j = 0; j < basicDisplaySeismos.length; j++){ for(int k = 0; k < componentSorted[i].length; k++){ if(componentSorted[i][k].equals(basicDisplaySeismos[j])) { current.addSelection(creator); creator.addParent(current); } } } } } //makes amp scale correctly.... pick displays show up with an unexpanded amplitude. //remove when the real bug causing the amplitude not to scale when created is fixed //creator.getInternalRegistrar().shaleTime(0, 1); } |
|
creator.getInternalRegistrar().shaleTime(0, 1); | private void addSelection(Selection creator, VerticalSeismogramDisplay reaper){ DataSetSeismogram[] creatorSeismos = creator.getSeismograms(); DataSetSeismogram[] newSeismos = new DataSetSeismogram[creatorSeismos.length]; for(int i = 0; i < creatorSeismos.length; i++){ // newSeismos[i] = new DataSetSeismogram(creatorSeismos[i], creatorSeismos[i] + "." + creator.getColor()); newSeismos[i] = (DataSetSeismogram)creatorSeismos[i].clone(); newSeismos[i].setName(newSeismos[i].getName()+"."+creator.getColor()); } BasicSeismogramDisplay selectionDisplay = reaper.addDisplay(newSeismos, (TimeConfig)creator.getInternalRegistrar()); creator.addDisplay(selectionDisplay); //makes amp scale correctly.... pick displays show up with an unexpanded amplitude. //remove when the real bug causing the amplitude not to scale when created is fixed //creator.getInternalRegistrar().shaleTime(0, 1); Arrival[] parentArrivals = creator.getParent().getArrivals(); if(parentArrivals != null){ selectionDisplay.addFlags(parentArrivals); } } |
|
particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], | particleDisplay = new ParticleMotionDisplay(creator.getSeismograms()[0], | public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); if(particleDisplay.getInitializationStatus()){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); JPanel displayPanel = new JPanel(); /*JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut);*/ displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); //displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else{ particleDisplay = null; JOptionPane.showMessageDialog(null, "The other components weren't found to create the Particle Motion Display, so it can't be created.", "Other Components not found", JOptionPane.WARNING_MESSAGE); } }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } } |
particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], | particleDisplay.addParticleMotionDisplay(creator.getSeismograms()[0], | public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); if(particleDisplay.getInitializationStatus()){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); JPanel displayPanel = new JPanel(); /*JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut);*/ displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); //displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else{ particleDisplay = null; JOptionPane.showMessageDialog(null, "The other components weren't found to create the Particle Motion Display, so it can't be created.", "Other Components not found", JOptionPane.WARNING_MESSAGE); } }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } } |
throw new InternalServerException("Smile currently does not support environments other than Http Servlet Environment."); | throw new RuntimeException("CbpViewHandler: idegaWeb currently does not support environments other than Http Servlet Environment."); | private void initializeResponseWriter(FacesContext ctx) throws FacesException { //check if running in httpservlet environment boolean httpServletEnv = true; if (!(ctx.getExternalContext().getRequest() instanceof HttpServletRequest)) { throw new InternalServerException("Smile currently does not support environments other than Http Servlet Environment."); } HttpServletRequest request = (HttpServletRequest) ctx.getExternalContext().getRequest(); HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse(); String contextType = "text/html"; String characterEncoding = request.getCharacterEncoding(); try { ResponseWriter responseWriter = new HtmlResponseWriterImpl(response.getWriter(),contextType,characterEncoding);// ResponseWriter responseWriter = new ResponseWriterImplDecorated(response.getWriter(),contextType,characterEncoding); ctx.setResponseWriter(responseWriter); } catch (IOException e) { throw new FacesException(e.getMessage(),e); } } |
if (component instanceof Screen) { writeState(ctx); } | private void renderComponent(UIComponent component, FacesContext ctx) { try { component.encodeBegin(ctx); if(component.getRendersChildren()) { component.encodeChildren(ctx); } else { Iterator it; UIComponent currentChild; it = component.getChildren().iterator(); while(it.hasNext()) { currentChild = (UIComponent) it.next(); renderComponent(currentChild,ctx); } } if (component instanceof Screen) { writeState(ctx); } component.encodeEnd(ctx); } catch(IOException e) { log.error("Component <" + component.getId() + "> could not render ! Continuing rendering of view <" + ctx.getViewRoot().getViewId() + ">..."); } } |
|
public ParamFilter(String name, boolean isDefined) { | public ParamFilter(String name, boolean isNotDefined) { | public ParamFilter(String name, boolean isDefined) { this.name = name; this.isDefined = isDefined; } |
this.isDefined = isDefined; | this.isNotDefined = isNotDefined; | public ParamFilter(String name, boolean isDefined) { this.name = name; this.isDefined = isDefined; } |
networks.addElement(cache); | networkAdd(cache); | public void run() { setProgressOwner(this); CacheNetworkAccess cache; logger.debug("Before networks"); if(configuredNetworks == null || configuredNetworks.length == 0) { NetworkAccess[] nets = netdc.a_finder().retrieve_all(); netDCToNetMap.put(netdc, nets); setProgressMax(this, nets.length+1); int progressVal = 1; setProgressValue(this, progressVal); progressVal++; logger.debug("Got all networks, num="+nets.length); for (int i=0; i<nets.length; i++) { // skip null networks...probably a bug on the server if (nets[i] != null) { // cache = new CacheNetworkAccess(nets[i]); cache = new DNDNetworkAccess(nets[i]); NetworkAttr attr = cache.get_attributes(); netIdToNetMap.put(NetworkIdUtil.toString(cache.get_attributes().get_id()), cache); logger.debug("Got attributes "+attr.get_code()); // preload attributes networks.addElement(cache); } else { logger.warn("a networkaccess returned from NetworkFinder.retrieve_all() is null, skipping."); } // end of else setProgressValue(this, progressVal); progressVal++; } } else { //when the channelChooser is configured with networkCodes.... int totalNetworks = 0; setProgressMax(this, configuredNetworks.length); for(int counter = 0; counter < configuredNetworks.length; counter++) { try { logger.debug("Getting network for "+configuredNetworks[counter]); NetworkAccess[] nets = netdc.a_finder().retrieve_by_code(configuredNetworks[counter]); logger.debug("Got "+nets.length+" networks for "+configuredNetworks[counter]); for(int subCounter = 0; subCounter < nets.length; subCounter++) { if (nets[subCounter] != null) { // cache = new CacheNetworkAccess(nets[subCounter]); cache = new DNDNetworkAccess(nets[subCounter]); NetworkAttr attr = cache.get_attributes(); NetworkAccess[] storedNets = (NetworkAccess[])netDCToNetMap.get(netdc); if ( storedNets == null) { storedNets = new NetworkAccess[1]; storedNets[0] = cache; netDCToNetMap.put(netdc, storedNets); } else { NetworkAccess[] tmp = new NetworkAccess[storedNets.length+1]; System.arraycopy(storedNets, 0, tmp, 0, storedNets.length); tmp[storedNets.length] = cache; netDCToNetMap.put(netdc, tmp); } // end of else netIdToNetMap.put(NetworkIdUtil.toString(cache.get_attributes().get_id()), cache); logger.debug("Got attributes "+attr.get_code()); // preload attributes networks.addElement(cache); totalNetworks++; } else { logger.warn("a networkaccess returned from NetworkFinder.retrieve_by_code is null, skipping."); } // end of else }//end of inner for subCounter = 0; }catch(NetworkNotFound nnfe) { logger.warn("Network "+configuredNetworks[counter]+" not found while getting network access uding NetworkFinder.retrieve_by_code"); } setProgressValue(this, counter+1); }//end of outer for counter = 0; }//end of if else checking for configuredNetworks == null if (doSelect) { // need to do this later to give java Event thread time to set // up network list before setting selection SwingUtilities.invokeLater(new Runnable() { public void run() { networkList.getSelectionModel().setSelectionInterval(0, networkList.getModel().getSize()-1); } }); } // end of if () setProgressValue(this, progressBar.getMaximum()); } |
addStation(newStations[j]); | stationAdd(newStations[j]); | public void run() { setProgressOwner(this); setProgressMax(this, 100); logger.debug("There are "+nets.length+" selected networks."); try { synchronized (ChannelChooser.this) { if (this.equals(getStationLoader())) { clearStationsFromThread(); } } int netProgressInc = 50 / nets.length; int progressValue = 10; setProgressValue(this, progressValue); for (int i=0; i<nets.length; i++) { logger.debug("Before get stations"); Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); setProgressValue(this, progressValue+netProgressInc/2); for (int j=0; j<newStations.length; j++) { synchronized (ChannelChooser.this) { if (this.equals(getStationLoader())) { addStation(newStations[j]); try { sleep((int)(.01*1000)); } catch (InterruptedException e) { } // end of try-catch } else { // no longer the active station loader return; } // end of else } setProgressValue(this, progressValue+netProgressInc/2- (newStations.length-j)/newStations.length); } setProgressValue(this, 100); logger.debug("finished adding stations"); try { sleep((int)(.01*1000)); } catch (InterruptedException e) { } // end of try-catch } // end of for ((int i=0; i<nets.length; i++) logger.debug("There are "+stationNames.getSize()+" items in the station list model"); // stationList.validate(); //stationList.repaint(); } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } } |
public boolean init(String authenticatedUser, | public boolean init(String url, String authenticatedUser, | public boolean init(String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException; |
numErrors = getLastHandledErNo(); | public HTMLReporter(File directory) throws IOException{ this.directory = directory; initIndexFile(); } |
|
BufferedWriter out = new BufferedWriter(new FileWriter(index)); writeln(out, "<html>"); writeln(out, " <head>"); writeln(out, " <title>Errors</title>"); writeln(out, " <style media="+q+"all"+q+">@import "+q+"../main.css"+q+";</style>"); writeln(out, " </head>"); writeln(out, " <body>"); writeln(out, " <div id="+q+"Header"+q+">Errors found:</div>"); writeln(out, "<br/>"); writeln(out, "<div id="+q+"Content"+q+">"); out.close(); | if(index.exists()) { BufferedWriter out = new BufferedWriter(new FileWriter(index, true)); writeln(out, "<hr>"); writeln(out, "SOD was restarted at " + ClockUtil.now() + ".<br>"); writeln(out, "There have been " + numErrors + " errors so far."); writeln(out, "<hr>"); out.close(); } else { BufferedWriter out = new BufferedWriter(new FileWriter(index)); writeln(out, "<html>"); writeln(out, " <head>"); writeln(out, " <title>Errors</title>"); writeln(out, " <style media=" + q + "all" + q + ">@import " + q + "../main.css" + q + ";</style>"); writeln(out, " </head>"); writeln(out, " <body>"); writeln(out, " <div id=" + q + "Header" + q + ">Errors found:</div>"); writeln(out, "<br/>"); writeln(out, "<div id=" + q + "Content" + q + ">"); out.close(); } | protected void initIndexFile() throws IOException { char q = '"'; File index = new File(directory, "index.html"); BufferedWriter out = new BufferedWriter(new FileWriter(index)); writeln(out, "<html>"); writeln(out, " <head>"); writeln(out, " <title>Errors</title>"); writeln(out, " <style media="+q+"all"+q+">@import "+q+"../main.css"+q+";</style>"); writeln(out, " </head>"); writeln(out, " <body>"); writeln(out, " <div id="+q+"Header"+q+">Errors found:</div>"); writeln(out, "<br/>"); writeln(out, "<div id="+q+"Content"+q+">"); out.close(); // we do not end the body or html tags to allow simple appends to this // file. Most browsers are ok with this } |
public void report(String message, Throwable e, List sections) throws IOException{ int cur = GlobalExceptionHandler.getNumHandled(); File outFile = new File(directory, "Exception_"+cur+".html"); | public void report(String message, Throwable e, List sections) throws IOException { File outFile = new File(directory, "Exception_" + ++numErrors + ".html"); | public void report(String message, Throwable e, List sections) throws IOException{ int cur = GlobalExceptionHandler.getNumHandled(); File outFile = new File(directory, "Exception_"+cur+".html"); appendToIndexFile(outFile, e); BufferedWriter bw = new BufferedWriter(new FileWriter(outFile)); String str = getHeader(e, cur); str += message; str += "\n<br/>\n<br/>\n"; String stackTrace = "<h2>Stack Trace</h2><br/>"; str += stackTrace +makeDivider(stackTrace.length()) + "<pre>"+ ExceptionReporterUtils.getTrace(e)+"</pre>"; bw.write(constructString(str, sections)); bw.close(); } |
String str = getHeader(e, cur); | String str = getHeader(e, numErrors); | public void report(String message, Throwable e, List sections) throws IOException{ int cur = GlobalExceptionHandler.getNumHandled(); File outFile = new File(directory, "Exception_"+cur+".html"); appendToIndexFile(outFile, e); BufferedWriter bw = new BufferedWriter(new FileWriter(outFile)); String str = getHeader(e, cur); str += message; str += "\n<br/>\n<br/>\n"; String stackTrace = "<h2>Stack Trace</h2><br/>"; str += stackTrace +makeDivider(stackTrace.length()) + "<pre>"+ ExceptionReporterUtils.getTrace(e)+"</pre>"; bw.write(constructString(str, sections)); bw.close(); } |
long extraTime = scale*(endTime.getMicroSecondTime() - beginTime.getMicroSecondTime()); return new MicroSecondTimeRange(new MicroSecondDate(beginTime.getMicroSecondTime() - extraTime), new MicroSecondDate(endTime.getMicroSecondTime() + extraTime)); | long interval = endTime.getMicroSecondTime() - beginTime.getMicroSecondTime(); long totalTime = scale*interval; return new MicroSecondTimeRange(new MicroSecondDate((long)(beginTime.getMicroSecondTime() - ((totalTime/(double)interval) - 1) * interval)), new MicroSecondDate(beginTime.getMicroSecondTime() + totalTime)); | public MicroSecondTimeRange getOversizedTimeRange(int scale){ long extraTime = scale*(endTime.getMicroSecondTime() - beginTime.getMicroSecondTime()); return new MicroSecondTimeRange(new MicroSecondDate(beginTime.getMicroSecondTime() - extraTime), new MicroSecondDate(endTime.getMicroSecondTime() + extraTime)); } |
bsd = new BasicSeismogramDisplay(seismos, names, null); | bsd = new BasicSeismogramDisplay(seismos, null); | public TestBSD(){ super("TestBSD"); edu.iris.Fissures.Time begin = new edu.iris.Fissures.Time("19911015T163000.000Z", -1); DataSetSeismogram[] seismos = {new DataSetSeismogram(((LocalSeismogramImpl)SimplePlotUtil. createSineWave()),null)}; String[] names = {"FIRST"}; bsd = new BasicSeismogramDisplay(seismos, names, null); bsd.addBottomTimeBorder(); bsd.setSize(500, 500); getContentPane().add(bsd, BorderLayout.CENTER); addFilterButton(); addScrollLeftButton(); addScrollRightButton(); addZoomIn(); addZoomOut(); //addSelectionTest(); getContentPane().add(panel, BorderLayout.SOUTH); } |
bsd.add(seismos, names); | bsd.add(seismos); | public void addTestData(int numSeis){ DataSetSeismogram[] seismos = new DataSetSeismogram[numSeis]; String[] names = new String[numSeis]; for(int i = 0; i < numSeis; i++){ seismos[i] = new DataSetSeismogram(((LocalSeismogramImpl)SimplePlotUtil.createTestData()), null); names[i] = "SINE" + 1; } bsd.add(seismos, names); } |
null, | private void init() throws Throwable { svci = new CalSvc(); CalSvcIPars pars = new CalSvcIPars(account, UserAuth.superUser, account, true, // public false, // caldav null, // synchId debug); svci.init(pars); } |
|
FileOutputStream fileOutputStream = null; try { File file = new File("output.txt"); fileOutputStream = new FileOutputStream(file); } catch (FileNotFoundException e) { } try { for (ReviewMessage reviewMessage : reviewMessages) { fileOutputStream.write(charset.encode("" + reviewMessage + "\n").array()); } } catch (IOException e) { } try { fileOutputStream.close(); } catch (IOException e) { } | public void loadLogFile(String filename) { initData(); reviewMessages.clear(); try { FileReader fileReader = new FileReader(filename); BufferedReader bufferedReader = new BufferedReader(fileReader); for (;;) { String line = bufferedReader.readLine(); if (!(line instanceof String)) { break; } if (line.length() < 2) { continue; } Matcher matcher = patternCommand.matcher(line); if (!matcher.find()) { continue; } Object[] command = Util.commandTextToJava(line); Integer commandInt = hashmapCommand.get(command[0].toString()); if (commandInt != null) { try { switch (commandInt) { case COMMAND_SB: handleSB(command); break; case COMMAND_SV: handleSV(command); break; case COMMAND_LM: handleLM(command); break; case COMMAND_GM: handleGM(command); break; case COMMAND_AT: handleAT(command); break; case COMMAND_PT: handlePT(command); break; default: break; } } catch (Exception e) { e.printStackTrace(); } } } } catch(IOException e) { } FileOutputStream fileOutputStream = null; try { File file = new File("output.txt"); fileOutputStream = new FileOutputStream(file); } catch (FileNotFoundException e) { } try { for (ReviewMessage reviewMessage : reviewMessages) { fileOutputStream.write(charset.encode("" + reviewMessage + "\n").array()); } } catch (IOException e) { } try { fileOutputStream.close(); } catch (IOException e) { } } |
|
StringBuffer queryExecuted = new StringBuffer(); if(executedSQLStatements!=null && !executedSQLStatements.isEmpty()){ Iterator iterator = executedSQLStatements.iterator(); while (iterator.hasNext()) { queryExecuted.append( (String) iterator.next()); queryExecuted.append("\n"); } } debug(queryExecuted.toString()); | 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); 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); } |
|
MicroSecondTimeRange pastTime = (MicroSecondTimeRange)seismoTimes.get(aSeis); | public UnitRangeImpl getAmpRange(DataSetSeismogram aSeis){ LocalSeismogramImpl seis = aSeis.getSeismogram(); MicroSecondTimeRange pastTime = (MicroSecondTimeRange)seismoTimes.get(aSeis); if(timeRegistrar == null){ return getAmpRange(aSeis, (MicroSecondTimeRange)seismoTimes.get(aSeis)); }else{ if (!timeRegistrar.contains(aSeis)) { getAmpRange(aSeis, timeRegistrar.getTimeRange()); timeRegistrar.addSeismogram(aSeis); } return getAmpRange(aSeis, timeRegistrar.getTimeRange(aSeis)); } } |
|
if(meanDiff >= this.ampRange.getMaxValue() - 1) | if(meanDiff >= this.ampRange.getMaxValue() - 1){ this.prevRange = this.ampRange; | public void removeSeismogram(DataSetSeismogram aSeis){ if (seismoAmps.size() == 1) { super.removeSeismogram(aSeis); return; } // end of if (seismos.size() == 1) MicroSecondTimeRange calcIntv; LocalSeismogramImpl seis = aSeis.getSeismogram(); if(this.timeRegistrar == null) calcIntv = new MicroSecondTimeRange(seis.getBeginTime(), seis.getEndTime()); else calcIntv = timeRegistrar.getTimeRange(aSeis); if(seismoAmps.containsKey(aSeis)){ int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); return; } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); if(meanDiff >= this.ampRange.getMaxValue() - 1) this.ampRange = null; } catch (Exception e) { this.ampRange = null; } seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); if(ampRange == null){ Iterator e = seismoAmps.keySet().iterator(); logger.debug("recalculating amp range as defining seismogram was removed"); while(e.hasNext()) this.getAmpRange(((DataSetSeismogram)e.next())); this.updateAmpSyncListeners(); } } } |
} | } } | public void removeSeismogram(DataSetSeismogram aSeis){ if (seismoAmps.size() == 1) { super.removeSeismogram(aSeis); return; } // end of if (seismos.size() == 1) MicroSecondTimeRange calcIntv; LocalSeismogramImpl seis = aSeis.getSeismogram(); if(this.timeRegistrar == null) calcIntv = new MicroSecondTimeRange(seis.getBeginTime(), seis.getEndTime()); else calcIntv = timeRegistrar.getTimeRange(aSeis); if(seismoAmps.containsKey(aSeis)){ int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); return; } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); if(meanDiff >= this.ampRange.getMaxValue() - 1) this.ampRange = null; } catch (Exception e) { this.ampRange = null; } seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); if(ampRange == null){ Iterator e = seismoAmps.keySet().iterator(); logger.debug("recalculating amp range as defining seismogram was removed"); while(e.hasNext()) this.getAmpRange(((DataSetSeismogram)e.next())); this.updateAmpSyncListeners(); } } } |
while(e.hasNext()) | while(e.hasNext()){ | public void removeSeismogram(DataSetSeismogram aSeis){ if (seismoAmps.size() == 1) { super.removeSeismogram(aSeis); return; } // end of if (seismos.size() == 1) MicroSecondTimeRange calcIntv; LocalSeismogramImpl seis = aSeis.getSeismogram(); if(this.timeRegistrar == null) calcIntv = new MicroSecondTimeRange(seis.getBeginTime(), seis.getEndTime()); else calcIntv = timeRegistrar.getTimeRange(aSeis); if(seismoAmps.containsKey(aSeis)){ int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); return; } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); if(meanDiff >= this.ampRange.getMaxValue() - 1) this.ampRange = null; } catch (Exception e) { this.ampRange = null; } seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); if(ampRange == null){ Iterator e = seismoAmps.keySet().iterator(); logger.debug("recalculating amp range as defining seismogram was removed"); while(e.hasNext()) this.getAmpRange(((DataSetSeismogram)e.next())); this.updateAmpSyncListeners(); } } } |
} if(ampRange == null){ ampRange = prevRange; } | public void removeSeismogram(DataSetSeismogram aSeis){ if (seismoAmps.size() == 1) { super.removeSeismogram(aSeis); return; } // end of if (seismos.size() == 1) MicroSecondTimeRange calcIntv; LocalSeismogramImpl seis = aSeis.getSeismogram(); if(this.timeRegistrar == null) calcIntv = new MicroSecondTimeRange(seis.getBeginTime(), seis.getEndTime()); else calcIntv = timeRegistrar.getTimeRange(aSeis); if(seismoAmps.containsKey(aSeis)){ int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); return; } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); if(meanDiff >= this.ampRange.getMaxValue() - 1) this.ampRange = null; } catch (Exception e) { this.ampRange = null; } seismoAmps.remove(aSeis); seismoTimes.remove(aSeis); if(ampRange == null){ Iterator e = seismoAmps.keySet().iterator(); logger.debug("recalculating amp range as defining seismogram was removed"); while(e.hasNext()) this.getAmpRange(((DataSetSeismogram)e.next())); this.updateAmpSyncListeners(); } } } |
|
logger.debug("corbaloc not null"); | public org.omg.CORBA.Object getRoot() { org.omg.CORBA.Object rootObj = null; if(nameServiceCorbaLoc != null) { logger.debug("corbaloc not null"); logger.info("Using name service corba loc=" + nameServiceCorbaLoc); rootObj = orb.string_to_object(nameServiceCorbaLoc); if(rootObj == null) { throw new RuntimeException("Unable to make an object from " + nameServiceCorbaLoc); } logger.debug("got root object"); } else { logger.debug("corbaloc is null, resolve initial references"); try { // get a reference to the Naming Service root_context rootObj = orb.resolve_initial_references("NameService"); } catch(org.omg.CORBA.ORBPackage.InvalidName e) { throw new RuntimeException("Unable to resolve from initial references", e); } if(rootObj == null) { throw new RuntimeException("Unable to resolve from initial references"); } } return rootObj; } |
|
logger.debug("corbaloc is null, resolve initial references"); | logger.debug("resolve initial references"); | public org.omg.CORBA.Object getRoot() { org.omg.CORBA.Object rootObj = null; if(nameServiceCorbaLoc != null) { logger.debug("corbaloc not null"); logger.info("Using name service corba loc=" + nameServiceCorbaLoc); rootObj = orb.string_to_object(nameServiceCorbaLoc); if(rootObj == null) { throw new RuntimeException("Unable to make an object from " + nameServiceCorbaLoc); } logger.debug("got root object"); } else { logger.debug("corbaloc is null, resolve initial references"); try { // get a reference to the Naming Service root_context rootObj = orb.resolve_initial_references("NameService"); } catch(org.omg.CORBA.ORBPackage.InvalidName e) { throw new RuntimeException("Unable to resolve from initial references", e); } if(rootObj == null) { throw new RuntimeException("Unable to resolve from initial references"); } } return rootObj; } |
String idstr = request.getParameter("cal"); | String idstr = getReqPar(request, "cal"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
idstr = request.getParameter("event"); | idstr = getReqPar(request, "event"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.noentityid"); | form.getErr().emit("org.bedework.client.error.noentityid"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.badentityid"); | form.getErr().emit("org.bedework.client.error.badentityid"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.nosuchcalendar", id); | form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.nosuchevent", id); | form.getErr().emit("org.bedework.client.error.nosuchevent", id); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.unimplemented"); | form.getErr().emit("org.bedework.client.error.unimplemented"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.badhow"); | form.getErr().emit("org.bedework.client.error.badhow"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.badwhotype"); | form.getErr().emit("org.bedework.client.error.badwhotype"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
form.getErr().emit("org.bedework.error.usernotfound"); | form.getErr().emit("org.bedework.client.error.usernotfound"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = request.getParameter("cal"); boolean calid = idstr != null; if (!calid) { idstr = request.getParameter("event"); } if (idstr == null) { form.getErr().emit("org.bedework.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badentityid"); return "error"; } CalSvcI svci = form.getCalSvcI(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.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.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.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.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.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.error.usernotfound"); return "notFound"; } } else { who = null; } Vector v = new Vector(); v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, v); svci.updateCalendar(cal); } else { svci.changeAccess(ev, v); svci.updateEvent(ev); } return "success"; } |
Collection fbs = new Vector(); | Collection fbs = new ArrayList(); | public Collection getFreeBusy(CalSvcI svci, String user) throws WebdavException { Iterator it = timeRanges.iterator(); Collection fbs = new Vector(); while (it.hasNext()) { TimeRange tr = (TimeRange)it.next(); try { BwFreeBusy fb = svci.getFreeBusy(null, new BwUser(user), tr.getStart(), tr.getEnd(), null, false); if (debug) { trace("Got " + fb); } fbs.add(fb); } catch (Throwable t) { throw new WebdavException(t); } } return fbs; } |
timeRanges = new Vector(); | timeRanges = new ArrayList(); | public int parse(Node nd) throws WebdavException { try { if (timeRanges == null) { timeRanges = new Vector(); } if (!MethodBase.nodeMatches(nd, CaldavTags.timeRange)) { throw new WebdavBadRequest(); } TimeRange tr = CalDavParseUtil.parseTimeRange(nd, intf.getSvci().getTimezones()); timeRanges.add(tr); if (debug) { trace("Parsed time range " + tr); } } catch (WebdavBadRequest wbr) { return wbr.getStatusCode(); } catch (Throwable t) { throw new WebdavBadRequest(); } return HttpServletResponse.SC_OK; } |
double d = n*sumSqrToN - sumToN*sumToN; | double d = (n+1)*sumSqrToN - sumToN*sumToN; | public double[] linearLeastSquares() { int n = getLength()-1; // use zero based, so n => n-1 int sumToN = n*(n+1)/2; int sumSqrToN = n*(n+1)*(2*n+1)/6; double sumValues = binarySum(0, getLength()); double indexSumValues = binaryIndexSum(0, getLength()); double d = n*sumSqrToN - sumToN*sumToN; double[] out = new double[2]; out[0] = (sumSqrToN * sumValues - sumToN * indexSumValues)/d; out[1] = (n * indexSumValues - sumValues * sumValues)/d; return out; } |
out[1] = (n * indexSumValues - sumValues * sumValues)/d; | out[1] = ((n+1) * indexSumValues - sumToN * sumValues)/d; | public double[] linearLeastSquares() { int n = getLength()-1; // use zero based, so n => n-1 int sumToN = n*(n+1)/2; int sumSqrToN = n*(n+1)*(2*n+1)/6; double sumValues = binarySum(0, getLength()); double indexSumValues = binaryIndexSum(0, getLength()); double d = n*sumSqrToN - sumToN*sumToN; double[] out = new double[2]; out[0] = (sumSqrToN * sumValues - sumToN * indexSumValues)/d; out[1] = (n * indexSumValues - sumValues * sumValues)/d; return out; } |
return this.ldapAttributesToPortalAttributes; | return this.attributesMapper.getLdapAttributesToPortalAttributes(); | public Map getLdapAttributesToPortalAttributes() { return this.ldapAttributesToPortalAttributes; } |
if (this.ldapContext == null) throw new IllegalStateException("LDAP context is null"); | if (this.contextSource == null) throw new IllegalStateException("ContextSource is null"); | public Map getUserAttributes(final Map seed) { // Checks to make sure the argument & state is valid if (seed == null) throw new IllegalArgumentException("The query seed Map cannot be null."); if (this.ldapContext == null) throw new IllegalStateException("LDAP context is null"); if (this.query == null) throw new IllegalStateException("query is null"); // Ensure the data needed to run the query is avalable if (!((queryAttributes != null && seed.keySet().containsAll(queryAttributes)) || (queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())))) { return null; } try { // Search for the userid in the usercontext subtree of the directory // Use the uidquery substituting username for {0}, {1}, ... final SearchControls sc = new SearchControls(); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); sc.setTimeLimit(this.timeLimit); // Can't just to a toArray here since the order of the keys in the Map // may not match the order of the keys in the List and it is important to // the query. final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } // Search the LDAP final NamingEnumeration userlist = this.ldapContext.search(this.baseDN, this.query, args, sc); try { if (userlist.hasMoreElements()) { final Map rowResults = new HashMap(); final SearchResult result = (SearchResult) userlist.next(); // Only allow one result for the query, do the check here to // save on attribute processing time. if (userlist.hasMoreElements()) { throw new IncorrectResultSizeDataAccessException("More than one result for ldap person attribute search.", 1, -1); } final Attributes ldapAttributes = result.getAttributes(); // Iterate through the attributes for (final Iterator ldapAttrIter = this.ldapAttributesToPortalAttributes.keySet().iterator(); ldapAttrIter.hasNext();) { final String ldapAttributeName = (String) ldapAttrIter.next(); final Attribute attribute = ldapAttributes.get(ldapAttributeName); // The attribute exists if (attribute != null) { for (final NamingEnumeration attrValueEnum = attribute.getAll(); attrValueEnum.hasMore();) { Object attributeValue = attrValueEnum.next(); // Convert everything except byte[] to String // TODO should we be doing this conversion? if (!(attributeValue instanceof byte[])) { attributeValue = attributeValue.toString(); } // See if the ldap attribute is mapped Set attributeNames = (Set) ldapAttributesToPortalAttributes.get(ldapAttributeName); // No mapping was found, just use the ldap attribute name if (attributeNames == null) attributeNames = Collections.singleton(ldapAttributeName); // Run through the mapped attribute names for (final Iterator attrNameItr = attributeNames .iterator(); attrNameItr.hasNext();) { final String attributeName = (String) attrNameItr .next(); MultivaluedPersonAttributeUtils.addResult(rowResults, attributeName, attributeValue); } } } } return rowResults; } else { return null; } } finally { try { userlist.close(); } catch (final NamingException ne) { log.warn("Error closing ldap person attribute search results.", ne); } } } catch (final Throwable t) { throw new DataAccessResourceFailureException("LDAP person attribute lookup failure.", t); } } |
try { final SearchControls sc = new SearchControls(); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); sc.setTimeLimit(this.timeLimit); | final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } | public Map getUserAttributes(final Map seed) { // Checks to make sure the argument & state is valid if (seed == null) throw new IllegalArgumentException("The query seed Map cannot be null."); if (this.ldapContext == null) throw new IllegalStateException("LDAP context is null"); if (this.query == null) throw new IllegalStateException("query is null"); // Ensure the data needed to run the query is avalable if (!((queryAttributes != null && seed.keySet().containsAll(queryAttributes)) || (queryAttributes == null && seed.containsKey(this.getDefaultAttributeName())))) { return null; } try { // Search for the userid in the usercontext subtree of the directory // Use the uidquery substituting username for {0}, {1}, ... final SearchControls sc = new SearchControls(); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); sc.setTimeLimit(this.timeLimit); // Can't just to a toArray here since the order of the keys in the Map // may not match the order of the keys in the List and it is important to // the query. final Object[] args = new Object[this.queryAttributes.size()]; for (int index = 0; index < args.length; index++) { final String attrName = (String) this.queryAttributes.get(index); args[index] = seed.get(attrName); } // Search the LDAP final NamingEnumeration userlist = this.ldapContext.search(this.baseDN, this.query, args, sc); try { if (userlist.hasMoreElements()) { final Map rowResults = new HashMap(); final SearchResult result = (SearchResult) userlist.next(); // Only allow one result for the query, do the check here to // save on attribute processing time. if (userlist.hasMoreElements()) { throw new IncorrectResultSizeDataAccessException("More than one result for ldap person attribute search.", 1, -1); } final Attributes ldapAttributes = result.getAttributes(); // Iterate through the attributes for (final Iterator ldapAttrIter = this.ldapAttributesToPortalAttributes.keySet().iterator(); ldapAttrIter.hasNext();) { final String ldapAttributeName = (String) ldapAttrIter.next(); final Attribute attribute = ldapAttributes.get(ldapAttributeName); // The attribute exists if (attribute != null) { for (final NamingEnumeration attrValueEnum = attribute.getAll(); attrValueEnum.hasMore();) { Object attributeValue = attrValueEnum.next(); // Convert everything except byte[] to String // TODO should we be doing this conversion? if (!(attributeValue instanceof byte[])) { attributeValue = attributeValue.toString(); } // See if the ldap attribute is mapped Set attributeNames = (Set) ldapAttributesToPortalAttributes.get(ldapAttributeName); // No mapping was found, just use the ldap attribute name if (attributeNames == null) attributeNames = Collections.singleton(ldapAttributeName); // Run through the mapped attribute names for (final Iterator attrNameItr = attributeNames .iterator(); attrNameItr.hasNext();) { final String attributeName = (String) attrNameItr .next(); MultivaluedPersonAttributeUtils.addResult(rowResults, attributeName, attributeValue); } } } } return rowResults; } else { return null; } } finally { try { userlist.close(); } catch (final NamingException ne) { log.warn("Error closing ldap person attribute search results.", ne); } } } catch (final Throwable t) { throw new DataAccessResourceFailureException("LDAP person attribute lookup failure.", t); } } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.