ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jone...@apache.org
Subject svn commit: r488043 - in /incubator/ofbiz/trunk/applications/workeffort: ./ config/ entitydef/ servicedef/ src/org/ofbiz/workeffort/workeffort/ webapp/workeffort/WEB-INF/ widget/
Date Sun, 17 Dec 2006 20:37:43 GMT
Author: jonesde
Date: Sun Dec 17 12:37:42 2006
New Revision: 488043

URL: http://svn.apache.org/viewvc?view=rev&rev=488043
Log:
Applied patch from Anil Patel in Jira #OFBIZ-549 to implement WorkEffort keyword indexing
and a manual keyword admin screen; this is a good start but still a couple of things to do
on it

Added:
    incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties   (with
props)
    incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml   (with props)
    incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
  (with props)
Modified:
    incubator/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties
    incubator/ofbiz/trunk/applications/workeffort/entitydef/entitygroup.xml
    incubator/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml
    incubator/ofbiz/trunk/applications/workeffort/ofbiz-component.xml
    incubator/ofbiz/trunk/applications/workeffort/servicedef/services.xml
    incubator/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
    incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
    incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml
    incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml

Modified: incubator/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties Sun
Dec 17 12:37:42 2006
@@ -31,7 +31,8 @@
 PageTitleAddWorkEffortCommEvent=Add Work Effort Communication Event
 PageTitleEditWorkEffortCommEvent=Edit Work Effort CommEvent
 PageTitleListWorkEffortCommEvents=Work Effort Communication Events
-
+PageTitleListWorkEffortKeyword = Work Effort Keywords
+PageTitleAddWorkEffortKeyword = Add Work Effort Keyword
 PageTitleAddWorkEffortPartyAssign=Add Work Effort Party Assignment
 PageTitleEditWorkEffortPartyAssign=Edit Work Effort Party Assignment
 PageTitleListWorkEffortPartyAssigns=Work Effort Party Assignments
@@ -217,6 +218,7 @@
 WorkEffortItem=Item
 WorkEffortKeyword=Keyword
 WorkEffortKeywordAllWordsMatch=all words match
+WorkEffortKeywordAlreadyExist=WorkEffort - Keyword already exist
 WorkEffortKeywordAnyWordMatches=any word matches
 WorkEffortKeywordRelevency=Keyword Relevency
 WorkEffortKeywords=Keywords

Added: incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties?view=auto&rev=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties (added)
+++ incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties Sun Dec
17 12:37:42 2006
@@ -0,0 +1,35 @@
+#####################################################################
+#
+# Copyright 2001-2006 The Apache Software Foundation
+#
+# Licensed 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.
+######################################################################
+
+# Assign a weight to each workeffort keyword source during indexing/keywork inuduction
+index.weight.WorkEffort.workEffortId=1
+index.weight.WorkEffort.workEffortName=1
+index.weight.WorkEffort.workEffortTypeId=1
+index.weight.WorkEffort.currentStatusId=1
+index.weight.WorkEffort.actualStartDate=1
+index.weight.WorkEffort.actualCompletionDate=1
+
+index.weight.WorkEffortNoteAndData.noteInfo=1
+
+index.weight.WorkEffortAttribute.attrName=1
+index.weight.WorkEffortAttribute.attrValue=1
+
+index.include.WorkEffortContentTypes=CREATED_MEDIA,PROJECT_SPEC,PROPOSAL_MEDIA,SUPPORTING_MEDIA
+index.weight.WorkEffortContent.CREATED_MEDIA=1
+index.weight.WorkEffortContent.PROJECT_SPEC=1
+index.weight.WorkEffortContent.PROPOSAL_MEDIA=1
+index.weight.WorkEffortContent.SUPPORTING_MEDIA=1

