

D:\PTC\Windchill\WC10\wc10_dev\wc10_jad\com\ptc\core\meta\container\common\AttributeTypeSummary.jad

http://hostname/Windchill/meta/LogicalAttributeReport.jsp

=============================

SACFDescribedByDocumentRevision.java

while(describedByDocumentsResult.hasMoreElements())
{
	/* Start MCAD_8.2 code merge */
	curDoc = ((WTDocument) describedByDocumentsResult.nextElement());
	ibaUtil = new IBAUtil((IBAHolder) curDoc);
	String documentSubType = ibaUtil.getIBAStringValue("RTN_DOCUMENT_SUBTYPE");

	log.debug(CLASSNAME + ":   Found Valid Describing Document: " + curDoc.getIdentity() + "." + curDoc.getIterationInfo().getIdentifier().getValue());
	log.debug(CLASSNAME + ":   Found Valid Document Subtype: " + documentSubType);
	if (documentSubType != null)
	{
		if(documentSubType.equalsIgnoreCase("Parts List (085)"))
		{
			count_085++;
			doc085 = curDoc;
		}
		else if(documentSubType.equalsIgnoreCase("Assembly Drawing (021)"))
		{
			count_021++;
			doc021 = curDoc;
		}
	}
}//end of while loop

=============================

ApprovedChangesReport.java

	private final String CNTYPENAME= "WCTYPE|wt.change2.WTChangeOrder2|com.ray.RaytheonChangeOrderCommonAttribs|com.ray.RaytheonChangeOrder|com.ray.RaytheonChangeNotice";
	private final String MCNTYPENAME = "WCTYPE|wt.change2.WTChangeOrder2|com.ray.RaytheonChangeOrderCommonAttribs|com.ray.RaytheonChangeOrder|com.ray.RaytheonChangeNotice|com.ray.RaytheonManufacturingChangeNotice";	
	private final String CPTYPENAME = "WCTYPE|wt.change2.WTChangeOrder2|com.ray.RaytheonChangeOrderCommonAttribs|com.ray.RaytheonChangeOrder|com.ray.RaytheonChangeProposal";
	private final String CNATTRNAME = "RTN_SUBTYPE";
	private final String MCNATTRNAME = "RTN_SUBTYPE";
	private final String CPATTRNAME = "RTN_TYPE";
	private final String ECN = "ECN";
	private final String MCN = "MCN";
	private final String ECP = "ECP";
	private final String OBJECTTYPE = "objectType";
	private final String CONSTRAINT = "constraint";


	public void filterGroup()
	{
		if(_filter_in == null || _filter_out == null) return;
		Group group = _filter_in;
		ArrayList<String> removeList = new ArrayList<String>();
		Date approvalDate = null;
		for (int i=0; i<group.getElementCount(); i++)
		{
			Element element = group.getElementAt(i);
			String obid = (String)element.getValue("obid");
			try
			{
				WTChangeOrder2 order = (WTChangeOrder2)BasicWebjectDelegate.getObjectByUfid(obid);
				approvalDate = ReportHelper.getDateStateWasSet(order, ReportHelper.APPROVED_STATE, true);
				element.addAtt(new Att("approvalDate", approvalDate));
				
				if((element.getAtt("IBA|RTN_TYPE").getValue().toString().equals("") || element.getAtt("IBA|RTN_TYPE").getValue() == null) && element.getAtt("IBA|RTN_SUBTYPE") != null)
				{//if the element is an ECN
					String s = element.getAtt("IBA|RTN_SUBTYPE").getValue().toString();
					//if the type doesn't match the filter criteria, mark this element for removal
					if(!s.equalsIgnoreCase(_type) && !_type.equals("All"))
					{
						removeList.add(obid);
					}
				}
				else if((element.getAtt("IBA|RTN_SUBTYPE").getValue().toString().equals("") || element.getAtt("IBA|RTN_SUBTYPE").getValue() == null) && element.getAtt("IBA|RTN_TYPE") != null)
				{//if the element is an ECP
					String s = element.getAtt("IBA|RTN_TYPE").getValue().toString();
					//if the type doesn't match the filter criteria, mark this element for removal
					if(!s.equalsIgnoreCase(_type) && !_type.equals("All"))
					{
						removeList.add(obid);
					}
				}
				if(approvalDate == null)
				{
					//if it's not approved, mark it for removal
					removeList.add(obid);
				}
				else
				{
					if((_start != null && approvalDate.before(_start)) || (_end != null && approvalDate.after(_end)))
					{
						//mark for removal anything that fell outside the defined date range
						removeList.add(obid);
					}
				}
			}
			catch (Exception e)
			{
				ext.raytheon.logger.RaytheonLogR.getLogger().error("Error in ApprovedChanges task", e);
			}
		}
		//remove all of the elements that failed the filter
		for(String s : removeList)
		{
			group.removeElementByUfid(s);
		}
		Enumeration elements = group.getElements();
		while(elements.hasMoreElements())
		{
			Object o = elements.nextElement();
			if(o instanceof Element)
			{
				_filter_out.addElement((Element)o);
 			}
		}
	}

	
	public void getTypes()
	{
		ArrayList<String> cnSet = getTypedDiscreteSet(CNTYPENAME, CNATTRNAME);
		ArrayList<String> mcnSet = getTypedDiscreteSet(MCNTYPENAME, MCNATTRNAME);
		ArrayList<String> cpSet = getTypedDiscreteSet(CPTYPENAME, CPATTRNAME);
		Element element = null;

		if (_mode != null && _mode.equals(ENGINEERING_MODE))
		{
			for(String s : cnSet)
			{
				element = new Element();
				element.addAtt(new Att(OBJECTTYPE, ECN));
				element.addAtt(new Att(CONSTRAINT, s));
				_subTypes.addElement(element);
			}

			for(String s : cpSet)
			{
				element = new Element();
				element.addAtt(new Att(OBJECTTYPE, ECP));
				element.addAtt(new Att(CONSTRAINT, s));
				_subTypes.addElement(element);
			}
		}
		else
		{
			for(String s : mcnSet)
			{
				element = new Element();
				element.addAtt(new Att(OBJECTTYPE, MCN));
				element.addAtt(new Att(CONSTRAINT, s));
				_subTypes.addElement(element);
			}
		}		
	}

