What is the getQuery method for?

The Documentum sample code is never commented, so my question is:

What does this line mean?

IDfQuery query = DfcUtils.getClientX().getQuery();
+3
source share
3 answers

The answer to the old question, but the original poster asked what the line means, and not which alternatives can be used.

The line creates an instance of the IDfQuery implementation from the factory method in an instance of the object created by the static factory method in the DFCUtils class. This object is then assigned to a variable.

So: -

  • DfcUtils = class containing the static getClientX () method
  • getClientX () = static factory method that returns an instance of an object
  • getQuery() = a factory , getClientX(), , IDfQuery;
  • query = , IDfQuery

factory, / getQuery() . , , . , factory bootstrapper, .

, factory, , switch, , , IOC (Inversion of control): -

public static IDfQuery getQuery(){
    IDfQuery returnValue;

    switch ( getDayOfWeek() ) {
        case "Monday" :  returnValue = new MondayQuery(); break;
        case "Tuesday" :  returnValue = new TuesdayQuery(); break;
        case "Wednesday" :  returnValue = new WednesdayQuery(); break;
        case "Thursday" :  returnValue = new ThursdayQuery(); break;
        case "Friday" :  returnValue = new FridayQuery(); break;
        case "Saturday" :  returnValue = new SaturdayQuery(); break;
        case "Sunday" :  returnValue = new SundayQuery(); break;
        default: returnValue = null; break;
    }

    return returnValue;
}

public static String getDayOfWeek(){
    return new SimpleDateFormat("EEEE").format( new Date() );
}
+5

Java

IDfQuery query = new DfQuery();

factory Docbasic, , COM

+6

Can be used

  IDfQuery query = new DfQuery();

an approach

In the current DFC manual, it is recommended that you use the com.documentum.com.DfClientX factory class to get new instances of objects, such as DfQuery, instead of directly calling the constructor

0
source

Source: https://habr.com/ru/post/1722117/


All Articles