public static void batchRelateAll( ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) { InstanceList instances = modelRoot.getInstanceList(TransientValueReference_c.class); synchronized (instances) { Iterator<NonRootModelElement> cursor = instances.iterator(); while (cursor.hasNext()) { final TransientValueReference_c inst = (TransientValueReference_c) cursor.next(); inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots); } } }
public static TransientValueReference_c resolveInstance( ModelRoot modelRoot, java.util.UUID p_m_value_id, java.util.UUID p_m_var_id) { InstanceList instances = modelRoot.getInstanceList(TransientValueReference_c.class); TransientValueReference_c source = null; synchronized (instances) { Object[] key = {p_m_value_id}; source = (TransientValueReference_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_value_id = IdAssigner.preprocessUUID(p_m_value_id); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. source.m_var_id = IdAssigner.preprocessUUID(p_m_var_id); return source; } } // there is no instance matching the id TransientValueReference_c new_inst = new TransientValueReference_c(modelRoot, p_m_value_id, p_m_var_id); return new_inst; }
// end declare accessors public static void checkClassConsistency(ModelRoot modelRoot) { Ooaofooa.log.println( ILogger.OPERATION, "Transient Value Reference", //$NON-NLS-1$ " Operation entered: Transient Value Reference::checkClassConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return; } TransientValueReference_c[] objs = TransientValueReference_c.TransientValueReferenceInstances(modelRoot, null, false); for (int i = 0; i < objs.length; i++) { objs[i].checkConsistency(); } }
public static TransientValueReference_c createProxy( ModelRoot modelRoot, java.util.UUID p_m_value_id, java.util.UUID p_m_var_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(TransientValueReference_c.class); TransientValueReference_c new_inst = null; synchronized (instances) { Object[] key = {p_m_value_id}; new_inst = (TransientValueReference_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_value_id = IdAssigner.preprocessUUID(p_m_value_id); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. new_inst.m_var_id = IdAssigner.preprocessUUID(p_m_var_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 TransientValueReference_c(modelRoot, p_m_value_id, p_m_var_id); new_inst.m_contentPath = contentPath; } return new_inst; }
public boolean evaluate(Object candidate) { TransientValueReference_c selected = (TransientValueReference_c) candidate; boolean retval = false; retval = (selected.getValue_id().equals(m_p37420)); return retval; }
public boolean checkConsistency() { Ooaofooa.log.println( ILogger.OPERATION, "Transient Value Reference", //$NON-NLS-1$ " Operation entered: Transient Value Reference::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 TransientValueReference_c_test37419_c implements ClassQueryInterface_c { TransientValueReference_c_test37419_c(java.util.UUID p37420) { m_p37420 = p37420; } private java.util.UUID m_p37420; public boolean evaluate(Object candidate) { TransientValueReference_c selected = (TransientValueReference_c) candidate; boolean retval = false; retval = (selected.getValue_id().equals(m_p37420)); return retval; } } TransientValueReference_c[] objs37418 = TransientValueReference_c.TransientValueReferenceInstances( modelRoot, new TransientValueReference_c_test37419_c(getValue_id())); if (((objs37418.length) == 0)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Transient Value Reference", //$NON-NLS-1$ "Consistency: Object: Transient Value Reference: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs37418.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Transient Value Reference: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs37418.length), e); } retval = false; } if (((objs37418.length) > 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Transient Value Reference", //$NON-NLS-1$ "Consistency: Object: Transient Value Reference: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs37418.length) + " Value_ID: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Transient Value Reference: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs37418.length) + " Value_ID: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } // Transient Value Reference is a subtype in association: rel.Numb = 801 // The supertype class is: Value class Value_c_test37424_c implements ClassQueryInterface_c { Value_c_test37424_c(java.util.UUID p37425) { m_p37425 = p37425; } private java.util.UUID m_p37425; public boolean evaluate(Object candidate) { Value_c selected = (Value_c) candidate; boolean retval = false; retval = (selected.getValue_id().equals(m_p37425)); return retval; } } Value_c[] objs37423 = Value_c.ValueInstances(modelRoot, new Value_c_test37424_c(getValue_id())); if (((objs37423.length) != 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Transient Value Reference", //$NON-NLS-1$ "Consistency: Object: Transient Value Reference: Association: 801: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs37423.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Transient Value Reference: Association: 801: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs37423.length), e); } retval = false; } // Transient Value Reference is a referring class in association: rel.Numb = 805 // The participating class is: Variable class Variable_c_test37427_c implements ClassQueryInterface_c { Variable_c_test37427_c(java.util.UUID p37428) { m_p37428 = p37428; } private java.util.UUID m_p37428; public boolean evaluate(Object candidate) { Variable_c selected = (Variable_c) candidate; boolean retval = false; retval = (selected.getVar_id().equals(m_p37428)); return retval; } } Variable_c[] objs37426 = Variable_c.VariableInstances(modelRoot, new Variable_c_test37427_c(getVar_id())); // The participant is unconditional // The multiplicity of the participant is one if (((objs37426.length) != 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Transient Value Reference", //$NON-NLS-1$ "Consistency: Object: Transient Value Reference: Association: 805: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs37426.length) + " Var_ID: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Transient Value Reference: Association: 805: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs37426.length) + " Var_ID: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } return retval; }