=============================

SGVUtils.java

	public static QueryResult searchBE( String beType, String filter ) throws Exception {
//		System.out.println( "\n SGVUtils.searchBE beType=" + beType + "	filter=" + filter );
		if ( SERVER ) {

//			String typePrefixefix = WTProperties.getLocalProperties().getProperty( "ext.sgv.softTypes.prefix", "net.atcsg.if.za.aa5webde002.SGV" );
			String typePrefix = SGVProperties.getProperty( "ext.sgv.softTypes.prefix", "net.atcsg.if.za.aa5webde004.SGV" );
			TypeIdentifier typeId = TypeHelper.getTypeIdentifier( "WCTYPE|wt.doc.WTDocument|" + typePrefix + ".SgvBusinessEntity|" + typePrefix + "." + beType.substring( 2 ) );
//			System.out.println( "TypeIdentifier=" + typeId );
			filter = filter.replace( '*', '%' );
			if ( !filter.startsWith( "%" ) ) {
				filter = "%" + filter;
			}
			if ( !filter.endsWith( "%" ) ) {
				filter = filter + "%";
			}
			QuerySpec qs = new QuerySpec( wt.doc.WTDocument.class );
			qs.setAdvancedQueryEnabled( true );
			SearchCondition sc = wt.type.TypedUtility.getSearchCondition( typeId, true );
			if ( sc == null ) {
				System.out.println( "SGVUtils.searchBE: Non trovato il TypeIdentifier per il tipo =" + beType );
				return null;
			}
			qs.appendWhere( sc );
			qs.appendAnd();
			qs.appendSearchCondition( new SearchCondition( WTDocument.class, "master>name", SearchCondition.LIKE, filter.replace( '*', '%' ) + "%", false ) );
			qs.appendAnd();
			qs.appendWhere( new SearchCondition( WTDocument.class, Iterated.ITERATION_INFO + "." + IterationInfo.LATEST, SearchCondition.IS_TRUE ) );
			System.out.println( " search cond=" + sc.toString() );
			QueryResult qr = PersistenceHelper.manager.find( qs );
			return qr;

		} else {

			try {
				RemoteMethodServer method = RemoteMethodServer.getDefault();
//				method.setUserName(user);
//				method.setPassword(password);
				Class aclass[] = { String.class, String.class };
				Object aobj[] = { beType, filter };
				return (QueryResult) method.invoke( "searchBE", "ext.sgv.utility.SGVUtils", null, aclass, aobj );
			} catch ( InvocationTargetException invocationtargetexception ) {
				Throwable throwable = invocationtargetexception.getTargetException();
				if ( throwable instanceof WTException ) {
					throw (WTException) throwable;
				} else {
					Object aobj1[] = { "searchBE" };
					throw new WTException( throwable, "wt.fc.fcResource", "0", aobj1 );
				}
			} catch ( RemoteException remoteexception ) {
				Object aobj2[] = { "searchBE" };
				throw new WTException( remoteexception, "wt.fc.fcResource", "0", aobj2 );
			}

		}
	}	 // end-searchBE
