[Building Sakai] A question about how to use some APIs in project Profile2

Small Cat shadowless4288 at gmail.com
Thu Nov 12 11:26:11 PST 2009


... I want to add a new page using gradebook service into profile 2, I name
this page "MyHello.html" and implement it in MyHello.java & MyQuery.java
(this class in a new package org.sakaiproject.profile2.tool.mysql    )

I've already use some other service like database api, site service  by
using cover (but I fell in using methods of adding bean in compponents.xml
>"<). But the problem is that I can't found gradebook cover ...
I tried to inject it follow these steps :( I use sakai 2.5.5 )
- add dependency in maven file
*<dependency>
            <groupId>org.sakaiproject</groupId>
            <artifactId>sakai-gradebook-service-api</artifactId>
            <version>${sakai.version}</version>
        </dependency>
- *add bean in components
*<bean id="org.sakaiproject.profile2.tool.mysql.MyQuery"
        class="org.sakaiproject.profile2.tool.mysql.MyQuery">
        <property name="gradebookService"
            ref="org.sakaiproject.service.gradebook.shared.*">
        </property>
    </bean>*
- coding...and this is a test function to get some assignment name ( I think
gradebookId = coursesiteID , it is right ? )
*// courseList is a list of course site id
public LinkedList<String> getAssignmentNameList(
            LinkedList<String> courseList) {
        LinkedList<Assignment> assignmentList = new LinkedList();
        try {
            while (!courseList.isEmpty()) {
                String tmpString = courseList.remove();
                List<Assignment> tmpList = gradebookService
                        .getAssignments(tmpString);
                assignmentList.addAll(tmpList);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        LinkedList<String> assignmentNameList = new LinkedList();
        try {
            while (!assignmentList.isEmpty()) {
                assignmentNameList.add(assignmentList.remove().getName());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return assignmentNameList;
    }*
/**************************************************************/

 I tried like that in Sakai and it return nothing >"<.
Can anyone help me ?



2009/11/6 Steve Swinsburg <steve.swinsburg at gmail.com>

> You've got a ; in the bean definitions, not sure if that matters too much
> though. But as for the dependency in the pom, if matters if you are on 2.5
> or 2.6+. If 2.6 then you don't need that dependency as its in the kernel but
> for 2.5 you will.
>
> Also, are you modifying the current Profile2 tool? ie
> http://confluence.sakaiproject.org/display/PROFILE/Profile2
>
> I am currently polishing up release of Profile2 for possible inclusion in
> 2.7 so it would be good to coordinate efforts here.
>
> cheers,
> Steve
>
>
> On 06/11/2009, at 3:47 PM, Small Cat wrote:
>
> Hi,
> In the components.xml, I added a bean for my class as :
> *
> <!--  MyPortfolios -->
>     <bean id = "org.sakaiproject.profile2.tool.myportfolios.MyPortfolios;"
>         class="org.sakaiproject.profile2.tool.myportfolios.MyPortfolios;">
>
>         <property name="siteService"
> ref="org.sakaiproject.site.api.SiteService"/>
>
>     </bean>*
> In relevant pom.xml , I added :
> *<dependency>
>                     <groupId>org.sakaiproject</groupId>
>                     <artifactId>sakai-site-api</artifactId>
>                     <scope>provided</scope>
>                 </dependency>
> *
> Is this right ?
> Thanks ,
>
>
> 2009/11/6 Steve Swinsburg <steve.swinsburg at gmail.com>
>
>> Hi,
>>
>> Are you making an addition to Profile2 that you might like to contribute
>> back? If so, thats great! Could you possibly Jira it here:
>> http://jira.sakaiproject.org/browse/PRFL
>>
>> For your issue, it's most likely an API injection issue. You'll need to
>> make sure you have the dependency in the relevant POM and in the
>> components.xml so Spring can inject it into the beans. However if you Jira
>> this task we can go over the goal and implementation details.
>>
>> cheers,
>> Steve
>>
>>
>>
>> On 06/11/2009, at 1:51 AM, Small Cat wrote:
>>
>> Dear all,
>> I want to add some functions for Profile2, and one of them can show all
>> scores of assigments in all course sites...
>> But I can't use some APIs as getSites.... ( I can use it in other tools,
>> but in Profile2 I don't know why it can't )
>> This is error when I deploy :
>>
>> *[ERROR] BUILD FAILURE
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Compilation failure
>>
>>
>> C:\sakai\profile2-1.2.1\tool\src\java\org\sakaiproject\profile2\tool\myportfolio
>> s\MyPortfolios.java:[22,52] cannot access
>> org.sakaiproject.entity.api.EntityProd
>> ucer
>> file org\sakaiproject\entity\api\EntityProducer.class not found
>>                         courseSiteList =
>> siteService.getSites(SelectionType.ACCE
>> SS,
>>
>>
>> C:\sakai\profile2-1.2.1\tool\src\java\org\sakaiproject\profile2\tool\myportfolio
>> s\MyPortfolios.java:[35,60] cannot access org.sakaiproject.entity.api.Edit
>> file org\sakaiproject\entity\api\Edit.class not found
>>
>> courseList.add(courseSiteList.remove(0).getTitle());*
>>
>> How to use getSites in Profile2 , if can not, what methods I can use to
>> replace ?
>> Thank you,
>> --
>> Regards,
>> Tran Trung Kien
>>  _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>>
>>
>>
>
>
> --
> Regards,
> Tran Trung Kien
>
>
>


-- 
Regards,
Tran Trung Kien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20091113/a791fbcc/attachment.html 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20091113/a791fbcc/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyQuery.java
Type: application/octet-stream
Size: 3200 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20091113/a791fbcc/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyHello.java
Type: application/octet-stream
Size: 1586 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20091113/a791fbcc/attachment-0001.obj 


More information about the sakai-dev mailing list