GetDetachedObjectId -vs- getObjectId

I am trying to set the object ID of a detached instance. I find that there
is a difference in the return result between the following.
Assume that "obj" is a detached object.
KodoHelper.setDetachedObjectId(obj, stringValuedID );
KodoHelper.getDetachedObjectId( obj ) ......gives the set stringValuedID
JDOHelper.getObjectId( obj ) .......gives original object id.
How do ObjectId and DetachedObjectId relate to one another?
I want to explicitly manage the object id. Bottom line is that I am
working with multiple PMs each with their own database. I have shadow
instance objects located in each database ( same instance, but different
object id's ). If an object under one PM changes, I would like to update
the shadow instance with the changes. I was trying to use attach/detach
methods to accomplish this.
The logic would look like the following.....
1) Fetch and detach changed object under PM1.
2) Fetch and detach shadow object under PM2.
3) Set the detached object id of the changed object to that of the shadow
object.
4) Perform an attach call using PM2 on the changed object that now has the
shadow object's id.
.....I expect the PM to think that my original detached shadow
object has simply been changed and now the PM will go through the usual
attach process and perform updates to fields that have been modified.
The problem with the above is that when attaching, the PM seems to still be
looking at the ObjectID ...not the DetachedObjectID. So, PM2 complains that
my changed object still belongs to PM1 and will not let me attach.
Thanks in advance for advice.
-Robert

