bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public void testisCloneOf() throws Exception { ATObject clone = original.meta_clone(); original.meta_isCloneOf(clone).base_ifFalse_( new NativeClosure(clone) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Cloning is not properly defined under the isCloneOf test."); return NATNil._INSTANCE_; } }); clone.meta_addMethod( new NATMethod(AGSymbol.alloc("addedMethod"), NATTable.EMPTY, null) { public ATObject base_apply(ATTable arguments, ATContext ctx) throws InterpreterException { throw new TestException("This method needs to be visible in the clone", 1); } }); try { clone.meta_invoke(clone, AGSymbol.alloc("addedMethod"), NATTable.EMPTY); } catch (TestException ae) { // given the definition, this should happen!!! } catch (XSelectorNotFound se) { // implies the addMethod to the clone was not performed correctly fail("performing meta_addMethod did not add the method as expected"); } original.meta_isCloneOf(clone).base_ifTrue_( new NativeClosure(clone) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Adding fields to a clone should disrupt the isCloneOf test when comparing the original to the extended object."); return NATNil._INSTANCE_; } }); clone.meta_isCloneOf(original).base_ifFalse_( new NativeClosure(original) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Adding fields to a clone should NOT disrupt the isCloneOf test when comparing the extended object to the original."); return NATNil._INSTANCE_; } }); extension.meta_isCloneOf(original).base_ifTrue_( new NativeClosure(original) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Extensions should not return true to the isCloneOf test."); return NATNil._INSTANCE_; } }); extension.meta_isCloneOf(clone).base_ifTrue_( new NativeClosure(clone) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Extensions should not return true to the isCloneOf test."); return NATNil._INSTANCE_; } }); }
public void testisCloneOf() throws Exception { ATObject clone = original.meta_clone(); original.meta_isCloneOf(clone).base_ifFalse_( new NativeClosure(clone) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Cloning is not properly defined under the isCloneOf test."); return NATNil._INSTANCE_; } }); clone.meta_addMethod( new NATMethod(AGSymbol.alloc("addedMethod"), NATTable.EMPTY, null) { public ATObject base_apply(ATTable arguments, ATContext ctx) throws InterpreterException { throw new TestException("This method needs to be visible in the clone", 1); } }); try { clone.meta_invoke(clone, AGSymbol.jAlloc("addedMethod"), NATTable.EMPTY); } catch (TestException ae) { // given the definition, this should happen!!! } catch (XSelectorNotFound se) { // implies the addMethod to the clone was not performed correctly fail("performing meta_addMethod did not add the method as expected"); } original.meta_isCloneOf(clone).base_ifTrue_( new NativeClosure(clone) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Adding fields to a clone should disrupt the isCloneOf test when comparing the original to the extended object."); return NATNil._INSTANCE_; } }); clone.meta_isCloneOf(original).base_ifFalse_( new NativeClosure(original) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Adding fields to a clone should NOT disrupt the isCloneOf test when comparing the extended object to the original."); return NATNil._INSTANCE_; } }); extension.meta_isCloneOf(original).base_ifTrue_( new NativeClosure(original) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Extensions should not return true to the isCloneOf test."); return NATNil._INSTANCE_; } }); extension.meta_isCloneOf(clone).base_ifTrue_( new NativeClosure(clone) { public ATObject base_apply(ATTable arguments) throws InterpreterException { fail("Extensions should not return true to the isCloneOf test."); return NATNil._INSTANCE_; } }); }
1,120,167
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String text = attrs.getValue("text"); Idea i = new Idea(text); String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else { current.add(i); } current = i; stack.push(current); } } }
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String text = attrs.getValue("text"); Idea i = new Idea(text); String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else { Idea i2 = new Idea("root"); i2.add(idea); idea = i2; stack.push(idea); idea.add(i); } current = i; stack.push(current); } } }
1,120,168
public void addCalendar(BwCalendar val, BwCalendar parent) throws CalFacadeException { HibSession sess = getSess(); /* We need write access to the parent */ access.accessible(parent, privWrite, false); /** Is the parent a calendar collection? *//* sess.namedQuery("countCalendarEventRefs"); sess.setEntity("cal", parent); Integer res = (Integer)sess.getUnique(); if (res.intValue() > 0) {*/ if (parent.getCalendarCollection()) { throw new CalFacadeException(CalFacadeException.illegalCalendarCreation); } /* Ensure the path is unique */ String path = parent.getPath(); if (path == null) { if (parent.getPublick()) { path = ""; } else { path = "/users/" + parent.getOwner().getAccount(); } } path += "/" + val.getName(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); if (sess.getUnique() != null) { throw new CalFacadeException(CalFacadeException.duplicateCalendar); } val.setPath(path); val.setOwner(getUser()); val.setCalendar(parent); parent.addChild(val); sess.save(parent); }
public void addCalendar(BwCalendar val, BwCalendar parent) throws CalFacadeException { HibSession sess = getSess(); /* We need write access to the parent */ access.checkAccess(parent, privWrite, false); /** Is the parent a calendar collection? *//* sess.namedQuery("countCalendarEventRefs"); sess.setEntity("cal", parent); Integer res = (Integer)sess.getUnique(); if (res.intValue() > 0) {*/ if (parent.getCalendarCollection()) { throw new CalFacadeException(CalFacadeException.illegalCalendarCreation); } /* Ensure the path is unique */ String path = parent.getPath(); if (path == null) { if (parent.getPublick()) { path = ""; } else { path = "/users/" + parent.getOwner().getAccount(); } } path += "/" + val.getName(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); if (sess.getUnique() != null) { throw new CalFacadeException(CalFacadeException.duplicateCalendar); } val.setPath(path); val.setOwner(getUser()); val.setCalendar(parent); parent.addChild(val); sess.save(parent); }
1,120,169
public BwCalendar getCalendar(int val) throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getCalendarById"); sess.setInt("id", val); sess.cacheableQuery(); BwCalendar cal = (BwCalendar)sess.getUnique(); if (cal != null) { access.accessible(cal, privRead, false); } return cal; }
public BwCalendar getCalendar(int val) throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getCalendarById"); sess.setInt("id", val); sess.cacheableQuery(); BwCalendar cal = (BwCalendar)sess.getUnique(); if (cal != null) { access.checkAccess(cal, privRead, false); } return cal; }
1,120,170
public Collection getCalendarCollections() throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getUserCalendarCollections"); sess.setEntity("owner", getUser()); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWrite, noAccessReturnsNull); }
public Collection getCalendarCollections() throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getUserCalendarCollections"); sess.setEntity("owner", getUser()); sess.cacheableQuery(); return postGet(sess.getList(), privWrite); }
1,120,171
public Collection getPublicCalendarCollections() throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getPublicCalendarCollections"); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWrite, true); }
public Collection getPublicCalendarCollections() throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getPublicCalendarCollections"); sess.cacheableQuery(); return postGet(sess.getList(), privWrite); }
1,120,172
protected IPreferenceStore getPreferenceStore() { return org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); }
protected IPreferenceStore getPreferenceStore() { return UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); }
1,120,173
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
public void paint(Graphics g){ if(overSizedImage == null || overSizedImage.get() == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
1,120,174
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
1,120,175
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
1,120,176
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); System.out.println(scale); double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * (overSize.getWidth() * scale); AffineTransform tx = AffineTransform.getTranslateInstance(-offset, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
1,120,177
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); } long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; repaint(); } }
1,120,178
public void removeSelectionDisplay(VerticalSeismogramDisplay display){ if(display == selectionDisplay){ removeSelectionDisplay(); }else if(display != null){ remove3CSelectionDisplay(); } }
public void removeSelectionDisplay(VerticalSeismogramDisplay display){ if(display == selectionDisplay){ removeSelectionDisplay(); }else if(display == threeSelectionDisplay){ remove3CSelectionDisplay(); } }
1,120,179
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } String reqpar = request.getParameter("updateEvent"); if (reqpar != null) { return updateEvent(request, form); } EventInfo ei = findEvent(request, form); if (ei == null) { return "doNothing"; } BwEvent ev = ei.getEvent(); form.setEditEvent(ev); String fwd = setEventCalendar(request, form, ev); if (fwd != null) { return fwd; } BwLocation loc = ev.getLocation(); if (debug) { if (loc == null) { debugMsg("Set event with null location"); } else { debugMsg("Set event with location " + loc); } } form.setEditLocation(null); if (loc != null) { form.setEventLocationId(loc.getId()); } else { form.setEventLocationId(CalFacadeDefs.defaultLocationId); } return "edit"; }
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } String reqpar = request.getParameter("updateEvent"); if (reqpar != null) { return updateEvent(request, form); } EventInfo ei = findEvent(request, form); if (ei == null) { return "doNothing"; } BwEvent ev = ei.getEvent(); form.setEditEvent(ev); String fwd = setEventCalendar(request, form, ev); if (fwd != null) { return fwd; } BwLocation loc = ev.getLocation(); if (debug) { if (loc == null) { debugMsg("Set event with null location"); } else { debugMsg("Set event with location " + loc); } } form.setEditLocation(null); if (loc != null) { form.setEventLocationId(loc.getId()); } else { form.setEventLocationId(CalFacadeDefs.defaultLocationId); } return "edit"; }
1,120,182
public MP3Player(File f) throws PlayerException { try { file = f; stream = new FileInputStream(file); player = new AdvancedPlayer(stream) { public void close() { System.out.print("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); } }; } catch (Exception exc) { throw new PlayerException(exc); } }
public MP3Player(File f) throws PlayerException { try { file = f; stream = new FileInputStream(file); player = new AdvancedPlayer(stream) { public void close() { System.out.println("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); } }; } catch (Exception exc) { throw new PlayerException(exc); } }
1,120,183
public void close() { System.out.print("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); }
public void close() { System.out.println("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); }
1,120,184
public synchronized void stop() { stopped = true; if (player != null) { System.out.println("stop()"); player.close(); player = null; } }
public synchronized void stop() { stopped = true; if (player != null) { player.close(); player = null; } }
1,120,185
public static void main(String[] args) { /* Initializes the corba orb, finds the naming service and other startup * tasks. See AbstractClient for the code in this method. */ init(args); try { /** This step is not required, but sometimes helps to determine if * a server is down. if this call succedes but the next fails, then * the nameing service is up and functional, but the network server * is not reachable for some reason. */ Object obj = fisName.getEventDCObject("edu/iris/dmc", "IRIS_EventDC"); logger.info("Got as corba object, the name service is ok"); /** This connectts to the actual server, as oposed to just getting * the reference to it. The naming convention is that the first * part is the reversed DNS of the organization and the second part * is the individual server name. The dmc lists their servers under * the edu/iris/dmc and their main network server is IRIS_EventDC.*/ EventDC eventDC = fisName.getEventDC("edu/iris/dmc", "IRIS_EventDC"); logger.info("got EventDC"); /** The EventFinder is one of the choices at this point. It * allows you to query for individual events, and then retrieve * information about them. */ EventFinder finder = eventDC.a_finder(); logger.info("got EventFinder"); MicroSecondDate now = new MicroSecondDate(); MicroSecondDate yesterday = now.subtract(new TimeInterval(5, UnitImpl.DAY)); TimeRange timeRange = new TimeRange(now.getFissuresTime(), yesterday.getFissuresTime()); String[] magTypes = new String[1]; magTypes[0] = "ALL"; String[] catalogs = new String[1]; catalogs[0] = "FINGER"; String[] contributors = new String[1]; contributors[0] = "NEIC"; EventSeqIterHolder iter = new EventSeqIterHolder(); EventAccess[] events = finder.query_events(new GlobalAreaImpl(), new QuantityImpl(0, UnitImpl.KILOMETER), new QuantityImpl(1000, UnitImpl.KILOMETER), timeRange, magTypes, 5.5f, 10.0f, catalogs, contributors, 500, iter); logger.info("Got "+events.length+" events."); for (int i = 0; i < events.length; i++) { EventAttr attr = events[i].get_attributes(); try { Origin origin = events[i].get_preferred_origin(); logger.info("Event "+i+" occurred in FE region "+attr.region.number+ " at "+origin.origin_time.date_time+ " mag="+origin.magnitudes[0].type+" "+origin.magnitudes[0].value+ " at ("+origin.my_location.latitude+", "+origin.my_location.longitude+") "+ "with depth of "+origin.my_location.depth.value+" "+origin.my_location.depth.the_units); } catch (NoPreferredOrigin e) { logger.warn("No preferred origin for event "+i, e); } } /** Here are someof the possible problems that can occur. */ }catch (org.omg.CORBA.ORBPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (NotFound e) { logger.error("Problem with name service: ", e); }catch (CannotProceed e) { logger.error("Problem with name service: ", e); } /** All done... */ }
public static void main(String[] args) { /* Initializes the corba orb, finds the naming service and other startup * tasks. See AbstractClient for the code in this method. */ init(args); try { /** This step is not required, but sometimes helps to determine if * a server is down. if this call succedes but the next fails, then * the nameing service is up and functional, but the network server * is not reachable for some reason. */ Object obj = fisName.getEventDCObject("edu/iris/dmc", "IRIS_EventDC"); logger.info("Got as corba object, the name service is ok"); /** This connectts to the actual server, as oposed to just getting * the reference to it. The naming convention is that the first * part is the reversed DNS of the organization and the second part * is the individual server name. The dmc lists their servers under * the edu/iris/dmc and their main network server is IRIS_EventDC.*/ EventDC eventDC = fisName.getEventDC("edu/iris/dmc", "IRIS_EventDC"); logger.info("got EventDC"); /** The EventFinder is one of the choices at this point. It * allows you to query for individual events, and then retrieve * information about them. */ EventFinder finder = eventDC.a_finder(); logger.info("got EventFinder"); MicroSecondDate now = new MicroSecondDate(); MicroSecondDate yesterday = now.subtract(new TimeInterval(5, UnitImpl.DAY)); TimeRange timeRange = new TimeRange(now.getFissuresTime(), yesterday.getFissuresTime()); String[] magTypes = new String[1]; magTypes[0] = "ALL"; String[] catalogs = new String[1]; catalogs[0] = "FINGER"; String[] contributors = new String[1]; contributors[0] = "NEIC"; EventSeqIterHolder iter = new EventSeqIterHolder(); EventAccess[] events = finder.query_events(new GlobalAreaImpl(), new QuantityImpl(0, UnitImpl.KILOMETER), new QuantityImpl(1000, UnitImpl.KILOMETER), timeRange, magTypes, 5.5f, 10.0f, catalogs, contributors, 500, iter); logger.info("Got "+events.length+" events."); for (int i = 0; i < events.length; i++) { EventAttr attr = events[i].get_attributes(); try { Origin origin = events[i].get_preferred_origin(); logger.info("Event "+i+" occurred in FE region "+attr.region.number+ " at "+origin.origin_time.date_time+ " mag="+origin.magnitudes[0].type+" "+origin.magnitudes[0].value+ " at ("+origin.my_location.latitude+", "+origin.my_location.longitude+") "+ "with depth of "+origin.my_location.depth.value+" "+origin.my_location.depth.the_units); } catch (NoPreferredOrigin e) { logger.warn("No preferred origin for event "+i, e); } } /** Here are someof the possible problems that can occur. */ }catch (org.omg.CORBA.ORBPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (NotFound e) { logger.error("Problem with name service: ", e); }catch (CannotProceed e) { logger.error("Problem with name service: ", e); } /** All done... */ }
1,120,186
public static void main(String[] args) { /* Initializes the corba orb, finds the naming service and other startup * tasks. See AbstractClient for the code in this method. */ init(args); try { /** This step is not required, but sometimes helps to determine if * a server is down. if this call succedes but the next fails, then * the nameing service is up and functional, but the network server * is not reachable for some reason. */ Object obj = fisName.getEventDCObject("edu/iris/dmc", "IRIS_EventDC"); logger.info("Got as corba object, the name service is ok"); /** This connectts to the actual server, as oposed to just getting * the reference to it. The naming convention is that the first * part is the reversed DNS of the organization and the second part * is the individual server name. The dmc lists their servers under * the edu/iris/dmc and their main network server is IRIS_EventDC.*/ EventDC eventDC = fisName.getEventDC("edu/iris/dmc", "IRIS_EventDC"); logger.info("got EventDC"); /** The EventFinder is one of the choices at this point. It * allows you to query for individual events, and then retrieve * information about them. */ EventFinder finder = eventDC.a_finder(); logger.info("got EventFinder"); MicroSecondDate now = new MicroSecondDate(); MicroSecondDate yesterday = now.subtract(new TimeInterval(5, UnitImpl.DAY)); TimeRange timeRange = new TimeRange(now.getFissuresTime(), yesterday.getFissuresTime()); String[] magTypes = new String[1]; magTypes[0] = "ALL"; String[] catalogs = new String[1]; catalogs[0] = "FINGER"; String[] contributors = new String[1]; contributors[0] = "NEIC"; EventSeqIterHolder iter = new EventSeqIterHolder(); EventAccess[] events = finder.query_events(new GlobalAreaImpl(), new QuantityImpl(0, UnitImpl.KILOMETER), new QuantityImpl(1000, UnitImpl.KILOMETER), timeRange, magTypes, 5.5f, 10.0f, catalogs, contributors, 500, iter); logger.info("Got "+events.length+" events."); for (int i = 0; i < events.length; i++) { EventAttr attr = events[i].get_attributes(); try { Origin origin = events[i].get_preferred_origin(); logger.info("Event "+i+" occurred in FE region "+attr.region.number+ " at "+origin.origin_time.date_time+ " mag="+origin.magnitudes[0].type+" "+origin.magnitudes[0].value+ " at ("+origin.my_location.latitude+", "+origin.my_location.longitude+") "+ "with depth of "+origin.my_location.depth.value+" "+origin.my_location.depth.the_units); } catch (NoPreferredOrigin e) { logger.warn("No preferred origin for event "+i, e); } } /** Here are someof the possible problems that can occur. */ }catch (org.omg.CORBA.ORBPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (NotFound e) { logger.error("Problem with name service: ", e); }catch (CannotProceed e) { logger.error("Problem with name service: ", e); } /** All done... */ }
public static void main(String[] args) { /* Initializes the corba orb, finds the naming service and other startup * tasks. See AbstractClient for the code in this method. */ init(args); try { /** This step is not required, but sometimes helps to determine if * a server is down. if this call succedes but the next fails, then * the nameing service is up and functional, but the network server * is not reachable for some reason. */ Object obj = fisName.getEventDCObject("edu/iris/dmc", "IRIS_EventDC"); logger.info("Got as corba object, the name service is ok"); /** This connectts to the actual server, as oposed to just getting * the reference to it. The naming convention is that the first * part is the reversed DNS of the organization and the second part * is the individual server name. The dmc lists their servers under * the edu/iris/dmc and their main network server is IRIS_EventDC.*/ EventDC eventDC = fisName.getEventDC("edu/iris/dmc", "IRIS_EventDC"); logger.info("got EventDC"); /** The EventFinder is one of the choices at this point. It * allows you to query for individual events, and then retrieve * information about them. */ EventFinder finder = eventDC.a_finder(); logger.info("got EventFinder"); MicroSecondDate now = new MicroSecondDate(); MicroSecondDate yesterday = now.subtract(new TimeInterval(5, UnitImpl.DAY)); TimeRange timeRange = new TimeRange(now.getFissuresTime(), yesterday.getFissuresTime()); String[] magTypes = new String[1]; magTypes[0] = "%"; String[] catalogs = new String[1]; catalogs[0] = "FINGER"; String[] contributors = new String[1]; contributors[0] = "NEIC"; EventSeqIterHolder iter = new EventSeqIterHolder(); EventAccess[] events = finder.query_events(new GlobalAreaImpl(), new QuantityImpl(0, UnitImpl.KILOMETER), new QuantityImpl(1000, UnitImpl.KILOMETER), timeRange, magTypes, 5.5f, 10.0f, catalogs, contributors, 500, iter); logger.info("Got "+events.length+" events."); for (int i = 0; i < events.length; i++) { EventAttr attr = events[i].get_attributes(); try { Origin origin = events[i].get_preferred_origin(); logger.info("Event "+i+" occurred in FE region "+attr.region.number+ " at "+origin.origin_time.date_time+ " mag="+origin.magnitudes[0].type+" "+origin.magnitudes[0].value+ " at ("+origin.my_location.latitude+", "+origin.my_location.longitude+") "+ "with depth of "+origin.my_location.depth.value+" "+origin.my_location.depth.the_units); } catch (NoPreferredOrigin e) { logger.warn("No preferred origin for event "+i, e); } } /** Here are someof the possible problems that can occur. */ }catch (org.omg.CORBA.ORBPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (NotFound e) { logger.error("Problem with name service: ", e); }catch (CannotProceed e) { logger.error("Problem with name service: ", e); } /** All done... */ }
1,120,187
public static void main(String[] args) { /* Initializes the corba orb, finds the naming service and other startup * tasks. See AbstractClient for the code in this method. */ init(args); try { /** This step is not required, but sometimes helps to determine if * a server is down. if this call succedes but the next fails, then * the nameing service is up and functional, but the network server * is not reachable for some reason. */ Object obj = fisName.getEventDCObject("edu/iris/dmc", "IRIS_EventDC"); logger.info("Got as corba object, the name service is ok"); /** This connectts to the actual server, as oposed to just getting * the reference to it. The naming convention is that the first * part is the reversed DNS of the organization and the second part * is the individual server name. The dmc lists their servers under * the edu/iris/dmc and their main network server is IRIS_EventDC.*/ EventDC eventDC = fisName.getEventDC("edu/iris/dmc", "IRIS_EventDC"); logger.info("got EventDC"); /** The EventFinder is one of the choices at this point. It * allows you to query for individual events, and then retrieve * information about them. */ EventFinder finder = eventDC.a_finder(); logger.info("got EventFinder"); MicroSecondDate now = new MicroSecondDate(); MicroSecondDate yesterday = now.subtract(new TimeInterval(5, UnitImpl.DAY)); TimeRange timeRange = new TimeRange(now.getFissuresTime(), yesterday.getFissuresTime()); String[] magTypes = new String[1]; magTypes[0] = "ALL"; String[] catalogs = new String[1]; catalogs[0] = "FINGER"; String[] contributors = new String[1]; contributors[0] = "NEIC"; EventSeqIterHolder iter = new EventSeqIterHolder(); EventAccess[] events = finder.query_events(new GlobalAreaImpl(), new QuantityImpl(0, UnitImpl.KILOMETER), new QuantityImpl(1000, UnitImpl.KILOMETER), timeRange, magTypes, 5.5f, 10.0f, catalogs, contributors, 500, iter); logger.info("Got "+events.length+" events."); for (int i = 0; i < events.length; i++) { EventAttr attr = events[i].get_attributes(); try { Origin origin = events[i].get_preferred_origin(); logger.info("Event "+i+" occurred in FE region "+attr.region.number+ " at "+origin.origin_time.date_time+ " mag="+origin.magnitudes[0].type+" "+origin.magnitudes[0].value+ " at ("+origin.my_location.latitude+", "+origin.my_location.longitude+") "+ "with depth of "+origin.my_location.depth.value+" "+origin.my_location.depth.the_units); } catch (NoPreferredOrigin e) { logger.warn("No preferred origin for event "+i, e); } } /** Here are someof the possible problems that can occur. */ }catch (org.omg.CORBA.ORBPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (NotFound e) { logger.error("Problem with name service: ", e); }catch (CannotProceed e) { logger.error("Problem with name service: ", e); } /** All done... */ }
public static void main(String[] args) { /* Initializes the corba orb, finds the naming service and other startup * tasks. See AbstractClient for the code in this method. */ init(args); try { /** This step is not required, but sometimes helps to determine if * a server is down. if this call succedes but the next fails, then * the nameing service is up and functional, but the network server * is not reachable for some reason. */ Object obj = fisName.getEventDCObject("edu/iris/dmc", "IRIS_EventDC"); logger.info("Got as corba object, the name service is ok"); /** This connectts to the actual server, as oposed to just getting * the reference to it. The naming convention is that the first * part is the reversed DNS of the organization and the second part * is the individual server name. The dmc lists their servers under * the edu/iris/dmc and their main network server is IRIS_EventDC.*/ EventDC eventDC = fisName.getEventDC("edu/iris/dmc", "IRIS_EventDC"); logger.info("got EventDC"); /** The EventFinder is one of the choices at this point. It * allows you to query for individual events, and then retrieve * information about them. */ EventFinder finder = eventDC.a_finder(); logger.info("got EventFinder"); MicroSecondDate now = new MicroSecondDate(); MicroSecondDate yesterday = now.subtract(new TimeInterval(5, UnitImpl.DAY)); TimeRange timeRange = new TimeRange(now.getFissuresTime(), yesterday.getFissuresTime()); String[] magTypes = new String[1]; magTypes[0] = "ALL"; String[] catalogs = new String[1]; catalogs[0] = "FINGER"; String[] contributors = new String[1]; contributors[0] = "NEIC"; EventSeqIterHolder iter = new EventSeqIterHolder(); EventAccess[] events = finder.query_events(new GlobalAreaImpl(), new QuantityImpl(0, UnitImpl.KILOMETER), new QuantityImpl(1000, UnitImpl.KILOMETER), timeRange, magTypes, 5.0f, 10.0f, catalogs, contributors, 500, iter); logger.info("Got "+events.length+" events."); for (int i = 0; i < events.length; i++) { EventAttr attr = events[i].get_attributes(); try { Origin origin = events[i].get_preferred_origin(); logger.info("Event "+i+" occurred in FE region "+attr.region.number+ " at "+origin.origin_time.date_time+ " mag="+origin.magnitudes[0].type+" "+origin.magnitudes[0].value+ " at ("+origin.my_location.latitude+", "+origin.my_location.longitude+") "+ "with depth of "+origin.my_location.depth.value+" "+origin.my_location.depth.the_units); } catch (NoPreferredOrigin e) { logger.warn("No preferred origin for event "+i, e); } } /** Here are someof the possible problems that can occur. */ }catch (org.omg.CORBA.ORBPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { logger.error("Problem with name service: ", e); }catch (NotFound e) { logger.error("Problem with name service: ", e); }catch (CannotProceed e) { logger.error("Problem with name service: ", e); } /** All done... */ }
1,120,188
public void afterPhase(PhaseEvent arg0) { callMain(arg0.getFacesContext(),arg0.getFacesContext().getViewRoot()); }
public void afterPhase(PhaseEvent arg0) { callMainOnRoot(arg0.getFacesContext(),arg0.getFacesContext().getViewRoot()); }
1,120,189
protected void callMain(FacesContext context,UIViewRoot root){ log.fine("IWPhaseListener.callMain"); IWContext iwc = IWContext.getIWContext(context); //recurseMain(iwc,root); call_Main(iwc,root); }
protected void callMain(FacesContext context,UIViewRoot root){ log.fine("IWPhaseListener.callMain"); IWContext iwc = IWContext.getIWContext(context); //recurseMain(iwc,root); call_Main(iwc,root); }
1,120,190
protected void findNextInstanceOfNotPresentationObject(IWContext iwc, UIComponent comp) { if(comp!=null){ if(comp instanceof PresentationObject){ //List children = comp.getChildren(); //for (Iterator iter = children.iterator(); iter.hasNext();) { for (Iterator iter = comp.getFacetsAndChildren(); iter.hasNext();) { UIComponent child = (UIComponent) iter.next(); findNextInstanceOfNotPresentationObject(iwc,child); } } else{ //List children = comp.getChildren(); //for (Iterator iter = children.iterator(); iter.hasNext();) { for (Iterator iter = comp.getFacetsAndChildren(); iter.hasNext();) { UIComponent child = (UIComponent) iter.next(); call_Main(iwc,child); } } } }
protected void findNextInstanceOfNotPresentationObject(IWContext iwc, UIComponent comp) { if(comp!=null){ if(comp instanceof PresentationObject){ //List children = comp.getChildren(); //for (Iterator iter = children.iterator(); iter.hasNext();) { for (Iterator iter = comp.getFacetsAndChildren(); iter.hasNext();) { UIComponent child = (UIComponent) iter.next(); findNextInstanceOfNotPresentationObject(iwc,child); } } else{ //List children = comp.getChildren(); //for (Iterator iter = children.iterator(); iter.hasNext();) { for (Iterator iter = comp.getFacetsAndChildren(); iter.hasNext();) { UIComponent child = (UIComponent) iter.next(); call_Main(iwc,child); } } } }
1,120,191
public abstract void changeAccess(Object o, Collection aces) throws CalFacadeException;
public abstract void changeAccess(Object o, Collection aces) throws CalFacadeException;
1,120,192
public abstract Collection getAces(Object o) throws CalFacadeException;
public abstract Collection getAces(BwShareableDbentity ent) throws CalFacadeException;
1,120,193
public SeismogramShape (DataSetSeismogram seis, Color color, String name){ this.dss = seis; this.seis = seis.getSeismogram(); this.color = color; this.name = name; this.stat = new Statistics(this.seis); }
public SeismogramShape (DataSetSeismogram seis, Color color, String name){ this.dss = seis; this.seis = seis.getSeismogram(); this.color = color; this.name = name; this.stat = new Statistics(this.seis); }
1,120,195
public static LocalSeismogramImpl integrate(LocalSeismogramImpl seis) throws FissuresException { SamplingImpl samp = seis.getSampling(); double sampPeriod = samp.getPeriod().convertTo(UnitImpl.SECOND).getValue(); LocalSeismogramImpl outSeis; TimeSeriesType dataType = seis.getDataType(); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] data = seis.get_as_shorts(); short[] out = new short[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (short)Math.round((data[i]+data[i-1])/2.0 * sampPeriod); } outSeis = new LocalSeismogramImpl(seis, out); } else if (seis.can_convert_to_long()) { int[] data = seis.get_as_longs(); int[] out = new int[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (int)Math.round((data[i]+data[i-1])/2.0 * sampPeriod); } outSeis = new LocalSeismogramImpl(seis, out); } else if (seis.can_convert_to_float()) { float[] data = seis.get_as_floats(); float[] out = new float[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (float)((data[i]+data[i-1])/2.0 * sampPeriod); } outSeis = new LocalSeismogramImpl(seis, out); } else { // must be doubles double[] data = seis.get_as_doubles(); double[] out = new double[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (data[i]+data[i-1])/2.0 * sampPeriod; } outSeis = new LocalSeismogramImpl(seis, out); } // end of else outSeis.y_unit = UnitImpl.multiply(UnitImpl.createUnitImpl(outSeis.y_unit), UnitImpl.SECOND); return outSeis; }
public static LocalSeismogramImpl integrate(LocalSeismogramImpl seis) throws FissuresException { SamplingImpl samp = seis.getSampling(); double sampPeriod = samp.getPeriod().convertTo(UnitImpl.SECOND).getValue(); LocalSeismogramImpl outSeis; TimeSeriesType dataType = seis.getDataType(); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] data = seis.get_as_shorts(); short[] out = new short[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (short)Math.round((data[i]+data[i-1])/2.0 * sampPeriod); } outSeis = new LocalSeismogramImpl(seis, out); } else if (seis.can_convert_to_long()) { int[] data = seis.get_as_longs(); int[] out = new int[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (int)Math.round((data[i]+data[i-1])/2.0 * sampPeriod); } outSeis = new LocalSeismogramImpl(seis, out); } else if (seis.can_convert_to_float()) { float[] data = seis.get_as_floats(); float[] out = new float[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (float)((data[i]+data[i-1])/2.0 * sampPeriod); } outSeis = new LocalSeismogramImpl(seis, out); } else { // must be doubles double[] data = seis.get_as_doubles(); double[] out = new double[data.length]; out[0] = 0; for (int i=1; i<out.length; i++) { out[i] = (data[i]+data[i-1])/2.0 * sampPeriod; } outSeis = new LocalSeismogramImpl(seis, out); } // end of else outSeis.y_unit = UnitImpl.multiply(UnitImpl.createUnitImpl(outSeis.y_unit), UnitImpl.SECOND); return outSeis; }
1,120,197
private static Properties getPr() throws CalEnvException { if (pr != null) { return pr; } synchronized (lockit) { if (pr != null) { return pr; } /** Load properties file */ pr = new Properties(); InputStream is = null; try { try { // The jboss?? way - should work for others as well. ClassLoader cl = Thread.currentThread().getContextClassLoader(); is = cl.getResourceAsStream(propertiesFile); } catch (Throwable clt) {} if (is == null) { // Try another way is = CalEnv.class.getResourceAsStream(propertiesFile); } if (is == null) { throw new CalEnvException("Unable to load properties file" + propertiesFile); } pr.load(is); //if (debug) { // pr.list(System.out); // Logger.getLogger(CalEnv.class).debug( // "file.encoding=" + System.getProperty("file.encoding")); //} return pr; } catch (CalEnvException cee) { throw cee; } catch (Throwable t) { Logger.getLogger(CalEnv.class).error("getEnv error", t); throw new CalEnvException(t.getMessage()); } finally { if (is != null) { try { is.close(); } catch (Throwable t1) {} } } } }
private static Properties getPr() throws CalEnvException { if (pr != null) { return pr; } synchronized (lockit) { if (pr != null) { return pr; } /** Load properties file */ pr = new Properties(); InputStream is = null; try { try { // The jboss?? way - should work for others as well. ClassLoader cl = Thread.currentThread().getContextClassLoader(); is = cl.getResourceAsStream(propertiesFile); } catch (Throwable clt) {} if (is == null) { // Try another way is = CalEnv.class.getResourceAsStream(propertiesFile); } if (is == null) { throw new CalEnvException("Unable to load properties file" + propertiesFile); } pr.load(is); //if (debug) { // pr.list(System.out); // Logger.getLogger(CalEnv.class).debug( // "file.encoding=" + System.getProperty("file.encoding")); //} return pr; } catch (CalEnvException cee) { throw cee; } catch (Throwable t) { Logger.getLogger(CalEnv.class).error("getEnv error", t); throw new CalEnvException(t.getMessage()); } finally { if (is != null) { try { is.close(); } catch (Throwable t1) {} } } } }
1,120,198
public BwCalendar getCalendar() throws Throwable { if (!isPublic) { return getDefaultCalendar(); } if (publicCal != null) { return publicCal; } String calName = "Test public calendar"; BwCalendar root = getPublicCalendars(); // See if we already created the test calendar earler publicCal = getCalendar(root.getPath() + "/" + calName); if (publicCal != null) { return publicCal; } publicCal = new BwCalendar(); publicCal.setName(calName); publicCal.setPublick(true); publicCal.setCalendarCollection(true); addCalendar(publicCal, root); return publicCal; }
public BwCalendar getCalendar() throws Throwable { if (!isPublic) { return getPreferredCalendar(); } if (publicCal != null) { return publicCal; } String calName = "Test public calendar"; BwCalendar root = getPublicCalendars(); // See if we already created the test calendar earler publicCal = getCalendar(root.getPath() + "/" + calName); if (publicCal != null) { return publicCal; } publicCal = new BwCalendar(); publicCal.setName(calName); publicCal.setPublick(true); publicCal.setCalendarCollection(true); addCalendar(publicCal, root); return publicCal; }
1,120,199
public static List listOfDataClasses(){ try { return EntityFinder.findAllByColumn(((com.idega.core.component.data.ICObjectHome)com.idega.data.IDOLookup.getHomeLegacy(ICObject.class)).createLegacy(),com.idega.core.component.data.ICObjectBMPBean.getObjectTypeColumnName(),com.idega.core.component.data.ICObjectBMPBean.COMPONENT_TYPE_DATA); } catch (SQLException ex) { } return null; }
public static Collection listOfDataClasses(){ try { return EntityFinder.findAllByColumn(((com.idega.core.component.data.ICObjectHome)com.idega.data.IDOLookup.getHomeLegacy(ICObject.class)).createLegacy(),com.idega.core.component.data.ICObjectBMPBean.getObjectTypeColumnName(),com.idega.core.component.data.ICObjectBMPBean.COMPONENT_TYPE_DATA); } catch (SQLException ex) { } return null; }
1,120,200
public static List listOfDataClasses(){ try { return EntityFinder.findAllByColumn(((com.idega.core.component.data.ICObjectHome)com.idega.data.IDOLookup.getHomeLegacy(ICObject.class)).createLegacy(),com.idega.core.component.data.ICObjectBMPBean.getObjectTypeColumnName(),com.idega.core.component.data.ICObjectBMPBean.COMPONENT_TYPE_DATA); } catch (SQLException ex) { } return null; }
public static List listOfDataClasses(){ try { com.idega.core.component.data.ICObjectHome home = (com.idega.core.component.data.ICObjectHome) com.idega.data.IDOLookup.getHomeLegacy(ICObject.class); return home.findAllByObjectType(com.idega.core.component.data.ICObjectBMPBean.COMPONENT_TYPE_DATA); } catch (SQLException ex) { } return null; }
1,120,201
public static List listOfDataClasses(){ try { return EntityFinder.findAllByColumn(((com.idega.core.component.data.ICObjectHome)com.idega.data.IDOLookup.getHomeLegacy(ICObject.class)).createLegacy(),com.idega.core.component.data.ICObjectBMPBean.getObjectTypeColumnName(),com.idega.core.component.data.ICObjectBMPBean.COMPONENT_TYPE_DATA); } catch (SQLException ex) { } return null; }
public static List listOfDataClasses(){ try { return EntityFinder.findAllByColumn(((com.idega.core.component.data.ICObjectHome)com.idega.data.IDOLookup.getHomeLegacy(ICObject.class)).createLegacy(),com.idega.core.component.data.ICObjectBMPBean.getObjectTypeColumnName(),com.idega.core.component.data.ICObjectBMPBean.COMPONENT_TYPE_DATA); } catch (FinderException ex) { } return null; }
1,120,202
protected void createComponents() { //Initialize drawing colors, border, opacity. subPane.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.fill = gbc.HORIZONTAL; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.gridx = upperLeftX=0; gbc.gridy = upperLeftY=0; add(subPane); add(Box.createRigidArea(new Dimension(0, 10))); setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); }
protected void createComponents() { //Initialize drawing colors, border, opacity. subPane.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.gridx = upperLeftX=0; gbc.gridy = upperLeftY=0; add(subPane); add(Box.createRigidArea(new Dimension(0, 10))); setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); }
1,120,203
private void dateChanged(){ updateToday(); int todaysYear = todayCalendar.get(Calendar.YEAR); int calJulianDay = calendar.get(Calendar.DAY_OF_YEAR); int todaysJulianDay = todayCalendar.get(Calendar.DAY_OF_YEAR); int calYear = calendar.get(Calendar.YEAR); otherButton.setSelected(true); if(calYear == todaysYear){ yearBox.setSelectedIndex(0); if(todaysJulianDay == calJulianDay){ todayButton.setSelected(true); } if(calJulianDay == todaysJulianDay-1 ){ yesButton.setSelected(true); } } else { int indexofyear = todaysYear - calYear; yearBox.setSelectedIndex(indexofyear); } if(monthBox != null) monthBox.setSelectedIndex(calendar.get(Calendar.MONTH)); if(dayBox != null) dayBox.setSelectedIndex(calendar.get(Calendar.DAY_OF_MONTH) - 1); if(hourBox != null) hourBox.setSelectedIndex(calendar.get(Calendar.HOUR_OF_DAY)); if(minuteBox != null) minuteBox.setSelectedIndex(calendar.get(Calendar.MINUTE)); if(secondBox != null) secondBox.setSelectedIndex(calendar.get(Calendar.SECOND)); repaint(); }
private void dateChanged(){ updateToday(); int todaysYear = todayCalendar.get(Calendar.YEAR); int calJulianDay = calendar.get(Calendar.DAY_OF_YEAR); int todaysJulianDay = todayCalendar.get(Calendar.DAY_OF_YEAR); int calYear = calendar.get(Calendar.YEAR); otherButton.setSelected(true); if(calYear == todaysYear){ if(yearBox != null) yearBox.setSelectedIndex(0); if(todaysJulianDay == calJulianDay){ todayButton.setSelected(true); } if(calJulianDay == todaysJulianDay-1 ){ yesButton.setSelected(true); } } else { int indexofyear = todaysYear - calYear; yearBox.setSelectedIndex(indexofyear); } if(monthBox != null) monthBox.setSelectedIndex(calendar.get(Calendar.MONTH)); if(dayBox != null) dayBox.setSelectedIndex(calendar.get(Calendar.DAY_OF_MONTH) - 1); if(hourBox != null) hourBox.setSelectedIndex(calendar.get(Calendar.HOUR_OF_DAY)); if(minuteBox != null) minuteBox.setSelectedIndex(calendar.get(Calendar.MINUTE)); if(secondBox != null) secondBox.setSelectedIndex(calendar.get(Calendar.SECOND)); repaint(); }
1,120,204
private static ATObject invokeUniqueSymbioticMethod(Object symbiont, Method javaMethod, Object[] jArgs) throws InterpreterException { try { return Symbiosis.javaToAmbientTalk(javaMethod.invoke(symbiont, jArgs)); } catch (IllegalAccessException e) { // the invoked method is not publicly accessible throw new XReflectionFailure("Java method "+Reflection.downSelector(javaMethod.getName()) + " is not accessible.", e); } catch (IllegalArgumentException e) { // illegal argument types were supplied, should not happen because the conversion should have already failed earlier (in atArgsToJavaArgs) throw new RuntimeException("[broken at2java conversion?] Illegal argument for Java method "+javaMethod.getName(), e); } catch (InvocationTargetException e) { // the invoked method threw an exception if (e.getCause() instanceof InterpreterException) throw (InterpreterException) e.getCause(); else if (e.getCause() instanceof Signal) { throw (Signal) e.getCause(); } else { throw new XJavaException(symbiont, javaMethod, e.getCause()); } } }
private static ATObject invokeUniqueSymbioticMethod(Object symbiont, Method javaMethod, Object[] jArgs) throws InterpreterException { try { return Symbiosis.javaToAmbientTalk(javaMethod.invoke(symbiont, jArgs)); } catch (IllegalAccessException e) { // the invoked method is not publicly accessible Method interfaceMethod = toInterfaceMethod(javaMethod); if (interfaceMethod == null) { throw new XReflectionFailure("Java method "+Reflection.downSelector(javaMethod.getName()) + " is not accessible.", e); } else { return invokeUniqueSymbioticMethod(symbiont, interfaceMethod, jArgs); } } catch (IllegalArgumentException e) { // illegal argument types were supplied, should not happen because the conversion should have already failed earlier (in atArgsToJavaArgs) throw new RuntimeException("[broken at2java conversion?] Illegal argument for Java method "+javaMethod.getName(), e); } catch (InvocationTargetException e) { // the invoked method threw an exception if (e.getCause() instanceof InterpreterException) throw (InterpreterException) e.getCause(); else if (e.getCause() instanceof Signal) { throw (Signal) e.getCause(); } else { throw new XJavaException(symbiont, javaMethod, e.getCause()); } } }
1,120,205
private boolean doCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, int currentMode, boolean ignoreCreator, boolean allCalendars) throws CalFacadeException { /* if no calendar set if public SEG: publicf=true else SEG: user=? */ if (calendar == null) { return CalintfUtil.appendPublicOrCreatorTerm(sb, qevName, currentMode, ignoreCreator); } if (calendar.getCalendarCollection()) { // Single leaf calendar - always include sb.append("("); sb.append(qevName); sb.append(".calendar=:calendar"); sb.append(") "); return false; } // Non leaf - build a query sb.append("("); appendCalendarClause(sb, qevName, calendar, new CalTerm(), allCalendars); sb.append(") "); return false; }
private boolean doCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, int currentMode, boolean ignoreCreator, boolean allCalendars) throws CalFacadeException { /* if no calendar set if public SEG: publicf=true else SEG: user=? */ if (calendar == null) { return CalintfUtil.appendPublicOrCreatorTerm(sb, qevName, currentMode, ignoreCreator); } if (calendar.getCalendarCollection()) { // Single leaf calendar - always include sb.append("("); sb.append(qevName); sb.append(".calendar=:calendar"); sb.append(") "); return false; } // Non leaf - build a query sb.append("("); appendCalendarClause(sb, qevName, calendar, calTerm, allCalendars); sb.append(") "); return false; }
1,120,207
public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval, boolean freeBusy, boolean allCalendars) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); if (debug) { trace("getEvents for start=" + startDate + " end=" + endDate); } /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); // XXX we should do the following for both events and annotations /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /*if (freeBusy) { sb.append(qevName); sb.append(".transparency != :transparency and "); }*/ /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, cal.getSuperUser(), allCalendars); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); /* XXX Limit result set size - pagination allows something like: query.setFirstResult(0); query.setMaxResults(10); */ if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } //if (freeBusy) { // sess.setString("transparency", "TRANSPARENT"); //} doCalendarEntities(setUser, calendar, allCalendars); flt.parPass(sess); if (debug) { trace(sess.getQueryString()); } Collection ceis = sess.getList(); if (debug) { trace("Found " + ceis.size() + " events"); } int desiredAccess = privRead; if (freeBusy) { desiredAccess = privReadFreeBusy; } ceis = postGetEvents(ceis, desiredAccess, noAccessReturnsNull, freeBusy); /** Run the events we got through the filters */ ceis = flt.postExec(ceis); Collection rceis = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, cal.getSuperUser(), recurRetrieval, freeBusy, allCalendars); if (rceis != null) { ceis.addAll(rceis); } return ceis; }
public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval, boolean freeBusy, boolean allCalendars) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); if (debug) { trace("getEvents for start=" + startDate + " end=" + endDate); } /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); // XXX we should do the following for both events and annotations /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /*if (freeBusy) { sb.append(qevName); sb.append(".transparency != :transparency and "); }*/ /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, cal.getSuperUser(), calTerm, allCalendars); if (calTerm.empty) { return new TreeSet(); } sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); /* XXX Limit result set size - pagination allows something like: query.setFirstResult(0); query.setMaxResults(10); */ if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } //if (freeBusy) { // sess.setString("transparency", "TRANSPARENT"); //} doCalendarEntities(setUser, calendar, calTerm, allCalendars); if (calTerm.empty) { return new TreeSet(); } flt.parPass(sess); if (debug) { trace(sess.getQueryString()); } Collection ceis = sess.getList(); if (debug) { trace("Found " + ceis.size() + " events"); } int desiredAccess = privRead; if (freeBusy) { desiredAccess = privReadFreeBusy; } ceis = postGetEvents(ceis, desiredAccess, noAccessReturnsNull, freeBusy); /** Run the events we got through the filters */ ceis = flt.postExec(ceis); Collection rceis = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, cal.getSuperUser(), recurRetrieval, freeBusy, calTerm, allCalendars); if (calTerm.empty) { return new TreeSet(); } if (rceis != null) { ceis.addAll(rceis); } return ceis; }
1,120,208
private Collection getLimitedRecurrences(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int currentMode, boolean ignoreCreator, int recurRetrieval, boolean freeBusy, boolean allCalendars) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); /* Name of the event in the query */ final String qevName = "evr"; Filters flt = new Filters(filter, sb, qevName + ".master", debug); /* SEG: from recurrences evr where */ sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and Note that we store the string version of the date only so this looks different than for regular events. */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName + ".master", calendar, currentMode, ignoreCreator, allCalendars); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // debugMsg("recurrences query is " + sb); //} sess.createQuery(sb.toString()); if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar, allCalendars); flt.parPass(sess); Collection rs = sess.getList(); //if (debug) { // debugMsg("recurrences query found " + rs.size()); //} /* We have a collection of recurrence instances, each of which has a * master event attached. For each unique master we should check it's * validity. We will maintain a table of ids we have checked and the result * so we only check once. * * We also handle the processing of the recurRetrieval parameter here. */ CheckMap checked = new CheckMap(); TreeSet ceis = new TreeSet(); Iterator it = rs.iterator(); while (it.hasNext()) { BwRecurrenceInstance inst = (BwRecurrenceInstance)it.next(); /* XXX should have a list of overrides that cover */ CoreEventInfo cei = makeProxy(inst, null, checked, recurRetrieval, freeBusy); if (cei != null) { //if (debug) { // debugMsg("Ev: " + proxy); //} ceis.add(cei); } } //if (debug) { // debugMsg("recurrences after postexec " + evs.size()); //} /** Run the events we got through the filters */ return flt.postExec(ceis); }
private Collection getLimitedRecurrences(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int currentMode, boolean ignoreCreator, int recurRetrieval, boolean freeBusy, boolean allCalendars) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); /* Name of the event in the query */ final String qevName = "evr"; Filters flt = new Filters(filter, sb, qevName + ".master", debug); /* SEG: from recurrences evr where */ sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and Note that we store the string version of the date only so this looks different than for regular events. */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName + ".master", calendar, currentMode, ignoreCreator, calTerm, allCalendars); if (calTerm.empty) { throw new CalFacadeException("No valid calendars."); } sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // debugMsg("recurrences query is " + sb); //} sess.createQuery(sb.toString()); if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar, calTerm, allCalendars); if (calTerm.empty) { throw new CalFacadeException("No valid calendars."); } flt.parPass(sess); Collection rs = sess.getList(); //if (debug) { // debugMsg("recurrences query found " + rs.size()); //} /* We have a collection of recurrence instances, each of which has a * master event attached. For each unique master we should check it's * validity. We will maintain a table of ids we have checked and the result * so we only check once. * * We also handle the processing of the recurRetrieval parameter here. */ CheckMap checked = new CheckMap(); TreeSet ceis = new TreeSet(); Iterator it = rs.iterator(); while (it.hasNext()) { BwRecurrenceInstance inst = (BwRecurrenceInstance)it.next(); /* XXX should have a list of overrides that cover */ CoreEventInfo cei = makeProxy(inst, null, checked, recurRetrieval, freeBusy); if (cei != null) { //if (debug) { // debugMsg("Ev: " + proxy); //} ceis.add(cei); } } //if (debug) { // debugMsg("recurrences after postexec " + evs.size()); //} /** Run the events we got through the filters */ return flt.postExec(ceis); }
1,120,209
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } CalSvcI svci = form.getCalSvcI(); svci.getUserAuth().removeAuth(getAuthUser(form)); form.getMsg().emit("org.bedework.pubevents.message.authuser.removed"); return "continue"; }
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } CalSvcI svci = form.getCalSvcI(); svci.getUserAuth().removeAuth(getAuthUser(form)); form.getMsg().emit("org.bedework.client.message.authuser.removed"); return "continue"; }
1,120,210
protected Command getCreateStartOutgoingExtension4002Command(CreateRelationshipRequest req) { EObject sourceEObject = req.getSource(); EObject targetEObject = req.getTarget(); if (false == sourceEObject instanceof Stereotype || (targetEObject != null && false == targetEObject instanceof ElementImport)) { return UnexecutableCommand.INSTANCE; } Stereotype source = (Stereotype) sourceEObject; ElementImport target = (ElementImport) targetEObject; org.eclipse.uml2.uml.Package container = (org.eclipse.uml2.uml.Package) getRelationshipContainer(source, UMLPackage.eINSTANCE.getPackage(), req.getElementType()); if (container == null) { return UnexecutableCommand.INSTANCE; } if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateExtension_4002(container, source, target)) { return UnexecutableCommand.INSTANCE; } return new Command() { }; }
protected Command getCreateStartOutgoingExtension4002Command(CreateRelationshipRequest req) { EObject sourceEObject = req.getSource(); EObject targetEObject = req.getTarget(); if (false == sourceEObject instanceof Stereotype || (targetEObject != null && false == targetEObject instanceof ElementImport)) { return UnexecutableCommand.INSTANCE; } Stereotype source = (Stereotype) sourceEObject; ElementImport target = (ElementImport) targetEObject; Package container = (Package) getRelationshipContainer(source, UMLPackage.eINSTANCE.getPackage(), req.getElementType()); if (container == null) { return UnexecutableCommand.INSTANCE; } if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateExtension_4002(container, source, target)) { return UnexecutableCommand.INSTANCE; } return new Command() { }; }
1,120,211
private boolean validateAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } /* We should see if somebody tried to change the name of the group */ updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if ((adminGroupGroupOwner != null) && (!adminGroupGroupOwner.equals(updAdminGroup.getGroupOwner().getAccount()))) { BwUser aggo = svci.findUser(adminGroupGroupOwner); if (aggo == null) { form.getErr().emit("org.bedework.pubevents.error.notfound", adminGroupGroupOwner); return false; } updAdminGroup.setGroupOwner(aggo); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { // no change return ok; } if (adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { // no change return ok; } String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } if (!adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { BwUser ageo = svci.findUser(adminGroupEventOwner); if (ageo == null) { form.getErr().emit("org.bedework.pubevents.error.notfound", adminGroupEventOwner); return false; } updAdminGroup.setOwner(ageo); } return ok; }
private boolean validateAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } /* We should see if somebody tried to change the name of the group */ updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.client.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if ((adminGroupGroupOwner != null) && (!adminGroupGroupOwner.equals(updAdminGroup.getGroupOwner().getAccount()))) { BwUser aggo = svci.findUser(adminGroupGroupOwner); if (aggo == null) { form.getErr().emit("org.bedework.pubevents.error.notfound", adminGroupGroupOwner); return false; } updAdminGroup.setGroupOwner(aggo); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { // no change return ok; } if (adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { // no change return ok; } String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } if (!adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { BwUser ageo = svci.findUser(adminGroupEventOwner); if (ageo == null) { form.getErr().emit("org.bedework.pubevents.error.notfound", adminGroupEventOwner); return false; } updAdminGroup.setOwner(ageo); } return ok; }
1,120,212
private boolean validateAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } /* We should see if somebody tried to change the name of the group */ updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if ((adminGroupGroupOwner != null) && (!adminGroupGroupOwner.equals(updAdminGroup.getGroupOwner().getAccount()))) { BwUser aggo = svci.findUser(adminGroupGroupOwner); if (aggo == null) { form.getErr().emit("org.bedework.pubevents.error.notfound", adminGroupGroupOwner); return false; } updAdminGroup.setGroupOwner(aggo); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { // no change return ok; } if (adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { // no change return ok; } String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } if (!adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { BwUser ageo = svci.findUser(adminGroupEventOwner); if (ageo == null) { form.getErr().emit("org.bedework.pubevents.error.notfound", adminGroupEventOwner); return false; } updAdminGroup.setOwner(ageo); } return ok; }
private boolean validateAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } /* We should see if somebody tried to change the name of the group */ updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if ((adminGroupGroupOwner != null) && (!adminGroupGroupOwner.equals(updAdminGroup.getGroupOwner().getAccount()))) { BwUser aggo = svci.findUser(adminGroupGroupOwner); if (aggo == null) { form.getErr().emit("org.bedework.client.error.usernotfound", adminGroupGroupOwner); return false; } updAdminGroup.setGroupOwner(aggo); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { // no change return ok; } if (adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { // no change return ok; } String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } if (!adminGroupEventOwner.equals(updAdminGroup.getOwner().getAccount())) { BwUser ageo = svci.findUser(adminGroupEventOwner); if (ageo == null) { form.getErr().emit("org.bedework.client.error.usernotfound", adminGroupEventOwner); return false; } updAdminGroup.setOwner(ageo); } return ok; }
1,120,213
private boolean validateNewAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } updAdminGroup.setAccount(Util.checkNull(updAdminGroup.getAccount())); if (updAdminGroup.getAccount() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "Name"); ok = false; } updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if (adminGroupGroupOwner == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "groupOwnerid"); ok = false; } else { updAdminGroup.setGroupOwner(getUser(svci, adminGroupGroupOwner)); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { adminGroupEventOwner = updAdminGroup.getAccount(); } if (adminGroupEventOwner == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "eventOwnerid"); ok = false; } else { String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } updAdminGroup.setOwner(getUser(svci, adminGroupEventOwner)); } return ok; }
private boolean validateNewAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } updAdminGroup.setAccount(Util.checkNull(updAdminGroup.getAccount())); if (updAdminGroup.getAccount() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "Name"); ok = false; } updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if (adminGroupGroupOwner == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "groupOwnerid"); ok = false; } else { updAdminGroup.setGroupOwner(getUser(svci, adminGroupGroupOwner)); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { adminGroupEventOwner = updAdminGroup.getAccount(); } if (adminGroupEventOwner == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "eventOwnerid"); ok = false; } else { String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } updAdminGroup.setOwner(getUser(svci, adminGroupEventOwner)); } return ok; }
1,120,214
private boolean validateNewAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } updAdminGroup.setAccount(Util.checkNull(updAdminGroup.getAccount())); if (updAdminGroup.getAccount() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "Name"); ok = false; } updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if (adminGroupGroupOwner == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "groupOwnerid"); ok = false; } else { updAdminGroup.setGroupOwner(getUser(svci, adminGroupGroupOwner)); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { adminGroupEventOwner = updAdminGroup.getAccount(); } if (adminGroupEventOwner == null) { form.getErr().emit("org.bedework.pubevents.error.missingfield", "eventOwnerid"); ok = false; } else { String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } updAdminGroup.setOwner(getUser(svci, adminGroupEventOwner)); } return ok; }
private boolean validateNewAdminGroup(PEActionForm form) throws Throwable { boolean ok = true; CalSvcI svci = form.getCalSvcI(); BwAdminGroup updAdminGroup = form.getUpdAdminGroup(); if (updAdminGroup == null) { // bogus call. return false; } updAdminGroup.setAccount(Util.checkNull(updAdminGroup.getAccount())); if (updAdminGroup.getAccount() == null) { form.getErr().emit("org.bedework.client.error.missingfield", "Name"); ok = false; } updAdminGroup.setDescription(Util.checkNull(updAdminGroup.getDescription())); if (updAdminGroup.getDescription() == null) { form.getErr().emit("org.bedework.client.error.missingfield", "description"); ok = false; } String adminGroupGroupOwner = Util.checkNull(form.getAdminGroupGroupOwner()); if (adminGroupGroupOwner == null) { form.getErr().emit("org.bedework.client.error.missingfield", "groupOwnerid"); ok = false; } else { updAdminGroup.setGroupOwner(getUser(svci, adminGroupGroupOwner)); } String adminGroupEventOwner = Util.checkNull(form.getAdminGroupEventOwner()); if (adminGroupEventOwner == null) { adminGroupEventOwner = updAdminGroup.getAccount(); } if (adminGroupEventOwner == null) { form.getErr().emit("org.bedework.client.error.missingfield", "eventOwnerid"); ok = false; } else { String prefix = getEnv(form).getAppProperty("app.admingroupsidprefix"); if (!adminGroupEventOwner.startsWith(prefix)) { adminGroupEventOwner = prefix + adminGroupEventOwner; } updAdminGroup.setOwner(getUser(svci, adminGroupEventOwner)); } return ok; }
1,120,215
public static void copyAttributes(Element destElement, Element srcElement) { NamedNodeMap attribs = srcElement.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String uri = attr.getNamespaceURI(); String qname = attr.getName(); String value = attr.getNodeValue(); // Prevent DOMException: NAMESPACE_ERR: An attempt is made to create or // change an object in a way which is incorrect with regard to namespaces. if (("xmlns".equals(qname) && "".equals(value)) == false) destElement.setAttributeNS(uri, qname, value); } }
public static void copyAttributes(Element destElement, Element srcElement) { NamedNodeMap attribs = srcElement.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String uri = attr.getNamespaceURI(); String qname = attr.getName(); String value = attr.getNodeValue(); // Prevent DOMException: NAMESPACE_ERR: An attempt is made to create or // change an object in a way which is incorrect with regard to namespaces. if (uri == null && qname.startsWith("xmlns")) { log.trace("Ignore attribute: [uri=" + uri + ",qname=" + qname + ",value=" + value + "]"); } else { destElement.setAttributeNS(uri, qname, value); } }
1,120,216
public Map mergeAttributes(Map toModify, Map toConsider) { if (toModify == null) throw new IllegalArgumentException("toModify argument illegally null."); if (toConsider == null) throw new IllegalArgumentException("toConsider argument illegally null."); for (Iterator iter = toConsider.keySet().iterator(); iter.hasNext();){ String key = (String) iter.next(); if (! toModify.containsKey(key)) toModify.put(key, toConsider.get(key)); } return toModify; }
public Map mergeAttributes(Map toModify, Map toConsider) { if (toModify == null) throw new IllegalArgumentException("toModify argument illegally null."); if (toConsider == null) throw new IllegalArgumentException("toConsider argument illegally null."); for (Iterator iter = toConsider.keySet().iterator(); iter.hasNext();){ String key = (String) iter.next(); if (! toModify.containsKey(key)) toModify.put(key, toConsider.get(key)); } return toModify; }
1,120,218
public Events(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, user, currentMode, ignoreCreator, debug); }
public Events(Calintf cal, AccessUtil access, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, user, currentMode, ignoreCreator, debug); }
1,120,219
public Events(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, user, currentMode, ignoreCreator, debug); }
public Events(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, currentMode, ignoreCreator, debug); }
1,120,220
private void addOverride(BwEventProxy proxy, BwRecurrenceInstance inst) throws CalFacadeException { BwEventAnnotation override = proxy.getRef(); override.setOwner(user); getSess().saveOrUpdate(override); inst.setOverride(override); }
private void addOverride(BwEventProxy proxy, BwRecurrenceInstance inst) throws CalFacadeException { BwEventAnnotation override = proxy.getRef(); override.setOwner(getUser()); getSess().saveOrUpdate(override); inst.setOverride(override); }
1,120,221
private void doCalendarEntities(boolean setUser, BwCalendar calendar) throws CalFacadeException { HibSession sess = getSess(); if (setUser) { sess.setEntity("user", user); } if (calendar != null) { if (calendar.getCalendarCollection()) { // Single leaf calendar sess.setEntity("calendar", calendar); } else { // Non leaf - add entities setCalendarEntities(calendar, new CalTerm()); } } }
private void doCalendarEntities(boolean setUser, BwCalendar calendar) throws CalFacadeException { HibSession sess = getSess(); if (setUser) { sess.setEntity("user", getUser()); } if (calendar != null) { if (calendar.getCalendarCollection()) { // Single leaf calendar sess.setEntity("calendar", calendar); } else { // Non leaf - add entities setCalendarEntities(calendar, new CalTerm()); } } }
1,120,222
public boolean editable(BwEvent val) throws CalFacadeException { if (currentMode == CalintfUtil.guestMode) { return false; } if (val.getPublick() != (currentMode == CalintfUtil.publicAdminMode)) { return false; } return user.equals(val.getCreator()); }
public boolean editable(BwEvent val) throws CalFacadeException { if (currentMode == CalintfUtil.guestMode) { return false; } if (val.getPublick() != (currentMode == CalintfUtil.publicAdminMode)) { return false; } return getUser().equals(val.getCreator()); }
1,120,223
private BwEventProxy makeProxy(BwRecurrenceInstance inst, BwEventAnnotation override, CheckMap checked, int recurRetrieval) throws CalFacadeException { BwEvent mstr; if (inst != null) { mstr = inst.getMaster(); } else { mstr = override.getTarget(); } int res = 0; if (checked != null) { res = checked.test(mstr); if (res < 0) { // failed return null; } } if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) && (checked != null) && (res != 0)) { // Master only and we've already seen it return null; } if ((checked == null) || (res == 0)) { // untested if (!access.accessible(mstr, privRead, noAccessReturnsNull)) { if (checked != null) { checked.setChecked(mstr, false); } return null; } } if (checked != null) { checked.setChecked(mstr, true); } if (recurRetrieval == CalFacadeDefs.retrieveRecurMaster) { // Master only and we've just seen it for the first time /* XXX I think this was wrong. Why make an override? */ // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); BwDateTime start = mstr.getDtstart(); BwDateTime end = mstr.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(user); return new BwEventProxy(override); } /* success so now we build a proxy with the event and any override. */ if (override == null) { if (recurRetrieval == CalFacadeDefs.retrieveRecurOverrides) { // Master and overrides only return null; } /* XXX The instance could point to an overrride if the owner of the event changed an instance. */ BwEventAnnotation instOverride = inst.getOverride(); boolean newOverride = true; if (instOverride != null) { if (instOverride.getOwner().equals(user)) { // It's our own override. override = instOverride; newOverride = false; } else { // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(instOverride); override.setMaster(instOverride); } } else { // make a fake one pointing at the master event override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); } if (newOverride) { BwDateTime start = inst.getDtstart(); BwDateTime end = inst.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(user); override.getRecurrence().setRecurrenceId(inst.getRecurrenceId()); override.setRecurrenceChanged(true); } } return new BwEventProxy(override); }
private BwEventProxy makeProxy(BwRecurrenceInstance inst, BwEventAnnotation override, CheckMap checked, int recurRetrieval) throws CalFacadeException { BwEvent mstr; if (inst != null) { mstr = inst.getMaster(); } else { mstr = override.getTarget(); } int res = 0; if (checked != null) { res = checked.test(mstr); if (res < 0) { // failed return null; } } if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) && (checked != null) && (res != 0)) { // Master only and we've already seen it return null; } if ((checked == null) || (res == 0)) { // untested if (!access.accessible(mstr, privRead, noAccessReturnsNull)) { if (checked != null) { checked.setChecked(mstr, false); } return null; } } if (checked != null) { checked.setChecked(mstr, true); } if (recurRetrieval == CalFacadeDefs.retrieveRecurMaster) { // Master only and we've just seen it for the first time /* XXX I think this was wrong. Why make an override? */ // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); BwDateTime start = mstr.getDtstart(); BwDateTime end = mstr.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(getUser()); return new BwEventProxy(override); } /* success so now we build a proxy with the event and any override. */ if (override == null) { if (recurRetrieval == CalFacadeDefs.retrieveRecurOverrides) { // Master and overrides only return null; } /* XXX The instance could point to an overrride if the owner of the event changed an instance. */ BwEventAnnotation instOverride = inst.getOverride(); boolean newOverride = true; if (instOverride != null) { if (instOverride.getOwner().equals(user)) { // It's our own override. override = instOverride; newOverride = false; } else { // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(instOverride); override.setMaster(instOverride); } } else { // make a fake one pointing at the master event override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); } if (newOverride) { BwDateTime start = inst.getDtstart(); BwDateTime end = inst.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(getUser()); override.getRecurrence().setRecurrenceId(inst.getRecurrenceId()); override.setRecurrenceChanged(true); } } return new BwEventProxy(override); }
1,120,224
private BwEventProxy makeProxy(BwRecurrenceInstance inst, BwEventAnnotation override, CheckMap checked, int recurRetrieval) throws CalFacadeException { BwEvent mstr; if (inst != null) { mstr = inst.getMaster(); } else { mstr = override.getTarget(); } int res = 0; if (checked != null) { res = checked.test(mstr); if (res < 0) { // failed return null; } } if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) && (checked != null) && (res != 0)) { // Master only and we've already seen it return null; } if ((checked == null) || (res == 0)) { // untested if (!access.accessible(mstr, privRead, noAccessReturnsNull)) { if (checked != null) { checked.setChecked(mstr, false); } return null; } } if (checked != null) { checked.setChecked(mstr, true); } if (recurRetrieval == CalFacadeDefs.retrieveRecurMaster) { // Master only and we've just seen it for the first time /* XXX I think this was wrong. Why make an override? */ // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); BwDateTime start = mstr.getDtstart(); BwDateTime end = mstr.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(user); return new BwEventProxy(override); } /* success so now we build a proxy with the event and any override. */ if (override == null) { if (recurRetrieval == CalFacadeDefs.retrieveRecurOverrides) { // Master and overrides only return null; } /* XXX The instance could point to an overrride if the owner of the event changed an instance. */ BwEventAnnotation instOverride = inst.getOverride(); boolean newOverride = true; if (instOverride != null) { if (instOverride.getOwner().equals(user)) { // It's our own override. override = instOverride; newOverride = false; } else { // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(instOverride); override.setMaster(instOverride); } } else { // make a fake one pointing at the master event override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); } if (newOverride) { BwDateTime start = inst.getDtstart(); BwDateTime end = inst.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(user); override.getRecurrence().setRecurrenceId(inst.getRecurrenceId()); override.setRecurrenceChanged(true); } } return new BwEventProxy(override); }
private BwEventProxy makeProxy(BwRecurrenceInstance inst, BwEventAnnotation override, CheckMap checked, int recurRetrieval) throws CalFacadeException { BwEvent mstr; if (inst != null) { mstr = inst.getMaster(); } else { mstr = override.getTarget(); } int res = 0; if (checked != null) { res = checked.test(mstr); if (res < 0) { // failed return null; } } if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) && (checked != null) && (res != 0)) { // Master only and we've already seen it return null; } if ((checked == null) || (res == 0)) { // untested if (!access.accessible(mstr, privRead, noAccessReturnsNull)) { if (checked != null) { checked.setChecked(mstr, false); } return null; } } if (checked != null) { checked.setChecked(mstr, true); } if (recurRetrieval == CalFacadeDefs.retrieveRecurMaster) { // Master only and we've just seen it for the first time /* XXX I think this was wrong. Why make an override? */ // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); BwDateTime start = mstr.getDtstart(); BwDateTime end = mstr.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(user); return new BwEventProxy(override); } /* success so now we build a proxy with the event and any override. */ if (override == null) { if (recurRetrieval == CalFacadeDefs.retrieveRecurOverrides) { // Master and overrides only return null; } /* XXX The instance could point to an overrride if the owner of the event changed an instance. */ BwEventAnnotation instOverride = inst.getOverride(); boolean newOverride = true; if (instOverride != null) { if (instOverride.getOwner().equals(getUser())) { // It's our own override. override = instOverride; newOverride = false; } else { // make a fake one pointing at the owners override override = new BwEventAnnotation(); override.setTarget(instOverride); override.setMaster(instOverride); } } else { // make a fake one pointing at the master event override = new BwEventAnnotation(); override.setTarget(mstr); override.setMaster(mstr); } if (newOverride) { BwDateTime start = inst.getDtstart(); BwDateTime end = inst.getDtend(); override.setDtstart(start); override.setDtend(end); override.setDuration(BwDateTime.makeDuration(start, end).toString()); override.setCreator(mstr.getCreator()); override.setOwner(user); override.getRecurrence().setRecurrenceId(inst.getRecurrenceId()); override.setRecurrenceChanged(true); } } return new BwEventProxy(override); }
1,120,225
public void updateEvent(BwEvent val) throws CalFacadeException { HibSession sess = getSess(); if (!(val instanceof BwEventProxy)) { sess.saveOrUpdate(val); if (val.getRecurring()) { /* Check the instances and see if any changes need to be made. */ updateRecurrences(val); } return; } /* Save the annotation. */ BwEventProxy proxy = (BwEventProxy)val; if (!proxy.getRefChanged()) { return; } /* if this is a proxy for a recurrence instance of our own event then the recurrence instance should point at this override. Otherwise we just update the event annotation. */ BwEventAnnotation override = proxy.getRef(); if (debug) { debugMsg("Update override event " + override); } BwEvent mstr = override.getTarget(); while (mstr instanceof BwEventAnnotation) { /* XXX The master may itself be an annotated event. We should really stop when we get to that point */ /* BwEventProxy tempProxy = new BwEventProxy(mstr); if (some-condition-holds) { break; } */ mstr = ((BwEventAnnotation)mstr).getTarget(); } if (mstr.getOwner().equals(user) && mstr.getRecurring()) { // Our own and a recurring event - retrieve the instance // from the recurrences table StringBuffer sb = new StringBuffer(); sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" rec "); sb.append(" where rec.master=:mstr "); sb.append(" and rec.recurrenceId=:rid "); sess.createQuery(sb.toString()); sess.setEntity("mstr", mstr); sess.setString("rid", override.getRecurrence().getRecurrenceId()); BwRecurrenceInstance inst = (BwRecurrenceInstance)sess.getUnique(); if (inst == null) { throw new CalFacadeException("Cannot locate instance for " + mstr + "with recurrence id " + override.getRecurrence().getRecurrenceId()); } sess.saveOrUpdate(override);// sess.flush(); if (inst.getOverride() == null) { inst.setOverride(override); sess.saveOrUpdate(inst); } } else { sess.saveOrUpdate(override); } proxy.setRefChanged(false); }
public void updateEvent(BwEvent val) throws CalFacadeException { HibSession sess = getSess(); if (!(val instanceof BwEventProxy)) { sess.saveOrUpdate(val); if (val.getRecurring()) { /* Check the instances and see if any changes need to be made. */ updateRecurrences(val); } return; } /* Save the annotation. */ BwEventProxy proxy = (BwEventProxy)val; if (!proxy.getRefChanged()) { return; } /* if this is a proxy for a recurrence instance of our own event then the recurrence instance should point at this override. Otherwise we just update the event annotation. */ BwEventAnnotation override = proxy.getRef(); if (debug) { debugMsg("Update override event " + override); } BwEvent mstr = override.getTarget(); while (mstr instanceof BwEventAnnotation) { /* XXX The master may itself be an annotated event. We should really stop when we get to that point */ /* BwEventProxy tempProxy = new BwEventProxy(mstr); if (some-condition-holds) { break; } */ mstr = ((BwEventAnnotation)mstr).getTarget(); } if (mstr.getOwner().equals(getUser()) && mstr.getRecurring()) { // Our own and a recurring event - retrieve the instance // from the recurrences table StringBuffer sb = new StringBuffer(); sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" rec "); sb.append(" where rec.master=:mstr "); sb.append(" and rec.recurrenceId=:rid "); sess.createQuery(sb.toString()); sess.setEntity("mstr", mstr); sess.setString("rid", override.getRecurrence().getRecurrenceId()); BwRecurrenceInstance inst = (BwRecurrenceInstance)sess.getUnique(); if (inst == null) { throw new CalFacadeException("Cannot locate instance for " + mstr + "with recurrence id " + override.getRecurrence().getRecurrenceId()); } sess.saveOrUpdate(override);// sess.flush(); if (inst.getOverride() == null) { inst.setOverride(override); sess.saveOrUpdate(inst); } } else { sess.saveOrUpdate(override); } proxy.setRefChanged(false); }
1,120,226
public edu.iris.Fissures.IfNetwork.Channel getChannel(ChannelId channelId) { System.out.println("-------- "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); channelId.station_code = channelId.station_code.toLowerCase(); System.out.println("******* after "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); Object obj = getParameter(StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); return (edu.iris.Fissures.IfNetwork.Channel)obj; }
public edu.iris.Fissures.IfNetwork.Channel getChannel(ChannelId channelId) { channelId.station_code = channelId.station_code.toLowerCase(); System.out.println("******* after "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); Object obj = getParameter(StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); return (edu.iris.Fissures.IfNetwork.Channel)obj; }
1,120,227
public edu.iris.Fissures.IfNetwork.Channel getChannel(ChannelId channelId) { System.out.println("-------- "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); channelId.station_code = channelId.station_code.toLowerCase(); System.out.println("******* after "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); Object obj = getParameter(StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); return (edu.iris.Fissures.IfNetwork.Channel)obj; }
public edu.iris.Fissures.IfNetwork.Channel getChannel(ChannelId channelId) { System.out.println("-------- "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); channelId.station_code = channelId.station_code.toLowerCase(); Object obj = getParameter(StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); return (edu.iris.Fissures.IfNetwork.Channel)obj; }
1,120,228
public Object getParameter(String name) { //ChannelProxy channelProxy = new ChannelProxy(); //ChannelId[] channelIds = getChannelIds(); //channelProxy.retrieve_grouping(channelIds, channelIds[0]); ///************************************************ if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "parameter[name/text()="+ dquote+name+dquote+"]/../"); if (nList != null && nList.getLength() != 0) { System.out.println("getting the parameter"); Node n = nList.item(0); if (n instanceof Element) { return XMLParameter.getParameter((Element)n); //System.out.println("THe tag name is "+((Element)n).getTagName()); // parameterCache.put(name, n); // return (Element)n; } } else { System.out.println("THE NODELIST IS NULL"); } // not a parameter, try parameterRef nList = evalNodeList(config, "parameterRef[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); try { Element e = sl.retrieve(); parameterCache.put(name, e); return e; } catch (Exception e) { logger.error("can't get paramterRef", e); } // end of try-catch } } //can't find that name??? return null; }
public Object getParameter(String name) { //ChannelProxy channelProxy = new ChannelProxy(); //ChannelId[] channelIds = getChannelIds(); //channelProxy.retrieve_grouping(channelIds, channelIds[0]); ///************************************************ if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { System.out.println("getting the parameter"); Node n = nList.item(0); if (n instanceof Element) { return XMLParameter.getParameter((Element)n); //System.out.println("THe tag name is "+((Element)n).getTagName()); // parameterCache.put(name, n); // return (Element)n; } } else { System.out.println("THE NODELIST IS NULL"); } // not a parameter, try parameterRef nList = evalNodeList(config, "parameterRef[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); try { Element e = sl.retrieve(); parameterCache.put(name, e); return e; } catch (Exception e) { logger.error("can't get paramterRef", e); } // end of try-catch } } //can't find that name??? return null; }
1,120,229
public Collection getAddContentCalendarCollections() { try { TreeMap tm = new TreeMap(listCollator); Iterator it = fetchSvci().getAddContentCalendarCollections().iterator(); while (it.hasNext()) { BwCalendar cal = (BwCalendar)it.next(); tm.put(cal.getName(), cal); } return tm.values();// return fetchSvci().getAddContentCalendarCollections(); } catch (Throwable t) { err.emit(t); return null; } }
public Collection getAddContentCalendarCollections() { try { TreeMap tm = new TreeMap(getListCollator()); Iterator it = fetchSvci().getAddContentCalendarCollections().iterator(); while (it.hasNext()) { BwCalendar cal = (BwCalendar)it.next(); tm.put(cal.getName(), cal); } return tm.values();// return fetchSvci().getAddContentCalendarCollections(); } catch (Throwable t) { err.emit(t); return null; } }
1,120,230
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } BwSubscription sub = form.getSubscription(); CalSvcI svc = form.fetchSvci(); String viewName = getReqPar(request, "view"); boolean addToDefaultView = false; if (viewName == null) { addToDefaultView = true; String str = getReqPar(request, "addtodefaultview"); if (str != null) { addToDefaultView = str.equals("y"); } } Boolean bool = getBooleanReqPar(request, "unremovable"); if ((bool != null) && !form.getUserAuth().isSuperUser()) { return "noAccess"; // Only super user for that flag } sub.setUnremoveable(bool.booleanValue()); if (!validateSub(sub, form)) { return "retry"; } if (getReqPar(request, "addSubscription") != null) { try { svc.addSubscription(sub); } catch (CalFacadeException cfe) { if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) { form.getErr().emit(cfe.getMessage()); return "success"; // User will see message and we'll stay on page } throw cfe; } } else if (getReqPar(request, "updateSubscription") != null) { svc.updateSubscription(sub); } else if (getReqPar(request, "delete") != null) { svc.removeSubscription(sub); } else { } if ((viewName == null) && !addToDefaultView) { // We're done - not adding to a view return "success"; } if (sub != null) { svc.addViewSubscription(viewName, sub); } form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } BwSubscription sub = form.getSubscription(); CalSvcI svc = form.fetchSvci(); String viewName = getReqPar(request, "view"); boolean addToDefaultView = false; if (viewName == null) { addToDefaultView = true; String str = getReqPar(request, "addtodefaultview"); if (str != null) { addToDefaultView = str.equals("y"); } } Boolean bool = getBooleanReqPar(request, "unremovable"); if ((bool != null) && !form.getUserAuth().isSuperUser()) { return "noAccess"; // Only super user for that flag } sub.setUnremoveable(bool.booleanValue()); if (!validateSub(sub, form)) { return "retry"; } if (getReqPar(request, "addSubscription") != null) { try { svc.addSubscription(sub); } catch (CalFacadeException cfe) { if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) { form.getErr().emit(cfe.getMessage()); return "success"; // User will see message and we'll stay on page } throw cfe; } } else if (getReqPar(request, "updateSubscription") != null) { svc.updateSubscription(sub); } else if (getReqPar(request, "delete") != null) { svc.removeSubscription(sub); } else { } if ((viewName == null) && !addToDefaultView) { // We're done - not adding to a view return "success"; } if (sub != null) { svc.addViewSubscription(viewName, sub); } form.setSubscriptions(svc.getSubscriptions()); return "success"; }
1,120,231
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } BwSubscription sub = form.getSubscription(); CalSvcI svc = form.fetchSvci(); String viewName = getReqPar(request, "view"); boolean addToDefaultView = false; if (viewName == null) { addToDefaultView = true; String str = getReqPar(request, "addtodefaultview"); if (str != null) { addToDefaultView = str.equals("y"); } } Boolean bool = getBooleanReqPar(request, "unremovable"); if ((bool != null) && !form.getUserAuth().isSuperUser()) { return "noAccess"; // Only super user for that flag } sub.setUnremoveable(bool.booleanValue()); if (!validateSub(sub, form)) { return "retry"; } if (getReqPar(request, "addSubscription") != null) { try { svc.addSubscription(sub); } catch (CalFacadeException cfe) { if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) { form.getErr().emit(cfe.getMessage()); return "success"; // User will see message and we'll stay on page } throw cfe; } } else if (getReqPar(request, "updateSubscription") != null) { svc.updateSubscription(sub); } else if (getReqPar(request, "delete") != null) { svc.removeSubscription(sub); } else { } if ((viewName == null) && !addToDefaultView) { // We're done - not adding to a view return "success"; } if (sub != null) { svc.addViewSubscription(viewName, sub); } form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } BwSubscription sub = form.getSubscription(); CalSvcI svc = form.fetchSvci(); String viewName = getReqPar(request, "view"); boolean addToDefaultView = false; if (viewName == null) { addToDefaultView = true; String str = getReqPar(request, "addtodefaultview"); if (str != null) { addToDefaultView = str.equals("y"); } } Boolean bool = getBooleanReqPar(request, "unremovable"); if ((bool != null) && !form.getUserAuth().isSuperUser()) { return "noAccess"; // Only super user for that flag } if (!validateSub(sub, form)) { return "retry"; } if (getReqPar(request, "addSubscription") != null) { try { svc.addSubscription(sub); } catch (CalFacadeException cfe) { if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) { form.getErr().emit(cfe.getMessage()); return "success"; // User will see message and we'll stay on page } throw cfe; } } else if (getReqPar(request, "updateSubscription") != null) { svc.updateSubscription(sub); } else if (getReqPar(request, "delete") != null) { svc.removeSubscription(sub); } else { } if ((viewName == null) && !addToDefaultView) { // We're done - not adding to a view return "success"; } if (sub != null) { svc.addViewSubscription(viewName, sub); } form.setSubscriptions(svc.getSubscriptions()); return "success"; }
1,120,232
public static final void bindArguments(String funnam, ATObject scope, ATTable parameters, ATTable arguments, boolean isDefinition) throws NATException { ATObject[] pars = parameters.asNativeTable().elements_; ATObject[] args = arguments.asNativeTable().elements_; // check to see whether the last argument is a spliced parameters, which // indicates a variable parameter list if (pars[pars.length - 1].isSplice()) { int numMandatoryPars = (pars.length - 1); // if so, check whether at least all mandatory parameters are matched if (args.length < numMandatoryPars) throw new XArityMismatch(funnam, numMandatoryPars, args.length); // bind all parameters except for the last one for (int i = 0; i < numMandatoryPars; i++) { scope.meta_defineField(pars[i].asSymbol(), args[i]); } // bind the last parameter to the remaining arguments int numRemainingArgs = args.length - numMandatoryPars; ATObject[] restArgs = new ATObject[numRemainingArgs]; for (int i = 0; i < numRemainingArgs; i++) { restArgs[i] = args[i + numMandatoryPars]; } ATSymbol restArgsName = pars[numMandatoryPars].asSplice().getExpression().asSymbol(); if (isDefinition) scope.meta_defineField(restArgsName, new NATTable(restArgs)); else scope.meta_assignField(restArgsName, new NATTable(restArgs)); } else { // regular parameter list: arguments and parameters have to match exactly if (pars.length != args.length) throw new XArityMismatch(funnam, pars.length, args.length); if (isDefinition) { for (int i = 0; i < pars.length; i++) { scope.meta_defineField(pars[i].asSymbol(), args[i]); } } else { for (int i = 0; i < pars.length; i++) { scope.meta_assignField(pars[i].asSymbol(), args[i]); } } } }
public static final void bindArguments(String funnam, ATObject scope, ATTable parameters, ATTable arguments, boolean isDefinition) throws NATException { ATObject[] pars = parameters.asNativeTable().elements_; ATObject[] args = arguments.asNativeTable().elements_; // check to see whether the last argument is a spliced parameters, which // indicates a variable parameter list if (pars[pars.length - 1].isSplice()) { int numMandatoryPars = (pars.length - 1); // if so, check whether at least all mandatory parameters are matched if (args.length < numMandatoryPars) throw new XArityMismatch(funnam, numMandatoryPars, args.length); // bind all parameters except for the last one for (int i = 0; i < numMandatoryPars; i++) { if (isDefinition) scope.meta_defineField(pars[i].asSymbol(), args[i]); else scope.meta_assignField(pars[i].asSymbol(), args[i]); } // bind the last parameter to the remaining arguments int numRemainingArgs = args.length - numMandatoryPars; ATObject[] restArgs = new ATObject[numRemainingArgs]; for (int i = 0; i < numRemainingArgs; i++) { restArgs[i] = args[i + numMandatoryPars]; } ATSymbol restArgsName = pars[numMandatoryPars].asSplice().getExpression().asSymbol(); if (isDefinition) scope.meta_defineField(restArgsName, new NATTable(restArgs)); else scope.meta_assignField(restArgsName, new NATTable(restArgs)); } else { // regular parameter list: arguments and parameters have to match exactly if (pars.length != args.length) throw new XArityMismatch(funnam, pars.length, args.length); if (isDefinition) { for (int i = 0; i < pars.length; i++) { if (isDefinition) scope.meta_defineField(pars[i].asSymbol(), args[i]); else scope.meta_assignField(pars[i].asSymbol(), args[i]); } } else { for (int i = 0; i < pars.length; i++) { scope.meta_assignField(pars[i].asSymbol(), args[i]); } } } }
1,120,233
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { boolean allowed = acl.evaluateAccess(who, owner.getAccount(), how, encoded); if (debug) { log(title + " got " + allowed + " and expected " + expected); } assertEquals(title, expected, allowed); }
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { CurrentAccess ca = new Acl().evaluateAccess(who, owner.getAccount(), how, encoded); if (debug) { log(title + " got " + allowed + " and expected " + expected); } assertEquals(title, expected, allowed); }
1,120,235
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { boolean allowed = acl.evaluateAccess(who, owner.getAccount(), how, encoded); if (debug) { log(title + " got " + allowed + " and expected " + expected); } assertEquals(title, expected, allowed); }
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { boolean allowed = acl.evaluateAccess(who, owner.getAccount(), how, encoded); if (debug) { log(title + " got " + ca.accessAllowed + " and expected " + expected); } assertEquals(title, expected, allowed); }
1,120,236
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { boolean allowed = acl.evaluateAccess(who, owner.getAccount(), how, encoded); if (debug) { log(title + " got " + allowed + " and expected " + expected); } assertEquals(title, expected, allowed); }
private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { boolean allowed = acl.evaluateAccess(who, owner.getAccount(), how, encoded); if (debug) { log(title + " got " + allowed + " and expected " + expected); } assertEquals(title, expected, ca.accessAllowed); }
1,120,237
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.ExtensionEditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } }
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(ExtensionEditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } }
1,120,238
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.getCalSvcI(); if (!form.validateEvent()) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.pubevents.message.event.added"); } else { form.getMsg().emit("org.bedework.pubevents.message.event.updated"); } return "continue"; }
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.getCalSvcI(); if (!form.validateEvent()) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.client.message.event.added"); } else { form.getMsg().emit("org.bedework.pubevents.message.event.updated"); } return "continue"; }
1,120,239
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.getCalSvcI(); if (!form.validateEvent()) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.pubevents.message.event.added"); } else { form.getMsg().emit("org.bedework.pubevents.message.event.updated"); } return "continue"; }
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } reqpar = request.getParameter("copy"); if (reqpar != null) { BwEvent evcopy = new BwEventObj(); form.getEvent().copyTo(evcopy); evcopy.setId(CalFacadeDefs.unsavedItemKey); form.setEvent(evcopy); form.assignAddingEvent(true); return "copy"; } CalSvcI svci = form.getCalSvcI(); if (!form.validateEvent()) { return "retry"; } /* Validation set up the form so that any selected contact, location * and or categories are available. */ BwEvent ev = form.getEvent(); ev.setPublick(true); if (form.getAddingEvent()) { svci.addEvent(ev, null); } else { svci.updateEvent(ev); } if (!alerts) { updateAuthPrefs(form, ev.getCategories(), ev.getSponsor(), ev.getLocation(), ev.getCalendar()); } form.resetEvent(); form.assignAddingEvent(false); if (form.getAddingEvent()) { form.getMsg().emit("org.bedework.pubevents.message.event.added"); } else { form.getMsg().emit("org.bedework.client.message.event.updated"); } return "continue"; }
1,120,240
public void changeAccess(Object o, Collection aces) throws CalFacadeException;
public void changeAccess(BwShareableDbentity ent, Collection aces) throws CalFacadeException;
1,120,243
public Collection getAces(Object o) throws CalFacadeException;
public Collection getAces(BwShareableDbentity ent) throws CalFacadeException;
1,120,244
public static MemoryFileBuffer writeStickerList(Report report,ReportInfo info){ Connection Conn = null; MemoryFileBuffer buffer = new MemoryFileBuffer(); MemoryOutputStream mos = new MemoryOutputStream(buffer); try { String[] Headers = report.getHeaders(); int Hlen = Headers.length; String sql = report.getSQL(); //String file = realpath; List cinfos = ReportFinder.listOfReportColumnInfo(report.getID()); ReportColumnInfo rinfo; String[] endstrings = new String[Hlen]; Font[] fonts = new Font[Hlen]; int[] spans = new int[Hlen]; int listsize = cinfos!=null?cinfos.size():0; for (int i = 0; i < Hlen; i++) { if(i < listsize){ rinfo = (ReportColumnInfo)cinfos.get(i); fonts[i] = getFont(rinfo); /** @todo endstring fix */ endstrings[i] = "\n"; spans[i] = rinfo.getColumnSpan(); } else{ fonts[i] = getFont(null); endstrings[i] = "\n"; spans[i] = 1; } } Conn = com.idega.util.database.ConnectionBroker.getConnection(); Statement stmt = Conn.createStatement(); ResultSet RS = stmt.executeQuery(sql); StickerList list = new StickerList(); list.setStickerHeight(info.getHeight()); list.setStickerWidth(info.getWidth()); list.setBorder(info.getBorder()); list.setRotation(info.getLandscape()); list.setPageSize(ReportFinder.getPageSize(info.getPagesize())); Paragraph parag; while(RS.next()){ parag = new Paragraph(); for(int i = 1; i <= Hlen; i++){ if(!RS.wasNull()) parag.add(new Chunk(RS.getString(i),fonts[i-1])); parag.add(endstrings[i-1]); } list.add(parag); } RS.close(); stmt.close(); StickerWriter.print(mos,list); } catch (Exception ex) { ex.printStackTrace(); } finally { ConnectionBroker.freeConnection(Conn); } buffer.setMimeType("application/pdf"); return buffer; }
public static MemoryFileBuffer writeStickerList(Report report,ReportInfo info){ Connection Conn = null; MemoryFileBuffer buffer = new MemoryFileBuffer(); MemoryOutputStream mos = new MemoryOutputStream(buffer); try { String[] Headers = report.getHeaders(); int Hlen = Headers.length; String sql = report.getSQL(); //String file = realpath; List cinfos = ReportFinder.listOfReportColumnInfo(report.getID()); ReportColumnInfo rinfo; String[] endstrings = new String[Hlen]; Font[] fonts = new Font[Hlen]; int[] spans = new int[Hlen]; int listsize = cinfos!=null?cinfos.size():0; for (int i = 0; i < Hlen; i++) { if(i < listsize){ rinfo = (ReportColumnInfo)cinfos.get(i); fonts[i] = getFont(rinfo); /** @todo endstring fix */ endstrings[i] = "\n"; spans[i] = rinfo.getColumnSpan(); } else{ fonts[i] = getFont(null); endstrings[i] = "\n"; spans[i] = 1; } } Conn = com.idega.util.database.ConnectionBroker.getConnection(); Statement stmt = Conn.createStatement(); ResultSet RS = stmt.executeQuery(sql); StickerList list = new StickerList(); list.setStickerHeight(info.getHeight()); list.setStickerWidth(info.getWidth()); list.setBorder(info.getBorder()); list.setRotation(info.getLandscape()); list.setPageSize(ReportFinder.getPageSize(info.getPagesize())); Paragraph parag; while(RS.next()){ parag = new Paragraph(); for(int i = 1; i <= Hlen; i++){ if(!RS.wasNull()) parag.add(new Chunk(RS.getString(i),fonts[i-1])); parag.add(endstrings[i-1]); } list.add(parag); } RS.close(); stmt.close(); StickerWriter.print(mos,list); } catch (Exception ex) { ex.printStackTrace(); } finally { ConnectionBroker.freeConnection(Conn); } buffer.setMimeType("application/pdf"); return buffer; }
1,120,245
protected String checkGroup(HttpServletRequest request, BwActionFormBase form, boolean initCheck) throws Throwable { if (form.getGroupSet()) { return null; } CalSvcI svci = form.fetchSvci(); try { Groups adgrps = svci.getGroups(); if (form.retrieveChoosingGroup()) { /** This should be the response to presenting a list of groups. We handle it here rather than in a separate action to ensure our client is not trying to bypass the group setting. */ String reqpar = request.getParameter("adminGroupName"); if (reqpar == null) { // Make them do it again. return "chooseGroup"; } return setGroup(request, form, adgrps, reqpar); } /** If the user is in no group or in one group we just go with that, otherwise we ask them to select the group */ Collection adgs; BwUser user = svci.findUser(form.getCurrentUser()); if (user == null) { return "noAccess"; } if (initCheck || !form.getUserAuth().isSuperUser()) { // Always restrict to groups we're a member of adgs = adgrps.getGroups(user); } else { adgs = adgrps.getAll(false); } if (adgs.isEmpty()) { /** If we require that all users be in a group we return to an error page. The only exception will be superUser. */ boolean noGroupAllowed = form.getEnv().getAppBoolProperty("app.nogroupallowed"); if (form.getUserAuth().isSuperUser() || noGroupAllowed) { form.assignAdminGroup(null); return null; } return "noGroupAssigned"; } if (adgs.size() == 1) { Iterator adgsit = adgs.iterator(); BwAdminGroup adg = (BwAdminGroup)adgsit.next(); form.assignAdminGroup(adg); String s = setAdminUser(request, form, adg.getOwner().getAccount(), true); if (s != null) { return s; } form.setAdminUserId(svci.getUser().getAccount()); return null; } /** Go ahead and present the possible groups */ form.setUserAdminGroups(adgs); form.assignChoosingGroup(true); // reset return "chooseGroup"; } catch (Throwable t) { form.getErr().emit(t); return "error"; } }
protected String checkGroup(HttpServletRequest request, BwActionFormBase form, boolean initCheck) throws Throwable { if (form.getGroupSet()) { return null; } CalSvcI svci = form.fetchSvci(); try { Groups adgrps = svci.getGroups(); if (form.retrieveChoosingGroup()) { /** This should be the response to presenting a list of groups. We handle it here rather than in a separate action to ensure our client is not trying to bypass the group setting. */ String reqpar = request.getParameter("adminGroupName"); if (reqpar == null) { // Make them do it again. return "chooseGroup"; } return setGroup(request, form, adgrps, reqpar); } /** If the user is in no group or in one group we just go with that, otherwise we ask them to select the group */ Collection adgs; BwUser user = svci.findUser(form.getCurrentUser()); if (user == null) { return "noAccess"; } if (initCheck || !form.getUserAuth().isSuperUser()) { // Always restrict to groups we're a member of adgs = adgrps.getGroups(user); } else { adgs = adgrps.getAll(false); } if (adgs.isEmpty()) { /** If we require that all users be in a group we return to an error page. The only exception will be superUser. */ boolean noGroupAllowed = form.getEnv().getAppBoolProperty("nogroupallowed"); if (form.getUserAuth().isSuperUser() || noGroupAllowed) { form.assignAdminGroup(null); return null; } return "noGroupAssigned"; } if (adgs.size() == 1) { Iterator adgsit = adgs.iterator(); BwAdminGroup adg = (BwAdminGroup)adgsit.next(); form.assignAdminGroup(adg); String s = setAdminUser(request, form, adg.getOwner().getAccount(), true); if (s != null) { return s; } form.setAdminUserId(svci.getUser().getAccount()); return null; } /** Go ahead and present the possible groups */ form.setUserAdminGroups(adgs); form.assignChoosingGroup(true); // reset return "chooseGroup"; } catch (Throwable t) { form.getErr().emit(t); return "error"; } }
1,120,246
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException { /** Do some checks first */ String authUser = String.valueOf(form.getCurrentUser()); if (!publicAdmin) { /* We're never allowed to switch identity as a user client. */ if (!authUser.equals(String.valueOf(user))) { return false; } } else if (user == null) { throw new CalFacadeException("Null user parameter for public admin."); } CalSvcI svci = BwWebUtil.getCalSvcI(request); /** Make some checks to see if this is an old - restarted session. If so discard the svc interface */ if (svci != null) { if (!svci.isOpen()) { svci = null; info(".Svci interface discarded from old session"); } } if (svci != null) { /* Already there and already opened */ if (debug) { debugMsg("CalSvcI-- Obtained from session for user " + svci.getUser()); } } else { if (debug) { debugMsg(".CalSvcI-- get new object for user " + user); } /* create a call back object so the filter can open the service interface */ BwCallback cb = new Callback(form); HttpSession hsess = request.getSession(); hsess.setAttribute(BwCallback.cbAttrName, cb); String runAsUser = user; try { svci = new CalSvc(); if (publicAdmin || (user == null)) { runAsUser = getRunAsUser(form); } CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, publicAdmin, false, // caldav null, // synchId debug); svci.init(pars); BwWebUtil.setCalSvcI(request, svci); form.setCalSvcI(svci); cb.in(true); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } } form.assignUserVO((BwUser)svci.getUser().clone()); if (publicAdmin) { canSwitch = canSwitch || ((access & UserAuth.contentAdminUser) != 0) || ((access & UserAuth.superUser) != 0); BwUser u = svci.getUser(); if (u == null) { throw new CalFacadeException("Null user for public admin."); } String curUser = u.getAccount(); if (!canSwitch && !user.equals(curUser)) { /** Trying to switch but not allowed */ return false; } if (!user.equals(curUser)) { /** Switching user */ svci.setUser(user); curUser = user; } form.assignCurrentAdminUser(curUser); } return true; }
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException { /** Do some checks first */ String authUser = String.valueOf(form.getCurrentUser()); if (!publicAdmin) { /* We're never allowed to switch identity as a user client. */ if (!authUser.equals(String.valueOf(user))) { return false; } } else if (user == null) { throw new CalFacadeException("Null user parameter for public admin."); } CalSvcI svci = BwWebUtil.getCalSvcI(request); /** Make some checks to see if this is an old - restarted session. If so discard the svc interface */ if (svci != null) { if (!svci.isOpen()) { svci = null; info(".Svci interface discarded from old session"); } } if (svci != null) { /* Already there and already opened */ if (debug) { debugMsg("CalSvcI-- Obtained from session for user " + svci.getUser()); } } else { if (debug) { debugMsg(".CalSvcI-- get new object for user " + user); } /* create a call back object so the filter can open the service interface */ BwCallback cb = new Callback(form); HttpSession hsess = request.getSession(); hsess.setAttribute(BwCallback.cbAttrName, cb); String runAsUser = user; try { svci = new CalSvc(); if (publicAdmin || (user == null)) { runAsUser = form.getEnv().getAppProperty("run.as.user"); } CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, publicAdmin, false, // caldav null, // synchId debug); svci.init(pars); BwWebUtil.setCalSvcI(request, svci); form.setCalSvcI(svci); cb.in(true); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } } form.assignUserVO((BwUser)svci.getUser().clone()); if (publicAdmin) { canSwitch = canSwitch || ((access & UserAuth.contentAdminUser) != 0) || ((access & UserAuth.superUser) != 0); BwUser u = svci.getUser(); if (u == null) { throw new CalFacadeException("Null user for public admin."); } String curUser = u.getAccount(); if (!canSwitch && !user.equals(curUser)) { /** Trying to switch but not allowed */ return false; } if (!user.equals(curUser)) { /** Switching user */ svci.setUser(user); curUser = user; } form.assignCurrentAdminUser(curUser); } return true; }
1,120,247
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException { /** Do some checks first */ String authUser = String.valueOf(form.getCurrentUser()); if (!publicAdmin) { /* We're never allowed to switch identity as a user client. */ if (!authUser.equals(String.valueOf(user))) { return false; } } else if (user == null) { throw new CalFacadeException("Null user parameter for public admin."); } CalSvcI svci = BwWebUtil.getCalSvcI(request); /** Make some checks to see if this is an old - restarted session. If so discard the svc interface */ if (svci != null) { if (!svci.isOpen()) { svci = null; info(".Svci interface discarded from old session"); } } if (svci != null) { /* Already there and already opened */ if (debug) { debugMsg("CalSvcI-- Obtained from session for user " + svci.getUser()); } } else { if (debug) { debugMsg(".CalSvcI-- get new object for user " + user); } /* create a call back object so the filter can open the service interface */ BwCallback cb = new Callback(form); HttpSession hsess = request.getSession(); hsess.setAttribute(BwCallback.cbAttrName, cb); String runAsUser = user; try { svci = new CalSvc(); if (publicAdmin || (user == null)) { runAsUser = getRunAsUser(form); } CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, publicAdmin, false, // caldav null, // synchId debug); svci.init(pars); BwWebUtil.setCalSvcI(request, svci); form.setCalSvcI(svci); cb.in(true); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } } form.assignUserVO((BwUser)svci.getUser().clone()); if (publicAdmin) { canSwitch = canSwitch || ((access & UserAuth.contentAdminUser) != 0) || ((access & UserAuth.superUser) != 0); BwUser u = svci.getUser(); if (u == null) { throw new CalFacadeException("Null user for public admin."); } String curUser = u.getAccount(); if (!canSwitch && !user.equals(curUser)) { /** Trying to switch but not allowed */ return false; } if (!user.equals(curUser)) { /** Switching user */ svci.setUser(user); curUser = user; } form.assignCurrentAdminUser(curUser); } return true; }
protected boolean checkSvci(HttpServletRequest request, BwActionFormBase form, BwSession sess, int access, String user, boolean publicAdmin, boolean canSwitch, boolean debug) throws CalFacadeException { /** Do some checks first */ String authUser = String.valueOf(form.getCurrentUser()); if (!publicAdmin) { /* We're never allowed to switch identity as a user client. */ if (!authUser.equals(String.valueOf(user))) { return false; } } else if (user == null) { throw new CalFacadeException("Null user parameter for public admin."); } CalSvcI svci = BwWebUtil.getCalSvcI(request); /** Make some checks to see if this is an old - restarted session. If so discard the svc interface */ if (svci != null) { if (!svci.isOpen()) { svci = null; info(".Svci interface discarded from old session"); } } if (svci != null) { /* Already there and already opened */ if (debug) { debugMsg("CalSvcI-- Obtained from session for user " + svci.getUser()); } } else { if (debug) { debugMsg(".CalSvcI-- get new object for user " + user); } /* create a call back object so the filter can open the service interface */ BwCallback cb = new Callback(form); HttpSession hsess = request.getSession(); hsess.setAttribute(BwCallback.cbAttrName, cb); String runAsUser = user; try { svci = new CalSvc(); if (publicAdmin || (user == null)) { runAsUser = getRunAsUser(form); } CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, publicAdmin, false, // caldav null, // synchId debug); svci.init(pars); BwWebUtil.setCalSvcI(request, svci); form.setCalSvcI(svci); cb.in(true); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } } form.assignUserVO((BwUser)svci.getUser().clone()); if (publicAdmin) { canSwitch = canSwitch || ((access & UserAuth.contentAdminUser) != 0) || ((access & UserAuth.superUser) != 0); BwUser u = svci.getUser(); if (u == null) { throw new CalFacadeException("Null user for public admin."); } String curUser = u.getAccount(); if (!canSwitch && !user.equals(curUser)) { /** Trying to switch but not allowed */ return false; } if (!user.equals(curUser)) { /** Switching user */ svci.setUser(user); curUser = user; } form.assignCurrentAdminUser(curUser); } return true; }
1,120,248
public CalEnv getEnv(BwActionFormBase frm) throws Throwable { CalEnv env = frm.getEnv(); if (env != null) { return env; } String envPrefix = JspUtil.getReqProperty(frm.getMres(), "org.bedework.envprefix"); env = new CalEnv(envPrefix, debug); frm.assignEnv(env); return env; }
private CalEnv getEnv(HttpServletRequest request, BwActionFormBase frm) throws Throwable { CalEnv env = frm.getEnv(); if (env != null) { return env; } String envPrefix = JspUtil.getReqProperty(frm.getMres(), "org.bedework.envprefix"); env = new CalEnv(envPrefix, debug); frm.assignEnv(env); return env; }
1,120,249
public CalEnv getEnv(BwActionFormBase frm) throws Throwable { CalEnv env = frm.getEnv(); if (env != null) { return env; } String envPrefix = JspUtil.getReqProperty(frm.getMres(), "org.bedework.envprefix"); env = new CalEnv(envPrefix, debug); frm.assignEnv(env); return env; }
public CalEnv getEnv(BwActionFormBase frm) throws Throwable { CalEnv env = frm.getEnv(); if (env != null) { return env; } String envPrefix = JspUtil.getReqProperty(frm.getMres(), "org.bedework.envprefix"); env = new CalEnv(envPrefix, debug); frm.assignEnv(env); return env; }
1,120,250
public boolean getPublicAdmin(UtilActionForm frm) throws Throwable { return JspUtil.getBoolProperty(frm.getMres(), "org.bedework.publicadmin", false); }
public boolean getPublicAdmin(UtilActionForm frm) throws Throwable { return JspUtil.getBoolProperty(frm.getMres(), "org.bedework.publicadmin", false); }
1,120,251
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
1,120,252
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
1,120,253
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("app.showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
public synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement")); if (!admin) { form.assignShowYearData(env.getAppBoolProperty("showyeardata")); } setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); SessionListener.setId(appName); // First time will have no name info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } int access = getAccess(request, messages); if (debug) { debugMsg("Container says that current user has the type: " + access); } /** Ensure we have a CalAdminSvcI object */ checkSvci(request, form, s, access, adminUserId, getPublicAdmin(form), false, debug); /** Somewhere up there we may have to do more for user auth in the session. This is where we can figure out this is a first call. */ UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } return s; }
1,120,254
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; CalEnv env = getEnv(request, form); setSessionAttr(request, "org.bedework.logprefix", env.getAppProperty("logprefix")); boolean guestMode = env.getAppBoolProperty("guestmode"); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,120,255
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = getReqPar(request, "adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,120,256
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,120,257
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,120,258
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,120,259
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("app.refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; boolean guestMode = getGuestMode(frm); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = request.getParameter("adminUserId"); if (temp != null) { adminUserId = temp; } } /* UWCalCallback cb = new Callback(form); HttpSession sess = request.getSession(); sess.setAttribute(UWCalCallback.cbAttrName, cb); */ BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } /* Set up ready for the action */ if (getPublicAdmin(form)) { /* Set some options from the environment */ CalEnv env = getEnv(form); form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } /** Show the owner we are administering */ form.setAdminUserId(form.fetchSvci().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } /** Ensure we have prefs and other values for the AuthUser */ setAuthUser(form); } else { form.setAutoCreateSponsors(true); form.setAutoCreateLocations(true); form.setAutoDeleteSponsors(true); form.setAutoDeleteLocations(true); String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action"); if (refreshAction == null) { refreshAction = form.getActionPath(); } if (refreshAction != null) { setRefreshInterval(request, response, form.getEnv().getAppIntProperty("refresh.interval"), refreshAction, form); } if (debug) { log.debug("curTimeView=" + form.getCurTimeView()); } } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } try { forward = doAction(request, response, s, form); if (getPublicAdmin(form)) { } else { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noaccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,120,260
public MP3Player(File f) throws PlayerException { try { file = f; stream = new FileInputStream(file); player = new AdvancedPlayer(stream) { public void close() { System.out.println("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); } }; } catch (Exception exc) { throw new PlayerException(exc); } }
public MP3Player(File f) throws PlayerException { try { file = f; stream = new FileInputStream(file); player = new AdvancedPlayer(stream) { public void close() { System.out.println("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); } }; } catch (Exception exc) { throw new PlayerException(exc); } }
1,120,261
public ATObject meta_eval(ATContext ctx) throws NATException { return new NATMethodInvocation(this.getSelector(), Evaluator.evaluateArguments(this.base_getArguments().asNativeTable(), ctx)); }
public ATObject meta_eval(ATContext ctx) throws NATException { return new NATMethodInvocation(this.base_getSelector(), Evaluator.evaluateArguments(this.base_getArguments().asNativeTable(), ctx)); }
1,120,262
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
private static void doChildren(OptionElement oel, Element subroot, Stack objStack) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,120,263
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (objStack.empty()) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,120,264
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (!objStack.empty()) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,120,265
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } Object val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,120,266
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, objStack); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,120,267
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); val = null; } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
private static void doChildren(OptionElement oel, Element subroot, Object val) throws CalEnvException { try { if (!XmlUtil.hasChildren(subroot)) { // Leaf node String ndval = XmlUtil.getElementContent(subroot); String name = subroot.getNodeName(); if (val == null) { // Add a leaf node and return OptionElement valnode = new OptionElement(); valnode.name = name; valnode.isValue = true; valnode.val = ndval; oel.addChild(valnode); return; } // Val is an object which should have a setter for the property Method meth = findMethod(val, name); Class[] parClasses = meth.getParameterTypes(); if (parClasses.length != 1) { error("Invalid setter method " + name); throw new CalEnvException("org.bedework.calenv.invalid.setter"); } Class parClass = parClasses[0]; Object par = null; if (parClass.getName().equals("java.lang.String")) { par = ndval; } else if (parClass.getName().equals("int") || parClass.getName().equals("java.lang.Integer")) { par = Integer.valueOf(ndval); } else if (parClass.getName().equals("long") || parClass.getName().equals("java.lang.Long")) { par = Long.valueOf(ndval); } else if (parClass.getName().equals("boolean") || parClass.getName().equals("java.lang.Boolean")) { par = Boolean.valueOf(ndval); } else { error("Unsupported par class for method " + name); throw new CalEnvException("org.bedework.calenv.unsupported.setter"); } Object[] pars = new Object[]{par}; meth.invoke(val, pars); return; } Element[] children = XmlUtil.getElementsArray(subroot); /* Non leaf nodes - call recursively with each of the children */ for (int i = 0; i < children.length; i++) { Element el = children[i]; String className = XmlUtil.getAttrVal(el, "classname"); OptionElement valnode = new OptionElement(); valnode.name = el.getNodeName(); oel.addChild(valnode); if (className != null) { /* This counts as a leaf node. All children provide values for the * object. */ if (val != null) { error("Nested classes not yet supported for element " + valnode.name + " and class " + className); throw new CalEnvException("org.bedework.calenv.nested.classes.unsupported"); } val = Class.forName(className).newInstance(); valnode.isValue = true; valnode.val = val; } else { /* Just a non-leaf node */ } doChildren(valnode, el, val); if (className != null) { objStack.pop(); } } } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } }
1,120,268
private static OptionElement parseOptions(InputStream is) throws CalEnvException{ Reader rdr = null; try { rdr = new InputStreamReader(is); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new InputSource(rdr)); /* We expect a root element named "bedework-options" */ Element root = doc.getDocumentElement(); if (!root.getNodeName().equals("bedework-options")) { throw new CalEnvException("org.bedework.bad.options"); } OptionElement oel = new OptionElement(); oel.name = "root"; doChildren(oel, root, null); return oel; } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } finally { if (rdr != null) { try { rdr.close(); } catch (Throwable t) {} } } }
private static OptionElement parseOptions(InputStream is) throws CalEnvException{ Reader rdr = null; try { rdr = new InputStreamReader(is); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new InputSource(rdr)); /* We expect a root element named "bedework-options" */ Element root = doc.getDocumentElement(); if (!root.getNodeName().equals("bedework-options")) { throw new CalEnvException("org.bedework.bad.options"); } OptionElement oel = new OptionElement(); oel.name = "root"; doChildren(oel, root, new Stack()); return oel; } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } finally { if (rdr != null) { try { rdr.close(); } catch (Throwable t) {} } } }
1,120,269
public void retrieveData(SeisDataChangeListener dataListener){ Iterator it = seisCache.iterator(); List existingSeismos = new ArrayList(); while(it.hasNext()){ LocalSeismogramImpl current = (LocalSeismogramImpl)((SoftReference)it.next()).get(); if(current != null){ existingSeismos.add(current); } } RequestFilter[] uncovered = {requestFilter}; if(existingSeismos.size() > 0){ LocalSeismogramImpl[] cachedSeismos = new LocalSeismogramImpl[existingSeismos.size()]; cachedSeismos = (LocalSeismogramImpl[])existingSeismos.toArray(cachedSeismos); pushData(cachedSeismos, dataListener); uncovered = DBDataCenter.notCovered(uncovered, cachedSeismos); } try{ System.out.println("requesting seismograms"); if(this.dataCenterOps instanceof DBDataCenter && uncovered.length > 0) { ((DBDataCenter)this.dataCenterOps).request_seismograms(uncovered, (LocalDataCenterCallBack)this, dataListener, false, ClockUtil.now().getFissuresTime()); } } catch(FissuresException fe) {} }
public void retrieveData(SeisDataChangeListener dataListener){ Iterator it = seisCache.iterator(); List existingSeismos = new ArrayList(); while(it.hasNext()){ LocalSeismogramImpl current = (LocalSeismogramImpl)((SoftReference)it.next()).get(); if(current != null){ existingSeismos.add(current); } } RequestFilter[] uncovered = {requestFilter}; if(existingSeismos.size() > 0){ LocalSeismogramImpl[] cachedSeismos = new LocalSeismogramImpl[existingSeismos.size()]; cachedSeismos = (LocalSeismogramImpl[])existingSeismos.toArray(cachedSeismos); pushData(cachedSeismos, dataListener); uncovered = DBDataCenter.notCovered(uncovered, cachedSeismos); } try{ if(this.dataCenterOps instanceof DBDataCenter && uncovered.length > 0) { ((DBDataCenter)this.dataCenterOps).request_seismograms(uncovered, (LocalDataCenterCallBack)this, dataListener, false, ClockUtil.now().getFissuresTime()); } } catch(FissuresException fe) {} }
1,120,270
public ATNil meta_assignVariable(ATSymbol name, ATObject value) throws NATException { return this.meta_assignField(name, value); }
public ATNil meta_assignVariable(ATSymbol name, ATObject value) throws NATException { try { return this.meta_assignField(name, value); } catch (XSelectorNotFound e) { throw new XUndefinedField("variable assignment", name.getText().asNativeText().javaValue); } }
1,120,271
public ATObject meta_invoke(ATObject receiver, ATSymbol atSelector, ATTable arguments) throws NATException { String jSelector = Reflection.upBaseLevelSelector(atSelector); return Reflection.downObject(Reflection.upInvocation(this, receiver, jSelector, arguments)); }
public ATObject meta_invoke(ATObject receiver, ATSymbol atSelector, ATTable arguments) throws NATException { String jSelector = Reflection.upBaseLevelSelector(atSelector); return Reflection.downObject(Reflection.upInvocation(this, receiver, jSelector, arguments)); }
1,120,272
public ATObject meta_lookup(ATSymbol selector) throws NATException { return this.meta_select(this, selector); }
public ATObject meta_lookup(ATSymbol selector) throws NATException { try { return this.meta_select(this, selector); } catch(XSelectorNotFound e) { throw new XUndefinedField("variable access", selector.getText().asNativeText().javaValue); } }
1,120,273
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws NATException { String jSelector = null; try { jSelector = Reflection.upBaseFieldAccessSelector(selector); return Reflection.downObject(Reflection.upFieldSelection(this, receiver, jSelector)); } catch (XSelectorNotFound e) { jSelector = Reflection.upBaseLevelSelector(selector); return Reflection.downObject(Reflection.upMethodSelection(this, receiver, jSelector)); } }
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws NATException { String jSelector = null; try { jSelector = Reflection.upBaseFieldAccessSelector(selector); return Reflection.downObject(Reflection.upFieldSelection(this, receiver, jSelector)); } catch (XSelectorNotFound e) { jSelector = Reflection.upBaseLevelSelector(selector); try { return Reflection.downObject(Reflection.upMethodSelection(this, receiver, jSelector)); } catch (XSelectorNotFound e2) { return receiver.meta_doesNotUnderstand(selector); } } }
1,120,274
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } svc.removeView(view); form.getMsg().emit("org.bedework.client.message.view.deleted"); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = getReqPar(request, "name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } svc.removeView(view); form.getMsg().emit("org.bedework.client.message.view.deleted"); return "success"; }
1,120,275