How to hide this method?

I want to use Protection Proxy Pattern,but I feel nervous about my
real method,how can i hide it(such as set it friendly or protected)?
you can see this code:
interface Safe{
     public String getSecret();
class RealSafe implements Safe{
     public String getSecret(){
          return new String("You can get the secret");
class ProtectionProxy implements Safe{
     private String password=null;
     public ProtectionProxy(String temp){
          password=temp;
     public String getSecret(){
          if(password.equals("I have the rights")){
               RealSafe realobj=new RealSafe();
               return realobj.getSecret();
          else{
               return new String("Illegal password,You can't get the secret");
How to hide the getSecret() in class RealSafe with the precondition of using Protection Proxy Pattern???????
How can i do? i need your help,please!

You can't prevent a malicious developer constructing an instance of RealSafe. They could always decompile your application and make changes to it if they wanted anyway!
The ProtectionProxy is really just a convenience for users of your API. It provides "reasonable" security through a means of determining whether the current user has access to the data. It does not provide a means of determining whether the current developer has access to it!
Your proxy lays down the rules for accessing the class being proxied. This works when the client application plays by the rules (as most applications do).
So all you need to do is make sure that developers who play by the rules can't construct an instance of RealSafe:
public class SafeFactory
  public static Safe getSafe(...)
    Safe safe = new RealSafe(...);
    return new ProtectionProxy(safe);
class RealSafe implements Safe
  RealSafe(...)
class ProtectedSafe implements Safe
  private Safe safe;
  ProtectedSafe(Safe safe)
    this.safe = safe;
}Thus the only way for a developer to get hold of an instance of Safe is to use SafeFactory.getSafe which always returns a ProtectedSafe.
Make sure you don't mistake this sort of pattern for robust security, though. It simply allows your client application to catch "UnauthorizedExceptions" and react accordingly. As pointed out in this thread there're various ways of getting at the data that's hiding inside a Proxy. If you're really concerned about preventing someone viewing your data unless they are authorised you need to either encrypt it or only load it (and not cache it) when their credentials have been provided.
Hope this helps.

Similar Messages

  • How to use this method in JSTL?help me please!

    I know I can use "<C:set >" like as
    <c:set var="clabel3" value="${portalCustomizeBean.portalPage}"/> ,
    but now I want to use one method of portalCustomizeBean object not a attribute of it !!!!!
    who would tell me how to use?
    this is wrong in my code:
    <c:set var="clabel" value="${portalCustomizeBean.currentPageLabel}"/>
    <c:set var="clabel3" value="${portalCustomizeBean.toEntitiesExceptSpaceEscape(clabel)}"/>
    but how to use "toEntitiesExceptSpaceEscape" method in JSTL?????

    Why can't you just assign the method's return value to a variable and then print that? A bit of scriptlet code will do the trick. (As much as we all hate to use scriptlet code.)
    I believe you'll be able to do what you want in the 1.1 standard JSTL, but for now this will suffice. - MOD

  • How to exit this method

    public class Main {
       static  int i=0;
    public static void main(String  args[]) {
    go();
    static void go(){
    i++;
    System.out.println("A");
    if(i==10){     
       System.exit(0);  // rather than terminating the program is there a way to exit this method ??
    go();
    }

    Assuming you mean the go method, you could use return, or just let the end of the method happen naturally.
    Like for example if i is 8 then the go method exits.
    You need to look into for loops, no clue what you are trying to do here, but it looks like you are trying to do a for loop without a for loop.
    JSG

  • How to hide this table if my record in display table =null?

    i create a list to display record inside the table. If i wanna hide my table in case the list no any record. What statement should i add on? i may using <c:choose> ?
    <tr>
    <td colspan="3">
    <fieldset>
    <legend>CSC Listing</legend>
    <table>
    <tr>
    <td colspan="4">
    <display:table name="CSC" pagesize="10" id="csc" sort="list" defaultsort="3" requestURI="/csc.do?submit=SEARCH" class="model" >
    <display:setProperty name="paging.banner.placement" value="both"/>
    <display:setProperty name="paging.banner.some_items_found" value=""/>
    <display:setProperty name="paging.banner.one_item_found" value=""/>
    <display:setProperty name="paging.banner.all_items_found" value=""/>
    <display:setProperty name="paging.banner.no_items_found" value=""/>
    <display:setProperty name="paging.banner.onepage" value=""/>
    <display:setProperty name="basic.msg.empty_list" ><center>No Record(s) was found.</center></display:setProperty>
    <display:column ><html:radio property="cid" value="${csc.id}" /></display:column>
    <display:column title="CSC ID" sortable="true"><cut value="${csc.merchantId}"/></display:column>
    <display:column title="CSC Number" sortable="true"><cut value="${csc.merchantNo}"/></display:column>
    <display:column title="CSC Name" sortable="true"><cut value="${csc.name}"/></display:column>
    </display:table>
    </td>
    </tr>

    You need to use an IF statement. I dont use jstl so youll have to find the syntax yourself.

  • SetDataValueAt() ? How do i use this method ?

    Hello,
    I have a application that was made using jdeveloper and
    bc4j,and in it I want to update a jjtextfield that is bound to a view object.I've read up on jutextfieldbinding and it has a method setDataValueAt(java.lang.Object,int attrindx) that I think i need.
    Please show me how to use this method as I can't find examples anywhere.I am new to programming with BC4j.
    Thanks in advance,
    Carl Lang

    For textfields bindings, you may use
    setDataValueAt(yournewvalue, 0)

  • How to hide Actions Column in Table

    Hi All,
    I have a simple requirement: I am showing a table (items)
    - the "Actions" column (Column with Buttons to Edit and Delete a particualr row) must not be show -> no changes to the table are allowed (I need to hide/ disable this column)
    How can I hide this column od the table?
    I have found out that the field is called thtmlb_oca and that htere is a getter method get-thtmlb_oca. However, the method does not contain coding and I do not know how to HIDE this field/ column...
    Please help me here..
    Thanks, Johannes

    Hi Johannes,
    To remove the column completely,
    you need to comment this line in the method GET_TABLE_LINE_SAMPLE of the Table View Context node class.
    TYPES: BEGIN OF line,
    *  thtmlb_oca  type  crm_thtmlb_one_click_action.
      INCLUDE TYPE xxxx.
      TYPES:  END OF line.
    Disabling can be controlled in the method GET_OCA_T_TABLE of the same class by putting code to delete the button.
    LOOP AT  rt_actions ASSIGNING <fs_actions>.
          <fs_actions>-active  = abap_false.
        ENDLOOP.
    Regards,
    Masood Imrani S.

  • How to hide the coloumns in the excel download Using I_OI_SPREADSHEET

    Hi,
    How to hide or delete the coloumns which are not containing any values ,I am using interface  I_OI_SPREADSHEET.
    There is a method in this interface HIDE_COLUMNS please let me know if any body knows how to use this method to hid the coloumns in the spread sheet download.
    Thanks in advance,
    Regards,
    Venu

    Hi,
    You just define first column and last column you want to hide from method:
    CALL METHOD go_excel->go_spreadsheet->hide_columns
      EXPORTING
        name     = 'test'
    *    no_flush = ' '
        first    = 2 "you want to hide row 2nd and 3rd
        last     = 3
      IMPORTING
        error    = go_excel->go_error
        retcode  = go_excel->gc_retcode.
    Regards,

  • How to hide Total value in RFX response webdynpro component

    HI experts,
           We are working on SRM 7.0 and there is a requirement to hide the Total Value that appers on RFX Response Header for a particular Role.The webdynpro component is FPM_IDR_COMPONENT and View is IDR_VIEW..I have searched the SDN and found that CL_FPM_IDR class methods can be used to hide the Items.But method SET_ITEMS_VISIBILITY sets the visibility for all items,but i want for a particular pair.Please advise me how to hide this field value pair dynamically.
    Regards
    Sonika

    What you might try is to remove the particular key_value pair from the lt_items table which is passed to the IDR.
    So search in(WDA/Assistance class/Feeder class ) and find out the place ,from where this table is filled and called to set items on IDR.
    Remove the pair before from table before the call to IDR.

  • How to hide fields on Sourcing cockpit

    Hi,
    Our client wants to hide some of the fileds in the  Souricng cockpit which they are not using by their purchasing department. example contract, auction, info rec etc in Sourcing cockpit
    How to hide this fields in Sourcing cockpit?
    They wants to bring internal note to soucing cockpit sceen, it is time cossuming for Puchasing department to drill down to each SC line item in Sourcing cocpit to see internal note for SC having 100+ items.
    Thanks
    Ravi

    Hi Ravi,
    You can even use the Screen variants to hide the standard fields on sourcing cockpit.
    Go to transaction SHD0--> Screen Variants.
    Transaction Code: BBPSOCO01
    To hide fields on the worklist the screen variant is BBP_SOCO_WL. Make a Z copy of this screen variant say ZBBP_SOCO_WL. Go inside this Z screen variant in change mode and tick in invisible box opposite to the field you want to hide. Save the screen variant.
    Now go to BADI BBP_SCREENVARIANT
    Method GET_SCREENVARIANT_SOCO
    Assign EV_SCVARIANT = 'ZBBP_SOCO_WL'.
    This will definately hide the fields. For bringing internal note , you need to create a customer field similar to internal note and assign the value of internal note to it.
    Hope this helps.
    Thanks,
    Pradeep

  • How to hide Bottom Line in Report ?

    Hi everyone,
    We are working on Reports 11gr2 64-bit.
    In every report, when text is completed on a page, a horizonal line (i.e. bottom line) at the end of the every page is shown and printed unnecessarily.
    But creates problem in printed stationary, specially in Cheque-printing.
    Kindly advise me how to hide this bottom-line, specially in printing.
    Thanks.
    Dev.
    Edited by: ocpdev on Apr 5, 2013 6:29 PM

    HI
    Is these reports are developed on 11g or migrated from earlier version.
    Anyhow, to test it, - create a report from scratch on 11g and run it, Also check the Footer for any Lines on it.
    I hope you can identify the issue by redoing the thing for testing
    Best of luck
    ocpdev wrote:
    Hi everyone,
    We are working on Reports 11gr2 64-bit.
    In every report, when text is completed on a page, a horizonal line (i.e. bottom line) at the end of the every page is shown and printed unnecessarily.
    But creates problem in printed stationary, specially in Cheque-printing.
    Kindly advise me how to hide this bottom-line, specially in printing.
    Thanks.
    Dev.
    Edited by: ocpdev on Apr 5, 2013 6:29 PM

  • How to hide Deletion boutton in COGI?

    Dear PP expert
    I don`t like User to deleted goods receipt error in tcode COGI, how to hide this boutton in COGI?
    Thanks in advance
    Edited by: benny zeng on Apr 11, 2009 11:07 AM

    Hi,
    You can do it by using transaction variant.
    Refer this linkto know how to create a transaction variant.
    Re: VARIANTS
    hope it helps

  • How to hide read mode navigation in acrobat xi permanantly

    How to hide "Read mode navigation" . In my application i am opening pdf file in light box window where i disable right click to protect download and print pdf file( only View ). but This Read mode navigation is appearing automatically when we put curson on file even if we protect the document. I have purchased Acrobat professional xi to created protected acrobat file by disabling menu tool bar but there is no option to hide readmode navigation. Please let us know how to hide this.
    Thanks,
    Nagendra

    If you want the form "flattened", that is all form fields converted to PDF context, you need to use some JavaScript to flatten the form fields. This will remove all form functionality. It will not prevent editing by Acrobat's text touchup or object tools.
    The "submit" button is used by other users to sent the PDF form data to a central collection site or email address where the sender or provider of the form can collect the submitted data.
    You could also use a digital certificate to sign the form and lock the fields. The signature will also verify that no changes have been made to the PDF since it was signed and one could also see what was changed.

  • How to Hide advance button in input list of values Popup

    I am using input List Of Values component to select value from search Pop up, in that popup i need only basic search only , i am unable to hide advance button... plase tell me how to hide this advance option

    I haven't tried this, but check
    How to remove basic/advanced button in inputListOfValues search dialog
    This does not have complete solution, but might give you some lead.

  • How to call a method in private section of a class in the public section

    Hi Everybody,
    i have written a method(meth1) in the private section of a class(C1).
    it is as follows
    class C1 definition.
    private section.
    methods: meth1 importing im_dt1 like tp1
                                             im_dt2 like tp2
                                             im_dt3 like tp3
                                             im_dt4 like tp4
                               returning value(re_dt1) like tp5.
    endclass.
    i have the final data that has to be displayed in internal table re_dt1.
    now my question is how to call  this method present in private section into public section and display the data present in re_dt1.
    Thanks,
    learning.abap.

    Hi,
    what you need is one public method being called at start-of-selection. Within this the private methods have to be called.
    The question is, why has the method for reading the database tables to be private? If you have only one private method reading all database tables the public method being called at start-of-selection will only consist of a call-method statement.
    This seems to be one call to much.
    The logic for reading the different database tables is hidden inside the class anyway.
    Is there any further logic reading the different database tables?
    Have always all table to be read? If not another approach would be one private method for each database table being called by a public method deciding which table has to be read:
    public section.
    methods get_data returning value(re_Dt1).
    private section.
    methods:
    get_table_a returning value(im_dt1),
    get_table_b returning value(im_dt2),
    get_table_c returning value(im_dt3),
    get_table_d returning value(im_dt4),
    combine_data importing im_dt1
                                    im_dt2
                                    im_dt3
                                    im_dt4
                            returning value(re_dt1).
    *- implementation of public method:
    method get_data.
      data: lt_dt1 ...
               lt_dt2,
               lt_dt3,
               lt_dt4.
    * here decide which tables have to be read:
    lt_dt1 = get_table_a( ).
    lt_dt2 = get_table_b( ).
    lt_dt3 = get_table_c( ).
    lt_dt4 = get_table_d( ).
    re_dt1 = combine_data( i_dt1 = lt_dt1
                                           i_dt2 = lt_dt2
                                           i_dt3 = lt_dt3
                                           i_dt4 = lt_dt4 ).
    endmethod.
    *- implementation of private methods
    method get_table_a.
    endmethod.
    method get_table_b.
    endmethod.
    method get_table_c.
    endmethod.
    method get_table_d.
    endmethod.
    method combine_data.
    endmethod.
    Regards
    Dirk

  • How to use the method for field-exit to trigger the workflow?

    Dear all,
         I want the workflow to trigger , when ever the check box for DELIVERY COMPLETED is checked in ME22N .
         I have developed a method in SE18 for the corresponding field and defined function module SWE_EVENT_CREATE with BOR bus2012 and event CHANGED.
        Now how to use this method to make my workflow to trigger?Shall I create an event in delegated bus2012 and can I call this method?
    Thanks and regards,
    S.Suresh

    Hi
    You want to place your method which is defined for particular filed.right?
    For that you can go for BADI. First you check whether any badi is getting called form that tcode ME22N. Then to place your method, implement that BADI.  So whenever that BADI is getting called, it will call your event. Through Event workflow will be getting triggered.
    Regards,
    Hemalatha.

Maybe you are looking for