rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
public static List listOfDataClasses(){
public static Collection listOfDataClasses(){
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; }
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);
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);
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; }
catch (SQLException ex) {
catch (FinderException ex) {
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; }
gbc.fill = gbc.HORIZONTAL;
gbc.fill = GridBagConstraints.HORIZONTAL;
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)); }
yearBox.setSelectedIndex(0);
if(yearBox != null) yearBox.setSelectedIndex(0);
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(); }
throw new XReflectionFailure("Java method "+Reflection.downSelector(javaMethod.getName()) + " is not accessible.", e);
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); }
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()); } } }
calTerm.empty = false;
private void appendCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, CalTerm calTerm, boolean allCalendars) throws CalFacadeException { if (calendar.getCalendarCollection()) { if (allCalendars || (calendar.getCalType() == BwCalendar.calTypeCollection)) { // leaf calendar if (calTerm.i > 1) { sb.append(" or "); } sb.append(qevName); sb.append(".calendar=:calendar" + calTerm.i); calTerm.i++; } } else { Iterator it = calendar.getChildren().iterator(); while (it.hasNext()) { appendCalendarClause(sb, qevName, (BwCalendar)it.next(), calTerm, allCalendars); } } }
appendCalendarClause(sb, qevName, calendar, new CalTerm(), allCalendars);
appendCalendarClause(sb, qevName, calendar, calTerm, allCalendars);
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; }
allCalendars);
calTerm, allCalendars); if (calTerm.empty) { return new TreeSet(); }
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; }
allCalendars);
calTerm, allCalendars); if (calTerm.empty) { throw new CalFacadeException("No valid calendars."); }
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); }
form.getMsg().emit("org.bedework.pubevents.message.authuser.removed");
form.getMsg().emit("org.bedework.client.message.authuser.removed");
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"; }
org.eclipse.uml2.uml.Package container = (org.eclipse.uml2.uml.Package) getRelationshipContainer(source, UMLPackage.eINSTANCE.getPackage(), req.getElementType());
Package container = (Package) getRelationshipContainer(source, UMLPackage.eINSTANCE.getPackage(), req.getElementType());
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() { }; }
form.getErr().emit("org.bedework.pubevents.error.missingfield",
form.getErr().emit("org.bedework.client.error.missingfield",
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; }
form.getErr().emit("org.bedework.pubevents.error.notfound",
form.getErr().emit("org.bedework.client.error.usernotfound",
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; }
form.getErr().emit("org.bedework.pubevents.error.missingfield", "Name");
form.getErr().emit("org.bedework.client.error.missingfield", "Name");
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; }
form.getErr().emit("org.bedework.pubevents.error.missingfield",
form.getErr().emit("org.bedework.client.error.missingfield",
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; }
if (("xmlns".equals(qname) && "".equals(value)) == false)
if (uri == null && qname.startsWith("xmlns")) { log.trace("Ignore attribute: [uri=" + uri + ",qname=" + qname + ",value=" + value + "]"); } else {
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 (("xmlns".equals(qname) && "".equals(value)) == false) destElement.setAttributeNS(uri, qname, value); } }
for (Iterator iter = toConsider.keySet().iterator(); iter.hasNext();){ String key = (String) iter.next(); if (! toModify.containsKey(key)) toModify.put(key, toConsider.get(key));
for (final Iterator iter = toConsider.entrySet().iterator(); iter.hasNext();){ final Map.Entry entry = (Map.Entry)iter.next(); final String key = (String) entry.getKey(); if (! toModify.containsKey(key)) { toModify.put(key, entry.getValue()); }
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 Events(Calintf cal, AccessUtil access, BwUser user,
public Events(Calintf cal, AccessUtil access,
public Events(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, user, currentMode, ignoreCreator, debug); }
super(cal, access, user, currentMode, ignoreCreator, debug);
super(cal, access, currentMode, ignoreCreator, debug);
public Events(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, user, currentMode, ignoreCreator, debug); }
override.setOwner(user);
override.setOwner(getUser());
private void addOverride(BwEventProxy proxy, BwRecurrenceInstance inst) throws CalFacadeException { BwEventAnnotation override = proxy.getRef(); override.setOwner(user); getSess().saveOrUpdate(override); inst.setOverride(override); }
sess.setEntity("user", user);
sess.setEntity("user", getUser());
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()); } } }
return user.equals(val.getCreator());
return getUser().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 user.equals(val.getCreator()); }
override.setOwner(user);
override.setOwner(getUser());
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); }
if (instOverride.getOwner().equals(user)) {
if (instOverride.getOwner().equals(getUser())) {
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); }
if (mstr.getOwner().equals(user) && mstr.getRecurring()) {
if (mstr.getOwner().equals(getUser()) && mstr.getRecurring()) {
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); }
System.out.println("-------- "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId));
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; }
System.out.println("******* after "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId));
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; }
dquote+name+dquote+"]/../");
dquote+name+dquote+"]");
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; }
TreeMap tm = new TreeMap(listCollator);
TreeMap tm = new TreeMap(getListCollator());
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; } }
if ((bool != null) && !form.getUserAuth().isSuperUser()) { return "noAccess";
if (bool != null) { if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } sub.setUnremoveable(bool.booleanValue());
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"; }
sub.setUnremoveable(bool.booleanValue());
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"; }
scope.meta_defineField(pars[i].asSymbol(), args[i]);
if (isDefinition) scope.meta_defineField(pars[i].asSymbol(), args[i]); else 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++) { 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]); } } } }
Acl acl = new Acl(debug);
public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } }
boolean allowed = acl.evaluateAccess(who, owner.getAccount(), how, encoded);
CurrentAccess ca = new Acl().evaluateAccess(who, owner.getAccount(), how, encoded);
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); }
log(title + " got " + allowed + " and expected " + expected);
log(title + " got " + ca.accessAllowed + " and expected " + expected);
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); }
assertEquals(title, expected, allowed);
assertEquals(title, expected, ca.accessAllowed);
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); }
semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.ExtensionEditPart.VISUAL_ID);
semanticHint = UMLVisualIDRegistry.getType(ExtensionEditPart.VISUAL_ID);
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); } }
form.getMsg().emit("org.bedework.pubevents.message.event.added");
form.getMsg().emit("org.bedework.client.message.event.added");
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"; }
form.getMsg().emit("org.bedework.pubevents.message.event.updated");
form.getMsg().emit("org.bedework.client.message.event.updated");
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"; }
if (getOrganizer() != null) { getOrganizer().setOwner(val); }
public void setOwner(BwUser val) { super.setOwner(val); if (attendeesHelper != null) { attendeesHelper.setOwner(val); } }
if (getOrganizer() != null) { getOrganizer().setPublick(val); }
public void setPublick(boolean val) { super.setPublick(val); if (attendeesHelper != null) { attendeesHelper.setPublick(val); } }
public void changeAccess(Object o, Collection aces) throws CalFacadeException;
public void changeAccess(BwShareableDbentity ent, Collection aces) throws CalFacadeException;
public void changeAccess(Object o, Collection aces) throws CalFacadeException;
public Collection getAces(Object o) throws CalFacadeException;
public Collection getAces(BwShareableDbentity ent) throws CalFacadeException;
public Collection getAces(Object o) throws CalFacadeException;
if(!RS.wasNull()) parag.add(new Chunk(RS.getString(i),fonts[i-1]));
String s = RS.getString(i); if(s!=null) parag.add(new Chunk(s,fonts[i-1]));
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; }
form.getEnv().getAppBoolProperty("app.nogroupallowed");
form.getEnv().getAppBoolProperty("nogroupallowed");
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"; } }
runAsUser = getRunAsUser(form);
runAsUser = form.getEnv().getAppProperty("run.as.user");
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; }
CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, publicAdmin, false, null, debug);
CalSvcIPars pars = new CalSvcIPars(user, access, runAsUser, form.getEnv().getAppPrefix(), publicAdmin, false, null, debug);
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; }
public CalEnv getEnv(BwActionFormBase frm) throws Throwable {
private CalEnv getEnv(HttpServletRequest request, BwActionFormBase frm) throws Throwable {
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; }
String envPrefix = JspUtil.getReqProperty(frm.getMres(), "org.bedework.envprefix");
HttpSession session = request.getSession(); ServletContext sc = session.getServletContext(); String appName = sc.getInitParameter("bwappname"); if ((appName == null) || (appName.length() == 0)) { appName = "unknown-app-name"; } String envPrefix = "org.bedework.app." + appName + ".";
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 boolean getPublicAdmin(UtilActionForm frm) throws Throwable { return JspUtil.getBoolProperty(frm.getMres(), "org.bedework.publicadmin", false);
public boolean getPublicAdmin(BwActionFormBase frm) throws Throwable { return frm.getEnv().getAppBoolProperty("publicadmin");
public boolean getPublicAdmin(UtilActionForm frm) throws Throwable { return JspUtil.getBoolProperty(frm.getMres(), "org.bedework.publicadmin", false); }
CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root");
CalEnv env = getEnv(request, form); String appName = env.getAppProperty("name"); String appRoot = env.getAppProperty("root");
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; }
form.setHour24(env.getAppBoolProperty("app.hour24")); form.setMinIncrement(env.getAppIntProperty("app.minincrement"));
form.setHour24(env.getAppBoolProperty("hour24")); form.setMinIncrement(env.getAppIntProperty("minincrement"));
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; }
form.assignShowYearData(env.getAppBoolProperty("app.showyeardata"));
form.assignShowYearData(env.getAppBoolProperty("showyeardata"));
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; }
boolean guestMode = getGuestMode(frm);
CalEnv env = getEnv(request, form); setSessionAttr(request, "org.bedework.logprefix", env.getAppProperty("logprefix")); boolean guestMode = env.getAppBoolProperty("guestmode");
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; }
String temp = request.getParameter("adminUserId");
String temp = getReqPar(request, "adminUserId");
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; }
CalEnv env = getEnv(form);
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; }
form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations"));
form.setAutoCreateSponsors(env.getAppBoolProperty("autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("autodeletelocations"));
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; }
String refreshAction = form.getEnv().getAppOptProperty("app.refresh.action");
String refreshAction = form.getEnv().getAppOptProperty("refresh.action");
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; }
form.getEnv().getAppIntProperty("app.refresh.interval"),
form.getEnv().getAppIntProperty("refresh.interval"),
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; }
player = new AdvancedPlayer(stream) { public void close() { System.out.println("AdvancedPlayer.close()"); super.close(); System.out.println(" done"); } };
player = new AdvancedPlayer(stream);
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); } }
return new NATMethodInvocation(this.getSelector(),
return new NATMethodInvocation(this.base_getSelector(),
public ATObject meta_eval(ATContext ctx) throws NATException { return new NATMethodInvocation(this.getSelector(), Evaluator.evaluateArguments(this.base_getArguments().asNativeTable(), ctx)); }
Object val) throws CalEnvException {
Stack objStack) throws CalEnvException {
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); } }
if (val == null) {
if (objStack.empty()) {
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); } }
if (val != null) {
if (!objStack.empty()) {
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); } }
val = Class.forName(className).newInstance();
Object val = Class.forName(className).newInstance();
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); } }
doChildren(valnode, el, val);
doChildren(valnode, el, objStack);
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); } }
val = null;
if (className != null) { objStack.pop(); }
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); } }
doChildren(oel, root, null);
doChildren(oel, root, new Stack());
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) {} } } }
System.out.println("requesting seismograms");
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) {} }
return this.meta_assignField(name, value);
try { return this.meta_assignField(name, value); } catch (XSelectorNotFound e) { throw new XUndefinedField("variable assignment", name.getText().asNativeText().javaValue); }
public ATNil meta_assignVariable(ATSymbol name, ATObject value) throws NATException { return this.meta_assignField(name, value); }
String jSelector = Reflection.upBaseLevelSelector(atSelector); return Reflection.downObject(Reflection.upInvocation(this, receiver, jSelector, arguments));
try { String jSelector = Reflection.upBaseLevelSelector(atSelector); return Reflection.downObject(Reflection.upInvocation(this, receiver, jSelector, arguments)); } catch (XSelectorNotFound e) { return receiver.meta_doesNotUnderstand(atSelector); }
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)); }
return this.meta_select(this, selector);
try { return this.meta_select(this, selector); } catch(XSelectorNotFound e) { throw new XUndefinedField("variable access", selector.getText().asNativeText().javaValue); }
public ATObject meta_lookup(ATSymbol selector) throws NATException { return this.meta_select(this, selector); }
return Reflection.downObject(Reflection.upMethodSelection(this, receiver, jSelector));
try { return Reflection.downObject(Reflection.upMethodSelection(this, receiver, jSelector)); } catch (XSelectorNotFound e2) { return receiver.meta_doesNotUnderstand(selector); }
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)); } }
String name = request.getParameter("name");
String name = getReqPar(request, "name");
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"; }
return "error";
return "retry";
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"; }
if(selectionDisplays + selectionWindow.getSize().height < tk.getScreenSize().height){
selectionWindow.setLocation((tk.getScreenSize().width - selectionWindow.getSize().width)/2, (tk.getScreenSize().height - selectionWindow.getSize().height)/2); /*if(selectionDisplays + selectionWindow.getSize().height < tk.getScreenSize().height){
public void createSelectionDisplay(Selection creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionWindow = new JFrame(); selectionWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { selectionDisplay.removeAll(); } }); selectionWindow.setSize(400, 200); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); DataSetSeismogram first = ((DataSetSeismogram)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder, this); creator.addDisplay(selectionDisplay.addDisplay(first, tr, ar, creator.getParent().getName() + "." + creator.getColor())); ar.visibleAmpCalc(tr); while(e.hasNext()){ selectionDisplay.addSeismogram(((DataSetSeismogram)e.next()), 0); } selectionWindow.getContentPane().add(selectionDisplay); Toolkit tk = Toolkit.getDefaultToolkit(); if(selectionDisplays + selectionWindow.getSize().height < tk.getScreenSize().height){ selectionWindow.setLocation(tk.getScreenSize().width - selectionWindow.getSize().width, tk.getScreenSize().height - (selectionDisplays + selectionWindow.getSize().height)); }else{ selectionWindow.setLocation(tk.getScreenSize().width - selectionWindow.getSize().width, 0); } selectionDisplays += selectionWindow.getSize().height; selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); DataSetSeismogram first = ((DataSetSeismogram)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); ar.visibleAmpCalc(tr); creator.addDisplay(selectionDisplay.addDisplay(first, tr, ar, creator.getParent().getName() + "." + creator.getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((DataSetSeismogram)e.next()), 0); } } }
selectionDisplays += selectionWindow.getSize().height;
selectionDisplays += selectionWindow.getSize().height;*/
public void createSelectionDisplay(Selection creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionWindow = new JFrame(); selectionWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { selectionDisplay.removeAll(); } }); selectionWindow.setSize(400, 200); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); DataSetSeismogram first = ((DataSetSeismogram)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder, this); creator.addDisplay(selectionDisplay.addDisplay(first, tr, ar, creator.getParent().getName() + "." + creator.getColor())); ar.visibleAmpCalc(tr); while(e.hasNext()){ selectionDisplay.addSeismogram(((DataSetSeismogram)e.next()), 0); } selectionWindow.getContentPane().add(selectionDisplay); Toolkit tk = Toolkit.getDefaultToolkit(); if(selectionDisplays + selectionWindow.getSize().height < tk.getScreenSize().height){ selectionWindow.setLocation(tk.getScreenSize().width - selectionWindow.getSize().width, tk.getScreenSize().height - (selectionDisplays + selectionWindow.getSize().height)); }else{ selectionWindow.setLocation(tk.getScreenSize().width - selectionWindow.getSize().width, 0); } selectionDisplays += selectionWindow.getSize().height; selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); DataSetSeismogram first = ((DataSetSeismogram)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); ar.visibleAmpCalc(tr); creator.addDisplay(selectionDisplay.addDisplay(first, tr, ar, creator.getParent().getName() + "." + creator.getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((DataSetSeismogram)e.next()), 0); } } }
current.addSelection(creator);
current.add3CSelection(creator);
public void createThreeSelectionDisplay(Selection creator){ if(threeSelectionDisplay == null){ logger.debug("creating 3C selection display"); threeSelectionWindow = new JFrame(); threeSelectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder, this); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); DataSetSeismogram first = ((DataSetSeismogram)creator.getSeismograms().getFirst()); LocalSeismogramImpl seis = first.getSeismogram(); XMLDataSet dataSet = (XMLDataSet)first.getDataSet(); ChannelId[] channelIds = dataSet.getChannelIds(); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); ChannelId[] channelGroup = channelProxy.retrieve_grouping(channelIds, seis.getChannelID()); DataSetSeismogram[] seismograms = new DataSetSeismogram[3]; try{ for(int counter = 0; counter < channelGroup.length; counter++) { String name = DisplayUtils.getSeismogramName(channelGroup[counter], dataSet, new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime())); seismograms[counter] = new DataSetSeismogram(dataSet.getSeismogram(name), dataSet); if(seismograms[counter].getSeismogram() != null){ Iterator g = basicDisplays.iterator(); while(g.hasNext()){ BasicSeismogramDisplay current = ((BasicSeismogramDisplay)g.next()); Iterator h = current.getSeismograms().iterator(); while(h.hasNext()){ if(((DataSetSeismogram)h.next()).getSeismogram() == seismograms[counter].getSeismogram()){ current.addSelection(creator); creator.addParent(current); } } } creator.addDisplay(threeSelectionDisplay.addDisplay(seismograms[counter], tr, ar, seismograms[counter].getSeismogram().getName() + "." + creator.getColor())); } } }catch(Exception f){ f.printStackTrace(); } ar.visibleAmpCalc(tr); threeSelectionWindow.getContentPane().add(threeSelectionDisplay); threeSelectionWindow.setSize(400, 400); Toolkit tk = Toolkit.getDefaultToolkit(); if((selectionDisplays + threeSelectionWindow.getSize().height) < tk.getScreenSize().height){ threeSelectionWindow.setLocation(tk.getScreenSize().width - threeSelectionWindow.getSize().width, tk.getScreenSize().height - (selectionDisplays + threeSelectionWindow.getSize().height)); }else{ threeSelectionWindow.setLocation(tk.getScreenSize().width - threeSelectionWindow.getSize().width, 0); } selectionDisplays+= threeSelectionWindow.getSize().height; threeSelectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); DataSetSeismogram first = ((DataSetSeismogram)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); ar.visibleAmpCalc(tr); creator.addDisplay(threeSelectionDisplay.addDisplay(first, tr, ar, creator.getParent().getName() + "." + creator.getColor())); while(e.hasNext()){ threeSelectionDisplay.addSeismogram(((DataSetSeismogram)e.next()), 0); } } }
if((selectionDisplays + threeSelectionWindow.getSize().height) < tk.getScreenSize().height){ threeSelectionWindow.setLocation(tk.getScreenSize().width - threeSelectionWindow.getSize().width, tk.getScreenSize().height - (selectionDisplays + threeSelectionWindow.getSize().height)); }else{ threeSelectionWindow.setLocation(tk.getScreenSize().width - threeSelectionWindow.getSize().width, 0); } selectionDisplays+= threeSelectionWindow.getSize().height;
threeSelectionWindow.setLocation((tk.getScreenSize().width - threeSelectionWindow.getSize().width)/2, (tk.getScreenSize().height - threeSelectionWindow.getSize().height)/2);
public void createThreeSelectionDisplay(Selection creator){ if(threeSelectionDisplay == null){ logger.debug("creating 3C selection display"); threeSelectionWindow = new JFrame(); threeSelectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder, this); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); DataSetSeismogram first = ((DataSetSeismogram)creator.getSeismograms().getFirst()); LocalSeismogramImpl seis = first.getSeismogram(); XMLDataSet dataSet = (XMLDataSet)first.getDataSet(); ChannelId[] channelIds = dataSet.getChannelIds(); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); ChannelId[] channelGroup = channelProxy.retrieve_grouping(channelIds, seis.getChannelID()); DataSetSeismogram[] seismograms = new DataSetSeismogram[3]; try{ for(int counter = 0; counter < channelGroup.length; counter++) { String name = DisplayUtils.getSeismogramName(channelGroup[counter], dataSet, new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime())); seismograms[counter] = new DataSetSeismogram(dataSet.getSeismogram(name), dataSet); if(seismograms[counter].getSeismogram() != null){ Iterator g = basicDisplays.iterator(); while(g.hasNext()){ BasicSeismogramDisplay current = ((BasicSeismogramDisplay)g.next()); Iterator h = current.getSeismograms().iterator(); while(h.hasNext()){ if(((DataSetSeismogram)h.next()).getSeismogram() == seismograms[counter].getSeismogram()){ current.addSelection(creator); creator.addParent(current); } } } creator.addDisplay(threeSelectionDisplay.addDisplay(seismograms[counter], tr, ar, seismograms[counter].getSeismogram().getName() + "." + creator.getColor())); } } }catch(Exception f){ f.printStackTrace(); } ar.visibleAmpCalc(tr); threeSelectionWindow.getContentPane().add(threeSelectionDisplay); threeSelectionWindow.setSize(400, 400); Toolkit tk = Toolkit.getDefaultToolkit(); if((selectionDisplays + threeSelectionWindow.getSize().height) < tk.getScreenSize().height){ threeSelectionWindow.setLocation(tk.getScreenSize().width - threeSelectionWindow.getSize().width, tk.getScreenSize().height - (selectionDisplays + threeSelectionWindow.getSize().height)); }else{ threeSelectionWindow.setLocation(tk.getScreenSize().width - threeSelectionWindow.getSize().width, 0); } selectionDisplays+= threeSelectionWindow.getSize().height; threeSelectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getInternalConfig(); DataSetSeismogram first = ((DataSetSeismogram)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig()); ar.visibleAmpCalc(tr); creator.addDisplay(threeSelectionDisplay.addDisplay(first, tr, ar, creator.getParent().getName() + "." + creator.getColor())); while(e.hasNext()){ threeSelectionDisplay.addSeismogram(((DataSetSeismogram)e.next()), 0); } } }
selectionDisplays -= selectionWindow.getSize().height;
public void removeAll(){ logger.debug("removing all displays"); if(parent != null){ parent.removeSelectionDisplay(this); } this.stopImageCreation(); seismograms.removeAll(); remove(seismograms); basicDisplays = new LinkedList(); sorter = new AlphaSeisSorter(); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); if(selectionDisplay != null){ selectionDisplay.removeAll(); selectionWindow.dispose(); selectionDisplays -= selectionWindow.getSize().height; selectionDisplay = null; } if(threeSelectionDisplay != null){ threeSelectionDisplay.removeAll(); threeSelectionWindow.dispose(); selectionDisplays -= threeSelectionWindow.getSize().height; selectionDisplay = null; } if(particleDisplay != null){ particleWindow.dispose(); particleDisplays--; particleDisplay = null; } repaint(); }
selectionDisplays -= threeSelectionWindow.getSize().height;
public void removeAll(){ logger.debug("removing all displays"); if(parent != null){ parent.removeSelectionDisplay(this); } this.stopImageCreation(); seismograms.removeAll(); remove(seismograms); basicDisplays = new LinkedList(); sorter = new AlphaSeisSorter(); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); if(selectionDisplay != null){ selectionDisplay.removeAll(); selectionWindow.dispose(); selectionDisplays -= selectionWindow.getSize().height; selectionDisplay = null; } if(threeSelectionDisplay != null){ threeSelectionDisplay.removeAll(); threeSelectionWindow.dispose(); selectionDisplays -= threeSelectionWindow.getSize().height; selectionDisplay = null; } if(particleDisplay != null){ particleWindow.dispose(); particleDisplays--; particleDisplay = null; } repaint(); }
selectionWindow.dispose(); selectionDisplays -= selectionWindow.getSize().height; selectionDisplay = null;
removeSelectionDisplay();
public void removeSelectionDisplay(VerticalSeismogramDisplay display){ if(display == selectionDisplay){ selectionWindow.dispose(); selectionDisplays -= selectionWindow.getSize().height; selectionDisplay = null; }else{ threeSelectionWindow.dispose(); selectionDisplays -= threeSelectionWindow.getSize().height; threeSelectionDisplay = null; } }
threeSelectionWindow.dispose(); selectionDisplays -= threeSelectionWindow.getSize().height; threeSelectionDisplay = null;
remove3CSelectionDisplay();
public void removeSelectionDisplay(VerticalSeismogramDisplay display){ if(display == selectionDisplay){ selectionWindow.dispose(); selectionDisplays -= selectionWindow.getSize().height; selectionDisplay = null; }else{ threeSelectionWindow.dispose(); selectionDisplays -= threeSelectionWindow.getSize().height; threeSelectionDisplay = null; } }
return (doAuth(cardnumber, monthExpires, yearExpires, amount, currency, "5", null, referenceNumber));
String authID = (doAuth(cardnumber, monthExpires, yearExpires, amount, currency, "5", null, null)); StringBuffer buffer = getPropertyString(_client); buffer.append(TPOS3Client.PN_AUTHORIDENTIFYRSP).append("=").append(authID); return buffer.toString();
public String creditcardAuthorization(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException{ return (doAuth(cardnumber, monthExpires, yearExpires, amount, currency, "5", null, referenceNumber)); }
private String doAuth(String cardnumber, String monthExpires, String yearExpires, double amount, String currency, String transactionType, Object parentDataPK, String authRspID) throws TPosException {
private String doAuth(String cardnumber, String monthExpires, String yearExpires, double amount, String currency, String transactionType, Object parentDataPK, String authIDRsp) throws TPosException {
private String doAuth(String cardnumber, String monthExpires, String yearExpires, double amount, String currency, String transactionType, Object parentDataPK, String authRspID) throws TPosException { if(_client != null) { _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); amount *= amountMultiplier; String stringAmount = Integer.toString((int)amount); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } boolean valid = false; try { valid = _client.sendAuthorisationReq(); } catch (IllegalArgumentException e) { getKeys(); createNewBatch(); _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } valid = _client.sendAuthorisationReq(); } boolean inserted = false; TPosAuthorisationEntriesBean entry; try { entry = TPosAuthorisationEntriesHome.getInstance().getNewElement(); // entry.setAttachmentCount(_client.getProperty(TPOS3Client.pn)); entry.setAuthorisationAmount(_client.getProperty(TPOS3Client.PN_AUTHORAMOUNT)); entry.setAuthorisationCode(_client.getProperty(TPOS3Client.PN_AUTHORISATIONCODE)); entry.setAuthorisationCurrency(_client.getProperty(TPOS3Client.PN_AUTHORCURRENCY)); entry.setAuthorisationIdRsp(_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); entry.setAuthorisationPathReasonCode(_client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE)); entry.setBatchNumber(_client.getProperty(TPOS3Client.PN_BATCHNUMBER)); entry.setBrandId(_client.getProperty(TPOS3Client.PN_CARDBRANDID)); entry.setBrandName(_client.getProperty(TPOS3Client.PN_CARDBRANDNAME)); entry.setCardCharacteristics(_client.getProperty(TPOS3Client.PN_CARDCHARACTER)); entry.setCardExpires(_client.getProperty(TPOS3Client.PN_EXPIRE)); entry.setCardName(_client.getProperty(TPOS3Client.PN_CARDTYPENAME)); entry.setCardType(_client.getProperty(TPOS3Client.PN_CARDTYPEID)); entry.setDetailExpected(_client.getProperty(TPOS3Client.PN_DETAILEXPECTED)); entry.setEntryDate(_client.getProperty(TPOS3Client.PN_DATE)); entry.setEntryTime(_client.getProperty(TPOS3Client.PN_TIME)); entry.setErrorNo(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); entry.setErrorText(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); entry.setLocationNr(_client.getProperty(TPOS3Client.PN_LOCATIONNUMBER)); entry.setMerchantNrAuthorisation(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR)); entry.setMerchantNrOtherServices(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES)); entry.setMerchantNrSubmission(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION)); // entry.setPan("***********"); entry.setPosNr(_client.getProperty(TPOS3Client.PN_POSNUMBER)); entry.setPosSerialNr(_client.getProperty(TPOS3Client.PN_POSSERIAL)); // entry.setPrintData(_client.getProperty(TPOS3Client.pn_p)); entry.setSubmissionAmount(_client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT)); entry.setSubmissionCurrency(_client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY)); entry.setTotalResponseCode(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE)); entry.setTransactionNr(_client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER)); entry.setVoidedAuthorisationIdResponse(_client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP)); entry.setVoidedTransactionNr(_client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER)); // entry.setXMLAttachment(_client.getProperty(TPOS3Client.)); entry.setCardNumber(CreditCardBusinessBean.encodeCreditCardNumber(cardnumber)); if (parentDataPK != null) { try { entry.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("TPosClient : could not set parentID : "+parentDataPK); } } inserted = TPosAuthorisationEntriesHome.getInstance().insert(entry);// String tmpTest;// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORAMOUNT);// System.out.println("PN_AUTHORAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORCURRENCY);// System.out.println("PN_AUTHORCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP);// System.out.println("PN_AUTHORIDENTIFYRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE);// System.out.println("PN_AUTHPATHREASONCODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_BATCHNUMBER);// System.out.println("PN_BATCHNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDID);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDNAME);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDCHARACTER);// System.out.println("PN_CARDCHARACTER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_EXPIRE);// System.out.println("PN_EXPIRE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPENAME);// System.out.println("PN_CARDTYPENAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPEID);// System.out.println("PN_CARDTYPEID : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DETAILEXPECTED);// System.out.println("PN_DETAILEXPECTED : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DATE);// System.out.println("PN_DATE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TIME);// System.out.println("PN_TIME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORNUMBER);// System.out.println("PN_ERRORNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORTEXT);// System.out.println("PN_ERRORTEXT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_LOCATIONNUMBER);// System.out.println("PN_LOCATIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION);// System.out.println("PN_MERCHANTNUMBERSUBMISSION : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSNUMBER);// System.out.println("PN_POSNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSSERIAL);// System.out.println("PN_POSSERIAL : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT);// System.out.println("PN_SUBMISSIONAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY);// System.out.println("PN_SUBMISSIONCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE);// System.out.println("PN_TOTALRESPONSECODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER);// System.out.println("PN_TRANSACTIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP);// System.out.println("PN_VOIDEDAUTHIDRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER);// System.out.println("PN_VOIDEDTRANSNUMBER : "+tmpTest.length()); } catch (Exception e) { e.printStackTrace(); } if (!inserted) { System.err.println("Unable to save entry to database"); } if (!valid) { TPosException e = new TPosException("Error in authorisation"); e.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); e.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); e.setDisplayError("Error in authorisation (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw e; } TPosException tposEx = null; switch (Integer.parseInt(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE), 10)) { case 0: return (_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); case 1: tposEx = new TPosException("Authorisation denied"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 2: tposEx = new TPosException("Authorisation denied, pick up card"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 3: tposEx = new TPosException("Authorisation denied, call for manual authorisation"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; } } return ("-1"); }
String encodedCardNumber = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber);
private String doAuth(String cardnumber, String monthExpires, String yearExpires, double amount, String currency, String transactionType, Object parentDataPK, String authRspID) throws TPosException { if(_client != null) { _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); amount *= amountMultiplier; String stringAmount = Integer.toString((int)amount); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } boolean valid = false; try { valid = _client.sendAuthorisationReq(); } catch (IllegalArgumentException e) { getKeys(); createNewBatch(); _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } valid = _client.sendAuthorisationReq(); } boolean inserted = false; TPosAuthorisationEntriesBean entry; try { entry = TPosAuthorisationEntriesHome.getInstance().getNewElement(); // entry.setAttachmentCount(_client.getProperty(TPOS3Client.pn)); entry.setAuthorisationAmount(_client.getProperty(TPOS3Client.PN_AUTHORAMOUNT)); entry.setAuthorisationCode(_client.getProperty(TPOS3Client.PN_AUTHORISATIONCODE)); entry.setAuthorisationCurrency(_client.getProperty(TPOS3Client.PN_AUTHORCURRENCY)); entry.setAuthorisationIdRsp(_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); entry.setAuthorisationPathReasonCode(_client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE)); entry.setBatchNumber(_client.getProperty(TPOS3Client.PN_BATCHNUMBER)); entry.setBrandId(_client.getProperty(TPOS3Client.PN_CARDBRANDID)); entry.setBrandName(_client.getProperty(TPOS3Client.PN_CARDBRANDNAME)); entry.setCardCharacteristics(_client.getProperty(TPOS3Client.PN_CARDCHARACTER)); entry.setCardExpires(_client.getProperty(TPOS3Client.PN_EXPIRE)); entry.setCardName(_client.getProperty(TPOS3Client.PN_CARDTYPENAME)); entry.setCardType(_client.getProperty(TPOS3Client.PN_CARDTYPEID)); entry.setDetailExpected(_client.getProperty(TPOS3Client.PN_DETAILEXPECTED)); entry.setEntryDate(_client.getProperty(TPOS3Client.PN_DATE)); entry.setEntryTime(_client.getProperty(TPOS3Client.PN_TIME)); entry.setErrorNo(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); entry.setErrorText(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); entry.setLocationNr(_client.getProperty(TPOS3Client.PN_LOCATIONNUMBER)); entry.setMerchantNrAuthorisation(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR)); entry.setMerchantNrOtherServices(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES)); entry.setMerchantNrSubmission(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION)); // entry.setPan("***********"); entry.setPosNr(_client.getProperty(TPOS3Client.PN_POSNUMBER)); entry.setPosSerialNr(_client.getProperty(TPOS3Client.PN_POSSERIAL)); // entry.setPrintData(_client.getProperty(TPOS3Client.pn_p)); entry.setSubmissionAmount(_client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT)); entry.setSubmissionCurrency(_client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY)); entry.setTotalResponseCode(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE)); entry.setTransactionNr(_client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER)); entry.setVoidedAuthorisationIdResponse(_client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP)); entry.setVoidedTransactionNr(_client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER)); // entry.setXMLAttachment(_client.getProperty(TPOS3Client.)); entry.setCardNumber(CreditCardBusinessBean.encodeCreditCardNumber(cardnumber)); if (parentDataPK != null) { try { entry.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("TPosClient : could not set parentID : "+parentDataPK); } } inserted = TPosAuthorisationEntriesHome.getInstance().insert(entry);// String tmpTest;// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORAMOUNT);// System.out.println("PN_AUTHORAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORCURRENCY);// System.out.println("PN_AUTHORCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP);// System.out.println("PN_AUTHORIDENTIFYRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE);// System.out.println("PN_AUTHPATHREASONCODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_BATCHNUMBER);// System.out.println("PN_BATCHNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDID);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDNAME);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDCHARACTER);// System.out.println("PN_CARDCHARACTER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_EXPIRE);// System.out.println("PN_EXPIRE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPENAME);// System.out.println("PN_CARDTYPENAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPEID);// System.out.println("PN_CARDTYPEID : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DETAILEXPECTED);// System.out.println("PN_DETAILEXPECTED : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DATE);// System.out.println("PN_DATE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TIME);// System.out.println("PN_TIME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORNUMBER);// System.out.println("PN_ERRORNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORTEXT);// System.out.println("PN_ERRORTEXT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_LOCATIONNUMBER);// System.out.println("PN_LOCATIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION);// System.out.println("PN_MERCHANTNUMBERSUBMISSION : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSNUMBER);// System.out.println("PN_POSNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSSERIAL);// System.out.println("PN_POSSERIAL : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT);// System.out.println("PN_SUBMISSIONAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY);// System.out.println("PN_SUBMISSIONCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE);// System.out.println("PN_TOTALRESPONSECODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER);// System.out.println("PN_TRANSACTIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP);// System.out.println("PN_VOIDEDAUTHIDRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER);// System.out.println("PN_VOIDEDTRANSNUMBER : "+tmpTest.length()); } catch (Exception e) { e.printStackTrace(); } if (!inserted) { System.err.println("Unable to save entry to database"); } if (!valid) { TPosException e = new TPosException("Error in authorisation"); e.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); e.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); e.setDisplayError("Error in authorisation (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw e; } TPosException tposEx = null; switch (Integer.parseInt(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE), 10)) { case 0: return (_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); case 1: tposEx = new TPosException("Authorisation denied"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 2: tposEx = new TPosException("Authorisation denied, pick up card"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 3: tposEx = new TPosException("Authorisation denied, call for manual authorisation"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; } } return ("-1"); }
_client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires);
if (authIDRsp == null) { _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); } else { _client.setProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP, authIDRsp); }
private String doAuth(String cardnumber, String monthExpires, String yearExpires, double amount, String currency, String transactionType, Object parentDataPK, String authRspID) throws TPosException { if(_client != null) { _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); amount *= amountMultiplier; String stringAmount = Integer.toString((int)amount); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } boolean valid = false; try { valid = _client.sendAuthorisationReq(); } catch (IllegalArgumentException e) { getKeys(); createNewBatch(); _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } valid = _client.sendAuthorisationReq(); } boolean inserted = false; TPosAuthorisationEntriesBean entry; try { entry = TPosAuthorisationEntriesHome.getInstance().getNewElement(); // entry.setAttachmentCount(_client.getProperty(TPOS3Client.pn)); entry.setAuthorisationAmount(_client.getProperty(TPOS3Client.PN_AUTHORAMOUNT)); entry.setAuthorisationCode(_client.getProperty(TPOS3Client.PN_AUTHORISATIONCODE)); entry.setAuthorisationCurrency(_client.getProperty(TPOS3Client.PN_AUTHORCURRENCY)); entry.setAuthorisationIdRsp(_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); entry.setAuthorisationPathReasonCode(_client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE)); entry.setBatchNumber(_client.getProperty(TPOS3Client.PN_BATCHNUMBER)); entry.setBrandId(_client.getProperty(TPOS3Client.PN_CARDBRANDID)); entry.setBrandName(_client.getProperty(TPOS3Client.PN_CARDBRANDNAME)); entry.setCardCharacteristics(_client.getProperty(TPOS3Client.PN_CARDCHARACTER)); entry.setCardExpires(_client.getProperty(TPOS3Client.PN_EXPIRE)); entry.setCardName(_client.getProperty(TPOS3Client.PN_CARDTYPENAME)); entry.setCardType(_client.getProperty(TPOS3Client.PN_CARDTYPEID)); entry.setDetailExpected(_client.getProperty(TPOS3Client.PN_DETAILEXPECTED)); entry.setEntryDate(_client.getProperty(TPOS3Client.PN_DATE)); entry.setEntryTime(_client.getProperty(TPOS3Client.PN_TIME)); entry.setErrorNo(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); entry.setErrorText(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); entry.setLocationNr(_client.getProperty(TPOS3Client.PN_LOCATIONNUMBER)); entry.setMerchantNrAuthorisation(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR)); entry.setMerchantNrOtherServices(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES)); entry.setMerchantNrSubmission(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION)); // entry.setPan("***********"); entry.setPosNr(_client.getProperty(TPOS3Client.PN_POSNUMBER)); entry.setPosSerialNr(_client.getProperty(TPOS3Client.PN_POSSERIAL)); // entry.setPrintData(_client.getProperty(TPOS3Client.pn_p)); entry.setSubmissionAmount(_client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT)); entry.setSubmissionCurrency(_client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY)); entry.setTotalResponseCode(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE)); entry.setTransactionNr(_client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER)); entry.setVoidedAuthorisationIdResponse(_client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP)); entry.setVoidedTransactionNr(_client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER)); // entry.setXMLAttachment(_client.getProperty(TPOS3Client.)); entry.setCardNumber(CreditCardBusinessBean.encodeCreditCardNumber(cardnumber)); if (parentDataPK != null) { try { entry.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("TPosClient : could not set parentID : "+parentDataPK); } } inserted = TPosAuthorisationEntriesHome.getInstance().insert(entry);// String tmpTest;// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORAMOUNT);// System.out.println("PN_AUTHORAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORCURRENCY);// System.out.println("PN_AUTHORCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP);// System.out.println("PN_AUTHORIDENTIFYRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE);// System.out.println("PN_AUTHPATHREASONCODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_BATCHNUMBER);// System.out.println("PN_BATCHNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDID);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDNAME);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDCHARACTER);// System.out.println("PN_CARDCHARACTER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_EXPIRE);// System.out.println("PN_EXPIRE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPENAME);// System.out.println("PN_CARDTYPENAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPEID);// System.out.println("PN_CARDTYPEID : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DETAILEXPECTED);// System.out.println("PN_DETAILEXPECTED : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DATE);// System.out.println("PN_DATE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TIME);// System.out.println("PN_TIME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORNUMBER);// System.out.println("PN_ERRORNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORTEXT);// System.out.println("PN_ERRORTEXT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_LOCATIONNUMBER);// System.out.println("PN_LOCATIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION);// System.out.println("PN_MERCHANTNUMBERSUBMISSION : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSNUMBER);// System.out.println("PN_POSNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSSERIAL);// System.out.println("PN_POSSERIAL : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT);// System.out.println("PN_SUBMISSIONAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY);// System.out.println("PN_SUBMISSIONCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE);// System.out.println("PN_TOTALRESPONSECODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER);// System.out.println("PN_TRANSACTIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP);// System.out.println("PN_VOIDEDAUTHIDRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER);// System.out.println("PN_VOIDEDTRANSNUMBER : "+tmpTest.length()); } catch (Exception e) { e.printStackTrace(); } if (!inserted) { System.err.println("Unable to save entry to database"); } if (!valid) { TPosException e = new TPosException("Error in authorisation"); e.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); e.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); e.setDisplayError("Error in authorisation (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw e; } TPosException tposEx = null; switch (Integer.parseInt(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE), 10)) { case 0: return (_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); case 1: tposEx = new TPosException("Authorisation denied"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 2: tposEx = new TPosException("Authorisation denied, pick up card"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 3: tposEx = new TPosException("Authorisation denied, call for manual authorisation"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; } } return ("-1"); }
entry.setCardNumber(CreditCardBusinessBean.encodeCreditCardNumber(cardnumber));
entry.setCardNumber(encodedCardNumber);
private String doAuth(String cardnumber, String monthExpires, String yearExpires, double amount, String currency, String transactionType, Object parentDataPK, String authRspID) throws TPosException { if(_client != null) { _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); amount *= amountMultiplier; String stringAmount = Integer.toString((int)amount); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } boolean valid = false; try { valid = _client.sendAuthorisationReq(); } catch (IllegalArgumentException e) { getKeys(); createNewBatch(); _client.setProperty(TPOS3Client.PN_USERID, _userId); _client.setProperty(TPOS3Client.PN_PASSWORD, _passwd); _client.setProperty(TPOS3Client.PN_MERCHANTID, _merchantId); _client.setProperty(TPOS3Client.PN_LOCATIONID, _locationId); _client.setProperty(TPOS3Client.PN_POSID, _posId); _client.setProperty(TPOS3Client.PN_PAN, cardnumber); _client.setProperty(TPOS3Client.PN_EXPIRE, monthExpires + yearExpires); //_client.setProperty(TPOS3Client.PN_EXPIRE, yearExpires + monthExpires); _client.setProperty(TPOS3Client.PN_AMOUNT, stringAmount); _client.setProperty(TPOS3Client.PN_CURRENCY, currency); _client.setProperty(TPOS3Client.PN_TRANSACTIONTYPE, transactionType); if (transactionType.equals("2")) { _client.setProperty(TPOS3Client.PN_CARDHOLDERCODE, "2"); } valid = _client.sendAuthorisationReq(); } boolean inserted = false; TPosAuthorisationEntriesBean entry; try { entry = TPosAuthorisationEntriesHome.getInstance().getNewElement(); // entry.setAttachmentCount(_client.getProperty(TPOS3Client.pn)); entry.setAuthorisationAmount(_client.getProperty(TPOS3Client.PN_AUTHORAMOUNT)); entry.setAuthorisationCode(_client.getProperty(TPOS3Client.PN_AUTHORISATIONCODE)); entry.setAuthorisationCurrency(_client.getProperty(TPOS3Client.PN_AUTHORCURRENCY)); entry.setAuthorisationIdRsp(_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); entry.setAuthorisationPathReasonCode(_client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE)); entry.setBatchNumber(_client.getProperty(TPOS3Client.PN_BATCHNUMBER)); entry.setBrandId(_client.getProperty(TPOS3Client.PN_CARDBRANDID)); entry.setBrandName(_client.getProperty(TPOS3Client.PN_CARDBRANDNAME)); entry.setCardCharacteristics(_client.getProperty(TPOS3Client.PN_CARDCHARACTER)); entry.setCardExpires(_client.getProperty(TPOS3Client.PN_EXPIRE)); entry.setCardName(_client.getProperty(TPOS3Client.PN_CARDTYPENAME)); entry.setCardType(_client.getProperty(TPOS3Client.PN_CARDTYPEID)); entry.setDetailExpected(_client.getProperty(TPOS3Client.PN_DETAILEXPECTED)); entry.setEntryDate(_client.getProperty(TPOS3Client.PN_DATE)); entry.setEntryTime(_client.getProperty(TPOS3Client.PN_TIME)); entry.setErrorNo(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); entry.setErrorText(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); entry.setLocationNr(_client.getProperty(TPOS3Client.PN_LOCATIONNUMBER)); entry.setMerchantNrAuthorisation(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR)); entry.setMerchantNrOtherServices(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES)); entry.setMerchantNrSubmission(_client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION)); // entry.setPan("***********"); entry.setPosNr(_client.getProperty(TPOS3Client.PN_POSNUMBER)); entry.setPosSerialNr(_client.getProperty(TPOS3Client.PN_POSSERIAL)); // entry.setPrintData(_client.getProperty(TPOS3Client.pn_p)); entry.setSubmissionAmount(_client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT)); entry.setSubmissionCurrency(_client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY)); entry.setTotalResponseCode(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE)); entry.setTransactionNr(_client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER)); entry.setVoidedAuthorisationIdResponse(_client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP)); entry.setVoidedTransactionNr(_client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER)); // entry.setXMLAttachment(_client.getProperty(TPOS3Client.)); entry.setCardNumber(CreditCardBusinessBean.encodeCreditCardNumber(cardnumber)); if (parentDataPK != null) { try { entry.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("TPosClient : could not set parentID : "+parentDataPK); } } inserted = TPosAuthorisationEntriesHome.getInstance().insert(entry);// String tmpTest;// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORAMOUNT);// System.out.println("PN_AUTHORAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORCURRENCY);// System.out.println("PN_AUTHORCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP);// System.out.println("PN_AUTHORIDENTIFYRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_AUTHPATHREASONCODE);// System.out.println("PN_AUTHPATHREASONCODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_BATCHNUMBER);// System.out.println("PN_BATCHNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDID);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDBRANDNAME);// System.out.println("PN_CARDBRANDNAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDCHARACTER);// System.out.println("PN_CARDCHARACTER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_EXPIRE);// System.out.println("PN_EXPIRE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPENAME);// System.out.println("PN_CARDTYPENAME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_CARDTYPEID);// System.out.println("PN_CARDTYPEID : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DETAILEXPECTED);// System.out.println("PN_DETAILEXPECTED : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_DATE);// System.out.println("PN_DATE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TIME);// System.out.println("PN_TIME : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORNUMBER);// System.out.println("PN_ERRORNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_ERRORTEXT);// System.out.println("PN_ERRORTEXT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_LOCATIONNUMBER);// System.out.println("PN_LOCATIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERAUTHOR);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBEROTHERSERVICES);// System.out.println("PN_MERCHANTNUMBEROTHERSERVICES : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_MERCHANTNUMBERSUBMISSION);// System.out.println("PN_MERCHANTNUMBERSUBMISSION : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSNUMBER);// System.out.println("PN_POSNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_POSSERIAL);// System.out.println("PN_POSSERIAL : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONAMOUNT);// System.out.println("PN_SUBMISSIONAMOUNT : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_SUBMISSIONCURRENCY);// System.out.println("PN_SUBMISSIONCURRENCY : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE);// System.out.println("PN_TOTALRESPONSECODE : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_TRANSACTIONNUMBER);// System.out.println("PN_TRANSACTIONNUMBER : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDAUTHIDRSP);// System.out.println("PN_VOIDEDAUTHIDRSP : "+tmpTest.length());// tmpTest = _client.getProperty(TPOS3Client.PN_VOIDEDTRANSNUMBER);// System.out.println("PN_VOIDEDTRANSNUMBER : "+tmpTest.length()); } catch (Exception e) { e.printStackTrace(); } if (!inserted) { System.err.println("Unable to save entry to database"); } if (!valid) { TPosException e = new TPosException("Error in authorisation"); e.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); e.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); e.setDisplayError("Error in authorisation (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw e; } TPosException tposEx = null; switch (Integer.parseInt(_client.getProperty(TPOS3Client.PN_TOTALRESPONSECODE), 10)) { case 0: return (_client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP)); case 1: tposEx = new TPosException("Authorisation denied"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 2: tposEx = new TPosException("Authorisation denied, pick up card"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; case 3: tposEx = new TPosException("Authorisation denied, call for manual authorisation"); tposEx.setErrorNumber(_client.getProperty(TPOS3Client.PN_ERRORNUMBER)); tposEx.setErrorMessage(_client.getProperty(TPOS3Client.PN_ERRORTEXT)); tposEx.setDisplayError("Authorisation denied (" + _client.getProperty(TPOS3Client.PN_ERRORNUMBER) + ")"); throw tposEx; } } return ("-1"); }
throw new CreditCardAuthorizationException("Unsupported");
HashMap map = parseProperties(properties); String cardnumber = (String) map.get(TPOS3Client.PN_PAN); String expires = (String) map.get(TPOS3Client.PN_EXPIRE); String amount = (String) map.get(TPOS3Client.PN_AMOUNT); String currency = (String) map.get(TPOS3Client.PN_CURRENCY); String monthExpires = expires.substring(0, 2); String yearExpires = expires.substring(2, 4); String authIDRsp = (String) map.get(TPOS3Client.PN_AUTHORIDENTIFYRSP); doAuth(cardnumber, monthExpires, yearExpires, Double.parseDouble(amount) / (double) amountMultiplier, currency, "5", null, authIDRsp);
public void finishTransaction(String properties) throws CreditCardAuthorizationException { throw new CreditCardAuthorizationException("Unsupported"); }
public String getAmount() {
private String getAmount() {
public String getAmount() { return Integer.toString(Integer.parseInt(_client.getProperty(TPOS3Client.PN_AMOUNT)) / amountMultiplier); }
public String getAuthorisationCode() {
private String getAuthorisationCode() {
public String getAuthorisationCode() { return _client.getProperty(TPOS3Client.PN_AUTHORISATIONCODE); }
public String getAutorIdentifyRSP() {
private String getAutorIdentifyRSP() {
public String getAutorIdentifyRSP() { return _client.getProperty(TPOS3Client.PN_AUTHORIDENTIFYRSP); }
public String getCCNumber() {
private String getCCNumber() {
public String getCCNumber() { return getPan(); }
public String getCardBrandName() {
private String getCardBrandName() {
public String getCardBrandName() { return _client.getProperty(TPOS3Client.PN_CARDBRANDNAME); }
public String getCardCharacter() {
private String getCardCharacter() {
public String getCardCharacter() { return _client.getProperty(TPOS3Client.PN_CARDCHARACTER); }
public String getCardTypeName() {
private String getCardTypeName() {
public String getCardTypeName() { return _client.getProperty(TPOS3Client.PN_CARDTYPENAME); }
protected CreditCardBusiness getCreditCardBusiness(IWApplicationContext iwac) {
private CreditCardBusiness getCreditCardBusiness(IWApplicationContext iwac) {
protected CreditCardBusiness getCreditCardBusiness(IWApplicationContext iwac) { try { return (CreditCardBusiness) IBOLookup.getServiceInstance(iwac, CreditCardBusiness.class); } catch (IBOLookupException e) { throw new IBORuntimeException(e); } }
public String getCurrency() {
private String getCurrency() {
public String getCurrency() { return _client.getProperty(TPOS3Client.PN_CURRENCY); }