-added annotations

-added link to projects
-removed unused files
-removed useless message
Esse commit está contido em:
Felipe Nascimento de Moura
2011-03-24 18:49:45 -03:00
commit c0dc18d2aa
12 arquivos alterados com 138 adições e 53 exclusões
@@ -0,0 +1 @@
Felipe ,felipe,laptop,24.03.2011 15:39,file:///home/felipe/.openoffice.org/3;
Arquivo binário não exibido.
+2
Ver Arquivo
@@ -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'] = <<<MESSAGE
Invalid HTTP requisition.
+2
Ver Arquivo
@@ -54,6 +54,8 @@ class pt {
$this->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'] = <<<MESSAGE
Requisição HTTP inválida.
+73 -7
Ver Arquivo
@@ -1,14 +1,20 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
/**
* This file is part of TheWebMind 3rd generation.
*
* Notice that, these packages are being used only for documentation,
* not to organize the classes.
*
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
* @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();
+47 -9
Ver Arquivo
@@ -1,12 +1,18 @@
<?php
/*
* This file is part of theWebMind Project.
* It offers features to deal with the project table into the database
/**
* This file is part of TheWebMind 3rd generation.
*
* Notice that, these packages are being used only for documentation,
* not to organize the classes.
*
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
* @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();
-19
Ver Arquivo
@@ -1,19 +0,0 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace DAO;
/**
* Description of Table
*
* @author felipe
*/
class Table extends \MindDB{
public function __construct()
{
}
}
-15
Ver Arquivo
@@ -1,15 +0,0 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace DAO;
/**
* Description of TableFactory
*
* @author felipe
*/
class TableFactory extends Table{
//put your code here
}
+2 -2
Ver Arquivo
@@ -82,8 +82,8 @@ abstract class Normal {
MindRelation &$relation)
{
/*
* excluir a relação entre a mais forte e a mais fraca
* marcar a fk como pk
* removes the relation between the stronger to the weaker
* marks the weaker fks as pks
*/
Analyst::unsetRelation( Analyst::$relations[$rel->name.
PROPERTY_SEPARATOR.
+2
Ver Arquivo
@@ -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||
+8 -1
Ver Arquivo
@@ -6,7 +6,14 @@ aos
que
bem
também
tambem
tanto
somente
por
em
em
no
na
mínimo
máximo
minimo
maximo
Link simbólico
+1
Ver Arquivo
@@ -0,0 +1 @@
mind3rd/projects/