business methods in playframework contolles

Could somebody explain is it possible to have potected, pivate methods in playfamewok's contolles except:

public static void method-action-name() {}

For example if I would have method like this:

protected static int doSomeWork() {}

and this method would be invoked in method-action-name() ..

public static void method-action-name() {
  ...
  int resul = doSomeWork();
  ...
}

I do not want to have long action-method, so I would like to split it to smaller ones, and then reuse it in other action-methods.

I mean is it ok (from playframework's point of view) to have such method in controller side instead of having them in domain classes? In Spring Framework, we use BP (business process) beans for that, for example.

Is it ok to have such helper methods for business methods in playframework controllers ?

Added after having answer & comments: For example if I have SearchController class then for that class would be nice to have methods like preSearch1(), preSearch2() what search() method would use, but if I move these methods (1,2) to another class then it should be class with name like SearchHelper then? in package named /src/helpers.. not very nice because they related to search too. But maybe then into /src/bp/SearchBP (bp=business-process). And then in controllers/Search i use /bp/SearchBP that use some Model object with .save() DAO methods (SearchBP can use Domain methods and Search class can use Domain methods as well)

The question here: what class ant package would be nice for those methods? (i just did watch it in examples - there alway very simple usage of controllers that use domain object that why i ask)

5
задан ses 9 May 2011 в 13:02
поделиться