public boolean evaluate(Object candidate) { DataTypeInPackage_c selected = (DataTypeInPackage_c) candidate; boolean retval = false; retval = (selected.getPackage_id().equals(m_p55161)) & (selected.getDt_id().equals(m_p55162)); return retval; }
public static void batchRelateAll( ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) { InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class); synchronized (instances) { Iterator<NonRootModelElement> cursor = instances.iterator(); while (cursor.hasNext()) { final DataTypeInPackage_c inst = (DataTypeInPackage_c) cursor.next(); inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots); } } }
private static DataTypeInPackage_c findDataTypeInPackageInstance( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class); synchronized (instances) { for (int i = 0; i < instances.size(); ++i) { DataTypeInPackage_c x = (DataTypeInPackage_c) instances.get(i); if (test == null || test.evaluate(x)) { if (x.ensureLoaded(loadComponent)) return x; } } } return null; }
public static DataTypeInPackage_c resolveInstance( ModelRoot modelRoot, java.util.UUID p_m_package_id, java.util.UUID p_m_dt_id) { InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class); DataTypeInPackage_c source = null; synchronized (instances) { Object[] key = {p_m_package_id, p_m_dt_id}; source = (DataTypeInPackage_c) instances.get(key); if (source != null && !modelRoot.isCompareRoot()) { source.convertFromProxy(); source.batchUnrelate(); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. source.m_package_id = IdAssigner.preprocessUUID(p_m_package_id); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. source.m_dt_id = IdAssigner.preprocessUUID(p_m_dt_id); return source; } } // there is no instance matching the id DataTypeInPackage_c new_inst = new DataTypeInPackage_c(modelRoot, p_m_package_id, p_m_dt_id); return new_inst; }
public static DataTypeInPackage_c[] DataTypeInPackageInstances( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { if (loadComponent) { PersistenceManager.ensureAllInstancesLoaded(modelRoot, DataTypeInPackage_c.class); } InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class); Vector matches = new Vector(); synchronized (instances) { for (int i = 0; i < instances.size(); ++i) { DataTypeInPackage_c x = (DataTypeInPackage_c) instances.get(i); if (test == null || test.evaluate(x)) { if (x.ensureLoaded(loadComponent)) matches.add(x); } } if (matches.size() > 0) { DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new DataTypeInPackage_c[0]; } } }
public static DataTypeInPackage_c DataTypeInPackageInstance( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { DataTypeInPackage_c result = findDataTypeInPackageInstance(modelRoot, test, loadComponent); if (result == null && loadComponent) { List pmcs = PersistenceManager.findAllComponents(modelRoot, DataTypeInPackage_c.class); for (int i = 0; i < pmcs.size(); i++) { PersistableModelComponent component = (PersistableModelComponent) pmcs.get(i); if (!component.isLoaded()) { try { component.load(new NullProgressMonitor()); result = findDataTypeInPackageInstance(modelRoot, test, loadComponent); if (result != null) return result; } catch (Exception e) { CorePlugin.logError("Error Loading component", e); } } } } if (result != null && loadComponent) { result.loadProxy(); } return result; }
// end declare accessors public static void checkClassConsistency(ModelRoot modelRoot) { Ooaofooa.log.println( ILogger.OPERATION, "Data Type in Package", //$NON-NLS-1$ " Operation entered: Data Type in Package::checkClassConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return; } DataTypeInPackage_c[] objs = DataTypeInPackage_c.DataTypeInPackageInstances(modelRoot, null, false); for (int i = 0; i < objs.length; i++) { objs[i].checkConsistency(); } }
public static DataTypeInPackage_c createProxy( ModelRoot modelRoot, java.util.UUID p_m_package_id, java.util.UUID p_m_dt_id, String p_contentPath, IPath p_localPath) { ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath); // if a model root was not resolved it is most likely // due to a missing file of the proxy, defualt back to // the original model root if (resolvedModelRoot != null) modelRoot = resolvedModelRoot; InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class); DataTypeInPackage_c new_inst = null; synchronized (instances) { Object[] key = {p_m_package_id, p_m_dt_id}; new_inst = (DataTypeInPackage_c) instances.get(key); } String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath)); if (modelRoot.isNewCompareRoot()) { // for comparisons we do not want to change // the content path contentPath = p_contentPath; } if (new_inst != null && !modelRoot.isCompareRoot()) { PersistableModelComponent pmc = new_inst.getPersistableComponent(); if (pmc == null) { // dangling reference, redo this instance new_inst.batchUnrelate(); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. new_inst.m_package_id = IdAssigner.preprocessUUID(p_m_package_id); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. new_inst.m_dt_id = IdAssigner.preprocessUUID(p_m_dt_id); } } if (new_inst == null) { // there is no instance matching the id, create a proxy // if the resource doesn't exist then this will be a dangling reference new_inst = new DataTypeInPackage_c(modelRoot, p_m_package_id, p_m_dt_id); new_inst.m_contentPath = contentPath; } return new_inst; }
public boolean checkConsistency() { Ooaofooa.log.println( ILogger.OPERATION, "Data Type in Package", //$NON-NLS-1$ " Operation entered: Data Type in Package::checkConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return true; } ModelRoot modelRoot = getModelRoot(); boolean retval = true; class DataTypeInPackage_c_test55160_c implements ClassQueryInterface_c { DataTypeInPackage_c_test55160_c(java.util.UUID p55161, java.util.UUID p55162) { m_p55161 = p55161; m_p55162 = p55162; } private java.util.UUID m_p55161; private java.util.UUID m_p55162; public boolean evaluate(Object candidate) { DataTypeInPackage_c selected = (DataTypeInPackage_c) candidate; boolean retval = false; retval = (selected.getPackage_id().equals(m_p55161)) & (selected.getDt_id().equals(m_p55162)); return retval; } } DataTypeInPackage_c[] objs55159 = DataTypeInPackage_c.DataTypeInPackageInstances( modelRoot, new DataTypeInPackage_c_test55160_c(getPackage_id(), getDt_id())); if (((objs55159.length) == 0)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Data Type in Package", //$NON-NLS-1$ "Consistency: Object: Data Type in Package: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs55159.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Data Type in Package: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs55159.length), e); } retval = false; } if (((objs55159.length) > 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Data Type in Package", //$NON-NLS-1$ "Consistency: Object: Data Type in Package: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs55159.length) + " Package_ID: " + "Not Printable" + " DT_ID: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Data Type in Package: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs55159.length) + " Package_ID: " + "Not Printable" + " DT_ID: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } // Data Type in Package is a link class in association: rel.Numb = 39 // Other side // The other side class in the association is: Data Type Package class DataTypePackage_c_test55166_c implements ClassQueryInterface_c { DataTypePackage_c_test55166_c(java.util.UUID p55167) { m_p55167 = p55167; } private java.util.UUID m_p55167; public boolean evaluate(Object candidate) { DataTypePackage_c selected = (DataTypePackage_c) candidate; boolean retval = false; retval = (selected.getPackage_id().equals(m_p55167)); return retval; } } DataTypePackage_c[] objs55165 = DataTypePackage_c.DataTypePackageInstances( modelRoot, new DataTypePackage_c_test55166_c(getPackage_id())); if (((objs55165.length) > 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Data Type in Package", //$NON-NLS-1$ "Consistency: Object: Data Type in Package: Association: 39: Cardinality of other side of link is greater than 1. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs55165.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Data Type in Package: Association: 39: Cardinality of other side of link is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs55165.length), e); } retval = false; } return retval; }