Sorry Hans, I didn't notice that a java file had been added in the commit. Now that there are actually source files it should work fine with git.
Thanks Scott On 24/08/2011, at 5:55 PM, Hans Bakker wrote: > If this statement is active, the ./ant command does not seem to compile > the file: HumanResEvents.java > > afterwards i get the error: > org.ofbiz.webapp.event.EventHandlerException: Error invoking event, the > class org.ofbiz.humanres.HumanResEvents was not found > > commenting out this statement resolves the problem. > > Regards, > Hans > > > > On Wed, 2011-08-24 at 17:38 +1200, Scott Gray wrote: >> Hi Hans, >> >> Why do you keep commenting out the ant target in build.xml? Removing it >> prevents compilation on git based checkouts, I already put it back in after >> you changed it last week. >> >> Regards >> Scott >> >> On 24/08/2011, at 3:25 PM, hans...@apache.org wrote: >> >>> Author: hansbak >>> Date: Wed Aug 24 03:25:12 2011 >>> New Revision: 1160969 >>> >>> URL: http://svn.apache.org/viewvc?rev=1160969&view=rev >>> Log: >>> missing and updated files of previous revision:1159056 >>> http://svn.apache.org/viewvc?rev=1159056&view=rev replace the HR company >>> tree with a jquery version >>> >>> Added: >>> >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> (with props) >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/ >>> >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/ >>> >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> (with props) >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/ >>> >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> (with props) >>> Modified: >>> ofbiz/trunk/applications/humanres/build.xml >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/controller.xml >>> >>> Modified: ofbiz/trunk/applications/humanres/build.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/build.xml?rev=1160969&r1=1160968&r2=1160969&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/humanres/build.xml (original) >>> +++ ofbiz/trunk/applications/humanres/build.xml Wed Aug 24 03:25:12 2011 >>> @@ -51,7 +51,7 @@ under the License. >>> <!-- Compilation of the source files >>> >>> --> >>> <!-- ================================================================== >>> --> >>> >>> - <target name="classes" depends="prepare"/> >>> + <!--<target name="classes" depends="prepare"/>--> >>> >>> <!-- ================================================================== >>> --> >>> <!-- Build JavaDoc >>> --> >>> >>> Added: >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java?rev=1160969&view=auto >>> ============================================================================== >>> --- >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> (added) >>> +++ >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> Wed Aug 24 03:25:12 2011 >>> @@ -0,0 +1,160 @@ >>> +/******************************************************************************* >>> + * Licensed to the Apache Software Foundation (ASF) under one >>> + * or more contributor license agreements. See the NOTICE file >>> + * distributed with this work for additional information >>> + * regarding copyright ownership. The ASF licenses this file >>> + * to you under the Apache License, Version 2.0 (the >>> + * "License"); you may not use this file except in compliance >>> + * with the License. You may obtain a copy of the License at >>> + * >>> + * http://www.apache.org/licenses/LICENSE-2.0 >>> + * >>> + * Unless required by applicable law or agreed to in writing, >>> + * software distributed under the License is distributed on an >>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >>> + * KIND, either express or implied. See the License for the >>> + * specific language governing permissions and limitations >>> + * under the License. >>> + >>> *******************************************************************************/ >>> +package org.ofbiz.humanres; >>> + >>> +import java.io.IOException; >>> +import java.io.UnsupportedEncodingException; >>> +import java.io.Writer; >>> +import java.util.List; >>> +import java.util.Map; >>> + >>> +import javax.servlet.http.HttpServletRequest; >>> +import javax.servlet.http.HttpServletResponse; >>> + >>> +import javolution.util.FastList; >>> +import javolution.util.FastMap; >>> +import net.sf.json.JSONObject; >>> + >>> +import org.ofbiz.base.util.Debug; >>> +import org.ofbiz.base.util.UtilMisc; >>> +import org.ofbiz.base.util.UtilValidate; >>> +import org.ofbiz.entity.Delegator; >>> +import org.ofbiz.entity.GenericValue; >>> +import org.ofbiz.entity.util.EntityUtil; >>> + >>> +public class HumanResEvents { >>> + public static final String module = HumanResEvents.class.getName(); >>> + public static final String resourceError = "ProductErrorUiLabels"; >>> + >>> + // Please note : the structure of map in this function is according to >>> the JSON data map of the jsTree >>> + @SuppressWarnings("unchecked") >>> + public static void getChildHRCategoryTree(HttpServletRequest request, >>> HttpServletResponse response){ >>> + Delegator delegator = (Delegator) >>> request.getAttribute("delegator"); >>> + String partyId = request.getParameter("partyId"); >>> + String onclickFunction = request.getParameter("onclickFunction"); >>> + String additionParam = request.getParameter("additionParam"); >>> + String hrefString = request.getParameter("hrefString"); >>> + String hrefString2 = request.getParameter("hrefString2"); >>> + >>> + List categoryList = FastList.newInstance(); >>> + List<GenericValue> childOfComs; >>> + >>> + try { >>> + GenericValue partyGroup = >>> delegator.findByPrimaryKey("PartyGroup" ,UtilMisc.toMap("partyId", >>> partyId)); >>> + if (UtilValidate.isNotEmpty(partyGroup)) { >>> + childOfComs = >>> EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", >>> UtilMisc.toMap( >>> + "partyIdFrom", partyGroup.get("partyId"), >>> "partyRelationshipTypeId", "GROUP_ROLLUP"))); >>> + if (UtilValidate.isNotEmpty(childOfComs)) { >>> + >>> + for (GenericValue childOfCom : childOfComs ) { >>> + Object catId = null; >>> + String catNameField = null; >>> + String title = null; >>> + >>> + Map josonMap = FastMap.newInstance(); >>> + Map dataMap = FastMap.newInstance(); >>> + Map dataAttrMap = FastMap.newInstance(); >>> + Map attrMap = FastMap.newInstance(); >>> + >>> + catId = childOfCom.get("partyIdTo"); >>> + >>> + //Department or Sub department >>> + GenericValue childContext = >>> delegator.findByPrimaryKey("PartyGroup" ,UtilMisc.toMap("partyId", catId)); >>> + if (UtilValidate.isNotEmpty(childContext)) { >>> + catNameField = (String) >>> childContext.get("groupName"); >>> + title = catNameField; >>> + josonMap.put("title",title); >>> + >>> + } >>> + //Check child existing >>> + List<GenericValue> childOfSubComs = >>> EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", >>> UtilMisc.toMap( >>> + "partyIdFrom", catId, >>> "partyRelationshipTypeId", "GROUP_ROLLUP"))); >>> + if (UtilValidate.isNotEmpty(childOfSubComs)) { >>> + josonMap.put("state", "closed"); >>> + } >>> + >>> + //Employee >>> + GenericValue emContext = >>> delegator.findByPrimaryKey("Person" ,UtilMisc.toMap("partyId", catId)); >>> + if (UtilValidate.isNotEmpty(emContext)) { >>> + String firstname = (String) >>> emContext.get("firstName"); >>> + String lastname = (String) >>> emContext.get("lastName"); >>> + if (UtilValidate.isEmpty(lastname)) { >>> + lastname = ""; >>> + } >>> + if (UtilValidate.isEmpty(firstname)) { >>> + firstname = ""; >>> + } >>> + title = firstname +" "+ lastname; >>> + } >>> + >>> + dataAttrMap.put("onClick", onclickFunction + "('" >>> + catId + additionParam + "')"); >>> + >>> + String hrefStr = hrefString + catId; >>> + if (UtilValidate.isNotEmpty(hrefString2)) { >>> + hrefStr = hrefStr + hrefString2; >>> + } >>> + dataAttrMap.put("href", hrefStr); >>> + >>> + dataMap.put("attr", dataAttrMap); >>> + >>> + attrMap.put("id", catId); >>> + josonMap.put("attr",attrMap); >>> + dataMap.put("title", title); >>> + josonMap.put("data", dataMap); >>> + >>> + categoryList.add(josonMap); >>> + } >>> + toJsonObjectList(categoryList,response); >>> + } >>> + } >>> + } catch (Exception e) { >>> + e.printStackTrace(); >>> + } >>> + } >>> + >>> + @SuppressWarnings("unchecked") >>> + public static void toJsonObjectList(List attrList, HttpServletResponse >>> response){ >>> + String jsonStr = "["; >>> + for (Object attrMap : attrList) { >>> + JSONObject json = JSONObject.fromObject(attrMap); >>> + jsonStr = jsonStr + json.toString() + ','; >>> + } >>> + jsonStr = jsonStr + "{ } ]"; >>> + if (UtilValidate.isEmpty(jsonStr)) { >>> + Debug.logError("JSON Object was empty; fatal error!",module); >>> + } >>> + // set the X-JSON content type >>> + response.setContentType("application/json"); >>> + // jsonStr.length is not reliable for unicode characters >>> + try { >>> + response.setContentLength(jsonStr.getBytes("UTF8").length); >>> + } catch (UnsupportedEncodingException e) { >>> + Debug.logError("Problems with Json encoding",module); >>> + } >>> + // return the JSON String >>> + Writer out; >>> + try { >>> + out = response.getWriter(); >>> + out.write(jsonStr); >>> + out.flush(); >>> + } catch (IOException e) { >>> + Debug.logError("Unable to get response writer",module); >>> + } >>> + } >>> +} >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> ------------------------------------------------------------------------------ >>> svn:eol-style = native >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> ------------------------------------------------------------------------------ >>> svn:keywords = "Date Rev Author URL Id" >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java >>> ------------------------------------------------------------------------------ >>> svn:mime-type = text/plain >>> >>> Added: >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy?rev=1160969&view=auto >>> ============================================================================== >>> --- >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> (added) >>> +++ >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> Wed Aug 24 03:25:12 2011 >>> @@ -0,0 +1,87 @@ >>> +/* >>> + * Licensed to the Apache Software Foundation (ASF) under one >>> + * or more contributor license agreements. See the NOTICE file >>> + * distributed with this work for additional information >>> + * regarding copyright ownership. The ASF licenses this file >>> + * to you under the Apache License, Version 2.0 (the >>> + * "License"); you may not use this file except in compliance >>> + * with the License. You may obtain a copy of the License at >>> + * >>> + * http://www.apache.org/licenses/LICENSE-2.0 >>> + * >>> + * Unless required by applicable law or agreed to in writing, >>> + * software distributed under the License is distributed on an >>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >>> + * KIND, either express or implied. See the License for the >>> + * specific language governing permissions and limitations >>> + * under the License. >>> + */ >>> + >>> +/* >>> + * This script is also referenced by the ecommerce's screens and >>> + * should not contain order component's specific code. >>> + */ >>> +import org.ofbiz.entity.util.EntityUtil; >>> +import org.ofbiz.base.util.*; >>> +import org.ofbiz.product.catalog.*; >>> +import org.ofbiz.product.category.*; >>> +import javolution.util.FastMap; >>> +import javolution.util.FastList; >>> +import javolution.util.FastList.*; >>> +import org.ofbiz.entity.*; >>> +import java.util.List; >>> + >>> +// Put the result of CategoryWorker.getRelatedCategories into the >>> separateRootType function as attribute. >>> +// The separateRootType function will return the list of category of given >>> catalog. >>> +// PLEASE NOTE : The structure of the list of separateRootType function is >>> according to the JSON_DATA plugin of the jsTree. >>> + >>> +completedTree = FastList.newInstance(); >>> +completedTreeContext = FastList.newInstance(); >>> +existParties = FastList.newInstance(); >>> + >>> +//internalOrg list >>> +partyRelationships = >>> EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", >>> [partyIdFrom : partyId, partyRelationshipTypeId : "GROUP_ROLLUP"])); >>> +if (partyRelationships) { >>> + //root >>> + partyRoot = delegator.findByPrimaryKey("PartyGroup", [partyId : >>> partyId]); >>> + partyRootMap = FastMap.newInstance(); >>> + partyRootMap.put("partyId", partyId); >>> + partyRootMap.put("groupName", partyRoot.getString("groupName")); >>> + >>> + //child >>> + for(partyRelationship in partyRelationships) { >>> + partyGroup = delegator.findByPrimaryKey("PartyGroup", [partyId : >>> partyRelationship.getString("partyIdTo")]); >>> + partyGroupMap = FastMap.newInstance(); >>> + partyGroupMap.put("partyId", partyGroup.getString("partyId")); >>> + partyGroupMap.put("groupName", partyGroup.getString("groupName")); >>> + completedTreeContext.add(partyGroupMap); >>> + } >>> + >>> + partyRootMap.put("child", completedTreeContext); >>> + completedTree.add(partyRootMap); >>> + >>> +} >>> +// The complete tree list for the category tree >>> +context.completedTree = completedTree; >>> +//Filter Existing parties >>> +existPartiesContexts = >>> EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", >>> [partyIdFrom : partyId])); >>> +if (existPartiesContexts) { >>> + for(existPartiesContext in existPartiesContexts) { >>> + partyGroup = delegator.findByPrimaryKey("PartyGroup", [partyId : >>> existPartiesContext.getString("partyIdTo")]); >>> + if (partyGroup) { >>> + partyGroupMap = FastMap.newInstance(); >>> + partyGroupMap.put("partyId", partyGroup.getString("partyId")); >>> + partyGroupMap.put("name", partyGroup.getString("groupName")); >>> + existParties.add(partyGroupMap); >>> + } >>> + person = delegator.findByPrimaryKey("Person", [partyId : >>> existPartiesContext.getString("partyIdTo")]); >>> + if (person) { >>> + personMap = FastMap.newInstance(); >>> + personMap.put("partyId", person.getString("partyId")); >>> + personMap.put("name", person.getString("firstName")); >>> + existParties.add(personMap); >>> + } >>> + } >>> +} >>> +context.existParties = existParties; >>> +println'=============================================== existParties : >>> '+existParties; >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> ------------------------------------------------------------------------------ >>> svn:eol-style = native >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> ------------------------------------------------------------------------------ >>> svn:keywords = "Date Rev Author URL Id" >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy >>> ------------------------------------------------------------------------------ >>> svn:mime-type = text/plain >>> >>> Modified: >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/controller.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/controller.xml?rev=1160969&r1=1160968&r2=1160969&view=diff >>> ============================================================================== >>> --- >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/controller.xml >>> (original) >>> +++ >>> ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/controller.xml >>> Wed Aug 24 03:25:12 2011 >>> @@ -1056,7 +1056,7 @@ under the License. >>> </request-map> >>> <request-map uri="getHRChild"> >>> <security auth="false" https="true"/> >>> - <event type="java" path="org.ofbiz.humanres.HumanResServices" >>> invoke="getChildHRCategoryTree"/> >>> + <event type="java" path="org.ofbiz.humanres.HumanResEvents" >>> invoke="getChildHRCategoryTree"/> >>> <response name="success" type="none"/> >>> </request-map> >>> <!-- ===================Lookup Request===================== --> >>> >>> Added: >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl?rev=1160969&view=auto >>> ============================================================================== >>> --- >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> (added) >>> +++ >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> Wed Aug 24 03:25:12 2011 >>> @@ -0,0 +1,111 @@ >>> +<#-- >>> +Licensed to the Apache Software Foundation (ASF) under one >>> +or more contributor license agreements. See the NOTICE file >>> +distributed with this work for additional information >>> +regarding copyright ownership. The ASF licenses this file >>> +to you under the Apache License, Version 2.0 (the >>> +"License"); you may not use this file except in compliance >>> +with the License. You may obtain a copy of the License at >>> + >>> +http://www.apache.org/licenses/LICENSE-2.0 >>> + >>> +Unless required by applicable law or agreed to in writing, >>> +software distributed under the License is distributed on an >>> +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >>> +KIND, either express or implied. See the License for the >>> +specific language governing permissions and limitations >>> +under the License. >>> +--> >>> + >>> +<script type="text/javascript"> >>> +<#-- some labels are not unescaped in the JSON object so we have to do >>> this manualy --> >>> +function unescapeHtmlText(text) { >>> + return jQuery('<div />').html(text).text() >>> +} >>> + >>> +jQuery(window).load(createTree()); >>> + >>> +<#-- creating the JSON Data --> >>> +var rawdata = [ >>> + <#if (completedTree?has_content)> >>> + <@fillTree rootCat = completedTree/> >>> + </#if> >>> + >>> + <#macro fillTree rootCat> >>> + <#if (rootCat?has_content)> >>> + <#list rootCat as root> >>> + { >>> + "data": {"title" : unescapeHtmlText("<#if >>> root.groupName?exists>${root.groupName?js_string} >>> [${root.partyId}]<#else>${root.partyId?js_string}</#if>"), "attr": {"href" >>> : "<@ofbizUrl>/viewprofile?partyId=${root.partyId}</@ofbizUrl>","onClick" : >>> "callDocument('${root.partyId}');"}}, >>> + "attr": {"id" : "${root.partyId}", "rel" : "root"} >>> + <#if root.child?exists> >>> + ,"state" : "closed" >>> + </#if> >>> + <#if root_has_next> >>> + }, >>> + <#else> >>> + } >>> + </#if> >>> + </#list> >>> + </#if> >>> + </#macro> >>> + ]; >>> + >>> + <#-- create Tree--> >>> + function createTree() { >>> + jQuery(function () { >>> + $.cookie('jstree_select', null); >>> + $.cookie('jstree_open', null); >>> + >>> + jQuery("#tree").jstree({ >>> + "core" : { "initially_open" : [ "${partyId}" ] }, >>> + "plugins" : [ "themes", "json_data","ui" ,"cookies", "types", >>> "crrm"], >>> + "json_data" : { >>> + "data" : rawdata, >>> + "ajax" : { "url" : >>> "<@ofbizUrl>getHRChild</@ofbizUrl>", "type" : "POST", >>> + "data" : function (n) { >>> + return { >>> + "partyId" : n.attr ? >>> n.attr("id").replace("node_","") : 1 , >>> + "additionParam" : "','category" , >>> + "hrefString" : "viewprofile?partyId=" , >>> + "onclickFunction" : "callDocument" >>> + }; >>> + } >>> + } >>> + }, >>> + "types" : { >>> + "valid_children" : [ "root" ], >>> + "types" : { >>> + "CATEGORY" : { >>> + "icon" : { >>> + "image" : >>> "/images/jquery/plugins/jsTree/themes/apple/d.png", >>> + "position" : "10px40px" >>> + } >>> + } >>> + } >>> + } >>> + }); >>> + }); >>> + } >>> + >>> + function callDocument(id,type) { >>> + //jQuerry Ajax Request >>> + var dataSet = {}; >>> + URL = 'viewprofile'; >>> + dataSet = {"partyId" : id, "ajaxUpdateEvent" : "Y"}; >>> + >>> + jQuery.ajax({ >>> + url: URL, >>> + type: 'POST', >>> + data: dataSet, >>> + error: function(msg) { >>> + alert("An error occured loading content! : " + msg); >>> + }, >>> + success: function(msg) { >>> + jQuery('div.contentarea').html(msg); >>> + } >>> + }); >>> + } >>> + >>> +</script> >>> + >>> +<div id="tree"></div> >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> ------------------------------------------------------------------------------ >>> svn:eol-style = native >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> ------------------------------------------------------------------------------ >>> svn:keywords = "Date Rev Author URL Id" >>> >>> Propchange: >>> ofbiz/trunk/applications/humanres/webapp/humanres/humanres/category/CategoryTree.ftl >>> ------------------------------------------------------------------------------ >>> svn:mime-type = text/plain >>> >>> >> > > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. >
smime.p7s
Description: S/MIME cryptographic signature