Inserting a tree of value objects
Let's say I have these entities in my database:
Person
personId (PK)
firstName
lastName
PhoneNumber
phoneNumberId (PK)
number
description
personId (FK referencing Person entity)
I have a PersonValueObject class with the following attributes:
Integer personId
String firstName
String lastName
Collection phoneNumbers (a collection of PhoneNumberValueObject's - can be populated or set to null, depending on use case)
I have a PhoneNumberValueObject class with the following attributes:
Integer phoneNumberId
String number
Strong description
Integer personId
PersonValueObject person (can be populated or set to null, depending on the use case)
I have session facade with the following methods
createPerson(PersonValueObject personVO)
createPhoneNumber(PhoneNumberValueObject phoneNumberVO)
My question is, how should I insert a tree containing a Person and his related PhoneNumbers? I see three options:
1) The session facade's client calls createPerson(), which inserts the personVO and then the session facade traverses the personVO.phoneNumbers collection and calls createPhoneNumber() internally for every element in the collection. This means that the createPerson() method must have extra code to traverse the collection.
2) The session facade's client calls createPerson(), which inserts the personVO. Next, the session facade's client traverses the personVO.phoneNumbers collection and calls createPhoneNumber() for every element in the collection. This means that the client must have extra code to traverse the collection.
3) Add a third method called createPersonTree(PersonValueObject personVO), which internally calls createPerson() and then internally calls createPhoneNumber(). In this case, the createPersonTree() method must have the extra code to traverse the collection. The way I see it, the advantage of this approach is that the session facade's client has a choice of calling createPersonTree(), if it needs to insert a whole tree, whereas it can just call createPhoneNumber() directly if it just needs to add a new phone number to an existing person.
Comments?
1) Are you using session Bean for inserting the data?
2) Are you using the Entity Beans, I mean BMP?
3) Have you looked in the features provided by the
CMP2.0.Let me explain all the patterns I am using. The client is a regular java class that implements the "business delegate" pattern. The business delegate communicates with a session bean that is implementing the "session facade" pattern. It is this session facade that has those methods I referred to above, namely createPerson(), createPhoneNumber() and potentially createPersonTree(). The session facade communicates with a Person entity bean and a PhoneNumber entity bean, which implement the persistence layer. Both of these entity beans use EJB 2.0 CMR and CMP. The actual inserts are performed by these entity beans. For example, inside the session facade's createPerson() method, the session facade delegates the actual insert to the Person entity bean.
Data is passed between objects by using the "value object" pattern. For example, the business delegate passes person data to the session facade inside a Person value object. The session facade also passes this value object to the entity bean (alternatively, the session facade could pass the person's attributes individually, but I thought this was not as convenient).
I hope that explains the situation.
Similar Messages
-
I am using SQL server 2008 R1 SP3. And when we are doing back up operations we are facing the below error
Msg 2601, Level 14, State 1, Procedure sp_flush_commit_table, Line 15
Cannot insert duplicate key row in object 'sys.syscommittab' with unique index 'si_xdes_id'. The
duplicate key value is (2238926153).
The statement has been terminated.
Please assist me with your inputs.
Thanks,
Rakesh.Hello,
Did you enable change tracking on the database? If so, please try to disable and re-enable the change tracking.
The following thread is about the similar issue, please refer to:
http://social.msdn.microsoft.com/forums/sqlserver/en-US/c2294c73-4fdf-46e9-be97-8fade702e331/backup-fails-after-installing-sql2012-sp1-cu1-build-3321
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Version: Jdeveloper 11.1.2.1.0
how to get programmatically tree node value.
i have tried but cann't read value from selected node.
please help me.
here is my application creation steps:
1. New Application
2. Fusion Web Application (ADF) Template
3. Create View Object VOTreeMst
Query:
Select Department_Name,Department_Id
From Departments
4. Create View Object VOTreeChd
Query:
Select Last_Name,Employee_Id,Department_Id
From Employees
5. Create View Link VLTreeMstChd
VOTreeMst.DepartmentId=VOTreeChd.DepartmentId
And Add to Application Module
6. Create page page1 in ViewController
New-->Web Tier-->JSF/Facelets-->Page
Selected Document Type JSP XML
7. Drag VOTreeMst1 From Data Controls into page1
and select Tree-->ADF Tree
8. ADD java Code into selection Listener
public void nodeSelect(SelectionEvent selectionEvent) {
//original selection listener set by ADF
String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
//make sure the default selection listener functionality is preserved.
//you don't need to do this for multi select trees as the ADF binding
//only supports single current row selection
/* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
new Class[] { SelectionEvent.class });
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
//for single select configurations, thi sonly is called once
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
CollectionModel collectionModel = (CollectionModel)tree.getValue();
treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
Row rw = nodeBinding.getRow();
//print first row attribute. Note that in a tree you have to determine the node
//type if you want to select node attributes by name and not index
String rowType = rw.getStructureDef().getDefName();
if(rowType.equalsIgnoreCase("VOTreeMst")){
System.out.println("This row is a department: " + rw.getAttribute("DepartmentId"));
else if(rowType.equalsIgnoreCase("VOTreeChd")){
System.out.println("This row is an employee: " + rw.getAttribute("EmployeeId"));
else{
System.out.println("Huh ????");
// ... do more usefuls stuff here
9. when i click on first node it is working but i click on second node it is not working
error message::
<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
javax.el.ELException: java.lang.NullPointerException
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1589)
at org.apache.myfaces.trinidad.component.UIXTree.broadcast(UIXTree.java:237)
<RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
javax.el.ELException: java.lang.NullPointerException
I have also tried using following code but same problem
public void onTreeSelect(SelectionEvent selectionEvent) {
//original selection listener set by ADF
String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
//make sure the default selection listener functionality is preserved.
//you don't need to do this for multi select trees as the ADF binding
//only supports single current row selection
/* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
new Class[] { SelectionEvent.class });
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
//for single select configurations, thi sonly is called once
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
treeBinding = (JUCtrlHierBinding)((CollectionModel)tree.getValue()).getWrappedData();
JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
Row rw = nodeBinding.getRow();
//print first row attribute. Note that in a tree you have to determine the node
//type if you want to select node attributes by name and not index
System.out.println("row: " + rw.getAttribute(0));
But
If i create .jspx page From
Web Tier->Jsp->page Then it is working fine
when i create .jspx page From
Web Tier->JSF\Facelets->page Then it is not working
i need to get value from "Web Tier->JSF\Facelets->page"
is there any help please?You should try Franks generic selectionListener http://www.oracle.com/technetwork/developer-tools/adf/learnmore/25-generic-tree-selection-listener-169164.pdf. For help on hoe to get the selected tree node data check http://www.oracle.com/technetwork/developer-tools/adf/learnmore/26-get-selected-tree-node-data-169165.pdf
Timo -
Cannot insert duplicate key row in object
This is a JPA question. The tbHardware table has a PK identity column and a unique non-clustered index on CoxBarcode column.
I have a SFSB in a Seam2.0.0.GA app running on JBoss 4.2.1.GA. I am using flushMode=FlushModeType.MANUAL (Seam specific when beginning a conversation) and that's why you see the flush() reference at the end of the following code snippet.
Query query = entityManager.createNativeQuery("INSERT INTO tbHardware "+
"VALUES (:coxBarCode, :serialNo, :currentStatus, :currentLocationNo, "+
":desc, :hardwareModelId, :ownerTypeCode, :firstEnteredDate, :enteredByUser, :lastAuditDate, :hardwarePrice, null)")
.setParameter("coxBarCode", coxBarcode)
.setParameter("serialNo", serialNo)
.setParameter("currentStatus", curstatus)
.setParameter("currentLocationNo", curloc)
.setParameter("desc", desc)
.setParameter("hardwareModelId", selmodid)
.setParameter("ownerTypeCode", selectedOwner)
.setParameter("firstEnteredDate", firstEnteredDate)
.setParameter("enteredByUser", enteredByUser)
.setParameter("lastAuditDate", lastAuditedDate)
.setParameter("hardwarePrice", unitPrice);
query.executeUpdate();
query = entityManager.createNativeQuery("INSERT INTO TbHardwareHistory "+
"VALUES (:hardwareId, :currentStatus, :currentLocationNo, :firstEnteredDate, null, :enteredByUser, :ownerTypeCode)")
.setParameter("hardwareId", findHardwareId(coxBarcode))
.setParameter("currentStatus", curstatus)
.setParameter("currentLocationNo", curloc)
.setParameter("firstEnteredDate", firstEnteredDate)
.setParameter("enteredByUser", enteredByUser)
.setParameter("ownerTypeCode", selectedOwner);
query.executeUpdate();
//TO DO: following query should return only one entity, need to refactor and remove the for loop below
TbHardware hw = (TbHardware)entityManager.createNativeQuery("SELECT t FROM tbHardware t WHERE t.coxBarCode = :coxBarCode AND t.serialNo = :serialNo", TbHardware.class)
.setParameter("coxBarCode", coxBarcode)
.setParameter("serialNo", serialNo)
.getSingleResult();
Integer hardwareId = hw.getHardwareId();
query = entityManager.createNativeQuery("INSERT INTO tbHardwareNote VALUES (:hardwareId, :hardwareNote)")
.setParameter("hardwareId", hardwareId).setParameter("hardwareNote", hardwareNote);
query.executeUpdate();
entityManager.flush();I am getting the following in the server.log:
10:10:57,552 ERROR [STDERR] Caused by: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
10:10:57,552 ERROR [STDERR] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
10:10:57,552 ERROR [STDERR] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
10:10:57,552 ERROR [STDERR] at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:174)
10:10:57,552 ERROR [STDERR] at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1163)
10:10:57,552 ERROR [STDERR] at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334)
10:10:57,552 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:48)
10:10:57,552 ERROR [STDERR] ... 138 more
10:10:57,552 ERROR [STDERR] Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.tbHardware' with unique index 'IX_tbHardwar_coxBarCode_UNIQUE'.
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
10:10:57,552 ERROR [STDERR] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
10:10:57,552 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
10:10:57,552 ERROR [STDERR] at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:165)
10:10:57,552 ERROR [STDERR] ... 141 moreHow should I handle this SQLServerException? What is the best practice regarding this from a JPA perspective? I thought about executing a select query prior to the insert in tbHardware to check to see if a record with that particular coxBarCode exists or not. Would the exception be handled differently if I used the persist() method instead of the createNativeQuery() and executeUpdate() combination? thx.
Edited by: asookazian on May 7, 2008 11:07 AMkajbj wrote:
What do you mean by control? Yes, you can find duplicates and remove them (by e.g. implementing a Comparator and adding them to a Set)
KajI mean to say replace the duplication with just a single value for insert!
Any psuedo for the comparactor suggested? -
Can anyone tell me how to Copy a node on an ALV Tree using context menu ?
Hello Vidya
The sample report ZUS_SDN_ALVTREE_CTXMENU demonstrates how to copy nodes on an ALV tree.
Before showing the entire coding I would like to point out a few crucial parts of the coding:
(1) Defintion of OUTTAB list
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE vbak.
TYPES: nkey TYPE lvc_nkey.
TYPES: ntype TYPE lvc_value. " 'VKORG' / 'VTWEG' / 'SPART' / leaf
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
The OUTTAB list contains two additional fields holding the tree key (LVC_NKEY) and the node type.
(2) The main logic of the report is implemented in event handler method handle_node_ctxmenu_sel.
WHEN 'COPY_SUBTREE'.
CALL METHOD go_alvtree->get_subtree
EXPORTING
i_node_key = node_key
IMPORTING
et_subtree_nodes = lt_subtree.
CALL METHOD go_alvtree->get_parent
EXPORTING
i_node_key = node_key
IMPORTING
e_parent_node_key = ld_parent_key.
LOOP AT lt_subtree INTO ld_node_key.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY nkey = ld_node_key.
APPEND ls_outtab TO lt_outtab.
ENDLOOP.
READ TABLE lt_outtab INTO ls_outtab INDEX 1.
ld_ntype = ls_outtab-ntype.
DELETE lt_outtab WHERE ( vbeln IS INITIAL ). " hierarchy nodes
CASE ld_ntype.
WHEN 'VKORG'.
ld_top_key = ld_parent_key.
WHEN 'VTWEG'.
ld_vkorg_key = ld_parent_key.
WHEN 'SPART'.
ld_vtweg_key = ld_parent_key.
WHEN 'LEAF'.
ld_spart_key = ld_parent_key.
ENDCASE.
" Note: similar logic like in routine CREATE_HIERARCHY
SORT lt_outtab BY vkorg vtweg spart kunnr audat.
LOOP AT lt_outtab INTO ls_outtab.
*& Report ZUS_SDN_ALVTREE_CTXMENU
*& Based on: BCALV_TREE_03
REPORT zus_sdn_alvtree_ctxmenu.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE vbak.
TYPES: nkey TYPE lvc_nkey.
TYPES: ntype TYPE lvc_value. " 'VKORG' / 'VTWEG' / 'SPART' / leaf
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_alvtree TYPE REF TO cl_gui_alv_tree.
DATA:
gt_outtab TYPE ty_t_outtab, " Sales Document
gt_fcat TYPE lvc_t_fcat.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
* §2. Define an event handler method to build up a context menu
* (postfix of event name: _CONTEXT_MENU_REQUEST).
* This event is fired each time the user klick with the right
* mouse button on a node.
CLASS-METHODS:
handle_node_ctxmenu_req
FOR EVENT node_context_menu_request OF cl_gui_alv_tree
IMPORTING
node_key
menu,
* §3. Define an event handler method to respond to a function code
* triggered by your menu (postfix: _CONTEXT_MENU_SELECTED).
* This event is fired when the user selects an entry of the
* build up context menu.
handle_node_ctxmenu_sel
FOR EVENT node_context_menu_selected OF cl_gui_alv_tree
IMPORTING
node_key
fcode
sender.
* 'sender' is an implicit event parameter that is provided by
* ABAP Objects runtime system. It contains a reference to the
* object that fired the event. You may directly use it to
* call methods of this instance.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
* §4. Implement your event handler methods.
METHOD handle_node_ctxmenu_req.
* Event parameter 'menu' holds a reference to the standard context
* menu of ALV Tree (functions 'Expand'/'Collapse' on nodes).
* You may either append your own functions (separated by a line)
* or clear the menu if you do not want to allow standard functions.
* In this case the standard menu is cleared.
CALL METHOD menu->clear.
* The next line defines one line of the context menu.
CALL METHOD menu->add_function
EXPORTING
fcode = 'DEL_SUBTREE'
text = 'Delete Subtree'(901). "Delete Subtree
CALL METHOD menu->add_function
EXPORTING
fcode = 'COPY_SUBTREE'
text = 'Copy Subtree'(902). "Copy Subtree
ENDMETHOD. "handle_node_ctxmenu_req
METHOD handle_node_ctxmenu_sel.
* At this point of execution, the user selected a menu entry of the
* menu build up in event handler method handle_node_cm_req.
* Query your own function codes and react accordingly.
DATA:
l_rc TYPE c,
ld_ntype TYPE lvc_value,
ld_parent_key TYPE lvc_nkey,
ld_node_key TYPE lvc_nkey,
lt_subtree TYPE lvc_t_nkey,
ls_outtab TYPE ty_s_outtab,
ls_last TYPE ty_s_outtab,
lt_outtab TYPE ty_t_outtab.
DATA:
ld_vkorg_key TYPE lvc_nkey,
ld_vtweg_key TYPE lvc_nkey,
ld_spart_key TYPE lvc_nkey,
ld_last_key TYPE lvc_nkey,
ld_top_key TYPE lvc_nkey.
CASE fcode.
WHEN 'DEL_SUBTREE'.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
textline1 = 'Do you really want to delete'(902)
textline2 = 'this node and all its subnodes?'(903)
titel = 'Confirmation'(904)
cancel_display = ' '
IMPORTING
answer = l_rc.
IF l_rc EQ 'J'.
CALL METHOD sender->delete_subtree
EXPORTING
i_node_key = node_key.
* Do not forget to refresh the display when you change the contents
* of your list.
CALL METHOD sender->frontend_update.
ENDIF.
WHEN 'COPY_SUBTREE'.
CALL METHOD go_alvtree->get_subtree
EXPORTING
i_node_key = node_key
IMPORTING
et_subtree_nodes = lt_subtree.
CALL METHOD go_alvtree->get_parent
EXPORTING
i_node_key = node_key
IMPORTING
e_parent_node_key = ld_parent_key.
LOOP AT lt_subtree INTO ld_node_key.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY nkey = ld_node_key.
APPEND ls_outtab TO lt_outtab.
ENDLOOP.
READ TABLE lt_outtab INTO ls_outtab INDEX 1.
ld_ntype = ls_outtab-ntype.
DELETE lt_outtab WHERE ( vbeln IS INITIAL ). " hierarchy nodes
CASE ld_ntype.
WHEN 'VKORG'.
ld_top_key = ld_parent_key.
WHEN 'VTWEG'.
ld_vkorg_key = ld_parent_key.
WHEN 'SPART'.
ld_vtweg_key = ld_parent_key.
WHEN 'LEAF'.
ld_spart_key = ld_parent_key.
ENDCASE.
SORT lt_outtab BY vkorg vtweg spart kunnr audat.
LOOP AT lt_outtab INTO ls_outtab.
IF ( ld_ntype = 'VKORG' ).
" new sales organisation
IF ( ls_outtab-vkorg = ls_last-vkorg ).
ELSE.
PERFORM add_sales_org
USING
ls_outtab
ld_top_key
CHANGING
ld_vkorg_key.
ls_outtab-nkey = ld_vkorg_key.
ls_outtab-ntype = 'VKORG'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ENDIF.
ENDIF.
IF ( ld_ntype = 'VKORG' OR
ld_ntype = 'VTWEG' ).
" new distribution channel
IF ( ls_outtab-vkorg = ls_last-vkorg AND
ls_outtab-vtweg = ls_last-vtweg ).
ELSE.
PERFORM add_distrib_chan
USING
ls_outtab
ld_vkorg_key
CHANGING
ld_vtweg_key.
ls_outtab-nkey = ld_vtweg_key.
ls_outtab-ntype = 'VTWEG'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ENDIF.
ENDIF.
IF ( ld_ntype = 'VKORG' OR
ld_ntype = 'VTWEG' OR
ld_ntype = 'SPART' ).
" new channel
IF ( ls_outtab-vkorg = ls_last-vkorg AND
ls_outtab-vtweg = ls_last-vtweg AND
ls_outtab-spart = ls_last-spart ).
ELSE.
PERFORM add_division
USING
ls_outtab
ld_vtweg_key
CHANGING
ld_spart_key.
ls_outtab-nkey = ld_spart_key.
ls_outtab-ntype = 'SPART'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ENDIF.
ENDIF.
* Leaf:
PERFORM add_complete_line
USING
ls_outtab
ld_spart_key
CHANGING
ld_last_key.
ls_outtab-nkey = ld_last_key.
ls_outtab-ntype = 'LEAF'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ls_last = ls_outtab.
ENDLOOP.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFRESH_TREE'
* IMPORTING
* RC =
ENDCASE.
ENDMETHOD. "handle_node_ctxmenu_sel
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
PERFORM init_controls.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL SCREEN '0100'.
* NOTE: no screen elements, ok_code -> gd_okcode
** PROCESS BEFORE OUTPUT.
** MODULE STATUS_0100.
** PROCESS AFTER INPUT.
** MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE. " facilitate manual entries
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
when 'REFRESH_TREE'.
CALL METHOD go_alvtree->update_calculations
* EXPORTING
* NO_FRONTEND_UPDATE =
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
DATA:
ls_hierarchy_header TYPE treev_hhdr.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999 " full-size screen
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* create tree control
CREATE OBJECT go_alvtree
EXPORTING
parent = go_docking
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = ' '
no_html_header = 'X'
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
* Hide columns and sum up values initially using the fieldcatalog
PERFORM build_fieldcatalog.
* IMPORTANT: Table 'gt_sflight' must be empty. Do not change this table
* (even after this method call). You can change data of your table
* by calling methods of CL_GUI_ALV_TREE.
* Furthermore, the output table 'gt_outtab' must be global and can
* only be used for one ALV Tree Control.
CALL METHOD go_alvtree->set_table_for_first_display
EXPORTING
is_hierarchy_header = ls_hierarchy_header
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_outtab. "table must be empty !
PERFORM init_tree.
ENDFORM. " INIT_CONTROLS
*& Form INIT_TREE
* text
* --> p1 text
* <-- p2 text
FORM init_tree .
PERFORM create_hierarchy.
PERFORM register_events.
* Update calculations which were initially defined by field DO_SUM
* of the fieldcatalog. (see build_fieldcatalog).
CALL METHOD go_alvtree->update_calculations.
* Send data to frontend.
CALL METHOD go_alvtree->frontend_update.
ENDFORM. " INIT_TREE
*& Form build_hierarchy_header
* text
* <--P_LS_HIERARCHY_HEADER text
FORM build_hierarchy_header
CHANGING
cs_hierarchy_header TYPE treev_hhdr.
cs_hierarchy_header-heading =
'SalesOrg/DistChannel/Division'(300).
cs_hierarchy_header-tooltip = 'Customer: Master Sales Data'(400).
cs_hierarchy_header-width = 45.
cs_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form build_fieldcatalog
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
REFRESH: gt_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'VBAK'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'VBELN' OR
'AUDAT' OR
'AUART' OR
'WAERK' OR
'VKORG' OR
'VTWEG' OR
'SPART' OR
'BSTNK' OR
'KUNNR'.
WHEN 'NETWR'.
ls_fcat-do_sum = 'X'.
ls_fcat-h_ftype = 'SUM'. " or: 'MAX' / 'AVG'
WHEN OTHERS.
ls_fcat-tech = 'X'.
ENDCASE.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " build_fieldcatalog
*& Form create_hierarchy
* text
* --> p1 text
* <-- p2 text
FORM create_hierarchy .
* define local data
DATA:
ls_outtab TYPE ty_s_outtab,
ls_last TYPE ty_s_outtab,
lt_outtab TYPE ty_t_outtab.
DATA:
ld_vkorg_key TYPE lvc_nkey,
ld_vtweg_key TYPE lvc_nkey,
ld_spart_key TYPE lvc_nkey,
ld_last_key TYPE lvc_nkey,
ld_top_key TYPE lvc_nkey.
" Select data
SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE lt_outtab
UP TO 1550 ROWS.
" sort table according to conceived hierarchy
SORT lt_outtab BY vkorg vtweg spart kunnr audat.
* Define one top node. In this way it is possible to calculate
* values for the whole hierarchy.
CALL METHOD go_alvtree->add_node
EXPORTING
i_relat_node_key = ''
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = 'Sales Documents'
IMPORTING
e_new_node_key = ld_top_key.
CLEAR: ls_outtab.
ls_outtab-nkey = ld_top_key.
ls_outtab-ntype = 'ROOT'.
MODIFY gt_outtab FROM ls_outtab INDEX 1
TRANSPORTING nkey ntype.
LOOP AT lt_outtab INTO ls_outtab.
" new sales organisation
IF ( ls_outtab-vkorg = ls_last-vkorg ).
ELSE.
PERFORM add_sales_org
USING
ls_outtab
ld_top_key
CHANGING
ld_vkorg_key.
ls_outtab-nkey = ld_vkorg_key.
ls_outtab-ntype = 'VKORG'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ENDIF.
" new distribution channel
IF ( ls_outtab-vkorg = ls_last-vkorg AND
ls_outtab-vtweg = ls_last-vtweg ).
ELSE.
PERFORM add_distrib_chan
USING
ls_outtab
ld_vkorg_key
CHANGING
ld_vtweg_key.
ls_outtab-nkey = ld_vtweg_key.
ls_outtab-ntype = 'VTWEG'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ENDIF.
" new channel
IF ( ls_outtab-vkorg = ls_last-vkorg AND
ls_outtab-vtweg = ls_last-vtweg AND
ls_outtab-spart = ls_last-spart ).
ELSE.
PERFORM add_division
USING
ls_outtab
ld_vtweg_key
CHANGING
ld_spart_key.
ls_outtab-nkey = ld_spart_key.
ls_outtab-ntype = 'SPART'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ENDIF.
* Leaf:
PERFORM add_complete_line
USING
ls_outtab
ld_spart_key
CHANGING
ld_last_key.
ls_outtab-nkey = ld_last_key.
ls_outtab-ntype = 'LEAF'.
DESCRIBE TABLE gt_outtab. " fill sy-tfill
MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
TRANSPORTING nkey ntype.
ls_last = ls_outtab.
ENDLOOP.
ENDFORM. " create_hierarchy
*& Form ADD_SALES_ORG
* text
* -->P_LS_OUTTAB text
* -->P_LD_TOP_KEY text
* <--P_LD_VKORG_KEY text
FORM add_sales_org
USING
value(us_outtab) TYPE ty_s_outtab
value(ud_relat_key) TYPE lvc_nkey
CHANGING
cd_node_key TYPE lvc_nkey.
* define local data
DATA:
ld_nodetext TYPE lvc_value,
ls_outtab TYPE ty_s_outtab.
ld_nodetext = us_outtab-vkorg.
" add node
CALL METHOD go_alvtree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_nodetext
is_outtab_line = ls_outtab
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " ADD_SALES_ORG
*& Form add_DISTRIB_CHAN
* text
* -->P_LS_OUTTAB text
* -->P_LD_VKORG_KEY text
* <--P_LD_VTWEG_KEY text
FORM add_distrib_chan
USING
value(us_outtab) TYPE ty_s_outtab
value(ud_relat_key) TYPE lvc_nkey
CHANGING
cd_node_key TYPE lvc_nkey.
* define local data
DATA:
ld_nodetext TYPE lvc_value,
ls_outtab TYPE ty_s_outtab.
ld_nodetext = us_outtab-vtweg.
" add node
CALL METHOD go_alvtree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_nodetext
is_outtab_line = ls_outtab
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " add_DISTRIB_CHAN
*& Form add_division
* text
* -->P_LS_OUTTAB text
* -->P_LD_VTWEG_KEY text
* <--P_LD_SPART_KEY text
FORM add_division
USING
value(us_outtab) TYPE ty_s_outtab
value(ud_relat_key) TYPE lvc_nkey
CHANGING
cd_node_key TYPE lvc_nkey.
* define local data
DATA:
ld_nodetext TYPE lvc_value,
ls_outtab TYPE ty_s_outtab.
ld_nodetext = us_outtab-spart.
" add node
CALL METHOD go_alvtree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_nodetext
is_outtab_line = ls_outtab
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " add_division
*& Form add_complete_line
* text
* -->P_LS_OUTTAB text
* -->P_LD_SPART_KEY text
* <--P_LD_LAST_KEY text
FORM add_complete_line
USING
value(us_outtab) TYPE ty_s_outtab
value(ud_relat_key) TYPE lvc_nkey
CHANGING
cd_node_key TYPE lvc_nkey.
* define local data
DATA:
ld_nodetext TYPE lvc_value,
ls_outtab TYPE ty_s_outtab.
WRITE us_outtab-kunnr TO ld_nodetext+0 NO-ZERO.
WRITE us_outtab-audat TO ld_nodetext+20 DD/MM/YYYY.
CONDENSE ld_nodetext.
" add node
CALL METHOD go_alvtree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_nodetext
is_outtab_line = us_outtab " !!!
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " add_complete_line
*& Form register_events
* text
* --> p1 text
* <-- p2 text
FORM register_events .
DATA:
lt_events TYPE cntl_simple_events,
ls_event TYPE cntl_simple_event.
* The following four tree events registers ALV Tree in the constructor
* method itself.
* - cl_gui_column_tree=>eventid_expand_no_children
* (needed to load data to frontend when a user expands a node)
* - cl_gui_column_tree=>eventid_header_context_men_req
* (needed for header context menu)
* - cl_gui_column_tree=>eventid_header_click
* (allows selection of columns (only when item selection activated))
* - cl_gui_column_tree=>eventid_item_keypress
* (needed for F1-Help (only when item selection activated))
* Nevertheless you have to provide their IDs again if you register
* additional events with SET_REGISTERED_EVENTS (see below).
* To do so, call first method GET_REGISTERED_EVENTS (this way,
* all already registered events remain registered, even your own):
CALL METHOD go_alvtree->get_registered_events
IMPORTING
events = lt_events.
* (If you do not these events will be deregistered!!!).
* You do not have to register events of the toolbar again.
* Register additional events for your own purposes:
* §5. Register first context menu event on frontend (with postfix
* (_REQUEST). The second is registered automatically.
ls_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
APPEND ls_event TO lt_events.
* register events on frontend
CALL METHOD go_alvtree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
* §6. Register both context menu events on backend (ABAP Objects
* event handling).
SET HANDLER:
lcl_eventhandler=>handle_node_ctxmenu_req FOR go_alvtree,
lcl_eventhandler=>handle_node_ctxmenu_sel FOR go_alvtree.
ENDFORM. " register_events
Regards,
Uwe -
Sybase Error 2601 Attempt to insert duplicate key row in object with unique
RE: Sybase Error 2601 Attempt to insert duplicate key row in object with unique index.
Hi Folks,
I'm getting the following error whilst executing a stored procedure in Sybase.
ERROR: Sybase Error 2601 Attempt to insert duplicate key row in object with unique index.
I understand that duplicate values have been inserted into a column that has a unique constraint.
I just can't figure out how to rectify the problem.
Your help will be greatly appreciated!
Many thanks in advance.If the value I'm trying to insert (using update)
already exists in the unique-value field then the DB
refuses to update the field.
If the value is different it will update.Are you trying to insert or update in SQL (identified by the keyword INSERT or UPDATE respectively)?
Even in case of an UPDATE query, if you are going to update the values of some columns to violate the unique constraints, the update will not succeed and you will get the error message.
or is it?
it tries to create a new row, but can't because there
is another row with the same unique-values.
If this is the case, I am only trying to update and
not create a new item.To put it in simpler words, if you have a set of values defining the uniqueness of a record, you cannot insert another record with the same set of unique values. Similarly, you cannot update an existing record by modifying the set to conflict with another set of unique values which already exist in the database.
Suppose there are two columns A and B defining the uniqueness of the record and you have only two records at the moment like -
A B
========
1 1
2 1
If you try to insert a record with A = 1 and B = 1, it will fail because a record already exists. You cannot violate uniqueness because the database has already been told that there will be only one record for any given combination of A and B.
Similarly, if you try to update the second record from A = 2 to A = 1, the end result would be A =1 and B = 1. There is already a record with that set of values and this will result in a violation of the uniqueness. So, this update will also be disallowed. On the other hand, if you try to update B to some value, say 3, there is no problem in doing so.
For convenience, you can imagine an UPDATE operation to be equivalent to DELETE + INSERT operation, though it doesn't necessarily work the same way internally.
I hope I was clear enough. -
When we try to deploy a wsp to sharepoint containing code to generate quick launch menu we get the following error messages when running the last enable-spfeature command in powershell. The same code is working in the development environment, but when we
deploy to a test server the following error occurs:
Add-SPSolution "C:\temp\ImpactSharePoint.wsp"
Install-SPSolution -Identity impactsharepoint.wsp -GACDeployment
Enable-SPFeature impactsharepoint_branding -url http://im-sp1/sites/impact/
Enable-SPFeature impactsharepoint_pages -url http://im-sp1/sites/impact/
From UlsViewer.exe:
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database 880i
High System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK'. The duplicate key value is (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6,
1000). The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj,
Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior
runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock) ClientConnectionId:2bb4004c-aa75-470e-b11e-dbf1c476aaed
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database 880k
High at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) at Microsoft.SharePoint.Library.SPRequestInternalClass.AddNavigationNode(String
bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified) at Microsoft.SharePoint.Library.SPRequestInternalClass.AddNavigationNode(String
bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified) at Microsoft.SharePoint.Library.SPRequest.AddNavigationNode(String
bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified) at Microsoft.SharePoint.Navigation.SPNavigationNode.AddInternal(Int32
iPreviousNodeId, Int32 iParentId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav) at Microsoft.SharePoint.Navigation.SPNavigationNodeCollection.AddInternal(SPNavigationNode node, Int32 iPreviousNodeId) at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.<ConfigureQuickLaunchBar>b__0()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback
secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.ConfigureQuickLaunchBar() at ImpactSharePoint.Features.Pages.PagesEventReceiver.FeatureActivated(SPFeatureReceiverProperties
properties) at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags
activateFlags, Boolean fForce) at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)
at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtWeb(Boolean fActivate, Boolean fEnsure, Guid featid, SPFeatureDefinition featdef, String urlScope, String sProperties, Boolean fForce) at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtScope(Boolean
fActivate, Guid featid, SPFeatureDefinition featdef, String urlScope, Boolean fForce) at Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature.UpdateDataObject() at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord() at System.Management.Automation.CommandProcessorBase.DoExecute() at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input, Hashtable errorResults, Boolean enumerate) at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext) at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0
arg0) at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.CommandProcessorBase.DoComplete() at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase
commandRequestingUpstreamCommandsToStop) at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate) at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc() at System.Management.Automation.Runspaces.PipelineThread.WorkerProc() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database 880j
High SqlError: 'Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK'. The duplicate key value is (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6, 1000).'
Source: '.Net SqlClient Data Provider' Number: 2601 State: 1 Class: 14 Procedure: 'proc_NavStructAddNewNode' LineNumber: 92 Server: 'IMPACTCLUSTER\IMPACTDB'
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database 880j
High SqlError: 'The statement has been terminated.' Source: '.Net SqlClient Data Provider' Number: 3621 State: 0 Class: 0 Procedure: 'proc_NavStructAddNewNode' LineNumber: 92 Server: 'IMPACTCLUSTER\IMPACTDB'
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database tzku
High ConnectionString: 'Data Source=IMPACTCLUSTER\IMPACTDB;Initial Catalog=WSS_Content;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connect Timeout=15;Application Name=SharePoint[powershell][1][WSS_Content]'
Partition: 6323df8a-5c57-4d3e-a477-09aa8b66100a ConnectionState: Closed ConnectionTimeout: 15
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database tzkv
High SqlCommand: 'BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAllocateEidBlockWebId @wssp0, @wssp1,
@wssp2, @wssp3, @EidBase OUTPUT SELECT @wssp4 = @EidBase, @wssp5 = @abort END IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAddNewNodeByUrl '6323DF8A-5C57-4D3E-A477-09AA8B66100A','7AE114DF-9D52-4B08-AFFA-8C544CBC27B6',1,2072,-1,0,N'sites/impact/default.aspx',N'PersonSøk',N'PersonSøk',NULL,0,0,0,NULL,@EidBase,@EidHome
OUTPUT SELECT @wssp6 = @abort END IF @abort = 0 BEGIN EXEC proc_NavStructLogChangesAndUpdateSiteChangedTime @wssp7, @wssp8, NULL END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0 BEGIN EXEC proc_UpdateDiskUsed
'6323DF8A-5C57-4D3E-A477-09AA8B66100A' END ' CommandType: Text CommandTimeout: 0 Parameter: '@wssp0' Type: UniqueIdentifier Size: 0 Direction: Input Value: '6323df8a-5c57-4d3e-a477-09aa8b66100a' Parameter: '@wssp1'
Type: UniqueIdentifier Size: 0 Direction: Input Value: '7ae114df-9d52-4b08-affa-8c544cbc27b6' Parameter: '@wssp2' Type: Int Size: 0 Direction: Input Value: '1' Parameter: '@wssp3' Type: Int Size: 0 Direction: Input Value: '2072'
Parameter: '@wssp4' Type: Int Size: 0 Direction: Output Value: '2072' Parameter: '@wssp5' Type: Int Size: 0 Direction: Output Value: '0' Parameter: '@wssp6' Type: Int Size: 0 Direction: Output Value: '10006'
Parameter: '@wssp7' Type: UniqueIdentifier Size: 0 Direction: Input Value: '6323df8a-5c57-4d3e-a477-09aa8b66100a' Parameter: '@wssp8' Type: UniqueIdentifier Size: 0 Direction: Input Value: '7ae114df-9d52-4b08-affa-8c544cbc27b6'
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database aek90
High SecurityOnOperationCheck = True
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database d0d6
High System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK'. The duplicate key value is (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6,
1000). The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj,
Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior
runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock) at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean
retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) ClientConnectionId:2bb4004c-aa75-470e-b11e-dbf1c476aaed
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database ad194
High ExecuteQuery failed with original error 0x80131904
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Database 8z23
Unexpected Unexpected query execution failure in navigation query, HResult -2146232060. Query text (if available): "BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase
= 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAllocateEidBlockWebId @wssp0, @wssp1, @wssp2, @wssp3, @EidBase OUTPUT SELECT @wssp4 = @EidBase, @wssp5 = @abort END IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAddNewNodeByUrl '6323DF8A-5C57-4D3E-A477-09AA8B66100A','7AE114DF-9D52-4B08-AFFA-8C544CBC27B6',1,2072,-1,0,N'sites/impact/default.aspx',N'PersonSøk',N'PersonSøk',NULL,0,0,0,NULL,@EidBase,@EidHome
OUTPUT SELECT @wssp6 = @abort END IF @abort = 0 BEGIN EXEC proc_NavStructLogChangesAndUpdateSiteChangedTime @wssp7, @wssp8, NULL END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0 BEGIN EXEC proc_UpdateDiskUsed
'6323DF8A-5C57-4D3E-A477-09AA8B66100A' END "
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
General 8kh7
High <nativehr>0x8107140d</nativehr><nativestack></nativestack>An unexpected error occurred while manipulating the navigational structure of this Web.
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
General aix9j
High SPRequest.AddNavigationNode: UserPrincipalName=i:0).w|s-1-5-21-2030300366-1823906440-2562684930-2106, AppPrincipalName= ,bstrUrl=http://im-sp1/sites/impact ,bstrName=PersonSøk ,bstrNameResource=<null> ,bstrNodeUrl=/sites/impact/default.aspx
,lType=0 ,lParentId=2072 ,lPreviousSiblingId=-1 ,bAddToQuickLaunch=False ,bAddToSearchNav=False
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
General ai1wu
Medium System.Runtime.InteropServices.COMException: <nativehr>0x8107140d</nativehr><nativestack></nativestack>An unexpected error occurred while manipulating the navigational structure of this
Web., StackTrace: at Microsoft.SharePoint.Navigation.SPNavigationNode.AddInternal(Int32 iPreviousNodeId, Int32 iParentId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav) at Microsoft.SharePoint.Navigation.SPNavigationNodeCollection.AddInternal(SPNavigationNode
node, Int32 iPreviousNodeId) at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.<ConfigureQuickLaunchBar>b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
secureCode) at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.ConfigureQuickLaunchBar() at ImpactSharePoint.Features.Pages.PagesEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)
at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean
fForce) at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly) at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtWeb(Boolean
fActivate, Boolean fEnsure, Guid featid, SPFeatureDefinition featdef, String urlScope, String sProperties, Boolean fForce) at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtScope(Boolean fActivate, Guid featid, SPFeatureDefinition
featdef, String urlScope, Boolean fForce) at Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature.UpdateDataObject() at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord()
at System.Management.Automation.CommandProcessorBase.DoExecute() at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate) at System.Management.Automation.PipelineOps.InvokePipeline(Object
input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext) at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame
frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1
clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.CommandProcessorBase.DoComplete() at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate) at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc() at System.Management.Automation.Runspaces.PipelineThread.WorkerProc() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
0x11F4 SharePoint Foundation
Feature Infrastructure 88jm
High Feature receiver assembly 'ImpactSharePoint, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3f4d824fecc0071e', class 'ImpactSharePoint.Features.Pages.PagesEventReceiver', method 'FeatureActivated' for feature
'd8aabd95-076a-4650-a8a6-0aa5bd8ac8d1' threw an exception: Microsoft.SharePoint.SPException: An unexpected error occurred while manipulating the navigational structure of this Web. ---> System.Runtime.InteropServices.COMException: <nativehr>0x8107140d</nativehr><nativestack></nativestack>An
unexpected error occurred while manipulating the navigational structure of this Web. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddNavigationNode(String bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32
lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified) at Microsoft.SharePoint.Library.SPRequest.AddNavigationNode(String bstrUrl, String bstrName, String bstrNameResource,
String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified) --- End of inner exception stack trace --- at Microsoft.SharePoint.SPGlobal.HandleComException(COMException
comEx) at Microsoft.SharePoint.Library.SPRequest.AddNavigationNode(String bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav,
String& pbstrDateModified) at Microsoft.SharePoint.Navigation.SPNavigationNode.AddInternal(Int32 iPreviousNodeId, Int32 iParentId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav) at Microsoft.SharePoint.Navigation.SPNavigationNodeCollection.AddInternal(SPNavigationNode
node, Int32 iPreviousNodeId) at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.<ConfigureQuickLaunchBar>b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
secureCode) at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.ConfigureQuickLaunchBar() at ImpactSharePoint.Features.Pages.PagesEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)
at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)
5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
The code:
using System.Diagnostics;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;
namespace ImpactSharePoint.ConfigureSharePointInstance
public class NavigationConfig
public void ConfigureQuickLaunchBar(SPWeb web)
SPSecurity.RunWithElevatedPrivileges(delegate
//Delete All Links
web.AllowUnsafeUpdates = true;
for (int i = web.Navigation.QuickLaunch.Count - 1; i > -1; i--)
web.Navigation.QuickLaunch[i].Delete(); // -> Deleting all the links in quick launch
web.QuickLaunchEnabled = true;
EventLog.WriteEntry("Sharepointfeature","Starter");
//Adding Links
SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
var sokNode = new SPNavigationNode("Søk", null, false);
nodes.AddAsFirst(sokNode);
sokNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til søk");
// Personsøk
var personSokNode = new SPNavigationNode("Deltakere", "/sites/impact/default.aspx", false); //TODO: fix hardkoding
sokNode.Children.AddAsFirst(personSokNode);
personSokNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node personsøk");
// Udb-søk
var udbSokNode = new SPNavigationNode("UDB-Søk", "/sites/impact/udbsok.aspx", false); //TODO: fix hardkoding
sokNode.Children.AddAsLast(udbSokNode);
udbSokNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node udbsøk");
// Kommuner
var kommuneNode = new SPNavigationNode("Kommuner", "/sites/impact/kommunesearch.aspx", false); //TODO: fix hardkoding
sokNode.Children.AddAsFirst(kommuneNode);
kommuneNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node kommunesøk");
// Organisasjoner
var virksomhetNode = new SPNavigationNode("Organisasjoner", "/sites/impact/virksomhetsearch.aspx", false); //TODO: fix hardkoding
sokNode.Children.AddAsFirst(virksomhetNode);
virksomhetNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node kommunesøk");
// NIR
var nirNode = new SPNavigationNode("Nir", null, false); //TODO: fix hardkoding
nodes.AddAsLast(nirNode);
nirNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node Nir");
// Tilskudd
var tilskuddNode = new SPNavigationNode("Tilskudd", "/sites/impact/", false);
nodes.AddAsLast(tilskuddNode);
tilskuddNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node Tilskudd");
// Kjøringsoversikt
var showkjoringerNode = new SPNavigationNode("Kjøringsoversikt", "/sites/dev/kjoringoversikt.aspx", false); //TODO: fix hardkoding
tilskuddNode.Children.AddAsFirst(showkjoringerNode);
showkjoringerNode.Update();
EventLog.WriteEntry("Sharepointfeature", "Lagt til node showkjoringerNode");
web.Update();
EventLog.WriteEntry("Sharepointfeature", "Etter update");
//Setting homepage
SPFolder folder = web.RootFolder;
folder.WelcomePage = "default.aspx";
folder.Update();
EventLog.WriteEntry("Sharepointfeature", "Etter homepage");
web.AllowUnsafeUpdates = false;i think you need to debug your code, lookalike the values you trying insert already exist in the database.
these two IDs (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6).
i would try to run the select command against the content db.
SELECT TOP * FROM [DB Name].[dbo].[NavNodes] where id = '6323df8a-5c57-4d3e-a477-09aa8b66100a'
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog -
Exposing Methods of Value Object
I have the need for a value (transfer) object that contains only getters and setters, as well as a full "business object" that has the same getters and setters as well as business logic (like insert()).
I hate the idea of maintaining two separate objects, and making sure that when I add a new attribute to the BO I remember to add it to the VO.
I would love to have the BO hold a private instance of the VO inside it, and automatically "expose" all the VO's methods to the outside world as if they were its own. I could do this with inheritence, but then I have the problem of creating a VO from a BO (lots of error-prone repetitive code).
Any ideas on how I could expose these methods, together with the BO's logic?
Thanks, GaryIf I've understood your question, you may use a Proxy
object to achieve the desired behaviour.
What you'll need to do is create a "super" interface
that contains the methods from your business object
and value object. You will then create a Proxy that
implements the "super" interface. When you invoke a
method on the proxy, the invocation handler will try
to first invoke the method on the business object. If
the business object does not implement the requested
method (i.e. one of the value methods), the handler
tries to invoke the method on the value object member
of the business object.
The only maintainence overhead implied by this
solution is that methods must be added to the "super"
interface to correspond to each method added to the
business or value objects.
Have a look at this example to see what I mean
public class Test {
public static void main(String[] args) {
try {
ProxyHandler d = new ProxyHandler(new
Handler(new BusinessObject());
Object o =
Object o =
Proxy.newProxyInstance(Thread.currentThread().getConte
tClassLoader(),
new Class[]
new Class[] {BusinessValueInterface.class},
class}, d);
BusinessValueInterface bvi =
rface bvi = (BusinessValueInterface)o;
bvi.businessMethod();
System.out.println(bvi.getVal());
catch (Exception ex) {
ex.printStackTrace();
static class ProxyHandler implements
nts InvocationHandler {
BusinessObject b;
public ProxyHandler(BusinessObject bo) {
b = bo;
public Object invoke(Object proxy, Method m,
thod m, Object[] params)
throws Throwable
Class[] paramClasses = null;
if (params != null) {
paramClasses = new
amClasses = new Class[params.length];
for (int x = 0; x < params.length;
params.length; x++)
paramClasses[x] =
paramClasses[x] = params[x].getClass();
Method m1 = null;
try {
m1 =
m1 = b.getClass().getMethod(m.getName(),
getName(), paramClasses);
catch (Exception ex) {
if (m1 != null) {
return m1.invoke(b, params);
else {
Method m2 =
Method m2 =
2 = b.val.getClass().getMethod(m.getName(),
paramClasses);
if (m2 != null) {
return m2.invoke(b.val, params);
else {
return null;
interface BusinessValueInterface {
public String getVal();
public void businessMethod();
static class BusinessObject {
ValueObject val = new ValueObject();
public void businessMethod() {
System.out.println("businessMethod
inessMethod invoked");
static class ValueObject {
public String getVal() {
return "value";
Good luck,
MikeI would definetly like to know more about what performance characteristics is needed in the system before recommending a dynamic proxy. Value objects accessors and mutators tend to be the most called methods in a system, and there is a fairly large overhead for dynamic proxies (about 5*(normal method call) on a windows 2000 box running IBM jre 1.3.1). Dynamix proxies are great and I use them for a lot of things, but NOT for value object setter and getters...
I�d recommend either wrapping the VO in the BO and exposing it as:
MyBO myBo = getBO();
myBo.getValue().setName( ... ); or make the BO stateless and pass the value in the method calls:
myBO.performSomeNiceBusinessLogic( valueObject, someOtherArgument );The latter is probably the way I would go for most cases, but the former has its advantages to.
Br - johan -
I have an index constraint "IX_Tag_Processed" on the field "Tag_Name" for the table "Tag_Processed". I keep getting this constraint error:
Msg 2601, Level 14, State 1, Line 15
Cannot insert duplicate key row in object 'etag.Tag_Processed' with unique index 'IX_Tag_Processed'. The duplicate key value is (AZPS_TEMUWS0110BL4_CISO).
The statement has been terminated.
For this INSERT: I have tried using tagstg.Tag_Name NOT IN with same result:
INSERT into [Forecast_Data_Repository].[etag].[Tag_Processed] (Tag_Name, Tag_Type,Start_Datetime, End_Datetime, Source_SC, Sink_SC, Source_CA, Sink_CA, Source, Sink, Load_dt, Energy_product_code_id)
SELECT DISTINCT (Tag_Name), Tag_Type,Start_Datetime, End_Datetime, Source_SC, Sink_SC, Source_CA, Sink_CA, Source, Sink, GETUTCDATE(), [Forecast_Data_Repository].rscalc.GetStubbedEngProductCodeFromStaging(tagstg.Tag_Name)
FROM [Forecast_Data_Repository].[etag].[Tag_Stg] tagstg
WHERE tagstg.Id BETWEEN @minTId AND @maxTId --AND
--tagstg.Tag_Name NOT IN (
-- SELECT DISTINCT tproc.Tag_Name from [Forecast_Data_Repository].[etag].[Tag_Processed] tproc
thank you in advance,
Greg HansonI have even tried a merge with the same constraint error,
DECLARE @minTId bigint, @minTRId bigint, @minEId bigint
DECLARE @maxTId bigint, @maxTRId bigint, @maxEId bigint
DECLARE @errorCode int
DECLARE @ReturnCodeTypeIdName nvarchar(50)
SELECT @minTRId = Min(Id) FROM [etag].[Transmission_Stg]
SELECT @maxTRId = Max(Id) FROM [etag].[Transmission_Stg]
SELECT @minTId = Min(Id) FROM [etag].[Tag_Stg]
SELECT @maxTId = Max(Id) FROM [etag].[Tag_Stg]
DECLARE @MergeOutputTag TABLE
ActionType NVARCHAR(10),
InsertTagName NVARCHAR(50)
--UpdateTagName NVARCHAR(50)
--DeleteTagName NVARCHAR(50)
DECLARE @MergeOutputEnergy TABLE
ActionType NVARCHAR(10),
InsertTagId BIGINT
--UpdateTagName NVARCHAR(50)
--DeleteTagName NVARCHAR(50)
DECLARE @MergeOutputTransmission TABLE
ActionType NVARCHAR(10),
InsertTagId BIGINT
--UpdateTagName NVARCHAR(50)
--DeleteTagName NVARCHAR(50)
MERGE [Forecast_Data_Repository].[etag].[Tag_Processed] tagProc
USING [Forecast_Data_Repository].[etag].[Tag_Stg] tagStg
ON
tagProc.Tag_Name = tagStg.Tag_Name AND
tagProc.Tag_Type = tagStg.Tag_Type AND
tagProc.Start_Datetime = tagStg.Start_Datetime AND
tagProc.End_Datetime = tagStg.End_Datetime AND
tagProc.Source_SC = tagStg.Source_SC AND
tagProc.Source_CA = tagStg.Source_CA AND
tagProc.Sink_CA = tagStg.Sink_CA AND
tagProc.Source = tagStg.Source AND
tagProc.Sink = tagStg.Sink
WHEN MATCHED THEN
UPDATE
SET Tag_Name = tagStg.Tag_Name,
Tag_Type = tagStg.Tag_Type,
Start_DateTime = tagStg.Start_Datetime,
End_Datetime = tagStg.End_Datetime,
Source_SC = tagStg.Source_SC,
Sink_SC = tagStg.Sink_SC,
Source_CA = tagStg.Source_CA,
Sink_CA = tagStg.Sink_CA,
Source = tagStg.Source,
Sink = tagStg.Sink,
Load_dt = GETUTCDATE()
WHEN NOT MATCHED BY TARGET THEN
INSERT (Tag_Name, Tag_Type, Start_Datetime, End_Datetime, Source_SC, Sink_SC, Source_CA, Sink_CA, Source, Sink, Load_dt)
VALUES (tagStg.Tag_Name, tagStg.Tag_Type, tagStg.Start_Datetime, tagStg.End_Datetime, tagStg.Source_SC, tagStg.Sink_SC, tagStg.Source_CA, tagStg.Sink_CA, tagStg.Source, tagStg.Sink, GETUTCDATE())
OUTPUT
$action,
INSERTED.Tag_Name
--UPDATED.Tag_Name
INTO @MergeOutputTag;
SELECT * FROM @MergeOutputTag;
Greg Hanson -
PS_ECQUEUEINST = Cannot insert duplicate key row in object
Running ECIN0001, and getting error
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert duplicate key row in object 'PS_ECQUEUEINST' with unique index 'PS_ECQUEUEINST'
Table values look like as under
ECTRANSID ECTRANSINOUTSW ECQUEUEINSTANCE
ASN_IN I 13
BANKNA I 1891
BSP I 120
EEBANKNA I 11765
HRBUS I -1
HREMP I -1
HREMP I 1
INVOICE O 100
PO ACK I 1
RFQ I 4
VOUCHER-IN I 18083Please, it is always a good idea to provide application, module, Peopletools, database and OS versions you are working on.
Nicolas. -
Hi All
I am getting the below error when modifying the navigation in one of the SharePoint 2010 site.
Error
An unexpected error occured while manipulating the navigational structure of this Web.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: b9cb4f2e-cd06-4d77-b999-272a881a2905
The SP log:
System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_AltPK'. The duplicate key value is (536677da-c0aa-41c8-991a-9ccf01d84b29, 4d9a2738-5c1d-4ad0-fcaf-9179e4230fg0, 1025,
13). The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Dat... b9cb4f2e-cd06-4d77-b999-272a881a2905
...a.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean
returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior) at Microsoft.SharePoint.Utilities.SqlSe... b9cb4f2e-cd06-4d77-b999-272a881a2905
Can someone help me.
MercuryManWhat build of SharePoint are you running. The error is similar to:
http://blogs.msdn.com/b/joerg_sinemus/archive/2013/02/12/february-2013-sharepoint-2010-hotfix.aspx
Trevor Seward, MCC
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Passing "Value Objects" from one JSP to next (2)
Someone posted a response from BEA which has since disappeared, it was no different
from what I was doing and it I still can't get it to store the information in
the Value Object.
I get values (true/false) from a Radio button on a FORM in a JSP, press a "Next
Step" Button.
I have a "Value Object" in JSP_1, which I use the setters to store various information
obtained from the <FORM>. I then "jsp:forward" to JSP_2, set different information
and then I "jsp:forward" to JSP_3 & so on. At the end of the JSP chain only the
last setter is has the value "true", all the other values are false, despite all
being "set" to "true".
The "Value Object" is not storing the information set in previous JSPs. When I
initially create the "value object" I use;
<jsp:useBean id="myVO" class="uk.co.notify.valueobjects.MyVO" scope="request"
/>
<jsp:setProperty name="myVO" property="*"/>
In JSP_2 JSP999 I don't use <jsp:setProperty> I let the setter in the VO do
it.
I am using WebLogic 6.1 sp2 under Windows 2K Pro.
Any pointers. Thanks.
[att1.html]
Ok. here's the difference.
Hitting submit is altogether a different "new" http request. It will send a
new request from your browser to the server. Whereas, the jsp:forward is
within the server itself.
So the VO object whose scope is set to "request" will not retain its values
between 2 http request.
For such kind of parameter passing, you could very well store the info. in
user's session object.
I hope this helps.
Best Regards,
Narayan Anand
Developer Relations Engineer
BEA Systems, Inc.
"Roger Lee" <[email protected]> wrote in message
news:[email protected]...
>
> If I put the jsp:forward statement in all my JSPs before I test for my
request;
>
> <%
> if ( request.getParameter("SubmitStep2") != null ) {
> String sParameter2 = request.getParameter("SubmitStep2");
> if (sParameter2.equals("Next Step")) {
> // CODE ETC
> }
> }
>
> The jsp will chain right to the last JSP and all the values set in my
ValueObject
> will remain set.
>
> Why does hitting a submitt button;
>
> <input type="submit" name="SubmitStep2" value="Next Step">
>
> cause the VO to lose previous stored values.
>
> Any information would be appreciated.
>
> Roger Lee
>
>
> "Roger Lee" <[email protected]> wrote:
> >
> >Narayan,
> >
> >I got your example working fine.
> >
> >I added a few more debug statements and it appears that as I enter JSP
> >2 the value
> >"set" in JSP 1 is stored okay (boolean true).
> >
> >However after the "submit" of the button in JSP which forwards us to
> >JSP 3 is
> >pressed all the values are reset to their default value (false).
> >
> >
> >"Narayan Anand" <[email protected]> wrote:
> >>Hi Roger,
> >>
> >>I will look into your code.
> >>In the meantime, pls try my test case in your system and see if you
> >can
> >>run
> >>that without any problem.
> >>
> >>Best Regards,
> >>Narayan Anand
> >>Developer Relations Engineer
> >>BEA Systems, Inc.
> >>
> >>"Roger Lee" <[email protected]> wrote in message
> >>news:[email protected]...
> >>>
> >>> Narayan,
> >>>
> >>> Thanks for your reply. My code seems to be the same as yours! I still
> >>can't get
> >>> the JSPs to "set" the VO and pass it down the chain of JSPs. When
> >I
> >>get
> >>the last
> >>> JSP the first three have the boolean value set to false, whilst the
> >>last
> >>one is
> >>> set to the value chosen (true).
> >>>
> >>> I have attached the JSPs and VO in the attached ZIP file. It must
> >be
> >>something
> >>> obvious, which I can't see!
> >>>
> >>> Regards,
> >>>
> >>> Roger Lee
> >>>
> >>>
> >>> "Narayan Anand" <[email protected]> wrote:
> >>> >
> >>> >
> >>> >
> >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0
> >>> >
> >>> >Hi Roger,
> >>> >
> >>> >I can still view my previous reply to your post.
> >>>
>
>>>http://216.148.48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3Dweblogic.dev
=
> >>> >eloper.interest.jsp&item=3D10138&utag=3D
> >>> >
> >>> >Just now I tested this again.
> >>> >WLS6.1SP2 on Win2k.
> >>> >
> >>> >JSP1 - sets one value using setProperty tag.
> >>> >JSP2 - sets second property using the VO's setter.
> >>> >JSP3 - retrieve and prints the values using the VO's getters and
> >also
> >>> >=
> >>> >using the getProperty tag.
> >>> >
> >>> >attached are all the jsp's and value object.
> >>> >Please test it in your environment. It should work.
> >>> >Then compare it with your code to see the difference.
> >>> >
> >>> >I hope this will help to resolve the issue.
> >>> >
> >>> >Regards,
> >>> >Narayan Anand
> >>> >Developer Relations Engineer
> >>> >BEA WebLogic Support
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > "Roger Lee" <[email protected]> wrote in message =
> >>> >news:[email protected]...
> >>> >
> >>> > Someone posted a response from BEA which has since disappeared,
> >>it
> >>> >was =
> >>> >no different
> >>> > from what I was doing and it I still can't get it to store the
> >=
> >>> >information in
> >>> > the Value Object.
> >>> >
> >>> > I get values (true/false) from a Radio button on a FORM in a JSP,
> >>=
> >>> >press a "Next
> >>> > Step" Button.
> >>> >
> >>> > I have a "Value Object" in JSP_1, which I use the setters to store
> >>> >=
> >>> >various information
> >>> > obtained from the <FORM>. I then "jsp:forward" to JSP_2, set
different
> >>> >=
> >>> >information
> >>> > and then I "jsp:forward" to JSP_3 & so on. At the end of the JSP
> >>chain
> >>> >=
> >>> >only the
> >>> > last setter is has the value "true", all the other values are
false,
> >>> >=
> >>> >despite all
> >>> > being "set" to "true".
> >>> >
> >>> > The "Value Object" is not storing the information set in previous
> >>=
> >>> >JSPs. When I
> >>> > initially create the "value object" I use;=20
> >>> >
> >>> > <jsp:useBean id=3D"myVO" class=3D"uk.co.notify.valueobjects.MyVO"
> >>=
> >>> >scope=3D"request"
> >>> > />=20
> >>> > <jsp:setProperty name=3D"myVO" property=3D"*"/>=20
> >>> >
> >>> > In JSP_2 JSP999 I don't use <jsp:setProperty> I let the setter
> >>in
> >>> >=
> >>> >the VO do
> >>> > it.
> >>> >
> >>> > I am using WebLogic 6.1 sp2 under Windows 2K Pro.=20
> >>> >
> >>> > Any pointers. Thanks.=20
> >>> >
> >>> >
> >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0
> >>> >
> >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> >>> ><HTML><HEAD>
> >>> ><META http-equiv=3DContent-Type content=3D"text/html; =
> >>> >charset=3Diso-8859-1">
> >>> ><META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
> >>> ><STYLE></STYLE>
> >>> ></HEAD>
> >>> ><BODY bgColor=3D#ffffff>
> >>> ><DIV><FONT face=3DArial size=3D2>Hi Roger,</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>I can still view my previous reply
> >>to
> >>> >=
> >>> >your=20
> >>> >post.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2><A=20
> >>>
>href=3D"http://216.148.48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3D=
> >>> >weblogic.developer.interest.jsp&item=3D10138&utag">http://216.148=
> >>>
>..48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3Dweblogic.developer.int=
> >>> >erest.jsp&item=3D10138&utag</A>=3D</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>Just now I tested this =
> >>> >again.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>WLS6.1SP2 on Win2k.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>JSP1 - sets one value using
setProperty
> >>> >=
> >>> >
> >>> >tag.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>JSP2 - sets second property using
> >>the
> >>> >=
> >>> >VO's=20
> >>> >setter.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>JSP3 - retrieve and prints the
values
> >>> >=
> >>> >using the=20
> >>> >VO's getters and also using the getProperty tag.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>attached are all the jsp's and
value=20
> >>> >object.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>Please test it in your environment.
> >>> >It =
> >>> >should=20
> >>> >work.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>Then compare it with your code to
> >>see
> >>> >=
> >>> >the=20
> >>> >difference.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>I hope this will help to resolve
> >>the=20
> >>> >issue.</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2>Regards,<BR>Narayan
Anand<BR>Developer
> >>> >=
> >>> >Relations=20
> >>> >Engineer<BR>BEA WebLogic Support</FONT></DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> >>> ><BLOCKQUOTE=20
> >>> >style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
> >>=
> >>> >BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
> >>> > <DIV>"Roger Lee" <<A=20
> >>> > href=3D"mailto:[email protected]">[email protected]</A>> wrote
> >in
> >>> >=
> >>> >message <A=20
> >>> > =
> >>>
>
>>>href=3D"news:[email protected]">news:[email protected]
=
> >>> >a.com</A>...</DIV><BR>Someone=20
> >>> > posted a response from BEA which has since disappeared, it was
> >no=20
> >>> > different<BR>from what I was doing and it I still can't get it
> >to
> >>=
> >>> >store the=20
> >>> > information in<BR>the Value Object.<BR><BR>I get values
(true/false)
> >>> >=
> >>> >from a=20
> >>> > Radio button on a FORM in a JSP, press a "Next<BR>Step" =
> >>> >Button.<BR><BR>I have=20
> >>> > a "Value Object" in JSP_1, which I use the setters to store
various=20
> >>> > information<BR>obtained from the <FORM>. I then "jsp:forward"
> >>> >to =
> >>> >JSP_2,=20
> >>> > set different information<BR>and then I "jsp:forward" to JSP_3
> >&
> >>> >=
> >>> >so on. At=20
> >>> > the end of the JSP chain only the<BR>last setter is has the value
> >>=
> >>> >"true", all=20
> >>> > the other values are false, despite all<BR>being "set" to =
> >>> >"true".<BR><BR>The=20
> >>> > "Value Object" is not storing the information set in previous JSPs.
> >>> >=
> >>> >When=20
> >>> > I<BR>initially create the "value object" I use; =
> >>> ><BR><BR><jsp:useBean=20
> >>> > id=3D"myVO" class=3D"uk.co.notify.valueobjects.MyVO" =
> >>> >scope=3D"request"<BR>/>=20
> >>> > <BR><jsp:setProperty name=3D"myVO" property=3D"*"/> <BR><BR>In
> >>> >=
> >>> >JSP_2=20
> >>> > JSP999 I don't use <jsp:setProperty> I let the setter in the
> >>> >=
> >>> >VO=20
> >>> > do<BR>it.<BR><BR>I am using WebLogic 6.1 sp2 under Windows 2K Pro.
> >>> >=
> >>> ><BR><BR>Any=20
> >>> > pointers. Thanks. <BR></BLOCKQUOTE></BODY></HTML>
> >>> >
> >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0--
> >>> >
> >>> >
> >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> >>> ><HTML>
> >>> ><HEAD>
> >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
> >>> ><LINK REL=STYLESHEET
> >>> > HREF="My-Style-Sheet.css"
> >>> > TYPE="text/css">
> >>> ></HEAD>
> >>> >
> >>> ><BODY>
> >>> >
> >>> ><CENTER>
> >>> ><TABLE BORDER=5>
> >>> > <TR><TH CLASS="TITLE">
> >>> > Reusing JavaBeans in JSP</TABLE>
> >>> ></CENTER>
> >>> ><P>
> >>> >
> >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
> >>> ><jsp:setProperty name="test"
> >>> > property="message"
> >>> > value="Hello forward WWW" />
> >>> >
> >>> ><jsp:forward page="/myjsp2.jsp" />
> >>> >
> >>> ></BODY>
> >>> ></HTML>
> >>> >
> >>> >
> >>> >
> >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> >>> ><HTML>
> >>> ><HEAD>
> >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
> >>> ><LINK REL=STYLESHEET
> >>> > HREF="My-Style-Sheet.css"
> >>> > TYPE="text/css">
> >>> ></HEAD>
> >>> >
> >>> ><BODY>
> >>> >
> >>> ><CENTER>
> >>> ><TABLE BORDER=5>
> >>> > <TR><TH CLASS="TITLE">
> >>> > Reusing JavaBeans in 2 JSP</TABLE>
> >>> ></CENTER>
> >>> ><P>
> >>> >
> >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
> >>> >
> >>> > <% test.setMessage1("Second message1 using setters"); %>
> >>> >
> >>> >
> >>> ><jsp:forward page="/myjsp3.jsp" />
> >>> >
> >>> >
> >>> ></BODY>
> >>> ></HTML>
> >>> >
> >>> >
> >>> >
> >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> >>> ><HTML>
> >>> ><HEAD>
> >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
> >>> ><LINK REL=STYLESHEET
> >>> > HREF="My-Style-Sheet.css"
> >>> > TYPE="text/css">
> >>> ></HEAD>
> >>> >
> >>> ><BODY>
> >>> >
> >>> ><CENTER>
> >>> ><TABLE BORDER=5>
> >>> > <TR><TH CLASS="TITLE">
> >>> > Reusing JavaBeans in 2 JSP</TABLE>
> >>> ></CENTER>
> >>> ><P>
> >>> >
> >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
> >>> >
> >>> ><%
> >>> >System.out.println("\nMessage is :"+test.getMessage());
> >>> >System.out.println("\nMessage1 is :"+test.getMessage1());
> >>> >%>
> >>> >
> >>> ><H1>Message: <I>
> >>> ><jsp:getProperty name="test" property="message" />
> >>> ></I></H1>
> >>> >
> >>> ><H1>Message1: <I>
> >>> ><jsp:getProperty name="test" property="message1" />
> >>> ></I></H1>
> >>> >
> >>> >
> >>> ></BODY>
> >>> ></HTML>
> >>> >
> >>> >
> >>> >
> >>> >package hall;
> >>> >
> >>> >public class SimpleBean {
> >>> > private String message = "No message specified";
> >>> > private String message1 = "No message1 specified";
> >>> >
> >>> > public String getMessage() {
> >>> > return(message);
> >>> > }
> >>> >
> >>> > public void setMessage(String message) {
> >>> > this.message = message;
> >>> > }
> >>> >
> >>> > public String getMessage1() {
> >>> > return(message1);
> >>> > }
> >>> >
> >>> > public void setMessage1(String message1) {
> >>> > this.message1 = message1;
> >>> > }
> >>> >}
> >>> >
> >>> >
> >>>
> >>
> >>
> >
>
-
How to get a Tree Node Value when a Tree is Expanded
My reqiurement is when i Expand a Tree i need the Expanded tree Node Value. For Example Consider Parent as a Root Node of a Tree, and Consider its two Children Child1 and Child2.
When + Parent Expanded
I will Get the Output as --Parent
- Child1
- Child2
so As when i expand the Tree i must Get the String Value Parent.duplicate
How to get a Tree Node Value when a Tree is Expanded -
Dynamically create Value Objects from XML file
Hi
I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.
-
Best Practice Question - Business Logic in Value Objects?
Just wondering what people's thoughts on best practices for setting properties of Value Objects.
For instance, I have several getter/setters in one of my Value Objects with logic in the setter that uses the value to set values of other properties.
For example, I have a Value Object that has the following properties:
category (of type Category, which is another Value Object with properties "name" and "id")
categoryId (of type int)
categoryUpdated (of type Boolean)
I have a collection of Category Objects in the Model. When I set the categoryId of this class, I set the "categoryUpdated" to true, and dispatch an CairngormEvent to that find the "category" with the specified "categoryId" and set the "category" property to this item.
So what is the best practice? To simply make the "categoryId" a public variable, and create a new Event/Command to perform all this logic? Or is it ok to do it all in the Value Object setter?
Thanks.Hi Eric,
I can't speak for best practices, but the only logic I've ever added to a VO were getters: an example was a set of getters on an airline flight VO to get overall flight departure/arrival times/cities from an array of flight segments in a property of the VO.
I feel uneasy (in the nicest possible way) about your VO for two reasons: firstly it has a strong dependency on bits of the Cairngorm framework to look up the category (and VOs normally don't need to depend on anything), and secondly the intent of Commands in Cairngorm is more to represent user gestures than to wire up VO properties (I often see people shoehorning stuff into Commands that might be better of as plain old business utility classes). I would rather see an UpdateCategoryCommand (that's what the user is trying to do?) that updates categoryId and hits a delegate to populate the category property.
That said you might have a very good reason for doing this. Could you tell us where the code is that's setting categoryId, and if anything is using categoryUpdated?
Cheers,
Robin
Maybe you are looking for
-
How can I change my iCloud username
How can I change my apple iCloud username!
-
Ten month ago, i bought my first pavillon. What's error !!!! Few week later, it begun to play a terrible noise. The diagnostic was easy : graphic card cooler. I photo to hp support team, who try to flash the bios before listenning my probleme. After
-
My iPad screen became green & noisy occasionally
I brought my iPad 64GB form US apple store last month during my business trip. After 5-6 weeks usage, my screen became green & noisy occasionally. Now i am back to Taiwan Taipei, and can't find local service here. http://www.flickr.com/photos/pipiche
-
Please provide answers(relevant) to my querries
Hi, I am new to ale and idocs I want to know about the various idoc statuses like 64.51,68,53 Moreover i want to know about mssage claases segments. specifically message type clifmas secondly i d want to know about tcode sm37,bd87,sm59 in detail.
-
HttpURLConnection returns overlaping responses for concurrent requests
Hi, we are facing an issue in making HttpURLConnection requests. Our servlet has to make HttpURLConnection to another server (Both request and response body to be passed is xml, that is the contract with server which we are firing requests to). User