Creating Custom compound Type in Hippo CMS10 and using it inside document - hippocms

I have Created Compound type Profile under go-green project of hippo community version. I have created compound-type inside go-green document types. This compound type has 5 fields via Name, Title, Designation, Description and Image. I wanna know how to render this compound type in the document where I am using this compound type. I have written my bean class for this compound type, but unable to render it inside document.
Any help on this is appreciated.
Thanks in advance.

The bean and the template need to be tied together. There is a third component which is the java Component class which needs to load the document on to the request. Though, if extending an existing document it probably is already put on the request. Then you can use the bean in your template like any other java bean.
Some of our tutorials may help. They start here[1].
[1] https://www.onehippo.org/trails/deep-dive/hello-world.html
--edit--
I should've read more carefully.
You shouldn't create a bean for a compound but for a document. This bean already exists for the document types in the project. If you are using essentials you can use the Bean Writer tool. Otherwise you will need to create the bean for the whole document. This still needs to be put on the request by a component of course. The class itself should be in your site war. It will be found as long as it is on the class path.

Related

What is the use of service.method attribute in Moqui?

I am not able to figure out the method in which I can use the service.method attribute in Moqui. Is this similar to that of service.invoke attribute in OFBIz which allows me to call the method form the file specified in the location.
I was not able to find any examples related to this anywhere in the code.
The annotation in the XSD for the service.#method attribute says: "The method within the location, if applicable to the service type."
To expand on that, for Java classes this is the method within the class. For Groovy scripts you can call a method in the script (or Groovy class) instead of running the top-level of the script.

Resolve all $refs in JSON Schema

I want to resolve all $refs in my JSON Schema. But internal and external. Which tool provide such functionality?
tv4 allows you to resolve internal and external refs.
You have to add manually each intended external reference as it is explained here. If an external ref has not been added, you can find it in tv4.missing.
The python json-schema validator also allows you to resolve external references if you use it with the reference module included.
You can review the rest of implementations if you need a resolver in any other programming language.

How do I add a SOAP template from XSD in soapUI when XML extension is in place?

I need to make a large number of SOAP test cases to automate the testing process of an application.
Currently, the architecture requires that a single "generic" SOAP method is invoked with an object of a generic type. Each "real" operation is defined by an element in the generic object and requires an object of an extended type to be used as input.
When I create the request template with soapUI, I only get the generic object elements, but I would like to add the empty template for a specific XSD type that is defined in my current schema to be used.
If I use xsi:type then soapUI correctly says that my markup is not valid against the schema (missing required elements), but I can't manage to get a ready-to-fill XML template.
Can you help me?
Example
genericRequest is made of
<genericRequest>
<methodName>specificMethodName</methodName>
<authenticationID>ABCDEF</authenticationID>
</genericRequest>
sumReuqest (extending genericRequest) for a "sum" operation is made of
<sumRequest>
<methodName>specificMethodName</methodName>
<authenticationID>ABCDEF</authenticationID>
<addend>5</addend>
<addend>3</addend>
</sumRequest>
I would ultimately like soapUI to fill a SOAP template with empty addend item (of course I work with lots of elements, and they are structured too!!)
In this case you need to create two resources in soaupUI one for generic request and other for operation request, I know right now its pain to create each resource for each operation, but soapUI is developed like that or if you think any of the parameters listed : http://www.soapui.org/REST-Testing/understanding-rest-parameters.html could help, you could define parameters as one of the above.
you could try using QUERY or MATRIX style parameters in your resource.

Basic flow of Struts

