Absent Member.
Absent Member.
1531 views

how to get categories color

Hi,
sorry for the newbie questions....
I'm trying to get category name and color from appointments in my calendar...


if (itemsResponse.getItems() != null) {
Item[] itemListApp = itemsResponse.getItems().getItem();
for (int i=0; i< itemListApp.length; i++) {
CategoryRefList categ = ((Appointment)itemListApp).getCategories();

if(categ!=null)
{
String[] categories = categ.getCategory();
for(String str:categories)
{
System.out.println("Category: "+str);

}
}
}
}

the code above print this result

3.GWDOM.GWPOSTOF.100.0.1.0.1@12

but now with how can I get color and name?

I find out also the method getCategoryListRequest

GetCategoryListResponse categoryResponse = this.service.getCategoryListRequest(this.session, properties.getTrustedTrace());
CategoryList catList = categoryResponse.getCategories();
Category[] cat = catList.getCategory();
for(Category c:cat)
{
System.out.println("Category-name: "+c.getName());
System.out.println("Category-color: "+c.getColor());
System.out.println("Category-version: "+c.getVersion());
System.out.println("Category-calendar: "+c.getModified());
System.out.println("Category-item: "+c.getChanges().getUpdate());
}

but it doesn't retrieve any result even if the categories are defined..

thanks
Labels (1)
0 Likes
5 Replies
Absent Member.
Absent Member.

What does the SOAP trace look like?
Preston

>>> On Wednesday, June 06, 2012 at 3:36 AM,

gabMan<gabMan@no-mx.forums.novell.com> wrote:

> Hi,
> sorry for the newbie questions....
> I'm trying to get category name and color from appointments in my
> calendar...
>
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> if (itemsResponse.getItems() != null) {
> Item[] itemListApp = itemsResponse.getItems().getItem();
> for (int i=0; i< itemListApp.length; i++) {
> CategoryRefList categ =

((Appointment)itemListApp).getCategories();
>
> if(categ!=null)
> {
> String[] categories = categ.getCategory();
> for(String str:categories)
> {
> System.out.println("Category: "+str);
>
> }
> }
> }
> }
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> the code above print this result
>
> 3.GWDOM.GWPOSTOF.100.0.1.0.1@12
>
> but now with how can I get color and name?
>
> I find out also the method getCategoryListRequest
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> GetCategoryListResponse categoryResponse =
> this.service.getCategoryListRequest(this.session,
> properties.getTrustedTrace());
> CategoryList catList = categoryResponse.getCategories();
> Category[] cat = catList.getCategory();
> for(Category c:cat)
> {
> System.out.println("Category‑name: "+c.getName());
> System.out.println("Category‑color: "+c.getColor());
> System.out.println("Category‑version: "+c.getVersion());
> System.out.println("Category‑calendar: "+c.getModified());
> System.out.println("Category‑item: "+c.getChanges().getUpdate());
> }
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> but it doesn't retrieve any result even if the categories are
> defined..
>
> thanks

0 Likes
Absent Member.
Absent Member.

soap trace?
I have only the following xml/soap response with SoapUi...

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getAppointmentsReturn>
<items>
<item xsi:type="Appointment">
<source>personal</source>
<delivered>2012-05-18T10:13:03.000Z</delivered>
<subject>Oggetto</subject>
<distribution>
<from>
<displayName>Roberto Corsini</displayName>
<email>Roberto.Corsini@regione.toscana.it</email>
</from>
</distribution>
<message>
<part contentType="text/plain">Cg==</part>
</message>
<attachments/>
<hasAttachment>0</hasAttachment>
<size>22452</size>
<startDate>2012-05-18T10:12:00.000Z</startDate>
<endDate>2012-05-18T11:12:00.000Z</endDate>
<place>via san, 1</place>
<customs>
<custom type="String">
<field>Tipo Evento</field>
<value>non</value>
<locked>0</locked>
</custom>
<custom type="String">
<field>Relatore</field>
<value>Pinco</value>
<locked>0</locked>
</custom>
<custom type="String">
<field>Citta</field>
<value>citta</value>
<locked>0</locked>
</custom>
<custom type="String">
<field>Indirizzo</field>
<value>indirizzo</value>
<locked>0</locked>
</custom>
</customs>
</item>
</items>
</getAppointmentsReturn>
</soapenv:Body>
</soapenv:Envelope>
0 Likes
Absent Member.
Absent Member.

