/** * get a string status indicator for the modelName status label, given the modelName * * @param modelName the model name to test * @return the status of the supplied model name */ private String getModelNameStatus(String sModelName) { // Check for null or zero-length if (sModelName == null || sModelName.length() == 0) { return MODEL_CREATE_ERROR_NO_NAME; // Check for valid model name } String fileNameMessage = ModelUtilities.validateModelName(sModelName, FILE_EXT); if (fileNameMessage != null) { return MODEL_CREATE_ERROR_INVALID_NAME; } // Check if already exists String sFileName = getFileName(sModelName); IPath modelFullPath = null; IPath modelRelativePath = null; if (newModelParent != null) { modelFullPath = newModelParent.getFullPath().append(sFileName); modelRelativePath = newModelParent.getProjectRelativePath().append(sFileName); } if (newModelParent != null && newModelParent.getProject().exists(modelRelativePath)) { return MODEL_CREATE_ERROR_ALREADY_EXISTS; } if (targetFilePath != null && targetFilePath.equals(modelFullPath)) { return MODEL_CREATE_ERROR_SAME_NAME_AS; } // success return MODEL_CREATE_ERROR_IS_VALID; }
private boolean isValidModelResource(Object oSelection) { boolean bResult = false; if (oSelection instanceof IResource) { try { IResource resource = (IResource) oSelection; if (ModelUtilities.isModelFile(resource)) { ModelResource mr = ModelUtil.getModelResource((IFile) resource, true); if (mr.getModelType() != null) { if (mr.getModelType().equals(newModelInfo.getModelType())) { if (mr.getPrimaryMetamodelDescriptor() != null) { if (mr.getPrimaryMetamodelDescriptor() .getNamespaceURI() .equals(newModelInfo.getModelURI())) { bResult = true; } } } } } } catch (ModelWorkspaceException mwe) { ModelerCore.Util.log(IStatus.ERROR, mwe, mwe.getMessage()); } } return bResult; }
/** * test whether the supplied modelName is valid * * @param modelName the model name to test * @return 'true' if the name is valid, 'false' if not. */ private boolean isValidModelName(String sModelName) { // Check for null or zero-length if (sModelName == null || sModelName.length() == 0) { return false; } // Check for valid model name String fileNameMessage = ModelUtilities.validateModelName(sModelName, FILE_EXT); if (fileNameMessage != null) { return false; } // Check if already exists String sFileName = getFileName(sModelName); IPath modelFullPath = null; IPath modelRelativePath = null; if (newModelParent != null) { modelFullPath = newModelParent.getFullPath().append(sFileName); modelRelativePath = newModelParent.getProjectRelativePath().append(sFileName); } if (newModelParent != null && newModelParent.getProject().exists(modelRelativePath)) { return false; } // Check if it is the same path as the relational model being generated if (targetFilePath != null && targetFilePath.equals(modelFullPath)) { return false; } // success return true; }
public Collection getEPR_queryValue() { return ModelUtilities.getOwnSlotValues(this, "EPR_query"); }
public void setEPR_queryValue(Collection EPR_query) { ModelUtilities.setOwnSlotValues(this, "EPR_query", EPR_query); }
public String getoperatorValue() { return ((String) ModelUtilities.getOwnSlotValue(this, "operator")); }
public void setoperatorValue(String operator) { ModelUtilities.setOwnSlotValue(this, "operator", operator); }
public Instance getsecond_argumentValue() { return ((Instance) ModelUtilities.getOwnSlotValue(this, "second_argument")); }
public void setsecond_argumentValue(Instance second_argument) { ModelUtilities.setOwnSlotValue(this, "second_argument", second_argument); }
public void setfirst_argumentValue(Instance first_argument) { ModelUtilities.setOwnSlotValue(this, "first_argument", first_argument); }
public Instance getcompletion_criteriaValue() { return ((Instance) ModelUtilities.getOwnSlotValue(this, "completion_criteria")); }
public void setdeferedValue(boolean defered) { ModelUtilities.setOwnSlotValue(this, "defered", new Boolean(defered)); }
public Instance getfirst_stepValue() { return ((Instance) ModelUtilities.getOwnSlotValue(this, "first_step")); }
public void setfirst_stepValue(Instance first_step) { ModelUtilities.setOwnSlotValue(this, "first_step", first_step); }
public void setlast_stepValue(Instance last_step) { ModelUtilities.setOwnSlotValue(this, "last_step", last_step); }
public Collection getstepsValue() { return ModelUtilities.getOwnSlotValues(this, "steps"); }
public void setstepsValue(Collection steps) { ModelUtilities.setOwnSlotValues(this, "steps", steps); }
public boolean isdeferedValue() { if (ModelUtilities.getOwnSlotValue(this, "defered") == null) return false; else return ((Boolean) ModelUtilities.getOwnSlotValue(this, "defered")).booleanValue(); }
public void setcompletion_criteriaValue(Instance completion_criteria) { ModelUtilities.setOwnSlotValue(this, "completion_criteria", completion_criteria); }