Propchange: incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/applications/workeffort/config/workeffortsearch.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml?view=auto&rev=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml (added)
+++ incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml Sun Dec 17 12:37:42
2006
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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.
+-->
+
+<entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/entity-eca.xsd">
+    <!-- WorkEffort Keyword Indexing ECAs -->
+    <eca entity="WorkEffort" operation="create-store" event="return">
+        <action service="indexWorkEffortKeywords" mode="sync" value-attr="workEffortInstance"/>
+    </eca>
+    <eca entity="WorkEffortAttribute" operation="create-store" event="return">
+        <action service="indexWorkEffortKeywords" mode="sync"/>
+    </eca>
+    <eca entity="WorkEffortContent" operation="create-store" event="return">
+        <action service="indexWorkEffortKeywords" mode="sync"/>
+    </eca>
+    <eca entity="WorkEffortNote" operation="create-store" event="return">
+        <action service="indexWorkEffortKeywords" mode="sync"/>
+    </eca>
+</entity-eca>

Propchange: incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/applications/workeffort/entitydef/eecas.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/ofbiz/trunk/applications/workeffort/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/entitydef/entitygroup.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/entitydef/entitygroup.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/entitydef/entitygroup.xml Sun Dec 17 12:37:42
2006
@@ -52,6 +52,7 @@
     <entity-group group="org.ofbiz" entity="WorkEffortContactMech" />    
     <entity-group group="org.ofbiz" entity="WorkEffortContent" />    
     <entity-group group="org.ofbiz" entity="WorkEffortContentType" />    
+    <entity-group group="org.ofbiz" entity="WorkEffortContentAndInfo" />    
     <entity-group group="org.ofbiz" entity="WorkEffortDeliverableProd" />
     <entity-group group="org.ofbiz" entity="WorkEffortFixedAssetAssign" />
     <entity-group group="org.ofbiz" entity="WorkEffortFixedAssetStd" />

Modified: incubator/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml Sun Dec 17
12:37:42 2006
@@ -663,4 +663,35 @@
       </relation>
     </view-entity>    
 
+    <view-entity entity-name="WorkEffortContentAndInfo"
+            package-name="org.ofbiz.workeffort.workeffort"
+            title="WorkEffortContent, Content and DataResource View Entity">
+      <member-entity entity-alias="WC" entity-name="WorkEffortContent"/>
+      <member-entity entity-alias="CO" entity-name="Content"/>
+      <member-entity entity-alias="DR" entity-name="DataResource"/>
+      <alias-all entity-alias="WC" />
+      <alias-all entity-alias="CO" />
+      <alias-all entity-alias="DR" prefix="dr"/>
+      <view-link entity-alias="WC" rel-entity-alias="CO">
+        <key-map field-name="contentId"/>
+      </view-link>
+      <view-link entity-alias="CO" rel-entity-alias="DR">
+        <key-map field-name="dataResourceId"/>
+      </view-link>
+      <relation type="one-nofk" rel-entity-name="ElectronicText">
+        <key-map field-name="dataResourceId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="ImageDataResource">
+        <key-map field-name="dataResourceId" />
+      </relation>
+      <relation type="one-nofk" rel-entity-name="OtherDataResource">
+        <key-map field-name="dataResourceId" />
+      </relation>
+      <relation type="many" rel-entity-name="ContentAssocDataResourceViewFrom">
+        <key-map field-name="contentId" rel-field-name="contentIdStart" />
+      </relation>
+      <relation type="many" rel-entity-name="ContentAssocDataResourceViewTo">
+        <key-map field-name="contentId" rel-field-name="contentIdStart" />
+      </relation>
+    </view-entity>    
 </entitymodel>

Modified: incubator/ofbiz/trunk/applications/workeffort/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/ofbiz-component.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/ofbiz-component.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/ofbiz-component.xml Sun Dec 17 12:37:42
2006
@@ -26,6 +26,7 @@
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_view.xml"/>
     <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
+    <entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortSecurityData.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>