Robert-
You are correct that a detached instance is not associated in any way
with any PersistenceManager.
You are also correct that the get/setDetachedObjectId methods are used
by the KodoPersistenceManager to identify the object when it is
re-attached. If the object id field is null or if it cannot construct an
ID from it, then Kodo will assume that the instance is a new instance,
and will treat it as such. It sounds like this is what is happening.
If might be easier for you to make a custom field to hold the detached
object id, using the "detached-objectid-field" metadata extension, in
which case you will be able to access that field at any time (note that
the field needs to be unmanaged).
Let us know if you still have the same problem. Any stack traces that
you see would be useful in determining the exact cause of the problem.
In article <[email protected]>, Robert Greene wrote:
To answer my own question ......kodo does not track any association with the
PM once detach is called. My problem was that I was not using the copy
created by the detach call ....but instead I was returning the actual
database object :-(
The above being said, still when I attempt to perform the logic defined
below it fails when I try to reattach. Somehow it is assigning a new OID to
the object on attachment and then it cannot find an object with this OID in
the database. I am still looking into this.
I am interested in feedback about the intended use of setDetachedObjectId.
I think that what I am trying to do should be possible, but I am making the
assumption that the attach methods implementation would get the value of the
DetachedObjectId, try and locate the original object with that
DetachedObjectId in the database ( getObjectById ) and then update the
database object's fields with the values found in the detached object.
-Robert
"Robert Greene" <[email protected]> wrote in message
news:[email protected]...
Thanks Patrick,
How does kodo track a detached object's association with a PM? I wasunder
the assumption that once detach is called, there is no longer any
association with a PM. When an object is detached, is there still some
other loose coupling with the originating PM? What would be the reasons
that the attachment processes would complain about a detached object still
being associated with another PM?
Do you see anything wrong with the logic of how I am attempting to use
attach/detach? I know that it is not the intended use, but I think that
theorectically is should work. There is really no documentation aboutthe
intended use of KodoHelper.setDetachedObjectId. Am I using it correctly
....that is .....should I expect the attachment process to use the new
ObjectId? If not, what is the intended use of the setDetachedObjectId
method?
Many thanks,
-Robert
"Patrick Linskey" <[email protected]> wrote in message
news:[email protected]...
Robert,
The detached OID and the OID itself are separately managed -- an object
has either one or the other, depending on whether or not it's detached.
So, setting the detached OID doesn't set the OID. Instead, the
attachment process does the appropriate work to get the OID into the
right state.
-Patrick
Robert Greene wrote:
I have found in the doc that getObjectId is returning and instance of
kodo.util.Id where getDetachedObjectId is returning a String
...representing
the ObjectId ....so I see the difference in the methods. I suppose
this
makes it easier for serializing the object and sending it around. SoI
guess the question is, why does setDetachedObjectId only set theStringified
value and not in addition, the actual object id that it is associatedwith?
Then the next question, how do I set that object id?
Thanks,
-Robert
"Robert Greene" <[email protected]> wrote in message
news:[email protected]...
I am trying to set the object ID of a detached instance. I find thatthere
is a difference in the return result between the following.
Assume that "obj" is a detached object.
KodoHelper.setDetachedObjectId(obj, stringValuedID );
KodoHelper.getDetachedObjectId( obj ) ......gives the set
stringValuedID
JDOHelper.getObjectId( obj ) .......gives original object id.
How do ObjectId and DetachedObjectId relate to one another?
I want to explicitly manage the object id. Bottom line is that I am
working with multiple PMs each with their own database. I have shadow
instance objects located in each database ( same instance, butdifferent
object id's ). If an object under one PM changes, I would like toupdate
the shadow instance with the changes. I was trying to use
attach/detach
methods to accomplish this.
The logic would look like the following.....
1) Fetch and detach changed object under PM1.
2) Fetch and detach shadow object under PM2.
3) Set the detached object id of the changed object to that of theshadow
object.
4) Perform an attach call using PM2 on the changed object that now hasthe
shadow object's id.
.....I expect the PM to think that my original detached shadow
object has simply been changed and now the PM will go through the
usual
attach process and perform updates to fields that have been modified.
The problem with the above is that when attaching, the PM seems tostill
be
looking at the ObjectID ...not the DetachedObjectID. So, PM2 complainsthat
my changed object still belongs to PM1 and will not let me attach.
Thanks in advance for advice.
-Robert
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • Help needed in making a Recursive loop( loops into loops)

    Hi i have a situation, i need to make loop into loop into loop....undecided loop.
    i have a object list which are parent.........eg.
    i query to get my 1st list is A, B and C....i loop it to display in table
    while looping i query A to get its child AA, AB, and AC, i loop it in table..
    while looping i query AA to get its child AAA, AAB and AAC...
    i have to check for the child till it has child level donw level...but i dont know how can i make a dynamic loop...i cant write a loop it for 15 to 20 .
    Is there any way to make a recursive loop so tht it checks for child into child.
    thanks

    my code is such......
    Corres[] objCorresBean = correspondence.getCorrespondence(objectId);
    for (int i = 0; i < objCorresBean.length; i++) {
    CorrespondenceBean corresBean = objCorresBean;
    String parent_object_id = corresBean.getObjectId();
    childCorresBean = correspondence.getChildCorrespondence
    (parent_object_id);
    for (int j = 0; j < childCorresBean.length; j++) {
    CorrespondenceBean childBean = childCorresBean[j];
    String child_object_id = childBean.getChildObjectId();
    may be child_object_id have some childrens.......i want to make it recursive

  • Retrieving the Full Path of the Document / Folder in Search results

    Hello,
    We have a custom portlet to perform search in knowledge directory. We are able to retrieve the results from knowledge directory and would like to know on one enhancement feature.
    Would like to know if it is possible to retrieve the directory structure / path of the document / folder. Something like "\Knowledge Directory\Customer Service\...." I have seen this path come up in search results when using Portal Admin. Not sure if it is available when using the idk.dll
    Below is a sample code in C#. Would you know if there is a way I can retrieve the directory strcuture. If so, what method would give me that value? I tried GetURL, but that gives me the URL of the document http://portal/.....as compared to the path.
    ===== 
    using Plumtree.Remote.Portlet; 
    using Plumtree.Remote.PRC; 
    using Plumtree.Remote.PRC.Search;
    //Establishing Session with Portal
    IRemoteSession session = RemoteSessionFactory.GetExplicitLoginContext(new Uri(portletPortalAPIPref), username, password);
    ISearchFactory searchFactory = session.GetSearchFactory();
    searchRequest = searchFactory.CreatePortalSearchRequest();
    searchRequest.SetQuery(txtSearchText.Text);
                //Setting up the Search Parameters – Objects to Search, Order By, Number of Results
      ObjectClass[] objectTypes = { ObjectClass.Document, ObjectClass.DocumentFolder };
      searchRequest.SetObjectTypesToSearch(objectTypes);
       searchRequest.SetResultsOrderBy(PlumtreeField.NAME);
       searchRequest.SetOrderAscending(true);
      searchRequest.SetResultsCount(0, RecordCount);
    //Executing the Search
    searchResponse = searchRequest.Execute();
    resultSet = searchResponse.GetResultSet();
      //iterate through the results
    IEnumerator resultsfolder = resultSet.GetResults();
    while (resultsfolder.MoveNext())
                        IPortalSearchResult result = (IPortalSearchResult)resultsfolder.Current;
    Convert.ToString(result.GetRank() + 1);
    result.GetIconURL().ToString();
    result.GetURL().ToString();
    result.GetName().ToString();
    result.GetExcerpt().ToString();
    result.GetLastModified().ToString();
    result.GetClassID().ToString();
    result.GetObjectID().ToString();

    Have you tried getting the extended data and the Parent Folder ID. (Plumtree.Remote.PRC.IExtendedData)
    Using an additional object search to get the Path for the Parent Folder ID.
    Here is a snippet that may help
    Plumtree.Remote.PRC.IObjectManager objectManager = session.GetObjectManager(Plumtree.Remote.PRC.ObjectClass.<your class to return>);
    Plumtree.Remote.PRC.IObjectQueryRow qResults = objectManager.QuerySingleObject(<id of object to return>);
    if (qResults != null)
        Plumtree.Remote.PRC.IExtendedData ied = qResults.GetExtendedData();
        if (ied != null)
           sResult =  ied.GetStringValue(<property you want to return>);

  • Problem with castor xml mapping

    Hi,
    we have following problem with castor xml mapping.
    How to use references in the collections(Hashmap or vector)?
    WE have a method called getAttribute map which will return a hashmap consist different type of objects. We want to keep only the
    references of objects if that object occurs more than once,instead of keeping the whole object
    Following is the the xml mapping file.
    <mapping>
    <class name="com.opvista.ndtool.core.mos.ManagedObject" identity="Id" auto-complete="false" verify-constructable="false">
    <map-to xml="ManagedObject"/>
    <field name="Id" get-method="getId" set-method="setId" type="string">
    <bind-xml name="Id" node="attribute"/>
    </field>
    <field name="AttributeMap" type="org.exolab.castor.mapping.MapItem" collection="map" get-method="getAttributeMap">
    <bind-xml name="AttributeMap" node="element">
         <class name="org.exolab.castor.mapping.MapItem">
    <field name="key" type="java.lang.Object">
         <bind-xml name="key" node="attribute"/>
    </field>
    <field name="value" type="java.lang.Object">
         <bind-xml name="value" node="element" reference="true"/>
         </field>
    </class>
         </bind-xml>
    </field>
    </class>
    </mapping>
    we are using reference=true for the values. But it will throw below exception.
    Unable to resolve ID for instance of class 'java.lang.String' due to the following error: Unable to resolve ClassDescriptor.
         at org.exolab.castor.xml.Marshaller.getObjectID(Marshaller.java:1988)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1628)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1831)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1814)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1825)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:821)
    Please help us to overcome from this problem?
    Thanks,
    Dileep

    for your ref here is what i think the basic mapping file would look like
    <class name="Person">
    <map-to xml="person"/>
    <field name="name" type="string">
    <bind-xml name="name" node="attribute" />
    </field>
    <field name="age" type="string">
    <bind-xml name="age" node="attribute" />
    </field>
    </class>
    <class name="MetaPerson">
    <map-to xml="person"/>
    <field name="dependents" type="string">
    <bind-xml name="dependents" node="attribute" />
    </field>
    <field name="presentAdd" type="string">
    <bind-xml name="present_add " node="attribute" />
    </field>
    <field name="permanentAdd" type="string">
    <bind-xml name="permanent_add " node="attribute" />
    </field>
    </class>
    however i am still not clear as to how i can use the metaperson object in the person class as well as in the mapping file.
    hope this gives a better idea abt my problem statement.
    Please help me out

  • Losing source-target mapping from a data flow diagram process

    Hi,
    When I reload a model design from an xml repository, I am losing source-target mappings from a data flow diagram process. I wonder why.
    The way it goes is:
    - I define a data flow diagram with information stores, processes, and flows.
    - Information structures are defined from the flows and the information trickles down to processes and information stores.
    - In a process, I define Source-Target Mapping by selecting a target element and then selecting the source element(s).
    - I save the whole model.
    - So far, the Source-Target Mapping keeps the association between target and source elements.
    - If I exit from Data Modeler, the next time I reload the saved model, the Source-Target Mapping target to source elements associations are lost!?
    Does anyone have the same issue or would know how to resolve it?
    Thanks,
    /Mario

    I am still having problems getting my source to target mappings to save after I apply the fix described in this thread. Any thoughts?
    From my TargetElement.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <oracle.dbtools.crest.model.design.process.TargetElement parentClass="java.lang.Object">
    <property name="objectID" dataType="java.lang.String" readOnly="true" defaultValue="" xmlName="id" xmlType="attribute" getter="getObjectID" setter="setObjectID" reffered="false"/>
    <property name="target" dataType="oracle.dbtools.crest.model.design.DesignObject" defaultValue="" xmlName="target" xmlType="element" getter="getTarget" setter="setTarget" reffered="true"/>
    <property name="description" dataType="java.lang.String" defaultValue="" xmlName="description" xmlType="element" getter="getDescription" setter="setDescription" reffered="false"/>
    <property name="name" dataType="java.lang.String" readOnly="true" defaultValue="" xmlName="name" xmlType="attribute" getter="getName" setter="setName" reffered="false"/>
    <property name="transformationType" dataType="java.lang.String" defaultValue="" xmlName="transformationType" xmlType="element" getter="getTransformationType" setter="setTransformationType" reffered="false"/>
    <collection name="sources" dataType="java.util.List" xmlName="sources" itemXmlName="sourceRef" getter="getSources" itemIsRef="true" refsXMLName="sourceRefs" addItem="addSource" getItemByID="getSourceByID" nativeList="true" orderTheList="true"/>
    <roproperty name="sources" dataType="interface java.util.List" getter="getSources"/>
    </oracle.dbtools.crest.model.design.process.TargetElement>
    Process.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <oracle.dbtools.crest.model.design.process.Process parentClass="oracle.dbtools.crest.model.design.process.Transformation">
    <property name="type" dataType="int" defaultValue="0" xmlName="type" xmlType="element" getter="getType" setter="setType" reffered="false" />
    <property name="batchMinimumTransactions" dataType="int" defaultValue="" xmlName="batchMinimumTransactions" xmlType="element" getter="getBatchMinimumTransactions" setter="setBatchMinimumTransactions" reffered="false" />
    <property name="batchTimeUnit" dataType="java.lang.String" defaultValue="" xmlName="batchTimeUnit" xmlType="element" getter="getBatchTimeUnit" setter="setBatchTimeUnit" reffered="false" />
    <property name="diagram" dataType="oracle.dbtools.crest.model.design.process.DataFlowDesign" defaultValue="" xmlName="diagram" xmlType="element" getter="getDiagram" setter="setDiagram" reffered="true" />
    <property name="footNote" dataType="java.lang.String" defaultValue="" xmlName="footNote" xmlType="element" getter="getFootNote" setter="setFootNote" reffered="false" />
    <property name="frequencyTimeUnit" dataType="java.lang.String" defaultValue="" xmlName="frequencyTimeUnit" xmlType="element" getter="getFrequencyTimeUnit" setter="setFrequencyTimeUnit" reffered="false" />
    <property name="frequencyTimes" dataType="int" defaultValue="" xmlName="frequencyTimes" xmlType="element" getter="getFrequencyTimes" setter="setFrequencyTimes" reffered="false" />
    <property name="interactiveLongestResponseTime" dataType="int" defaultValue="" xmlName="interactiveLongestResponseTime" xmlType="element" getter="getInteractiveLongestResponseTime" setter="setInteractiveLongestResponseTime" reffered="false" />
    <property name="interactiveResponseTimeUnit" dataType="java.lang.String" defaultValue="" xmlName="interactiveResponseTimeUnit" xmlType="element" getter="getInteractiveResponseTimeUnit" setter="setInteractiveResponseTimeUnit" reffered="false" />
    <property name="mode" dataType="java.lang.String" defaultValue="" xmlName="mode" xmlType="element" getter="getMode" setter="setMode" reffered="false" />
    <property name="paramsWrappersString" dataType="java.lang.String" defaultValue="" xmlName="paramsWrappersString" xmlType="element" getter="getParamsWrappersString" setter="setParamsWrappersString" reffered="false" />
    <property name="priority" dataType="java.lang.String" defaultValue="" xmlName="priority" xmlType="element" getter="getPriority" setter="setPriority" reffered="false" />
    <property name="transformationtask" dataType="oracle.dbtools.crest.model.design.process.TransformationTask" defaultValue="" xmlName="transformationtask" xmlType="element" getter="getTransformationTask" setter="setTransformationTask" reffered="true" />
    <property name="peakPeriodsString" dataType="java.lang.String" defaultValue="" xmlName="peakPeriodsString" xmlType="element" getter="getPeakPeriodsString" setter="setPeakPeriodsString" reffered="false" />
    <collection name="events" dataType="java.util.List" xmlName="events" itemXmlName="eventRef" getter="getEvents" itemIsRef="true" refsXMLName="eventRefs" removeItem="removeEvent" addItem="addEvent" getItemByID="getPartyByID" nativeList="true" orderTheList="true" />
    <collection name="targetMappings" dataType="java.util.List" xmlName="targetMappings" itemXmlName="targetMapping" getter="getTargetElements" createItem="createTargetElement" removeItem="removeEvent" addItem="addTargetElement" getItemByID="getPartyByID" nativeList="true" orderTheList="true" />
    <roproperty name="componentFlowsFor" dataType="interface java.util.Collection" getter="getComponentFlowsFor" />
    <roproperty name="events" dataType="interface java.util.List" getter="getEvents" />
    <roproperty name="flowEvents" dataType="interface java.util.List" getter="getFlowEvents" />
    <roproperty name="paramMapping" dataType="oracle.dbtools.crest.model.design.DesignObject" getter="getParamMapping" />
    <roproperty name="paramsWrappers" dataType="interface java.util.List" getter="getParamsWrappers" />
    <roproperty name="parentprocess" dataType="oracle.dbtools.crest.model.design.process.Process" getter="getParentProcess" />
    <roproperty name="parentprocessInDFD" dataType="oracle.dbtools.crest.model.design.process.Process" getter="getParentProcessInDFD" />
    <roproperty name="peakperiods" dataType="[Z" getter="getPeakPeriods" />
      <roproperty name="processedAttributesAndFlows" dataType="interface java.util.List" getter="getProcessedAttributesAndFlows" />
      <roproperty name="processedEntitiesAndFlows" dataType="interface java.util.List" getter="getProcessedEntitiesAndFlows" />
      </oracle.dbtools.crest.model.design.process.Process>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Condition in Parser

    Hi there:
    Please see below for a piece of my java code: I will be happy to send all.
    Question: I have an XMLParser where the details of my objects is going. I want to put a condition there (in the parser), if versionlabel is not "Approved" Do not send it!
    Let me explain, I have a virtual document i.e. many documents within this virtual document. After checking validation, all the details of every document within a virtual document are sent into the Parser. A virtual document can contain many other documents! In the parser, I want to go through each document and check, Is the versionlabel =APPROVED? For documents, that do not contain Approved version label, discard it and only send the ones with Approved versionlabel.
    Thnxs in advance
    * returns the XML for a document
    * @param session current docbase session
    * @param r_object_id object id of document
    * @param isVirtual whether the document is virtual
    * @param objectType type of object
    * @param contentType type of content
    * @param versionlabel version label to select
    * @param descend whether to descend virtual document
    * @return DOM Document
    * @throws DfException standard documentum exception
    public static Document getXMLForDoc(IDfSession session, String r_object_id, boolean isVirtual,
    String objectType, String contentType, String versionlabel, boolean descend)
    throws DfException {
    IDfSysObject sysObj
    = (IDfSysObject) session.getObject(new DfId(r_object_id));
    String exportDir = sysObj.getObjectId().getId() + "_" + System.currentTimeMillis() + File.separatorChar;
    String returnFileName = NCCIConstants.NCCI_DIR_TEMP + exportDir +sysObj.getObjectId();
    IDfFormat fileFormat = sysObj.getFormat();
    if (returnFileName.lastIndexOf('.') < returnFileName.length() - 4) {
    returnFileName += "." + fileFormat.getDOSExtension();
         logger.debug("Exporting to : " + returnFileName);
    com.documentum.operations.IDfExportOperation exportOperation = new DfExportOperation();
         boolean success = (new File(NCCIConstants.NCCI_DIR_TEMP + exportDir)).mkdirs();
         if (!success) {
              logger.debug("Creation of directory failed");
    exportOperation.setDestinationDirectory(NCCIConstants.NCCI_DIR_TEMP + exportDir);
    exportOperation.setRecordInRegistry(0);
    exportOperation.setIncludeExternalReferences(true);
         logger.debug("Exporting version : " + versionlabel);
    if (sysObj.isVirtualDocument() == true) {
    com.documentum.fc.client.IDfVirtualDocument virdoc = sysObj.asVirtualDocument(versionlabel, false);
    IDfExportNode idfexportnode = (IDfExportNode) exportOperation.add(virdoc);
         idfexportnode.setFilePath(returnFileName);
    } else {
    IDfExportNode idfexportnode = (IDfExportNode) exportOperation.add(sysObj);
         idfexportnode.setFilePath(returnFileName);
    exportOperation.enableManageApplicationSupportDocuments(false);
    String DTDLocation = NCCIConstants.NCCI_MANUAL_DTD_LOCATION;
    if (contentType != "XMLforHTML") {
    DTDLocation = StringUtils.replace("/NCCIManual.dtd", "RenderPDF/NCCIManual.dtd", DTDLocation);
    logger.debug("Setting DTD location : " + DTDLocation);
    exportOperation.setXMLSystemId(DTDLocation);
    logger.debug("Setting schema location : " + NCCIConstants.NCCI_MANUAL_SCHEMA_LOCATION);
    exportOperation.setXMLSchemaLocation(NCCIConstants.NCCI_MANUAL_SCHEMA_LOCATION);
    ((IDfExportOperationInternal) exportOperation).enableDCTMAttrsInXML(true);
    if (!exportOperation.execute()) {
    IDfList l = exportOperation.getErrors();
    String s = OperationsManager.processErrors(l);
    throw new DfException(DfException.DM_DFC_E_UNDEFINED, "XML Operation failed! " + s);
         } else {
              logger.debug("Exporting succesful to : " + returnFileName);
    //     Document doc = XMLReader.parseXmlFileWithDtd(returnFileName, false, NCCIConstants.NCCI_MANUAL_DTD_LOCATION);
    Document doc = XMLReader.parseXmlFile(returnFileName, false);
         doc.getDocumentElement().setAttribute("xmlns:atict","http://www.arbortext.com/namespace/atict");
         FileUtils.deleteDir(new File(NCCIConstants.NCCI_DIR_TEMP + exportDir ));
         return doc;
    }

    I think its better to add my entire code- should I? Okay, this is what is going on. I have a virtual document in DOCUMENTUM (Content Management). Let me take a moment and define a virtual document.
    A simple document is a document with one or more primary content files. Each primary content file associated with a document is represented by a content object in the Database.
    All the primary content files in a simple document must have the same file format. A virtual document is a document that includes one or more components structured as an ordered hierarchy. A component can be a simple document or another virtual document.
    A virtual document can have any number of components, nested to any level.
    Using virtual documents lets you combine documents with a variety of formats into one document. It also allows you to use one document in a variety of larger documents. For example, you can place a graphic in a simple document and then add that document as a component to multiple virtual documents.
    Problem:
    When this java code executes. It creates a connection and multiple of other things. What I am having problem with is when it comes to nodes in a virtual document. Since there are many node (documents) in a virtual document.. This code goes in to the virtual document and checks each node (document). In particular it checks which node (document) through its object id and check if it has a version label "Approved" and send it to the Parser. Then other classes invoke, rendering each approved node of the virtual document and send to the website.
    Now Documentum has a software bug in it. It is sending all and any version of the nodes (documents) from the virtual document into the Parser. Where as, only approved version is supposed to be published.
    The good thing is I have everything in XML Parser.
    The reason to check and delete non-approved versions in the Parser is because we want to keep Draft version of the node in the Database. Therefore, since we have everything going into the Parser, we can put a condition in there saying, check all nodes of a virtual document, if any exist with non-approved version- Delete it and send it off to be rendered.
    Thnxs

  • WCEM:clicking on custom button(Excel Downlaod) giving message "An error occurred; please try again. If the error persists, please contact technical support."

    Hi Expert,
    I need help.
    I created a custom button to download data to an excel sheet. after clicking the button I am getting message
    "An error occurred; please try again. If the error persists, please contact technical support.".
    I tried debugging WCEM, but it is not even reaching that point.
    Your help will be highly appreciated.
    here is the code.
    BitContentview.XHTML
    <wec:commandButton  id="bdtexcel" immediate="true" actionListener="#{cc.vch.DownloadBITData}" type="submit" value="#{i18n['invoices.ui.openitems.printSelected']}"/>
    UI-repository.xml
      <ViewComponent name="BITContentView"  componentHandlerClassName="com.cpr.cprwec.app.comm.module.ebpp.ui.handler.impl.BITDetailViewVCHandler"/>
    BITDetailViewVCHnadler.java
    package com.cpr.cprwec.app.comm.module.ebpp.ui.handler.impl;
    import com.cpr.cprwec.app.comm.module.ebpp.backendobject.interf.EbppBackend;
    import java.io.IOException;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.List;
    import javax.faces.context.FacesContext;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletResponse;
    import com.cpr.cprwec.app.comm.module.ebpp.modulemgmt.impl.EbppModuleAccessImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.modulemgmt.interf.EbppModuleAccess;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.DisputeDataDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.OpenItemDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.DisputeDataDTO;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.OpenItemDTO;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.BITDataDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.BITDataDTO;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.BITDetailDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.BITDetailDTO;
    import com.sap.wec.app.common.module.common.attachment.businessobject.interf.Attachment;
    import com.sap.wec.tc.core.backend.sp.jco.JCoConnection;
    import com.sap.wec.tc.core.businessobject.BusinessObjectException;
    import com.sap.wec.tc.core.common.exceptions.ApplicationBaseRuntimeException;
    import com.sap.wec.tc.core.common.logging.WCFLocation;
    import com.sap.wec.tc.core.common.searching.businessobject.impl.GenericSearch;
    import com.sap.wec.tc.core.common.searching.businessobject.interf.GenericSearchReturnResultData;
    import com.sap.wec.tc.core.common.util.GenericFactory;
    import com.sap.wec.tc.core.common.util.Message;
    import com.sap.wec.tc.core.common.util.MessageList;
    import com.sap.wec.tc.core.common.util.table.Table;
    import com.sap.wec.tc.core.common.util.table.TableRow;
    import com.sap.wec.tc.core.modulemgmt.ForeignModuleAccess;
    import com.sap.wec.tc.core.modulemgmt.ModuleAccess;
    import com.sap.wec.tc.core.modulemgmt.exceptions.ModuleInactiveException;
    import com.sap.wec.tc.core.modulemgmt.exceptions.ModuleLifecycleException;
    import com.sap.wec.tc.core.runtime.WecFrameworkRuntime;
    import com.sap.wec.tc.core.runtime.WecSession;
    import com.sap.wec.tc.core.runtime.jsf.WecFrameworkRuntimeJSF;
    import com.sap.wec.tc.core.runtime.jsf.composition.PageManagerBean;
    import com.sap.wec.tc.core.runtime.navigation.NavigationCondition;
    import com.sap.wec.tc.core.ui.composition.menu.MenuManager;
    import com.sap.wec.tc.core.ui.composition.menu.MenuMetadataException;
    import com.sap.wec.tc.core.ui.vc.BuildTime;
    import com.sap.wec.tc.core.ui.vc.NavigationParameterBinding;
    import com.sap.wec.tc.core.ui.vc.RequestParameterBinding;
    import com.sap.wec.tc.core.ui.vc.impl.ViewComponentHandlerBaseImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.businessobject.interf.BIT;
    import com.cpr.cprwec.app.comm.module.ebpp.businessobject.impl.BITImpl;
    public class BITDetailViewVCHandler extends
            ViewComponentHandlerBaseImpl<EbppModuleAccess> {
        protected static final WCFLocation LOCATION = WCFLocation
                .getInstance(BITDetailViewVCHandler.class.getName());
        public BITDataDTO bitDataDTO;
        public BITDetailDTO bitDetailDTO;
        public List<BITDataDTO> BITDataDTOList;
        public List<BITDetailDTO> BITDetailDTOList;
        public boolean noBITData;
        public boolean noBITDetail;
        public boolean renderPanel = true;
        public boolean isDownloadBITData;
        public boolean isDownloadBITDetail;
        public boolean downloadStarted=false;
        public boolean BITFound =false;
        public boolean isBITFound() {
            return BITFound;
        public void setDownloadStarted( boolean downloadStarted ){
            this.downloadStarted = downloadStarted;
        public boolean getDownloadStarted(){
            return this.downloadStarted;
        public void setBITFound(boolean BITFound) {
            this.BITFound = BITFound;
        public String getObjectID() {
            return objectID;
        public void setObjectID(String objectID) {
            this.objectID = objectID;
        public List<BITDataDTO> getBITDataDTOList() {
            return BITDataDTOList;
        public List<BITDetailDTO> getBITDetailDTOList() {
            return BITDetailDTOList;
        public Boolean getNoBITData() {
            return noBITData;
        public Boolean getNoBITDetail() {
            return noBITDetail;
        public Boolean getRenderPanel() {
            return renderPanel;
        private static final int DEFAULT_BUFFER_SIZE = 1024000;
        public Attachment attachmentData;
        public Attachment getAttachmentData() {
            return attachmentData;
        @RequestParameterBinding(maxLength = 1024)
        protected String objectID;
        @BuildTime
        public String processBuildTime() throws BusinessObjectException {
            BIT BIT = null;
            noBITData = noBITDetail = false;
            renderPanel = true;
            if (isLoggedIn()) {
                if ( isDownloadBITData == true ){
                    this.downloadBITDataExcel();
                else {
                this.getModuleAccess().getBITBO().clearMessages();
                BIT = this.moduleAccess.getBITBO().getBITFromBackend(objectID);
                BITDataDTOList = BIT.getBITDataDTOList();
                BITDetailDTOList = BIT.getBITDetailDTOList();
                MessageList objectData = this.getModuleAccess().getBITBO()
                        .getMessageList();
                if (objectData.size() > 0) {
                    noBITData = noBITDetail = true;
                    renderPanel = false;
                    this.addMessageList(objectData);
            return checkLoginCondition();
        private boolean isLoggedIn() {
            return checkLoginCondition() == null;
        private String checkLoginCondition() {
            NavigationCondition navCondition = getNavigationCondition("login");
            if (!navCondition.isFullfiled()) {
                navCondition.addToNavigationStack();
                return navCondition.getOutcome();
            return null;
        public String downloadBITData(){
            downloadStarted = true;
            isDownloadBITData = true;
            downloadBITDataExcel();
            return checkLoginCondition();
        public void downloadBITDataExcel() {
        //    dummyDebug("downloadBITDataExcel", BITDataDTOList.size(), "", "" );
            if (BITDataDTOList.size() > 0) {
                try {
                    attachmentData = this.getModuleAccess().getDownloadBO()
                            .getBITDataExcel(BITDataDTOList);
                    if (attachmentData != null) {
                        FacesContext faces = FacesContext.getCurrentInstance();
                        HttpServletResponse response = (HttpServletResponse) faces
                                .getExternalContext().getResponse();
                        response.reset();
                        response.setContentType(attachmentData
                                .getAttachmentMimeType());
                        response.setContentLength(attachmentData
                                .getAttachmentContent().length);
                        response.setHeader("Content-disposition",
                                "attachment;filename="
                                        + attachmentData.getAttachmentName());
                        response.setBufferSize(DEFAULT_BUFFER_SIZE);
                        ServletOutputStream out;
                        try {
                            out = response.getOutputStream();
                            out.write(attachmentData.getAttachmentContent());
                            out.flush();
                            faces.responseComplete();
                        } catch (IOException e) {
                            throw new ApplicationBaseRuntimeException(
                                    "Problem opening file", e);
                        } finally {
                            attachmentData = null;
                } catch (BusinessObjectException e) {
                    e.printStackTrace();
            isDownloadBITData = false;

    Thanks Hamendra for checking the issue.
    I am setting up breakpoints in WCEM, tab JAVA EE then from menu RUN->Toggle brekpoints and then debug configuration.
    the breakpoints are in several places in  handler class BITDetailviewVCHandler class including method  downloadBITData.
    this method I am calling from BitContentview.XHTML
    <wec:commandButton  id="bdtexcel" immediate="true" actionListener="#{cc.vch.DownloadBITData}" type="submit" value="#{i18n['invoices.ui.openitems.printSelected']}"/>
    When the BIT page is loading the control stops at the breakpoint.
    but it is not stopping there  when i click the 'Excel Download' button.
    How do I get the log file. I am very new to WCEM, please guide me.
    I tried to debug the UI using Google chrome. it is giving me the following error.
    POST https://<>/<>/<>/<>HomePage.jsf?wec-appid=<>MAINAPP6&wec-locale=en_US 500 (Internal Server Error)
    when I expand the node
    c.event.trigger:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:54
    c.event.trigger:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:54
    c.event.trigger:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:66
    (anonymous function):<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:30
    c.extend.each:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:24 c.fn.c.each:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:66 c.fn.extend.trigger:<>/<>/javax.faces.resource/<>dev/comp.theme/templates/jquery/js/commandButton.js.jsf:31
    com.sap.wec.commandButton.submitForm:<>/<>/main/<>HomePage.jsf?wec-appid=<>MAINAPP6&objectID=500000233&page=D61CFFF8E75D48A1B348F315D209EFF9&wec-locale=en_US:48 onclick
    Navigated to https://wsapdjd803.<>.ca:<>/<>/main/<>HomePage.jsf?wec-appid=<>MAINAPP6&wec-locale=en_US
    Seems to be it is failing somewhere commandButton-related JavaScript functions
    Thanks
    Subassish

  • Master Agreement Import Failed

    Hi experts,
    An error was encountered during Data Import of Master Agreement in CLM system.  Logs shown below.  
    Details of the errors:
    Failed: object 1: metadata exception
    Exception: method not found
    MessageId: exception.common.db.metadata.reflection
    Info: target method = getObjectId [STANDARD_ATTRIBUTE_ID].
    found in fpa logs:
    metadata exception, Exception: method not found, AttributeId: SAPPORG_OBJECT_ID, MessageId: exception.common.db.metadata.reflection
    When checking in Setup --> Extension Definition List --> Master Agreement Extensions, SAPPORG is existing in the Attributes tab
    Regards,
    Lester

    Hi Lester,
    In setup>extension defnition, you can define different extensions for an object type (e.g. MA) for different contexts. In case of MA, you can define different set of extensions in enterpirse context and in subcontext(s).
    e.g. for enterprise context you can have EXT1 for MA
          for subcontext1 you can have EXT2 for MA
          for subcontext2 you can have EXT3 for MA
    When a user logs-in he will be associated with a context based on his company. Say with subcontext 2. In that case the user can see only extension EXT2.
    I was suspecting extensions are defined in a different context than from the user is importing... Please check.
    1. Check 1: user used for importing, the associated company & determine the respective context
    2. go to setup>ext def and look for this MA under this context and see the extension.
    Thanks,
    Baski

  • Help with test case

    Hi,
    I'm trying to produce a test case for a subtle problem, but can't get a
    simple one to work :-(
    I think I'm doing something wrong:
    Source:
    package kodo;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Properties;
    import javax.jdo.JDOHelper;
    import javax.jdo.PersistenceManager;
    import javax.jdo.PersistenceManagerFactory;
    import junit.framework.TestCase;
    public class KodoTest1 extends TestCase
    * @param id
    public KodoTest1(String id)
    super(id);
    public void test1() throws Exception
    PersistenceManagerFactory pmf = getFactory();
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    A a = new A();
    a._b = new ArrayList();
    pm.makePersistent(a);
    Object aId = JDOHelper.getObjectId(a);
    B b = new B();
    b._parent = a;
    a._b.add(b);
    pm.currentTransaction().commit(); // looks good after this -- _b is
    a ProxyLinkedList
    pm.close();
    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    A aClone = (A) pm.getObjectById(aId, false);
    assertNotNull(aClone);
    Collection c = aClone._b;
    assertNotNull(c); // fails
    assertEquals(1,aClone._b.size());
    pm.currentTransaction().commit();
    private static PersistenceManagerFactory getFactory() throws Exception
    InputStream propStream =
    KodoTest1.class.getResourceAsStream("/kodo-local.properties");
    Properties props = new Properties();
    props.load(propStream);
    return JDOHelper.getPersistenceManagerFactory(props);
    package.jdo:
    <?xml version="1.0"?>
    <jdo>
    <package name="kodo">
    <class name="B"/>
    <class name="A">
    <field name="_b">
    <collection element-type="B"/>
    <extension vendor-name="kodo" key="inverse" value="_parent"/>
    </field>
    </class>
    </package>
    </jdo>
    kodo-local.properties:
    javax.jdo.option.RetainValues: true
    javax.jdo.option.RestoreValues: true
    javax.jdo.option.Optimistic: true
    javax.jdo.option.NontransactionalWrite: false
    javax.jdo.option.NontransactionalRead: true
    javax.jdo.option.Multithreaded: true
    javax.jdo.option.MsWait: 5000
    javax.jdo.option.MinPool: 1
    javax.jdo.option.MaxPool: 80
    javax.jdo.option.IgnoreCache: false
    javax.jdo.option.ConnectionUserName: tomd
    javax.jdo.option.ConnectionURL: jdbc:oracle:thin:@holygrail:1521:db1
    javax.jdo.option.ConnectionPassword: password
    javax.jdo.option.ConnectionDriverName: oracle.jdbc.OracleDriver
    javax.jdo.PersistenceManagerFactoryClass:
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory
    com.solarmetric.kodo.impl.jdbc.WarnOnPersistentTypeFailure: true
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass:
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory
    com.solarmetric.kodo.impl.jdbc.FlatInheritanceMapping: true
    com.solarmetric.kodo.impl.jdbc.AutoReturnTimeout: 10
    #com.solarmetric.kodo.Logger:
    #stdout
    # (Kodo 2.4 license key)
    com.solarmetric.kodo.LicenseKey: xxxxxxxxxxxxxxxxxxxxxxx
    com.solarmetric.kodo.EnableQueryExtensions: false
    com.solarmetric.kodo.DefaultFetchThreshold: -1
    com.solarmetric.kodo.impl.jdbc.DictionaryProperties:NameTruncationVersion=1
    com.solarmetric.kodo.impl.jdbc.UseBatchedStatements=false
    com.solarmetric.kodo.impl.jdbc.StatementCacheMaxSize=1

    You should not be directly accessing fields of PersistenceCapable
    instances or should enhance as Persistence aware:
    e.g. jdoc kodo.KodoTest1.
    However, I strongly recommend against this. It is bad object oriented
    design to be exposing internal variables so (wrap at the least in a
    get method). And in JDO, can easily cause strange behavior if not
    handled correctly as you see in your test case.
    Btw, I would recommend against packaging in kodo as we may be moving
    towards simplifying our package structures into kodo prefixed packages.
    On Wed, 18 Jun 2003 20:11:45 +1000, Tom Davies wrote:
    Hi,
    I'm trying to produce a test case for a subtle problem, but can't get a
    simple one to work :-(
    I think I'm doing something wrong:
    Source:
    package kodo;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Properties;
    import javax.jdo.JDOHelper;
    import javax.jdo.PersistenceManager;
    import javax.jdo.PersistenceManagerFactory;
    import junit.framework.TestCase;
    public class KodoTest1 extends TestCase {
    * @param id
    public KodoTest1(String id)
    super(id);
    public void test1() throws Exception
    PersistenceManagerFactory pmf = getFactory(); PersistenceManager pm =
    pmf.getPersistenceManager(); pm.currentTransaction().begin();
    A a = new A();
    a._b = new ArrayList();
    pm.makePersistent(a);
    Object aId = JDOHelper.getObjectId(a); B b = new B();
    b._parent = a;
    a._b.add(b);
    pm.currentTransaction().commit(); // looks good after this -- _b is
    a ProxyLinkedList
    pm.close();
    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    A aClone = (A) pm.getObjectById(aId, false); assertNotNull(aClone);
    Collection c = aClone._b;
    assertNotNull(c); // fails
    assertEquals(1,aClone._b.size());
    pm.currentTransaction().commit();
    private static PersistenceManagerFactory getFactory() throws Exception
    InputStream propStream =
    KodoTest1.class.getResourceAsStream("/kodo-local.properties");
    Properties props = new Properties();
    props.load(propStream);
    return JDOHelper.getPersistenceManagerFactory(props);
    package.jdo:
    <?xml version="1.0"?>
    <jdo>
    <package name="kodo">
    <class name="B"/>
    <class name="A">
    <field name="_b">
    <collection element-type="B"/>
    <extension vendor-name="kodo" key="inverse" value="_parent"/>
    </field>
    </class>
    </package>
    </jdo>
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Equality between primitive and persistent objects

    Folks,
    I have discovered by chance that the KODO Query implementation allows me
    to test for equality between an Integer and a persistent object. This is
    actually phenomenally useful because it allows me to easily work around
    some really inefficient auto-generated SQL (see below).
    I couldn't find anything about this feature in the JDO specs. Is it
    accidental? Is it supported, or likely to disappear in future versions?
    Dave Syer.
    # 'bean' is an object already loaded from the persistence store
    javax.jdo.JDOHelper.getObjectId(bean)Bean-101
    # it has one mutable property, which is persistence capable
    # and also a read-only property which is the database id
    # (Integer) of the property:
    javax.jdo.JDOHelper.getObjectId(bean.getProperty())Property-371
    bean.getPropertyId()371
    # get an extent for querying (pm is the PersistenceManager)
    ex=pm.getExtent(Bean,0)# First do a query on property...
    qu=pm.newQuery(ex);
    qu.declareParameters("Property id1");
    qu.setFilter("property == id1")# ...generates SQL with additional unnecessary(?) Cartesian join
    # to PROPERTY table:
    res=qu.execute(bean.getProperty())# resulting SQL:
    # SELECT t0.PROPERTY_ID, t0.PROPERTY_ID FROM BEAN t0, PROPERTY t1
    # WHERE (t0.PROPERTY_ID = 371 AND t0.PROPERTY_ID =
    # t1.PROPERTY_ID)
    # Now do a query on propertyId (Integer)...
    qu=pm.newQuery(ex);
    qu.declareParameters("java.lang.Integer id1");
    qu.setFilter("propertyId == id1")# ...but parameter value is allowed to be a Property -- magically
    # turned into an integer when the SQL is generated:
    res=qu.execute(bean.getProperty())# resulting SQL:
    # SELECT t0.PROPERTY_ID, t0.PROPERTY_ID FROM BEAN t0 WHERE
    # t0.PROPERTY_ID = 371

    It is accidental and unsupported.Is there any other way to get round the 'unnecessary join' issue that I
    mentioned briefly in my original posting? In a real world example, I was
    able to improve performance of a single query by a factor of 100 (and my
    DB experts tell me there was no way to optimise indexes or anything at the
    RDBMS level and achieve the same result).
    DAve.

  • About o-r mapping

    Hi all,
    I have two questions when creating database scheme:
    1, kodo use a default FlatInheritanceMapping to mapping class inheritance
    hierachy to a RDMS.But this is not always a practic way.In most time we
    mapping every leaf class in the hierachy to a separate table ,and do not
    create any table for the supperclass but mapping their persistent field to
    those leaf class table. In this way,redundant data be created indeed ,but
    the whole data model become more mainteneable and reasonable. My question
    is ,does kodo support this kind of o-r mapping ? if so, how to config the
    metadate file ?
    2, When using datastore identity,it's not nesseccary for programmers to
    implement object id.But how can i access a object's id creaded by JDO
    implemention? for example,my application want to compare tow object for
    equality by their id,how do I access the id in my program ?
    Thanks
    Gentri

    Thank you Patrick. I have another question: does kodo support non-durable
    identity ?
    Gentri
    "Patrick Linskey" <[email protected]>
    ??????:[email protected]..
    On Sat, 19 Jul 2003 18:13:41 +0800, Gentri wrote:
    Hi all,
    I have two questions when creating database scheme:
    1, kodo use a default FlatInheritanceMapping to mapping class
    inheritance
    hierachy to a RDMS.But this is not always a practic way.In most time we
    mapping every leaf class in the hierachy to a separate table ,and do not
    create any table for the supperclass but mapping their persistent fieldto
    those leaf class table. In this way,redundant data be created indeed,but
    the whole data model become more mainteneable and reasonable. Myquestion
    is ,does kodo support this kind of o-r mapping ? if so, how to configthe
    metadate file ?Kodo does not currently support this type of mapping. It's on our radar
    screens, and we anticipate supporting it in the next couple months.
    2, When using datastore identity,it's not nesseccary for programmers to
    implement object id.But how can i access a object's id creaded by JDO
    implemention? for example,my application want to compare tow object for
    equality by their id,how do I access the id in my program ?You can do:
    Object oid1 = JDOHelper.getObjectId (o1);
    Object oid2 = JDOHelper.getObjectId (o2);
    if (oid1 != null && oid1.equals (oid2))
    // do stuff
    This works with both application and datastore identity.
    Note, however, that the JDO spec guarantees that no matter how you
    navigate to an object within a given persistence manager, you will always
    obtain the same object reference within that PM, and you will always
    obtain different object references within different PMs.
    That means that if o1 and o2 were both obtained in the same PM, you can
    just do an == comparison to see if they represent the same data.
    -Patrick
    Patrick Linskey
    SolarMetric Inc.

  • Multiple Login PEI's

    I am going crazy trying to migrate some custom pei's and activity spaces from 5.04 to 6.0.1. We currently have 5 or 6 login PEI's. Depending on what happens in the OnAfterLogin method, we may need to redirect the user to a custom activity space. Lets say the user is redirected on step 3, goes out and completes what ever action is required in the AS. After the as is complete, I want to get back into my login flow and complete steps 4-6, but I am not sure how to do this. On step three, I had to return a redirect to a custom space. When I complete my AS I can return null, but that dosen't seem to put me back in the flow. It actually seems to get me stuck in the same AS. So if the custom AS was for changing a password, the user is stuck changing their password forever because I didn't return a valid redirect.
    I have the code for how this was worked around in 5.04, but it breaks in 6.0 and I am not sure it was the right way to do it anyway. Can anybody provide some good ideas on how to do this in 6.0 sp1?
    Thanks,
    Berney

    I'm making some custom login PEIs right now but from scratch in a new 6.1 installation. Do you mind if I ask if you were able to get your custom activity spaces (AS)(most notably your change password AS) to show custom branding according to experience definition? We have 5 uniquely branded portals and each must use the same change password AS but right now I only have it showing the ugly blue out of the box branding - I can't get it branded w/ our custom header and footer. It's going to take some more homework on my part. If I could just find out the exp.def./subportal-id from my PEI to begin w/ that'd be great (right now, using
    IPTSubPortalInfo subPortal = (IPTSubPortalInfo) ptSession.GetSessionInfo().GetCurrentUserCachedSubPortalInfo();
    int id = subPortal.GetObjectID()
    doesn't work.

  • Another strange query

    hi,
    the call:
    patient = (PPatient)pm.getObjectById(patientId, true);
    yields to the following sql statement:
    SELECT COUNT(*) FROM PPATIENT, PPATIENT t0 WHERE t0.OID = ?
    this is a dramatically performance problem for us.
    the patientId is an id returned by
    pm.getObjectId(patient);
    then
    commit;
    and then getObjectById
    the above call behaves the same with or with or without an active
    transaction!
    thanks in advance
    matthias.stephan

    Matthias & Tibor-
    Good catch. You are right: the SQL we are issuing is sub-optimal. I've
    made a bug report for this at:
    http://bugzilla.solarmetric.com/show_bug.cgi?id=613
    You can expect it to be fixed in the near future.
    In article <[email protected]>, Tibor Varga wrote:
    Hi,
    This is something I was also pondering about. Can you explain why the
    query performed by Kodo is faster than this one:
    SELECT COUNT(*) FROM PPATIENT t0 WHERE t0.OID = ?
    This one does not count the number of rows in the given table, it either
    gives you 1 or 0, depending on the existence of the sought record.
    I feel I'm missing something tricky here. Thank you,
    Tibor
    Marc Prud'hommeaux wrote:
    Matthias,
    Passing the "true" argument to PersistenceManager.getObjectById
    indicates that the JDO system must verify that the object exists in the
    datastore. Thus, Kodo is performing the validation in as fast a way as
    it can.
    If you do not want datastore-side validation, and instead just want to
    grab the object from the cache, then pass "false" as the second
    argument.
    See also:
    http://www.solarmetric.com/javadoc/jdo/javax/jdo/PersistenceManager.html#getObjectById(java.lang.Object,%20boolean)
    In article <b59hmm$dai$[email protected]>, Matthias Stephan wrote:
    hi,
    the call:
    patient = (PPatient)pm.getObjectById(patientId, true);
    yields to the following sql statement:
    SELECT COUNT(*) FROM PPATIENT, PPATIENT t0 WHERE t0.OID = ?
    this is a dramatically performance problem for us.
    the patientId is an id returned by
    pm.getObjectId(patient);
    then
    commit;
    and then getObjectById
    the above call behaves the same with or with or without an active
    transaction!
    thanks in advance
    matthias.stephan
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Building relationships that have no foreign key

    Hi,
    I have a situation where the database team have provided me a schema
    something like that shown below:
    PERSON
    |========================================|
    | PK | NAME | SSNUM | MGR |
    |========================================|
    | 1 | john | 123-45-6789 | 3 |
    | 2 | fred | 987-65-4321 | 3 |
    | 3 | alice | 111-22-3333 | NULL |
    | ... |
    |========================================|
    COMPANY
    |=================|
    | PK | NAME |
    |=================|
    | 1 | acme |
    | 2 | bcme |
    | 3 | ccme |
    | |
    |=================|
    ATTRIBUTE
    |========================================|
    | PK | SOURCE_ID | SOURCE_TYPE | VALUE |
    |========================================|
    | 1 | 1 | P | one |
    | 2 | 1 | C | two |
    | ... |
    |========================================|
    PERSON and COMPANY are application objects. A PERSON or a COMPANY can
    have an ATTRIBUTE tagged to it. Now, there is not a foreign key
    relationship from PERSON/COMPANY to ATTRIBUTE. The relationship can be
    derived by understanding that ATTRIBUTE.SOURCE_ID is the PK value for
    either PERSON or COMPANY, and ATTRIBUTE.SOURCE_TYPE states whether its a
    PERSON (P) or COMPANY (C).
    The database guys say this is a common approach to modelling data that
    is not a "first order" property of a class, which I guess may be up for
    debate. In any case....
    I can't model this using objects and relationships using KODO. So, my
    question is, how would you approach this?
    Thanks,
    Mike.
    PS As an aside, if there was a way in the JDO metadata to "hardcode" a
    value for one or more of the columns in a foreign key relationship, it
    would help a lot. Then I could build a navigable link from PERSON to
    ATTRIBUTE, where the SOURCE_ID data column is PERSON.PK and the
    SOURCE_TYPE is the string literal 'P'.

    That certainly is a unique problem... and certainly not a sort of model I
    would encourage...
    however, you should be able to accomplish this in Kodo with a non-direct
    relationship... i.e. Attributes has a reference-id not a reference. So
    Attribute may say look like this:
    private int referenceId = -1;
    private char type;
    public void getSource ()
    Object oid = null;
    if (referenceId < 0)
         return null;
    switch (type)
    case 'P':
         oid = new PersonId (referenceId);
         break;
    case 'C':
         oid = new CompanyId (referenceId);
         break:
    default: return null;
    return JDOHelper.getPeristenceManager (this).getObjectById (oid, true);
    public void setSource (Person p)
    PersonId pid = (PersonId) JDOHelper.getObjectId (p);
    refernceId = pid.id;
    type = 'P';
    Now this would get a little more complicated for objects which
    haven't been made persistent, but can simply be accomplished by using
    javax.jdo.InstanceCallbacks and preStore () and using a transient field
    Object source. Using non-application identity, would require casting oids to
    our ObjectIds.Id (in our JavaDoc). Actually, as I think about it, it may
    be better to do this all in a transient state:
    public Attribute
         private transient Object src;
         private int referenceId;
         private char type;
         public void setSource (Person p)
              src = p;
         public Object getSource ()
              if (src != null || JDOHelper.getPersistenceManager (this) == null)
                   return src;
              /// same as previous example
              return JDOHelper.getPersistenceManager (this).getObjectById (oid);
         public void preStore () // instancecallbacks
              PersonId id = (PersonId) JDOHelkper.getObjectId (src);
              referenceId = id.id;
              type = 'P';
    Again this isn't 100% solid code but a suggestion to get you started on
    your problem.
    While 3.0 will support more complex mappings, it won't get around the
    multiple types per field problem... but this could be solved via
    interfaces (e.g. public interface AttributeSource), though I'd have to
    defer to our 3.0 architect on that one.
    On Fri, 14 Feb 2003 16:15:04 +0200, Mike Hogan wrote:
    Hi,
    I have a situation where the database team have provided me a schema
    something like that shown below:
    PERSON
    |========================================|
    | PK | NAME | SSNUM | MGR |
    |========================================|
    | 1 | john | 123-45-6789 | 3 |
    | 2 | fred | 987-65-4321 | 3 |
    | 3 | alice | 111-22-3333 | NULL |
    | ... |
    |========================================|
    COMPANY
    |=================|
    | PK | NAME |
    |=================|
    | 1 | acme |
    | 2 | bcme |
    | 3 | ccme |
    | |
    |=================|
    ATTRIBUTE
    |========================================|
    | PK | SOURCE_ID | SOURCE_TYPE | VALUE |
    |========================================|
    | 1 | 1 | P | one |
    | 2 | 1 | C | two |
    | ... |
    |========================================|
    PERSON and COMPANY are application objects. A PERSON or a COMPANY can
    have an ATTRIBUTE tagged to it. Now, there is not a foreign key
    relationship from PERSON/COMPANY to ATTRIBUTE. The relationship can be
    derived by understanding that ATTRIBUTE.SOURCE_ID is the PK value for
    either PERSON or COMPANY, and ATTRIBUTE.SOURCE_TYPE states whether its a
    PERSON (P) or COMPANY (C).
    The database guys say this is a common approach to modelling data that
    is not a "first order" property of a class, which I guess may be up for
    debate. In any case....
    I can't model this using objects and relationships using KODO. So, my
    question is, how would you approach this?
    Thanks,
    Mike.
    PS As an aside, if there was a way in the JDO metadata to "hardcode" a
    value for one or more of the columns in a foreign key relationship, it
    would help a lot. Then I could build a navigable link from PERSON to
    ATTRIBUTE, where the SOURCE_ID data column is PERSON.PK and the
    SOURCE_TYPE is the string literal 'P'.--
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

  • Error in function PTCard.Store (): -2147467259

    hello,
    <p>
    I am trying to add a card to the knowledge directory using API. I call <strong>IPTCard.Store()</strong> method to store the card. below is my code.
    public void createCard(int folderParent, String cardName){
    IPTCatalog catalog = session.GetCatalog();
    IPTCard card = catalog.CreateCard();
    card.SetName(cardName);
    int[] parentIds = {folderParent};
    card.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_PARENTFOLDERIDS, parentIds);
    card.SetDescription("test description.");
    card.Store();
    But when i call "IPTCard.Store()" method, it returns the following error;
    </p>
    <strong> com.plumtree.openfoundation.util.XPException: Error in function PTCard.Store (): -2147467259 - Failed to store card: storing cards in DB failed
    </strong>does anybody have an idea, why this error appears ??
    thank you for ur openion in adv.
    <p>
    </p>

    I can't tell from the error, but I suspect you will need to associate the card with a data source (content upload or similar) before it can be stored in the database (PTCard.Store).
    Since I don't remember exactly how I did this at one point, I have provided some code below that I hacked from the API and changed around. It sets some extra stuff related to the file upload data source, but you can probably use some of it to piece together data source info. Here are some relevant lines that you'll probably need to fudge with:
                   IPTDataSource ptDS          = (IPTDataSource)
    session.GetDataSources().Open(nDataSourceID, false);
                   string strCardPropBagXML = pbagCardProp.SaveToXML(0);
                   ptDS.ImportDocument(strCardPropBagXML, nDocTypeID, ptCard, true, null);
    And here's the rest of the code it was ripped from...
              // Functions in this region were somewhat ripped from the UI source (KD submission space)
              // they have been slightly cleaned and commented for clarity (actual card submission happens here)
              public static IPTCard SubmitCard(int dataSourceId, int parentFolderId, string name, string description, string path, string type, string docId, string duServer, string duId, SortedList propertyList, IPTSession session, AActivitySpace space) {
                   IXPPropertyBag pbag = CreateCardSubmitUploadPropertyBag(path, type, docId);
                   return SubmitCardWithPropertyBag(parentFolderId, dataSourceId, name, description, duServer, duId, false, propertyList, pbag, session, space);
              public static IPTCard SubmitCardWithPropertyBag(int parentFolderId, int nDataSourceID, string strCardName, string strCardDescription, string duServer, string duId, bool approved, SortedList propertyList, IXPPropertyBag pbagCardProp, IPTSession session, AActivitySpace space) {
                   // Set Parent Folder
                   int[] arFolderIDs = new int[] {parentFolderId};
                   // set language to be that of the default locale
                   // Retrieve the SearchLocaleVarPack to verify the language
                   IApplication application = ApplicationManager.GetInstance()
                        .GetApplication(AppConstants.MAIN_APPLICATION_NAME.ToString());
                   PTSearchLocaleVarPack vpPTSearchLocales = (PTSearchLocaleVarPack) application.GetVarPackManager()
                        .GetVariablePackage(PTSearchLocaleVarPack.VARPACK_ID);
                   // Retrieve the user's default language:
                   string strCardLanguageCode = (string) PTPersonalSettingsHelper.GetPersonalSettingValue(PersonalSettingNames.LANGUAGE,
                        space);
                   // default to english if invalid language
                   if (false == vpPTSearchLocales.IsValidLanguage(strCardLanguageCode)) {
                        strCardLanguageCode = DirModel.ENGLISH_LOCALE_CODE;
                   return SubmitCardWithPropertyBag(arFolderIDs, strCardLanguageCode, 0,
                        nDataSourceID, pbagCardProp, strCardName, strCardDescription, duServer, duId, approved, propertyList, session, space);
              public static IPTCard SubmitCardWithPropertyBag(int[] arFolderIDs,
                   string strLanguage, int nDocTypeID, int nDataSourceID,
                   IXPPropertyBag pbagCardProp, string strCardName,
                   string strCardDescription, string duId, string duServer, bool approved,
                   SortedList propertyList, IPTSession session, AActivitySpace space) {
                   // create the card
                   IPTCard ptCard = session.GetCatalog().CreateCard();
                   ptCard.SetContentLanguage(strLanguage);
                   // Parent IDs can be a single value or an array of values
                   ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_PARENTFOLDERIDS,
                        arFolderIDs);
                   // if the index server isn't up, don't try to index, create the card
                   // and inform the user later
                   IXPPropertyBag statusBag = session.GetCatalog().GetSearchServerStatus();
                   SearchServerStatusInfo statusInfo = new SearchServerStatusInfo(statusBag, "INDEXSTATUS");
                   if (XPStringUtility.EqualsIgnoreCase(statusInfo.connectStatus,"OK")) {
                        ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_INDEXONSTORE, 1);
                   } else {
                        ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_INDEXONSTORE, 0);
                   // if the card is approved, we set this flag
                   if (approved) {
                        ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_INSERTAPPROVED, 1);
                   /* inherit parent folder ACLs */
                   ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_INHERITPARENTFOLDERPERMISSIONS, 1);
                   // Set the crawler tag to be "Manual"
                   ptCard.SetCrawlerTag(space.GetString(1635, "ptmsgs_portalbrowsingmsgs"));
                   if ((null != strCardName) && (strCardName.Length > 0)) {
                        ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_OVERWRITENAME, 0);
                        ptCard.SetName(strCardName);
                   if ((null != strCardDescription) && (strCardDescription.Length > 0)) {
                        ptCard.SetCardSettings(PT_CARD_SETTINGS.PT_CARD_OVERWRITEDESCRIPTION, 0);
                        ptCard.SetDescription(strCardDescription);
                   ptCard.SetDocumentLocation(pbagCardProp);
                   ptCard.SetDataSourceID(nDataSourceID);
                   // Get the DocumentTypeMap
                   if (0 == nDocTypeID) {
                        // Determine Default
                        IPTDocumentTypeMap ptMap;
                        ptMap = (IPTDocumentTypeMap) session.OpenGlobalObject(PT_GLOBALOBJECTS.PT_GLOBAL_DOCUMENTTYPEMAP,
                             false);
                        ptMap.Initialize(session);
                        nDocTypeID = ptMap.LookupByPropBag(pbagCardProp);
                        // If no default DocType was found,
                        // determine what default DocType should be used based on the server config setting
                        if (0 == nDocTypeID) {
                             IApplication application = ApplicationManager.GetInstance()
                                  .GetApplication(AppConstants.MAIN_APPLICATION_NAME.ToString());
                             PTDirPrefsVarPack vpPTDirPrefs = (PTDirPrefsVarPack) application.GetVarPackManager()
                                  .GetVariablePackage(PTDirPrefsVarPack.VARPACK_ID);
                             nDocTypeID = vpPTDirPrefs.GetDefaultDocType();
                   IPTDataSource ptDS          = (IPTDataSource) session.GetDataSources().Open(nDataSourceID, false);
                   string strCardPropBagXML = pbagCardProp.SaveToXML(0);
                   ptDS.ImportDocument(strCardPropBagXML, nDocTypeID, ptCard, true, null);
                   // set file upload properties
                   /* get the card and it's property values */
                   IPTCardPropertyValues ptPropValues = ptCard.GetPropertyValues();
                   /* Document Upload ID */
                   IPTCardPropertyValue ptValue = ptPropValues.Add(PT_INTRINSICS.PT_PROPERTY_UPLOAD_DUID);
                   ptValue.SetOverrideValue(duId); /* make this an override value so it is not lost on a re-index */
                   /* Document Upload Server */
                   ptValue = ptPropValues.Add(PT_INTRINSICS.PT_PROPERTY_UPLOAD_DUSERVER);
                   ptValue.SetOverrideValue(duServer); /* make this an override value so it is not lost on a re-index */
                   /* Custom Property Settings */
                   if (propertyList.Count > 0) {
                        foreach (DictionaryEntry de in propertyList) {
                             try {
                                  int propId = (int) de.Key;
                                  ptValue = ptPropValues.GetItem(propId);
                                  if (null == ptValue) { ptValue = ptPropValues.Add(propId); }                              
                                  ptValue.SetOverrideValue(de.Value);
                             } catch (Exception) {
                                  // ignore exceptions, maybe the wrong property or card
                   //store the card
                   ptCard.Store();
                   ptCard.UnlockObject();
                   // approve or unapprove the card
                   /* 2 for approve, 1 for unapprove */
                   //session.GetCatalog().SetApprovalStateByCard(ptCard.GetObjectID(), (approved ? 2 : 1), arFolderIDs );
                   return ptCard;
              public static IXPPropertyBag CreateCardSubmitUploadPropertyBag(string path, string type, string _docID) {
                   IXPPropertyBag pbagCardProp;
                   pbagCardProp = PortalObjectsFactory.CreatePropertyBag();
                   pbagCardProp.Write("PTC_PBAGFORMAT", 2000);
                   pbagCardProp.Write("PTC_DTM_SECT", XPConvert.ToInteger(_type));
                   pbagCardProp.Write("PTC_UNIQUE", _path);
                   pbagCardProp.Write("PTC_DOC_ID", _docID);
                   return pbagCardProp;
              }

Maybe you are looking for

  • Data acquisition from NI PXI 5152 using LabVIEW

    Hi,     This might be really stupid question, I am new to LabVIEW and the Digitizer equipment. I was wondering if there are already any labVIEW based application available to read the data from PXI5152. I would be using both channels available and ma

  • Help needed with Avid AAF to Premiere Pro CC (w/wo/AE in the loop)

    Folks, I am taking over a feature film edit to finish in Premiere Pro. I want to use AE's Pro Importer to convert the Avid edit (AAF export) to an AE session and then export to PP CC. The 1st editor was cutting with Avid Media Composer. All the sourc

  • Itunes troubleshooting for windows 8

    I recently got a windows 8 and Itunes says "Itunes have stopped working" and it says windows is looking for a solution but nothing ever happens. I deleted all Itunes history and files and redownloaded it several times but it stil does the same exact

  • InDesign CS3 - Application Error

    Hi, I work with CS3 Design Premium Suite. While working with InDesign CS3 sometimes I receive this error and the application closes after clicking the ok / cancel to the error window Error Windows: DDE Server Windows: Indesign.exe - Application error

  • JPA Arhitectural Design Decision

    Hi, I'm building a 1 tier web shop, using mostly Ajax, Servlets and JPA and I need your advice on a design decision. When a user demands to see the products belonging to a particular category of products, my DAO object returns to the servlet a java.u