diff --git a/docs/pt/.~lock.Relatorio parcial - TCC-I-5.odt# b/docs/pt/.~lock.Relatorio parcial - TCC-I-5.odt# new file mode 100644 index 0000000..261f0d1 --- /dev/null +++ b/docs/pt/.~lock.Relatorio parcial - TCC-I-5.odt# @@ -0,0 +1 @@ +Felipe ,felipe,laptop,24.03.2011 15:39,file:///home/felipe/.openoffice.org/3; \ No newline at end of file diff --git a/docs/pt/Relatorio parcial - TCC-I-5.odt b/docs/pt/Relatorio parcial - TCC-I-5.odt index 66c9380..5e47426 100755 Binary files a/docs/pt/Relatorio parcial - TCC-I-5.odt and b/docs/pt/Relatorio parcial - TCC-I-5.odt differ diff --git a/mind3rd/API/L10N/en.php b/mind3rd/API/L10N/en.php index bbeb769..b83ed57 100755 --- a/mind3rd/API/L10N/en.php +++ b/mind3rd/API/L10N/en.php @@ -47,6 +47,8 @@ class En { $this->messages['analyseFirst'] = "You will need to analyze the project. It has not been analyzed yet.Execute the 'analyze' command.\n"; $this->messages['permissionDenied'] = Mind::message("Permission denied to change/create/delete files.\nPlease, allow the system to change files in mind's root directory", '[Fail]', false);; $this->messages['additionalCounterCol'] = "This field was automatically added to allow an insertion of a new tuple using repeated values for the other keys."; + $this->messages['commitChanged'] = Mind::message("VCS: Commited to version %s", '[Ok]', false); + $this->messages['commitUnchanged'] = Mind::message("VCS: Nothing to commit. Still in version %s", '[Ok]', false); $this->messages['http_invalid_requisition'] = <<messages['sourceFileNotFound'] = Mind::message("O arquivo fonte '%s' não foi encontrado para o projeto atual.", '[Fail]', false); $this->messages['permissionDenied'] = Mind::message("Permissão negada pra acessar, criar, alterar ou excluir um arquivo.\nPor favor, libere acesso ao sistema para o diretório raíz do Mind.\n", '[Fail]', false); $this->messages['additionalCounterCol'] = "Campo adicionado automaticamente, a ser usado como diferencial para cada tupla, a fim de possibilizar um novo registro utilizando as mesmas demais chaves."; + $this->messages['commitChanged'] = Mind::message("VCS: Consignado para versão %s", '[Ok]', false); + $this->messages['commitUnchanged'] = Mind::message("VCS: Nada a consignar. Ainda na versão %s", '[Ok]', false); $this->messages['http_invalid_requisition'] = << + * @license licenses/mind3rd.license */ - namespace DAO; /** - * Description of Project + * Deals with the SQLite to retrieve or interact with project's information. + * It deals a lot with version control of the current project. * + * @package VCS + * @subpackage DAO * @author felipe */ class Project{ @@ -19,6 +25,14 @@ class Project{ public $originalCode= ''; public $framework= ''; + /** + * Gets the list of entities in the current version of the analyzed project. + * It returns an array with all the entity's name, id and version. + * + * @param integer $vs + * @return Array An array with all the entities for the project in the curret + * or passed(if passed) version. + */ public function getCurrentEntities($vs=false) { $qr= "SELECT entity.name as name, @@ -36,6 +50,15 @@ class Project{ return $entities; } + /** + * Inserts the passed property into the SQLite database. + * It inserts the passed property as a property of the table with the + * id equals to the passed $enKey. + * + * @param \MindProperty $prop + * @param integer $enKey + * @return boolean True if everything went ok, an error otherwise + */ public function insertProperty(\MindProperty $prop, $enKey) { $refs= ""; @@ -69,9 +92,17 @@ class Project{ ".$enKey.", '".$refs."' )"; - $this->db->execute($qr); + return $this->db->execute($qr); } + /** + * Get all the properties of the passed entity. + * It returns an associative array(with the property name in each index) of + * all the properties the passed entity has. + * + * @param array $entity + * @return Array + */ public function getProperties(Array $entity) { $qr= "select pk_property, @@ -97,6 +128,14 @@ class Project{ return $ret; } + /** + * Marks an entity as changed from the last version. + * It updates the entity's status to changed, in the previous version, + * the new version will have it with the OK flag. + * + * @param array $en + * @return boolean True in case of success, otherwise, generates an error + */ public function markAsChanged(Array $en) { $qr= "UPDATE entity @@ -105,6 +144,14 @@ class Project{ return $this->db->execute($qr); } + /** + * Marks an entity as dropped from the last version. + * The next version has not the passed entity, so, it will be marked + * as dropped, in the previous version. + * + * @param array $en + * @return boolean True in case of success, otherwise, generates an error + */ public function markAsDopped(Array $en) { $qr= "UPDATE entity @@ -113,6 +160,12 @@ class Project{ return $this->db->execute($qr); } + /** + * Inserts a new version into the SQLite database. + * It also starts the versonId variable to the next version. + * + * @return boolean True in case of success, otherwise, generates an error + */ public function addNewVersion() { $this->data['version']++; @@ -149,6 +202,16 @@ class Project{ return false; } + /** + * Inserts an entity into the SQLite database. + * Adds an entity into the database, marking it with the passed status + * and version. + * + * @param \MindEntity $entity + * @param integer $vs + * @param integer $status + * @return integer the inserted entity id(the primary key, itself) + */ public function insertEntity(\MindEntity $entity, $vs=1, $status=\COMMIT_STATUS_OK) @@ -177,6 +240,9 @@ class Project{ return $enKey; } + /** + * The constructor. + */ public function __construct() { $this->db= new \MindDB(); diff --git a/mind3rd/API/classes/DAO/ProjectFactory.php b/mind3rd/API/classes/DAO/ProjectFactory.php index 5590f1d..4244b92 100644 --- a/mind3rd/API/classes/DAO/ProjectFactory.php +++ b/mind3rd/API/classes/DAO/ProjectFactory.php @@ -1,12 +1,18 @@ + * @license licenses/mind3rd.license */ namespace DAO; /** - * TableFactory: will work with the DAO\Table class + * ProjectFactory: will work with the DAO\Project class. + * This class will deal with the SQLite database to check for Project's + * changes. * * @package VCS * @subpackage DAO @@ -14,6 +20,13 @@ namespace DAO; */ class ProjectFactory extends Project{ + /** + * Returns if the entity from the SQLite is the same as the entity in the Memory + * + * @param array $entity1 + * @param \MindEntity $entity2 + * @return boolean + */ public function areDifferent(Array $entity1, \MindEntity $entity2) { $props= $this->getProperties($entity1); @@ -55,6 +68,15 @@ class ProjectFactory extends Project{ return false; } + /** + * Saves the current entities + * + * It will persist the current entities into the SQLite database. + * This will also verifies the changes in the previous version and + * make the necessary changes. + * + * @param Array &$currentEntities + */ public function saveEntities(&$currentEntities) { $enKey= null; @@ -86,21 +108,25 @@ class ProjectFactory extends Project{ foreach($currentEntities as $en) { $commited= true; - echo "DROPPING ".$en['name']."\n"; $this->markAsDopped($en); } if($commited) - echo "VCS: Commited to version ".$this->data['version']."\n"; + \Mind::write('commitChanged', true, $this->data['version']); else { $this->data['version']--; - echo "VCS: Nothing to commit...still in version ". - $this->data['version']."\n"; + \Mind::write('commitUnchanged', true, $this->data['version']); } $this->changed= $commited; } + /** + * Gets the data from the current version. + * + * @param integer $vs + * @return Array The current version id, version and the project's creator + */ public function getCurrentVersion($vs= false) { $qr_newProj= "SELECT pk_version, @@ -121,6 +147,12 @@ class ProjectFactory extends Project{ return $data; } + /** + * Commits the current data to the SQLite database. + * It will commit the analyzed structure to the databse into a + * new version of the current project, or return a message + * of "unchanged" + */ public function commit() { $this->changed= false; @@ -141,6 +173,12 @@ class ProjectFactory extends Project{ $this->db->execute("COMMIT"); } + /** + * The DAO\ProjectFactory constructor + * It calls the DAO\Project's constructor + * @param array $projectData + * @param integer $vs + */ public function __construct(Array $projectData, $vs=false) { parent::__construct(); diff --git a/mind3rd/API/classes/DAO/Table.php b/mind3rd/API/classes/DAO/Table.php deleted file mode 100644 index 4b17106..0000000 --- a/mind3rd/API/classes/DAO/Table.php +++ /dev/null @@ -1,19 +0,0 @@ -name. PROPERTY_SEPARATOR. diff --git a/mind3rd/API/cortex/analyst/Normalizer.php b/mind3rd/API/cortex/analyst/Normalizer.php index 2eaf509..9e51b57 100755 --- a/mind3rd/API/cortex/analyst/Normalizer.php +++ b/mind3rd/API/cortex/analyst/Normalizer.php @@ -292,6 +292,8 @@ ->setRefTo($relation->focus, $pk); if(!$entity->selfRef) $fk->setRequired(true); + if($relation->linkType == 'must') + $fk->setRequired (true); if($relation->uniqueRef) { if(!$entity->linkTable|| diff --git a/mind3rd/API/languages/pt/ignore.list b/mind3rd/API/languages/pt/ignore.list index 501c034..78d60f9 100755 --- a/mind3rd/API/languages/pt/ignore.list +++ b/mind3rd/API/languages/pt/ignore.list @@ -6,7 +6,14 @@ aos que bem também +tambem tanto somente por -em \ No newline at end of file +em +no +na +mínimo +máximo +minimo +maximo \ No newline at end of file diff --git a/projects b/projects new file mode 120000 index 0000000..e614987 --- /dev/null +++ b/projects @@ -0,0 +1 @@ +mind3rd/projects/ \ No newline at end of file