Modified: incubator/ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/servicedef/services.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/servicedef/services.xml Sun Dec 17 12:37:42
2006
@@ -450,4 +450,33 @@
         <description>Remove a Work Effort Review</description>
         <auto-attributes entity-name="WorkEffortReview" include="pk" mode="IN" optional="false"/>
     </service>
+    
+    <service name="indexWorkEffortKeywords" engine="simple"
+                location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="indexWorkEffortKeywords">
+        <description>Index the Keywords for a WorkEffort</description>
+        <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
+        <attribute name="workEffortInstance" type="GenericValue" mode="IN" optional="true"/>
+    </service>
+    <service name="createWorkEffortKeyword" default-entity-name="WorkEffortKeyword" engine="simple"
+                location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="createWorkEffortKeyword"
auth="true">
+        <description>Create a Work Effort Keyword</description>
+        <auto-attributes include="pk" mode="IN" optional="true"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="deleteWorkEffortKeyword" engine="simple"
+                location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="deleteWorkEffortKeyword"
auth="true">
+        <description>Remove a Work Effort Keyword</description>
+        <auto-attributes entity-name="WorkEffortKeyword" include="pk" mode="IN" optional="false"/>
+    </service>
+    <service name="createWorkEffortKeywords" default-entity-name="WorkEffortKeyword" engine="simple"
+                location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="createWorkEffortKeywords"
auth="true">
+        <description>Create a Work Effort Keyword</description>
+        <auto-attributes include="pk" mode="IN" optional="true"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>    
+    <service name="deleteWorkEffortKeywords" engine="simple"
+                location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="deleteWorkEffortKeywords"
auth="true">
+        <description>Remove all Work Effort Keyword</description>
+        <auto-attributes entity-name="WorkEffort" include="pk" mode="IN" optional="false"/>
+    </service>
 </services>

