• maziz
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Hi,
 
I am having a problem with inheritance. I am not sure what I am doing wrong... please help.
 
I have an abstract class that looks like this:
public abstract class TokenHandlerAbstract {
  protected Pattern p = null;
 
public Boolean isValid(String testString, TPParams params) {
    Pattern p = getPattern();
    return isPatternMatch(p, testString);
  }
  protected virtual Pattern getPattern() {
    String regexp = functionName + '(.*)';
    if ((p == null) || (p.pattern() != regexp)) {
      p = Pattern.compile(regexp);
    }
    return p;
  }
}
 
This class is extended with a class that looks like this:
public class TokenHandlerString extends TokenHandlerAbstract {
  protected override Pattern getPattern() {
    // Anything surrounded by single quotes
    String regexp = '\'.*\'';
    if ((p == null) || (p.pattern() != regexp)) {
      p = Pattern.compile(regexp);
    }
    return p; 
  }
}

These classes get called from a third class that looks like this:

public class TokenValueFinder {
  private TokenHandlerString thString = new TokenHandlerString();
  public String findValue(String testString, TPParams params) {
    if (thString.isValid(testString, params)) {
      ...
    }
  }
}

When I view the page I get this error:

System.TypeException: Method is not visible: [TokenHandlerString].getPattern()

Class.TokenHandlerAbstract.isValid: line 7, column 21
Class.TokenValueFinder.findValue: line 31, column 20
Class.TPTextParser2.privateParse: line 35, column 31
Class.TPTextParser2.Parse: line 15, column 9
Class.TPResolved2.getTemplateResolved: line 198, column 28
External entry point

If I change the visibility of getPattern() from protected to public, the error goes away. But why?
 
I understand that isValid()has to be public because I am calling the method from a different class. But getPattern() is being called from the same class or one that inherits from it.
 
Thanks
 
Andres Perez
Hello, we develop a suite of applications that include a feature that employs contact "synchronization" with a number of CRM systems (ACT!, SalesLogix, Outlook, etc).
 
Basically, the "synchronization" is simply our application and the CRM running at the same time, and while the user is on a specific contact in the UI of the CRM, our applications allow the user to import the contact data into our system.
 
I'm trying to look into the abilities of the sforce API and at this point I don't see why retrieving the contact data would be a problem. However, I'm not sure about knowing where the user is within Salesforce, for example, if they were viewing contact detail, is there a way to determine which contact they are looking at? I'm assuming we'd then be able to take that key and retrieve the associated data using the sforce api.
 
If not, maybe our "synchronization/import" would need to work a little differently than usual for salesforce. We have a customer (and it has come up in the past as well) that's very interested in us offering/adding this feature with salesforce. Thanks for any knowledge you have on the subject.


Message Edited by Randy_ on 12-05-2008 06:34 AM
  • December 05, 2008
  • Like
  • 0

We have a client application that currently relies on knowing the administrator username/password to log in and read/update data in salesforce

When admins change their password or reset the security tokens, this creates big problems.

How does one solve this issue?

I am wondering if any of these can be used (in preferred order)

1. Salesforce acts as a the single-sign on authentication authority.

2. A "fake" single sign-on solution where we maintain the username/password for one user who has privileges similar to Admin (SFDC recommends that real admin not be put on Single Sign On). We would implement the Authenticate web service and return true.

3  A real single sign on solution where both our application and salesforce use a central username/password. I assume this is possible

4. Salesforce.com periodically polls our application to pull the data, instead of we callling it. How does one implement periodic polling?





Message Edited by GoForceGo on 11-28-2008 08:15 AM
I use the following custom button OnClick Javascript code to pass some values and create a new Case from a Contract.

var CaseURL = "/500/e?CF00N70000002BrKD={!Contract.ContractNumber}&CF00N70000002BrKD_lkid={!Contract.Id}&cas4_lkid={!Contract.AccountId}&cas4={!Contract.Account}&cas5=Maintenance%20Request%20RMA&retURL=%2F{!Contract.Id}";
parent.frames.location.replace(CaseURL);

The code does exactly what it's supposed to do but when a value for Account is passed through that has an ampersand in it everything after the ampersand is left off ex. "Jack & Jill" becomes "Jack".  When you save everything it is corrected since the ID was properly assigned but I'd sure like to not have my users alarmed when they see the name botched.

So far I've tried to surround {!Contract.Account} with single (%27) and double quotes (%22) but all that does is put a single or double quote in front of the value.

Thanks much.
USE CASE
User enters data in text area on standard field (non visual force page)  return of save button has been overrriden to call an s-control. .S-control needs to populate the value of the merge field referencing that standard field  in a javascript var and append it to the url for an iframe. (Seems simple)

PROBLEM
Darn CRLF's that are embedded in the Merge Field if user hits enter in the text area field cause disasterous results (unterminated string error) when applying the merge field value to a javascript var.

QUESTION
Why have I constantly been unsuccessful in using Substitute to remove the CRLF??  Has ANYONE gotten this to work?

I've read varous other hacks requiring additional presentation logic of hidden form fields  or hidden divs working but this is not a read only field. The user is entering this right before the s-control is called.  I've heard of maybe run an additonal query either using query or retrieve as opposed to evaling the merge field but this has not seemed to work for me either.

ie. .the below I am using to protect against single and double quotes but I've tried numerous deritives to project against carriage returns and Substitute just doesn't seem to want to do it.

var desc = encodeURI("{! Substitute(Substitute(Case.Description ,"\\","\\\\"),"\"","\\\"")}" );

Any help would be greatly appreciated as I've wasted numerous hours on this. (in any other scenario I would use the full service side power of java to remove unwanted stuff before applying to the javascript var but in the case of Force.com and using an s-control. from my understanding my server side capability in this context is somewhat limited.

Thank you!


Message Edited by sf consultant on 11-26-2008 07:56 AM

Message Edited by sf consultant on 11-26-2008 07:57 AM

Message Edited by sf consultant on 11-26-2008 07:58 AM