Well I want to study Struts so I am going to begin with Struts 1,
I would like to know the general flow. What files are required?
Whats the function of struts-config.xml? validation.xml? validation-rules.xml
When you visit your JSP page, and an action gets fired, what happens? What does the Action and Form class do? Which class is called first when an action gets fired.
I just downloaded a sample form, and all these files are confusing at first. I would like to know whats going on to get a better idea of Struts.
You should start with a tutorial on Struts, that will make it easy to understand :D. You can find plenty on the web, especially for Struts 1. Here is a starting point for example.
But just for the sake of it, here is a high view presentation.
First you add the Struts ActionServlet into your web.xml file and you configure it to accept requests that match a certain mapping. For Struts this is *.do (you can have whatever you want for this, *.do is just a convention in the Struts community).
Now, whatever arrives on the server with such a *.do URL pattern is sent to the ActionServlet.
Now, the content of struts-config.xml file comes into play. The ActionServlet is a front controller which just dispatches to other more appropriate resources for specific processing. Those specific resources are the Action classes.
You can have for example a LoginAction that must process requests that arrive on the login.do path. In the struts-config.xml you specify this: everything that comes on the login path must be sent to LoginAction class.
And you can have as many declarations as you want, for path x call XAction, for y call YAction etc etc.
Normally your client submits data to the server, data that he inputs into a HTML form. This data you need to process in your Action class. Now enter ActionForm.
The ActionForm is a bean that the Struts framework fills with the data from the HTML form. Instead of doing request.getParameter("foo") you can work with objects like formBean.getFoo() for example.
Once you do your processing in the Action class using the ActionForm, you then must present the results in some view (by the way, Struts is a MVC framework so you must know a stuff or two about this also).
The views are normally JSP files. When you return from your Action, you specify a "forward" location by name (i.e. to what view to go). Now again the information is in the struts-config.xml file where the name of the view is mapped to a JSP location.
The framework will then forward control to that JSP, the JSP presents the data which is then sent to the client as HTML (the client will no longer need to access JSPs directly - they must be hidden by the Struts framework).
In the new page the client again performs some requests and the process repeats.
Well, that's about as high presentation as it can get. Off course there is more than this, but you will discover them while learning about Struts.
As for the validator-rules.xml and validation.xml, those are used by the Validator framework which you can integrate with Struts by the use of a plugin (Struts has plugins you can use to add new stuff to it) to also add validation to the user's input.
Well, that is about it. You can find plenty of tutorials on the web offering more details but hope helps you get a better start.
Good luck!
When a user submitted a jsp page. that page having (attribute of
)action="login.do". the container will call to web.xml. in that
web.xml there are two sections servlet And servlet mapping
In servlet mapping it find *.do in the url-pattern. if it found to
take the name of servlet. and check the corresponding class. in the
servlet section. that class is ActionServlet.
ActionServlet is the controller of Struts module architecture. in
Action servlet having the service method. in that method we create
RequestPrecessor class instance
Service(req,res) RequestPrecessor rp = new RequestPrecessor();
We call a process method of RequestProcessor class through the
instance rp.process(req,res)
In the request processor class have the process method with the
parameter of req,res. then it has 1 if condition in this class.
that condition return always true. because that is dummy method.
Inside that condition there are 6 steps are processing
Create a action mapping instance in the Struts- Config.xml. it
will keep all details of the action mapping path, value, type
forward, validation=true/false, input
="*.jsp" etc these r created instance
Then it will create Form class instance before it check the name of
action mapping and form name are coincidence or not if it same it
will create form instance
Then it will go to ActionMapping instance the ris mention or not the
validate =true/false if false it will not execute the this step else
it will execute this step.
Then it will create action instance
Next it will take four parameters of execute Method it will return
ActionErrors instance. if it is not empty. it will go to error page
other wise it will got to corresponding page. else if it is empty
if will go further and display corresponding value of page in jsp
view.This is struts flow.
Model
Struts doesn't support Model directly. However, the Struts actions and configuration file provide you ability to implement it by your own.
View
1) Form bean that extends org.apache.struts.action.ActionForm, that is used in two ways at run time:
When a JSP page prepares the related HTML form for display, the JSP
page accesses the bean, which holds values to be placed into the
form. Those values are provided from business logic or from previous
user input.
When user input is returned from a web browser, the bean
validates and holds that input either for use by business logic or
(if validation failed) for subsequent redisplay.
2) Struts tag libraries such as bean, logic, html & tiles plugin
Controller
The Struts action servlet handles runtime events in accordance with a set of rules that are provided at deployment time. Those rules are contained in a Struts configuration file and specify how the servlet responds to every outcome received from the business logic. Changes to the flow of control require changes only to the configuration file.
Struts action extends org.apache.struts.action.Action. At run time, the action servlet is said to "execute actions," which means that the servlet invokes the execute method of each of the instantiated action classes. The object returned from the execute method directs the action servlet as to what action or JSP file to access next.
To facilitate reuse, invoke business logic from the action class rather than including business logic in that class.
See the Struts 1.3 example
For your comparison & reference, here's Struts 2.3 demo

Is there a way of using an XPages data source (document or view) as a property in a managed bean?

I would like to have a reference of the actual used data source (eg: com.ibm.xsp.model.domino.wrapped.DominoDocument) in a managed bean object. Is it possible to have such a property? And how do you implement this approach?
Data source itself is a request scope bean. It is bad idea to keep it as property, I would suggest that your bean's methods accept data source as parameter.
Another approach would be to keep String value of data source name, and get it via JSF binding.