cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Disable Container Level OIR's

cadjett
1-Newbie

Disable Container Level OIR's

OIR question.


At my current client location, they have a wc10.1 OIR disable at container level issue.


For whatever reason, they have like 50 containers with 10 different OIR's.


They now want to override & disable those 50 or so, with 10 new ORG level
OIR's, that they will loadfromfile create.

Obviously they dont want to manually select disable for 500 OIR's from the interface.


I'll assume that you cant change the container level OIR's to disabled
through loadfronfile, but I could be wrong.


Does anybody know the route to diable those. LoadFromFile, coding, ???


Thanks
L Jett

13 REPLIES 13

Update:

We are upgrading from 9.1 to 10.1.

We tried the diable container level OIR route through loadfromfile enable="false", as in loadfromfile snippet below:



<organizationconfig>

<typebasedrule>
<enginerule isdefault="false" enabled="&lt;strong">false">
<rulename>Test OIR</rulename>
<rulespecification> <attributevalues objtype="wt.doc.WTDocument|&lt;type">">
.........

But the false did not work on an existing OIR. But if you manually delete the OIR 1st,
then run the same loadfromfile with false on, it creates & is disabled.

Just wont work on existing.

We have a call in to ptc support & they mentioned possible code on wc9.1 to delete the OIR. Thats not a preference,
but well accept what we can get. But we are waiting.

If anyone has working loadfromfile &/or source to disable or delete, it would be very helpful.

L Jett

ddemay
1-Newbie
(To:cadjett)

I never investigated, but I wanted a SQL script to disable the OIR's at the database level. Or a commamnd line tool.

I like to load them to be able to see them, but still use my own. Each system is different of course.

Dave

Sent from my Verizon Wireless BlackBerry

Good idea Dave,

I did a little research on the sql side:


I just noticed there is a "ENABLEDFLAG" column in the TYPEBASEDRULE table



select * from windchill.TYPEBASEDRULE

CLASSNAMEKEYCONTAINERREFEREN|IDA3CONTAINERREFERENCE|DEFAULTRULE|DESCRIPTION|CLASSNAMEKEYDOMAINREF|IDA3DOMAINREF|0|0|Document Control Form OIR|wt.doc.WTDocument|<type>|INIT||0||UTF8|2011-05-08 12:23:26.0|0|2011-05-08 12:23:26.0|wt.rule.TypeBasedRule|21262|1|2011-05-08 12:23:26.0



Its either a 1 or a 0


if all else fails, I bet we could use sql to disable the OIR's we want. change the 0 to 1.


Or write java class to run sql.


But I have been looking for java withTYPEBASEDRULE & ENABLEFLAG in java code.


I think I have already found the class that LoadFromFile uses to do OIR's:

wt.ixb.handlers.netmarkets.OrgConfigIXHandler


for(Enumeration enumeration7 = ixbelement.getElements("TypeBasedRule"); enumeration7.hasMoreElements(); vector.clear())
{
if(flag1)
{
orgTags;
vector.add("TypeBasedRule");
ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources", "20", vector.toArray(), 1);
vector.clear();
flag1 = false;
}
IxbElement ixbelement9 = (IxbElement)enumeration7.nextElement();
orgTags;
vector.add("TypeBasedRule");
typeRuleTags;
vector.add(ixbelement9.getValue("className"));
ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources", "22", vector.toArray(), 2);
importer.importElement(ixbelement9);
ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources", "23", vector.toArray(), 2);
}

if(!flag1)
{
orgTags;
vector.add("TypeBasedRule");
ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources", "21", vector.toArray(), 1);
vector.clear();
}


See the "TypeBasedRule" above.


I will run with the java side, because I am not great with sql to change table entries. more on the query side.

If anybody knows the sql to change the 0 to 1, that might help. I could test on a vmware.

LJett


More later.
RandyJones
19-Tanzanite
(To:cadjett)