Sorry, I meant the getCategoryListRequest and the response.
This item does not even have a category element.

Preston

>>> On Wednesday, June 06, 2012 at 9:36 AM,

gabMan<gabMan@no-mx.forums.novell.com> wrote:

> soap trace?
> I have only the following xml/soap response with SoapUi...
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema‑instance">
> <soapenv:Body>
> <getAppointmentsReturn>
> <items>
> <item xsi:type="Appointment">
> <source>personal</source>
> <delivered>2012‑05‑18T10:13:03.000Z</delivered>
> <subject>Oggetto</subject>
> <distribution>
> <from>
> <displayName>Roberto Corsini</displayName>
> <email>Roberto.Corsini@regione.toscana.it</email>
> </from>
> </distribution>
> <message>
> <part contentType="text/plain">Cg==</part>
> </message>
> <attachments/>
> <hasAttachment>0</hasAttachment>
> <size>22452</size>
> <startDate>2012‑05‑18T10:12:00.000Z</startDate>
> <endDate>2012‑05‑18T11:12:00.000Z</endDate>
> <place>via san, 1</place>
> <customs>
> <custom type="String">
> <field>Tipo Evento</field>
> <value>non</value>
> <locked>0</locked>
> </custom>
> <custom type="String">
> <field>Relatore</field>
> <value>Pinco</value>
> <locked>0</locked>
> </custom>
> <custom type="String">
> <field>Citta</field>
> <value>citta</value>
> <locked>0</locked>
> </custom>
> <custom type="String">
> <field>Indirizzo</field>
> <value>indirizzo</value>
> <locked>0</locked>
> </custom>
> </customs>
> </item>
> </items>
> </getAppointmentsReturn>
> </soapenv:Body>
> </soapenv:Envelope>

0 Likes
Absent Member.
Absent Member.

I read the only way to get categories list is to invoke getCategoryListRequest method.
I get every time a null pointer...which could be the problem?
Are there some fields that I'm not able to see?

GetCategoryListResponse categoryResponse = this.service.getCategoryListRequest(this.session, true);
CategoryList catList = categoryResponse.getCategories();
Category[] cat = catList.getCategory();
for(Category c:cat)
{
System.out.println("Category-name: "+c.getName());
System.out.println("Category-color: "+c.getColor());
System.out.println("Category-version: "+c.getVersion());
System.out.println("Category-calendar: "+c.getModified());
System.out.println("Category-item: "+c.getChanges().getUpdate());
}

Thanks
0 Likes
Absent Member.
Absent Member.

Sorry, I need the SOAP trace to show what
data is returned. There are various trace utilities.
You could try: http://www.pocketsoap.com/tcpTrace

Preston

>>> On Thursday, June 07, 2012 at 4:06 AM,

gabMan<gabMan@no-mx.forums.novell.com> wrote:

> I read the only way to get categories list is to invoke
> getCategoryListRequest method.
> I get every time a null pointer...which could be the problem?
> Are there some fields that I'm not able to see?
>
> GetCategoryListResponse categoryResponse =
> this.service.getCategoryListRequest(this.session, true);
> CategoryList catList = categoryResponse.getCategories();
> Category[] cat = catList.getCategory();
> for(Category c:cat)
> {
> System.out.println("Category‑name: "+c.getName());
> System.out.println("Category‑color: "+c.getColor());
> System.out.println("Category‑version: "+c.getVersion());
> System.out.println("Category‑calendar: "+c.getModified());
> System.out.println("Category‑item: "+c.getChanges().getUpdate());
> }
>
> Thanks

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.