Added: incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java?view=auto&rev=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
(added)
+++ incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
Sun Dec 17 12:37:42 2006
@@ -0,0 +1,164 @@
+/*
+ *
+ * Copyright 2001-2006 The Apache Software Foundation
+ * 
+ * Licensed 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.workeffort.workeffort;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.common.KeywordSearchUtil;
+import org.ofbiz.content.data.DataResourceWorker;
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtil;
+
+public class WorkEffortKeywordIndex {
+    public static final String module = WorkEffortKeywordIndex.class.getName();
+    public static void indexKeywords(GenericValue workEffort) throws GenericEntityException
{        
+        if (workEffort == null) return;
+        
+        GenericDelegator delegator = workEffort.getDelegator();
+        if (delegator == null) return;
+        String workEffortId = workEffort.getString("workEffortId");
+        String separators = KeywordSearchUtil.getSeparators();
+        String stopWordBagOr = KeywordSearchUtil.getStopWordBagOr();
+        String stopWordBagAnd = KeywordSearchUtil.getStopWordBagAnd();
+        boolean removeStems = KeywordSearchUtil.getRemoveStems();
+        Set stemSet = KeywordSearchUtil.getStemSet();
+        
+        Map keywords = new TreeMap();
+        List strings = new ArrayList(50);
+        int widWeight = 1;
+        try {
+            widWeight = Integer.parseInt(UtilProperties.getPropertyValue("workeffortsearch",
"index.weight.WorkEffort.workEffortId", "1"));
+        } catch (Exception e) {
+            Debug.logWarning("Could not parse weight number: " + e.toString(), module);
+        }
+        keywords.put(workEffort.getString("workEffortId").toLowerCase(), new Long(widWeight));
+        
+        addWeightedKeywordSourceString(workEffort, "workEffortName", strings);
+        addWeightedKeywordSourceString(workEffort, "workEffortTypeId", strings);
+        addWeightedKeywordSourceString(workEffort, "currentStatusId", strings);
+        
+        if (!"0".equals(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortNoteAndData.noteInfo",
"1"))) {
+            Iterator workEffortNotes = UtilMisc.toIterator(delegator.findByAnd("WorkEffortNoteAndData",
UtilMisc.toMap("workEffortId", workEffortId)));
+            while (workEffortNotes != null && workEffortNotes.hasNext()) {
+                GenericValue workEffortNote = (GenericValue) workEffortNotes.next();
+                addWeightedKeywordSourceString(workEffortNote, "noteInfo", strings);
+                }
+        }
+        //WorkEffortAttribute
+        if (!"0".equals(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortAttribute.attrName",
"1")) ||
+                !"0".equals(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortAttribute.attrValue",
"1"))) {
+            Iterator workEffortAttributes = UtilMisc.toIterator(delegator.findByAnd("WorkEffortAttribute",
UtilMisc.toMap("workEffortId", workEffortId)));
+            while (workEffortAttributes != null && workEffortAttributes.hasNext())
{
+                GenericValue workEffortAttribute = (GenericValue) workEffortAttributes.next();
+                addWeightedKeywordSourceString(workEffortAttribute, "attrName", strings);
+                addWeightedKeywordSourceString(workEffortAttribute, "attrValue", strings);
+            }
+        }
+        
+        String workEffortContentTypes = UtilProperties.getPropertyValue("workeffortsearch",
"index.include.WorkEffortContentTypes");
+        List workEffortContentTypeList = Arrays.asList(workEffortContentTypes.split(","));
+        Iterator workEffortContentTypeIter = workEffortContentTypeList.iterator();
+        while (workEffortContentTypeIter.hasNext()) {
+            String workEffortContentTypeId = (String) workEffortContentTypeIter.next(); 
          
+            int weight = 1;
+            try {
+                weight = Integer.parseInt(UtilProperties.getPropertyValue("workeffortsearch",
"index.weight.WorkEffortContent." + workEffortContentTypeId, "1"));
+            } catch (Exception e) {
+                Debug.logWarning("Could not parse weight number: " + e.toString(), module);
+            }
+            
+            List workEffortContentAndInfos = delegator.findByAnd("WorkEffortContentAndInfo",
UtilMisc.toMap("workEffortId", workEffortId, "workEffortContentTypeId", workEffortContentTypeId),
null);
+            Iterator workEffortContentAndInfoIter = workEffortContentAndInfos.iterator();
+            while (workEffortContentAndInfoIter.hasNext()) {
+                GenericValue workEffortContentAndInfo = (GenericValue) workEffortContentAndInfoIter.next();
+                addWeightedDataResourceString(workEffortContentAndInfo, weight, strings,
delegator, workEffort);                
+                List alternateViews = workEffortContentAndInfo.getRelated("ContentAssocDataResourceViewTo",
UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"));
+                alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(),
"caFromDate", "caThruDate", true);
+                Iterator alternateViewIter = alternateViews.iterator();
+                while (alternateViewIter.hasNext()) {
+                    GenericValue thisView = (GenericValue) alternateViewIter.next();
+                    addWeightedDataResourceString(thisView, weight, strings, delegator, workEffort);
+                }
+            }
+        }    
+        Iterator strIter = strings.iterator();
+        while (strIter.hasNext()) {
+            String str = (String) strIter.next();
+            // call process keywords method here
+            KeywordSearchUtil.processKeywordsForIndex(str, keywords, separators, stopWordBagAnd,
stopWordBagOr, removeStems, stemSet);
+        }
+
+        List toBeStored = new LinkedList();
+        Iterator kiter = keywords.entrySet().iterator();
+        while (kiter.hasNext()) {
+            Map.Entry entry = (Map.Entry) kiter.next();
+            GenericValue workEffortKeyword = delegator.makeValue("WorkEffortKeyword", UtilMisc.toMap("workEffortId",
workEffort.getString("workEffortId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));
+            toBeStored.add(workEffortKeyword);
+        }
+        if (toBeStored.size() > 0) {
+            if (Debug.verboseOn()) Debug.logVerbose("KeywordSearch induceKeywords Storing
" + toBeStored.size() + " keywords for workEffortId " + workEffort.getString("workEffortId"),
module);
+            delegator.storeAll(toBeStored);
+        }
+            
+    }
+
+    public static void addWeightedDataResourceString(GenericValue dataResource, int weight,
List strings, GenericDelegator delegator, GenericValue workEffort) {
+        Map workEffortCtx = UtilMisc.toMap("workEffort", workEffort);
+        try {
+            String contentText = DataResourceWorker.renderDataResourceAsText(delegator, dataResource.getString("dataResourceId"),
workEffortCtx, dataResource, null, null);
+            for (int i = 0; i < weight; i++) {
+                strings.add(contentText);
+            }
+        } catch (IOException e1) {
+            Debug.logError(e1, "Error getting content text to index", module);
+        } catch (GeneralException e1) {
+            Debug.logError(e1, "Error getting content text to index", module);
+        }
+    }
+    public static void addWeightedKeywordSourceString(GenericValue value, String fieldName,
List strings) {
+        if (value.getString(fieldName) != null) {
+            int weight = 1;
+
+            try {
+                weight = Integer.parseInt(UtilProperties.getPropertyValue("workeffortsearch",
"index.weight." + value.getEntityName() + "." + fieldName, "1"));
+            } catch (Exception e) {
+                Debug.logWarning("Could not parse weight number: " + e.toString(), module);
+            }
+
+            for (int i = 0; i < weight; i++) {
+                strings.add(value.getString(fieldName));
+            }
+        }
+    }
+
+}

Propchange: incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
(original)
+++ incubator/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
Sun Dec 17 12:37:42 2006
@@ -522,7 +522,37 @@
         <response name="success" type="view" value="EditWorkEffortReviews"/>
         <response name="error" type="view" value="EditWorkEffortReviews"/>
     </request-map>
-            
+    
+    <!-- WorkEffort Keyword -->
+    <request-map uri="EditWorkEffortKeywords">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="EditWorkEffortKeywords"/>
+    </request-map>       
+    <request-map uri="createWorkEffortKeyword">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createWorkEffortKeyword"/>
+        <response name="success" type="view" value="EditWorkEffortKeywords"/>
+        <response name="error" type="view" value="EditWorkEffortKeywords"/>
+    </request-map>
+    <request-map uri="deleteWorkEffortKeyword">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="deleteWorkEffortKeyword"/>
+        <response name="success" type="view" value="EditWorkEffortKeywords"/>
+        <response name="error" type="view" value="EditWorkEffortKeywords"/>
+    </request-map>
+    <request-map uri="createWorkEffortKeywords">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createWorkEffortKeywords"/>
+        <response name="success" type="view" value="EditWorkEffortKeywords"/>
+        <response name="error" type="view" value="EditWorkEffortKeywords"/>
+    </request-map>
+    <request-map uri="deleteWorkEffortKeywords">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="deleteWorkEffortKeywords"/>
+        <response name="success" type="view" value="EditWorkEffortKeywords"/>
+        <response name="error" type="view" value="EditWorkEffortKeywords"/>
+    </request-map>
+                
     
     <!-- Lookup request mappings -->
     <request-map uri="LookupWorkEffort"><security https="true" auth="true"/><response
name="success" type="view" value="LookupWorkEffort"/></request-map>
@@ -601,6 +631,8 @@
     <view-map name="EditWorkEffortContents" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#EditWorkEffortContents"/>
   
     <view-map name="EditWorkEffortGoodStandards" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#EditWorkEffortGoodStandards"/>
   
     <view-map name="EditWorkEffortReviews" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#EditWorkEffortReviews"/>
   
+    
+    <view-map name="EditWorkEffortKeywords" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#EditWorkEffortKeywords"/>
         
     <view-map name="LookupWorkEffort" type="screen" page="component://workeffort/widget/LookupScreens.xml#LookupWorkEffort"/>
     <view-map name="LookupTimesheet" type="screen" page="component://workeffort/widget/LookupScreens.xml#LookupTimesheet"/>

Modified: incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml Sun Dec 17 12:37:42
2006
@@ -914,4 +914,29 @@
             <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteWorkEffortReview?workEffortId=${workEffortId}&amp;userLoginId=${userLoginId}&amp;reviewDate=${reviewDate}"/>
         </field>
     </form>
+        <!-- WorkEffortKeyword forms -->
+    <form name="AddWorkEffortKeyword" default-title-style="tableheadtext"
+        default-tooltip-style="tabletext" default-widget-style="inputBox"
+        target="createWorkEffortKeyword" title="" type="single">
+        <auto-fields-service service-name="createWorkEffortKeyword"/>
+        <field name="workEffortId"><hidden value="${parameters.workEffortId}"/></field>
+        <field name="keyword" title="${uiLabelMap.WorkEffortKeyword}*"><text size="10"/></field>
+        <field name="relevancyWeight" title="${uiLabelMap.ProductWeight}"><text
size="5"/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit
button-type="button"/></field>
+    </form>
+    <form name="ListWorkEffortKeywords" type="list" target="" list-name="listWorkEffortKeywords"

+         default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
+        <actions>
+            <entity-and entity-name="WorkEffortKeyword" use-cache="true" list-name="workEffortkeywords">
+                <field-map env-name="workEffortId" field-name="workEffortId" />
+            </entity-and>
+        </actions>
+        <field name="workEffortId" widget-style="buttontext"><hidden/></field>
       
+        <field name="keyword"  title="${uiLabelMap.WorkEffortKeywords}"  widget-style="tabletext"><display/></field>
+        <field name="relevancyWeight" header-link="createWorkEffortKeywords?workEffortId=${workEffortId}"
title="${uiLabelMap.ProductReInduceKeywords}" header-link-style="buttontext" ><display/></field>
+        <field name="deleteLink" title="${uiLabelMap.ProductDeleteAllKeywords}" header-link="deleteWorkEffortKeywords?workEffortId=${workEffortId}"
widget-style="buttontext" header-link-style="buttontext" >
+            <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteWorkEffortKeyword?workEffortId=${workEffortId}&amp;keyword=${keyword}"/>
+        </field>
+    </form>
+
 </forms>

Modified: incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml Sun Dec 17 12:37:42
2006
@@ -89,5 +89,9 @@
         <menu-item name="WorkEffortReviews" title="${uiLabelMap.WorkEffortReviews}">
             <link target="EditWorkEffortReviews?workEffortId=${workEffortId}"/>
         </menu-item>        
+        <menu-item name="WorkEffortKeywords" title="${uiLabelMap.WorkEffortKeywords}">
+            <link target="EditWorkEffortKeywords?workEffortId=${workEffortId}"/>
+        </menu-item>
     </menu>
+    
 </menus>

Modified: incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml?view=diff&rev=488043&r1=488042&r2=488043
==============================================================================
--- incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml (original)
+++ incubator/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Sun Dec 17
12:37:42 2006
@@ -565,4 +565,24 @@
             </widgets>
         </section>
     </screen>
+    <screen name="EditWorkEffortKeywords">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleListWorkEffortKeyword"/>
+                <set field="tabButtonItem" value="WorkEffortKeywords"/>
+                <set field="labelTitleProperty" value="PageTitleListWorkEffortKeyword"/>
+                <set field="workEffortId" from-field="parameters.workEffortId"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonWorkEffortDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container><label style="head1">${uiLabelMap.PageTitleAddWorkEffortKeyword}</label></container>
+                        <include-form name="AddWorkEffortKeyword" location="component://workeffort/widget/WorkEffortForms.xml"/>
+                        <container><label style="head1">${uiLabelMap.WorkEffortKeywords}</label></container>
+                        <include-form name="ListWorkEffortKeywords" location="component://workeffort/widget/WorkEffortForms.xml"/>
                       
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>



Mime
View raw message