On 07/24/12 12:23, Lawrence Jett wrote:
>
> Good idea Dave,
>
> I did a little research on the sql side:
>
> I just noticed there is a "*ENABLEDFLAG*" column in the *TYPEBASEDRULE* table
> select * from windchill.TYPEBASEDRULE
>
> CLASSNAMEKEYCONTAINERREFEREN|IDA3CONTAINERREFERENCE|DEFAULTRULE|DESCRIPTION|CLASSNAMEKEYDOMAINREF|IDA3DOMAINREF|*ENABLEDFLAG*|INHERITEDDOMAIN|NAME|OBJTYPE|RULETYPE|SECURITYLABELS|SPECIFICATIONISNULL|CONTENTSA5|ENCODINGA5|CREATESTAMPA2|MARKFORDELETEA2|MODIFYSTAMPA2|CLASSNAMEA2A2|IDA2A2|UPDATECOUNTA2|UPDATESTAMPA2
> wt.inf.container.OrgContainer|14523|0||wt.admin.AdministrativeDomain|14524|*0*|0|*FMCNA Document
> Control Form OIR|wt.doc.WTDocument|<type>*|INIT||0||UTF8|2011-05-08 12:23:26.0|0|2011-05-08
> 12:23:26.0|wt.rule.TypeBasedRule|21262|1|2011-05-08 12:23:26.0
> Its either a 1 or a 0
> if all else fails, I bet we could use sql to disable the OIR's we want. change the 0 to 1.
> Or write java class to run sql.
> But I have been looking for java with TYPEBASEDRULE & ENABLEFLAG in java code.
> I think I have already found the class that LoadFromFile uses to do OIR's:
>
> *wt.ixb.handlers.netmarkets.OrgConfigIXHandler*
> for(Enumeration enumeration7 = ixbelement.getElements("*TypeBasedRule*");
> enumeration7.hasMoreElements(); vector.clear())
> {
> if(flag1)
> {
> orgTags;
> vector.add("*TypeBasedRule*");
> ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources",
> "20", vector.toArray(), 1);
> vector.clear();
> flag1 = false;
> }
> IxbElement ixbelement9 = (IxbElement)enumeration7.nextElement();
> orgTags;
> vector.add("*TypeBasedRule*");
> typeRuleTags;
> vector.add(ixbelement9.getValue("className"));
> ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources",
> "22", vector.toArray(), 2);
> importer.importElement(ixbelement9);
> ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources",
> "23", vector.toArray(), 2);
> }
> if(!flag1)
> {
> orgTags;
> vector.add("*TypeBasedRule*");
> ProjectIXUtils.postFeedback(importer, "wt.ixb.handlers.netmarkets.NMIxResources",
> "21", vector.toArray(), 1);
> vector.clear();
> }
> See the "*TypeBasedRule" *above*.*
> *I will run with the java side, because I am not great with sql to change table entries. more on
> the query side.
>
> If anybody knows the sql to change the 0 to 1, that might help. I could test on a vmware.
> *

The sql is trivial:
update TYPEBASEDRULE set ENABLEDFLAG = '0' where ???;
commit;

The "where" is the key in only updating rows that are appropriate. ie
update TYPEBASEDRULE set ENABLEDFLAG = '0' where ida3domainref = '7';
commit;

or

update TYPEBASEDRULE set ENABLEDFLAG = '0' where ida3domainref = '13420' and objtype =
'wt.epm.document';
commit;


> *
> LJett
> *
> More later.
>
> -----End Original Message-----


--
------------------------------------------------------------------------
Randy Jones
Systems Administrator
Great Plains Mfg., Inc.
1525 E North St
PO Box 5060
Salina, KS USA 67401
email: -
Phone: 785-823-3276
Fax: 785-667-2695
------------------------------------------------------------------------

Randy is right. The sql is trivial, I would suggest:


update TYPEBASEDRULE set ENABLEDFLAG = '1' where NAME in ('<an_oir_name_here>', '<another_oir_name_here>', '<etc>');


However, I noticed in our system, the ENABLEDFLAG field has values of 0,1or 2. So before making the change in production, I would suggest that someone determine the difference between the intended use of 1 and 2 in a test system. Lawrence has suggested he would try this first on a vmware image. I would be interested in knowing what the difference between the Flag values is.

Yes, I was already using:

UPDATE TYPEBASEDRULE SET enabledFlag='0' WHERE IDA2A2='6460';

But I ran into an issue. I had read or assumed that the enableFlag would either be 0 or 1.

I am finding values other than those. I will research.

L Jett

Change one through the UI to disabled, what is the value? Use that in your SQL

I found values other than 0,1,2. Some 100,200,300 plus.

The odd part is that on the dev box, they are all 0 & enabled.

On the vmware, they are 0-399, with no consistancy.

I at first that it would be 0 or 1 for org level. Then maybe 0 or 200 for product xyz, 0 or 300 for library abc.

No dice. All over the place.

Still researching...

L Jett

I did that. Disable.

For "? CN OIR", it changed the enableFlag to 361.
I thought OK, when I change the "? CA OIR", it will also be 361. Nope. 362. I actually figured it would be different.

I would assume that when I go back & change it to enable, it will go back to 0.

Opps, what happens when you assume with PTC &/or Windchill, you make an azzOfPTC....sorry Jeff....ha..ha

Let me go check that.

L Jett

Enabled both & they went back to 0.


For the heck of it, I disabled to see if it would go back to either 361 or 362.

It went to 363. Incremental.

Now I should run the sql code & change it to 1 & see what it does. See if it disables or freaks out.

It does seem the the "wt.inf.container.ExchangeContainer" ones are all 0 or 1.

Where the 356 is container level (product/Library).

More research/testting.

L Jett

Here is the updated code, so I/others can query the classes/methods later.

I use /**/ instead of tabs (before each line), so its more legible & wont word wrap oddly in your editor:

package ext;

import java.io.*;
import java.text.*;
import java.sql.*;
import java.net.*;
import java.util.*;
import java.lang.*;

import java.sql.PreparedStatement;

import wt.pds.DatabaseInfoUtilities;
import wt.pds.PDSIfc;
import wt.pom.*;

import wt.util.WTException;
import wt.fc.collections.*;

