Subtype dependency on corresponding subtypes

Hi All,
I have a design question.
I am writing an application that will search through the contents of various files against a given search criteria. I envisage that there will be different search strategies, each of which have different search criteria. A couple of examples would be as per below.
Plain Text Strategy. Criteria: a single string (search term), case sensitive flag.
Regular Expression Strategy: a single regular expression, number of lines before and after each result to include, case sensitive flag.
XML Strategy: a single string (search term), name of the xml element to be searched within.
I envisage having an abstract search type and concrete subclasses based on each strategy. For example:
interface Search {
   SearchResult search(SearchCriteria criteria);
public class PlainTextSearchStrategy implements Search { 
   public SearchResult search(SearchCriteria criteria) {
      // do the search..
public class RegularExpressionSearchStrategy implements Search {  ... }
public class XmlSearchStrategy implements Search {  ... }My difficulty is the SearchCriteria. Each search strategy type would have its own search criteria type and I do not think there is any common behaviour (or data) that can be defined in the criteria super type. As such, SearchCriteria is just a marker interface, and this bothers me. The search strategy sub-types would need to cast SearchCriteria to the specific type they need, so there is no type safety beyond ensuring the marker interface is implemented. For example:
public class PlainTextSearchStrategy implements Search { 
   public SearchResult search(SearchCriteria criteria) {
      PlainTextSearchCriteria ptCriteria = (PlainTextSearchCriteria) criteria;
      // do the search..
}Is there a design better suited to this problem of ensuring a sub-type can rely on corresponding subtypes being present? As I understand it, generics won't help me here either. Do I need to live with the casting?
Any advice would be much appreciated!
Rob
:)

Even so, the client shouldn't need to know the
runtime type of the object. For example, if all of
the criteria are strings, you can use varargs to pass
them: interface Search {
SearchResult search(String... criteria);
code] Hi Uncle, thank you for this response. You have raised some important questions that I have put some thought into previously. If I were to store the criteria as strings, it would make a flexible search criteria object, but I think there are some disadvantages:
- I would want constants etc to formalize the position of each criterion in an array, for example.
- I would have to unpack each criterion and potentially parse them into types such as booleans and regular expressions or dates.
On the other hand, if each criteria were a type of its own, I would not have to unpack or care about the position of a string in an array.
But I'm not recommending a specific approach,
just encouraging the OP to minimize the coupling
between these Search objects and the code that uses
them. You are certainly right about the tighter coupling. Plain text search strategy is tightly coupled to plain text criteria, regular expression search strategy is tightly coupled to regular expression search strategy. Is this such a bad thing here? I would think that a search strategy should break if it does not receive criteria specific to its logic. My thinking is that the type safety is a deliberate measure to ensure the right arguments are sent to a subclass in a situation where the superclass defines something broader.
That's what programming to interfaces is all
about. If the client has to know the runtime types
of the Search objects, you largely defeat the purpose
of using interfaces.This point made me think a lot. The reason I began with the idea of a SearchStrategy supertype in the first place was so that multiple strategies could be swapped in and out as needed. Spring could control the initialisation of them and at the UI level I could potentially have a combo box for the user to select which one they want to use.
Then I thought: what about polymorphism for the search criteria as well? But, for a given strategy, I don't think I would ever want to swap between different search criteria types.
I hope I haven't misunderstood what you have stated; thank you for the thought behind your response.
Rob

Similar Messages

  • B/w images

         Is it possible to create a pdf (from .html for example) with true 1 bit images ( so that they could be compressed to jbig2 with PDF Optimizer ) using acrobat 9 ?
    It seems like "print to pdf" from a web browser stores images as gray or colored, depending on corresponding options, but not b/w .
    "Create -> pdf from web page" just misunderstands 1bit .bmp ...
    There is at least one program that can create such pdfs : abby finereader, but it, of course, is hard to use to convert usual web page....

    Well...the only question is where is this option...
    I've tried various combinations in most common printer properties dialog "file-print-properties". Did you mean it's enough to select "black and white" on " paper/quality " tab? Well, I'll try again.....
    Nothing, still gray:
    This time I've used acdsee to print  .tif image to pdf with "standard" profile and etc. unchanged, except selection of BW on second tab.. It's gray..
    Next time I took gray image, and in addition to selecting BW ,in profile I've set "color-color management policies: tag everything foro color management"
    "color-working spaces-gray: black and white" . I've even unchecked "advanced-allow postScript to override ..." and "advanced-save original JPEG ..." ...
    And nothing, it's still gray...
    I've looked through "control panel-printers-adobe pdf-properties" and found nothing except "color management " tab which...emm.... can be used to reduce images to 1bit,as I think, but seems as this won't change its storage format to 1bit.(I'm still trying to use jbig2...)

  • Show different lists depending on subtype

    Hi,
    In transaction PA30 it is possible to show a list. Normally you define the list screen number in the customizing for infotypes, so just 1 different screen is possible. Now I want to know if it is possible to use  2 different screens for the list display. I need to redefine the screen number within the program flow depending on the subtype. I can't find an user-exit for this. Has anyone a solution??
    kind regards Maarten

    Hi Maarten,
            I think U can do this by definig a new feature based on the subtype and call the alternate screen  for the respective variable key.
    How to do:
    step 1 : Create a feature with the variable keys defined based on the subtype.
    step 2:U can use the table T588M to call different alternate screens for the respective variable key(Output from feature). 
    U can ask ur functional consultant to do this kind of work.The data in the table T588M is maintained by the functional people.

  • New subtype to 0021 FAmily member /dependants

    Hi ,
    I want to add a new sub type to family members and Dependants info type.I see a lot subtypes available in V_T591A however when i go to the master data i only see one subtype coming up 7:emergency contact. All the other subtypes such as child,spouse and divorced spouse even though they exist do not seem to come up. I was wondering if there was any place where we mention what subtypes appear and do not appear in the master data.  Any help is very much appreceated.
    Thanks in advance
    Jason

    Hi Jason,
    Just try to maintain the subtypes in V_T591A for IT0021 through SM30 or IMG path: PM -> PA -> Personnel Data -> Family -> Personnel Data -> Define family types
    The most common family types have already been defined in the standard SAP System.
    1. Check whether the default settings meet your requirements.
    2. If you need to create a new family type, proceed as follows:
    a) Enter the value 0021 in the field Infotype.
    b) Enter the number of the new infosubtypes.
    c) Enter a short text for the family type.
    d) Determine the time constraint of the family type.
    Also if there are subtypes already defined there for IT0021 and then also they are not getting displayed then you need to evaluate.
    Let me know if this is the case.
    Hope this will be of help
    Regards
    guds

  • ALE distribution of HR master data to CRM - subtype CELL and MAIL

    Hello,
    Overview/Introduction:
    we are using the ALE distribution of HR master data to CRM. The distribution has already been set up and it is running. We know that the infotype communication (0105) is especially distributing the subtypes 0010 (e-Mail) and 0020 (telephone number). This e-Mail address and the telephone number are stored in the business partner in the CRM system.
    For this infotype 0105 there are also the subtypes CELL (cell phone) and MAIL (e-Mail address). Unfortunately this cell phone number and the mail address (from subtype MAIL) are not stored at the business partner in CRM.
    Our request is on the one hand to store the data from subtype CELL into the field mobile number of the business partner. And on the other hand we want to store the e-mail address of subtype MAIL at the business partner instead of subtype 0010.
    For some reason it seems that these requests canu2019t be setup within SAP standard.
    So we found SAP note 758426 which suggests to use the BAdI HRALEX_INBOUND and the report RH_ENHANCE_BP_TEMPLATE.
    Problem:
    Now the problem is that the BAdI does not get called! The BAdI is active! We tried to set break points -> unfortunately did not stop! And we also implemented an endless loop in the BAdI -> even with this the system did not u2018stopu2019!?
    Any ideas?
    Thank you,
    Roman

    Hi,
    First you need to create a distribution model using transaction BD64 : Edit > Model View > create.
    Then you will need to maintain fields for description and technical name. In partner box you need to enter the source system (HR) and the target system (FI) in the second field. Then you need to assign a message type and filter settings if you need it. You need to create this distribution model in source system (HR).
    After, still in BD64, go to environment > change partner profile or transaction WE20
    Select your target system and enter the corresponding message type ( HRMD_A or HRMD_ABA depends on your scenario) with the correct customizing (receiver port, packet size, idoc type, syntax check and output mode).
    Then please do the same things in your source system using WE20 for your source system and define your inbound parameters (Process code HRMD, processing by function module : use trigger immediately if it is not a production system or else trigger by background program and this case you will need to run report RBDAPP01 to process Idocs).
    Once done, then go back to your model view in your source system (BD64) and go to Environment > generate partner profiles. Then please go to Edit > Model View > distribute
    After all these settings done, it should work.
    Please also check out documentation :
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/82/933b90aa9e11d6b28800508b5d5211/frameset.htm
    Best Regards
    Christine

  • How to hide subtypes from standard infotype 21 in ECC6.0 ?

    Hi All,
    I encounter the following problem : we've upgraded our customer's SAP HR system from 4.6c to ECC6.0 and new standard subtypes for infotype 21 appear (especially when you press F4 or use the entry help button in transaction PA30) ...
    And our customer askes us to remove these new one ... so I made my research and finded in the IMG : 'BAdI: Set Up Entry Help for Subtypes' ... Then I clicked on it, a window appear and I choose the corresponding line for IT0021 ... but I don't know what to do after that ? I tried to create a new implementation with name terminated by 0021 (like proposed in SAP standard help) but I encountered a blocking message about the Filter type (defaulted at INFTYPA and not modifiable).
    Before that, I found the view V_T591A but it doesn't seems to be indicated to remove line from this table to solve my problem, that's why I continued to investigating and finally find the 'BAdI: Set Up Entry Help for Subtypes'.
    Then I desactivated the Badi and the system asked me a transport request ... now I try to re-enable it and the system ask me a repair key At this time, I didn't make any change in the system.
    I really don't know what to do ... Could you help me ?
    Only one thing makes me happy : I did this in the sandbox system and our other landscape's system are not impacted by my research ... Ouf !
    Have a nice day / afternoon / night !
    Sincerely yours,
    Alexandre.

    I would go more along the way of using a search help exit. In fact for field FAMSA the search help used is the generic H_PAD_T591A_SUBTY so there is a search help exit for that one, HR_H_PAD_T591A_SUBTY_EXIT. I haven't used it still, but there is some documents on how to use and restrict the values you want for a specific Infotype.
    There could be another way, but in the case of the Infotype 0021 i don't think it's possible which is using implicit enhancements in the PAI modules of the screen. Some infotypes are possible to enhance, some aren't i think that 21 is one of the "aren't" ...
    Either way, hope this can be another way to go. Good luck.

  • Subtype Validity Start date Check

    Hi All,
    For one of the infotype we created a new subtype with the validity in future date say 01102010.
    Now if i go to infotype i am able to create the record for this new subtype with the start date as 01042010 which should not be allowed.
    I checked the table V_T582A and also the time contraint for the infotype.
    Time constraint for the infotype depends upon the subtype and in the subtype table it is mentioned as 2.
    I know that we have the custom check for the infotype but is it possible through stadard settings
    Pls guide me on this
    Regards,
    Umesh Chaudhari

    Hi Umesh,
    Though the subtype table for 0071 (Pension funds GB) is V_T591A; it also reads T5G30 to identify the schemes..
    Table T5G30 in turn has got various Pension Schemes with Start Date/End Date.. If you Start Date and End Date of the Plan is in Future (01102010) and if you intend to maintain the new scheme (Subtype) from 01042010; an error is displayed..."Scheme XXX is unknown for this period; check pension table entries."
    Kumarpal Jain.

  • Creation of subtype for custom infotye

    hi,
    I have a requirement to create a subtype for custom infotype for particular fields and same fields can be able to see in T-code pa30 for corresponding infotype and subtype .
    Kindly tell me the steps or proceedure to create subtype.
    Thanks in advance
    Shweta

    hi,
    you can achieve this using PM01 transaction and some functional configuration.
    for more details search in ERP HCM Forums.

  • SQL Developer Data Modeler-  Creating super/subtype relationship

    The User's Guide does not tell you how to create super/subtype relationship.
    To create super/subtype relationship in a logical model, you must already have the two candidate entities; one to be the supertype, the other subtype.
    - on the logical model diagram, right click the candidate subtype and select Properties
    - on the Entity Properties dialog box, select the candidate supertype from the Super Entity drop-down list, then OK
    Depending on whether you enable or disable the Box-in-box Presentation on your logical diagram, the subtype would be shown inside or outside its supertype entity, respectively

    Hi Peter,
    When I examine an XML file for a relation converted from version 2.0, the XML elements "nameOnSource" and "nameOnTarget" are missing in the converted 3.0 EA1 versionthey are not loaded during "open" of older design. If you define them they will go into XML file.
    Philip

  • Infotypes and its subtypes. ( urgent )

    Hi all ,
    Please provide me some information regarding basic standard  infotypes along with its subtypes , purpose of the subtypes, its fields and its purpose also how the data flows within the data types.
       In short i want all the functional details of infotypes and its subtypes.
    Thanx,
    Amruta.

    Hi
    Address (IT0006): Sub type may be Permanent, Communication, etc
    Family / Dependent Members (IT0021): Sub type Spouse, Family, Dependent etc
    Obects on Loans (IT0040): Sub type Laptops, Projector etc
    Comminucations (IT0105) : Sub type Mail, Telephone etc
    These are some std IT for ur eg., The IT sub types are created based on the req. If you want to know clearly abt the sub types for the available infotype Goto SPRO>Personnel Management> Personnel Administration--..... Infotypes .....

  • SDDM EA 3.1: Engineer to Relational Model (subtypes)

    It seems that mandatory attributes of entity subtypes become mandatory columns on the corresponding tables even when you engineer to "one table" (the super type).
    In that case I would expect that the column would become optional.
    Even better: a check constraint would verify that the column was not null for records belonging to the originating subtype.
    / Marc de Oliveira

    1) Funny, when I dropped the column, and had it recreated by the engineering process, it worked correctly. But re-engineering the old column kept setting it to mandatory even when I manually set it to optional. I have a sense that some of my objects are ignored by the tool... Only when I drop them and recreate them they seem to be recognized. I had the same issue with some entities that consistenetly did not got engineered into my relational model. Only when I created a new ER-diagram and included the same entities they would get engineered into the relational model...
    2) Designer did this. When a supertype table was generated in the "one table" mode there would always be a new column called SUBTYPE with a constraint allowing the short names of each subtype as values (ex: for the table PARTIES the SUBTYPE column could only contain the values PERS and ORG). With this in place you could create constraints such as "SUBTYPE = 'PERS' and FIRST_NAME is not null or SUBTYPE = 'ORG' and FIRST_NAME is null".
    Regards,
    Marc de Oliveira

  • Subtree generation does not save its settings. Supertype-Subtype-RollUp needed.

    Hello OTN-Network,
    currenty we are investigating whether we will use Oracle SQL Data Modeler in a new data warehouse project.
    As we are working with the top-down approach, we plan to start with the Logical Model which contains super-sub-type-hierarchies.
    We tested this functionality and were able to derive from Logical Modell to a Relational Model but we are unable to use the settings described the the entity properties "Subtypes -> Subtree generation".
    We would like to do a "Supertype-Subtype-RollUp". When changing the settings they are not saved and set to the default "Do not present". In our example two subtypes have one supertype in common,
    which is definied as "Super Type" in the properties.
    Could you pls. tell me how to achieve that attributes etc. from subtypes are rolled up to one single table?
    Do not hesitate to come back in case of any queries.
    Thanks in advance

    Hi,
    how to achieve that attributes etc. from subtypes are rolled up to one single table?
    Implementation of elements(types) of entity hierarchy depends on "Engineer To" flag - if it's set for related relational model then enity will be implemented as table. So for single table you need that flag set only for super-type (or root of hierarchy) and not checked for all subtypes.
    "Subtree generation" is not a property, it's functionality allowing easy set up of "Engineer to" property for edited entity and its sub-tree. This is why it's always on "Do not preset".
    Philip

  • Subtype in abap hr

    Hi Friends,
    I have to retrive data from more than one(10-20) subtype of infotype2001. But i am using Rp_provide_from_last statement in my program.
    How can i retrive.

    As long as you use macros to access infotype data (i.e rp_provide_from_last ) I believe you also have declaration like
    infotypes 2001.
    This means that corresponding table p2001 is filled with all the data for particular EE during GET PERNR event. So all you need is to restrict the records from internal table with the subtypes you want, like
    loop at p2001 where subty = ...
                                  or subty = ...
    "here process only selected subtypes' records
    endloop.
    or use range table, append there all the subtypes you want and use it in the loop
    loop at p2001 where subty in it_range_subty.
      "here process only selected subtypes' records
    endloop.
    Regards
    Marcin

  • Materials replication and R3PRODSTYP product subtype - SYSFAIL in inbound q

    Hi,
    We are using SRM 7.0 and we have a problem in materials replication. In inbound queues we have the status sysfail and the following error:
    R3A* Error in Mapping (Details: transaction SMW01)
    In SW01 the error messages are: u201CDownload inicial material: Table not supported by functionu201D and u201CCategory for material type MAT_Z001 does not existu201D
    We did the initial download of DNL_CUST_PROD1 and the materialu2019s group corresponding to R3MATCLASS were replicated successfully. However the product subtype, corresponding to R3PRODSTYP, was not correctly replicated. Thus, the materials are not being replicated.
    Do you have any ideas?
    Thanks in advance,
    Best regards,
    AN

    Hi AN,
    Do you mind verifying your setup with this blog? : /people/marcin.gajewski/blog/2007/02/05/how-to-replicate-material-master-from-r3-to-srm
    Also in ECC system, what are your entries in the table : CRMPRLS?
    Regards,
    Nikhil

  • Validity Date options in the Portal for Child Subtype

    Hi All,
    For Child Subtype, the three options
    1. Valid from Today
    2. Valid as of Future Date
    3. Validity Period
    are present in the portal depending on the usecase maintained. For the 2nd & 3rd option, the user can enter only future dates.
    Past dates are not allowed to be entered from the portal but are allowed in the backend.
    We have a requirement of allowing past dates from the portal. But when we try to do this, we get an error 'Start data should be today's date or later'.
    What is the reason of preventing past dates for the record in the portal when this is available in backend?
    Thanks,
    Anushree

    Hi
    Some companies don't want employees to be able to back-date records for children due to eg. rules for reimbursement, absence quotas etc. They want HR-department to check if setting dates in past is OK.
    But you can change this behaviour by creating an implementation of HRXSS_PER_BEGDA. It is found in PTARQ -> Customizing-> Service-specific settings ->Own data -> Change default start date.
    Make sure you test the use case, because not all use-cases allow setting dates.
    Code would be like this:
    method IF_EX_HRXSS_PER_BEGDA~DEFAULT_DATE.
      data: ls_t7xsspersubtype type t7xsspersubtype.
      if infty eq '0021'.    -> Add subtype if needed
      Get use-case
        select single * from t7xsspersubtype
          into ls_t7xsspersubtype
          where molga eq molga
            and infotype eq infty
            and subtype eq subty.
      Set begda='19000101' if use-case is A*
        if sy-subrc eq 0 and
           ls_t7xsspersubtype-usecase+0(1) eq 'A'.
          begda = '19000101'.
        endif.
      endif.
    endmethod.
    Hope this helps
    /Kirsten

Maybe you are looking for

  • Query hint to force SQL to use a temporary table in a CTE query?

    Hi, is it possible to tell SQL Server to create a temporary table by itself when I'm using a CTE in my query? I have a query starting with a CTE where I group by my record, then another recursive CTE use the first CTE and finally my select statement

  • Testing of SAP BW system after migration from OS Unix to windows

    Hi Experts, I am working on a project wherein testing of BW system is required after migration from OS Unix to Windows. If any one has done same set of activities in past or has any idea of this, please share all major test steps required after migra

  • Re: BT Broadband Desktop Help problem

    I am new to this FORUM and as yet have not been able to find how to open a THREAD so I have taken this facility to post my query or should it be queries. According to the BT.Com website the Broadband Desktop Help program functions with XP, Vista and

  • Any updates on 1.6.1?

    Anyone have any updates on the rollout of 1.6.1? Didn't know if anyone had updates on the progress of the tweaking since the rollout in WA with the audio isssues?  In VHO 08 (NJ) and was scheduled initially for Jan 27th. THX 

  • Updating the table using excel sheet

    hello friends i have exported the tabel EINA in to a excel sheet , and made changes , now i want to upload same excel sheet into same table and update the change value into table , how can i do this??? regards ravikant dewangan