public class OIR_Disable_01 {
/**/public static void main(String args[]) {

/**//**/Statement statement;
/**//**/ResultSet resultset;
/**//**/statement = null;
/**//**/resultset = null;

/**//**/try {
/**//**//**/statement = connection.createStatement();
/**//**//**/String s,s1,s2,s3;
/**//**//**/idStg=";

/**//**//**/for(resultset = statement.executeQuery("Select Name, CLASSNAMEKEYCONTAINERREFEREN, IDA2A2, ENABLEDFLAG from TYPEBASEDRULE WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0"); resultset.next();) {
/**//**//**//**/s = resultset.getString("Name");
/**//**//**//**/s1 = resultset.getString("CLASSNAMEKEYCONTAINERREFEREN");
/**//**//**//**/s2 = resultset.getString("IDA2A2");
/**//**//**//**/s3 = resultset.getString("ENABLEDFLAG");

/**//**//**//**/idStg = idStg+s2+",";

/**//**//**//**/System.out.println((new StringBuilder()).append("\nName: ").append(s).append("\n\tContainer: ").append(s1).toString());
/**//**//**//**/System.out.println((new StringBuilder()).append("\tIDA2A2: ").append(s2).append("\n\tENABLEDFLAG: ").append(s3).toString());
/**//**//**/}

/**//**//**/idStgFull = idStg.substring(0,idStg.length()-1);
/**//**//**/System.out.println("idStgFull: "+idStgFull);

/**//**//**/String ps1;

/**//**//**/ps1 = (new StringBuilder()).append("UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE IDA2A2 in (").append(idStgFull).append(")").toString();

/**//**//**/System.out.println("SQL Update Stg: "+ps1);
/**//**//**/preparedstatement = connection.prepareStatement(ps1);
/**//**//**/preparedstatement.executeUpdate();
/**//**//**/connection.commit();
/**//**/}
/**//**/catch(SQLException sqlexception1) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception1);
/**//**//**/sqlexception1.printStackTrace();
/**//**/}

/**//**/try {
/**//**//**/if(resultset != null)
/**//**//**//**/resultset.close();
/**//**//**/if(statement != null)
/**//**//**//**/statement.close();
/**//**//**/if(preparedstatement != null)
/**//**//**//**/preparedstatement.close();
/**//**/}
/**//**/catch(SQLException sqlexception) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception);
/**//**//**/sqlexception.printStackTrace();
/**//**/}
}

/**/static Connection connection;
/**/static PreparedStatement preparedstatement;
/**/static String idStgFull, idStg;

/**/static {
/**//**/try {
/**//**//**/connection = DataServicesRegistry.getDefault().getPdsFor("DEFAULT").getDataSource().getConnection();
/**//**/}
/**//**/catch(Throwable throwable) {
/**//**//**/throw new ExceptionInInitializerError(throwable);
/**//**/}
/**/}
}


Basically the sql is:

Select Name, CLASSNAMEKEYCONTAINERREFEREN, IDA2A2, ENABLEDFLAG from TYPEBASEDRULE WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0'

Take IDA2A2's into array & use in Update sql.

UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE IDA2A2 in (0001,0002)

L Jett

The last code was good for testing & printing query before run.

The code below might be a more direct Update sql route, where you dont need to log.

Again using /**/ instead of tab for clarity. Just find/replace /**/ with tabs or ?


package ext;


import java.io.*;
import java.text.*;
import java.sql.*;
import java.net.*;
import java.util.*;
import java.lang.*;


import java.sql.PreparedStatement;


import wt.pds.DatabaseInfoUtilities;
import wt.pds.PDSIfc;
import wt.pom.*;


public class FMCNA_OIR_Disable_02 {
/**/public static void main(String args[]) {
/**//**/try {
/**//**//**/String ps1 = ("UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0");


/**//**//**/System.out.println("SQL Update Stg: "+ps1);
/**//**//**/preparedstatement = connection.prepareStatement(ps1);
/**//**//**/preparedstatement.executeUpdate();
/**//**//**/connection.commit();
/**//**/}
/**//**/catch(SQLException sqlexception1) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception1);
/**//**//**/sqlexception1.printStackTrace();
/**//**/}


/**//**/try {
/**//**//**/if(preparedstatement != null)
/**//**//**//**/preparedstatement.close();
/**//**/}
/**//**/catch(SQLException sqlexception) {
/**//**//**/System.out.println("SQLException while executing startQuery: "+sqlexception);
/**//**//**/sqlexception.printStackTrace();
/**//**/}
/**/}


/**/static Connection connection;
/**/static PreparedStatement preparedstatement;


/**/static {
/**//**/try {
/**//**//**/connection = DataServicesRegistry.getDefault().getPdsFor("DEFAULT").getDataSource().getConnection();
/**//**/}
/**//**/catch(Throwable throwable) {
/**//**//**/throw new ExceptionInInitializerError(throwable);
/**//**/}
/**/}
}


L Jett

Or straight sql:

UPDATE TYPEBASEDRULE SET enabledFlag=1 WHERE CLASSNAMEKEYCONTAINERREFEREN='wt.inf.container.OrgContainer' AND ENABLEDFLAG='0';
commit;

Top Tags