BUG-14990 - NEW FEATURE, permitir especificar extensiones para los inputdocs.

Nuevo campo en Input Documents, dicho campo acepta las extensiones de los inputdocs permitidos.
Se agregaron validaciones para que funcione correctamente
This commit is contained in:
jennylee
2014-08-29 15:17:43 -04:00
parent db57d8c81c
commit a585a9a4b1
15 changed files with 331 additions and 19 deletions

View File

@@ -81,6 +81,8 @@ class InputDocumentMapBuilder
$tMap->addColumn('INP_DOC_TAGS', 'InpDocTags', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('INP_DOC_TYPE_FILE', 'InpDocTypeFile', 'string', CreoleTypes::VARCHAR, false, 200);
$tMap->addValidator('INP_DOC_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Input Document UID can be no larger than 32 in size');
$tMap->addValidator('INP_DOC_UID', 'required', 'propel.validator.RequiredValidator', '', 'Input Document UID is required.');

View File

@@ -75,6 +75,12 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
*/
protected $inp_doc_tags;
/**
* The value for the inp_doc_type_file field.
* @var string
*/
protected $inp_doc_type_file = '*.*';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -177,6 +183,17 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
return $this->inp_doc_tags;
}
/**
* Get the [inp_doc_type_file] column value.
*
* @return string
*/
public function getInpDocTypeFile()
{
return $this->inp_doc_type_file;
}
/**
* Set the value of [inp_doc_uid] column.
*
@@ -353,6 +370,28 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
} // setInpDocTags()
/**
* Set the value of [inp_doc_type_file] column.
*
* @param string $v new value
* @return void
*/
public function setInpDocTypeFile($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->inp_doc_type_file !== $v || $v === '*.*') {
$this->inp_doc_type_file = $v;
$this->modifiedColumns[] = InputDocumentPeer::INP_DOC_TYPE_FILE;
}
} // setInpDocTypeFile()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -386,12 +425,14 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$this->inp_doc_tags = $rs->getString($startcol + 7);
$this->inp_doc_type_file = $rs->getString($startcol + 8);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 8; // 8 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 9; // 9 = InputDocumentPeer::NUM_COLUMNS - InputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating InputDocument object", $e);
@@ -619,6 +660,9 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
case 7:
return $this->getInpDocTags();
break;
case 8:
return $this->getInpDocTypeFile();
break;
default:
return null;
break;
@@ -647,6 +691,7 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$keys[5] => $this->getInpDocVersioning(),
$keys[6] => $this->getInpDocDestinationPath(),
$keys[7] => $this->getInpDocTags(),
$keys[8] => $this->getInpDocTypeFile(),
);
return $result;
}
@@ -702,6 +747,9 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
case 7:
$this->setInpDocTags($value);
break;
case 8:
$this->setInpDocTypeFile($value);
break;
} // switch()
}
@@ -757,6 +805,10 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$this->setInpDocTags($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setInpDocTypeFile($arr[$keys[8]]);
}
}
/**
@@ -800,6 +852,10 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$criteria->add(InputDocumentPeer::INP_DOC_TAGS, $this->inp_doc_tags);
}
if ($this->isColumnModified(InputDocumentPeer::INP_DOC_TYPE_FILE)) {
$criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $this->inp_doc_type_file);
}
return $criteria;
}
@@ -868,6 +924,8 @@ abstract class BaseInputDocument extends BaseObject implements Persistent
$copyObj->setInpDocTags($this->inp_doc_tags);
$copyObj->setInpDocTypeFile($this->inp_doc_type_file);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseInputDocumentPeer
const CLASS_DEFAULT = 'classes.model.InputDocument';
/** The total number of columns. */
const NUM_COLUMNS = 8;
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -55,6 +55,9 @@ abstract class BaseInputDocumentPeer
/** the column name for the INP_DOC_TAGS field */
const INP_DOC_TAGS = 'INPUT_DOCUMENT.INP_DOC_TAGS';
/** the column name for the INP_DOC_TYPE_FILE field */
const INP_DOC_TYPE_FILE = 'INPUT_DOCUMENT.INP_DOC_TYPE_FILE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -66,10 +69,10 @@ abstract class BaseInputDocumentPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('InpDocUid', 'ProUid', 'InpDocFormNeeded', 'InpDocOriginal', 'InpDocPublished', 'InpDocVersioning', 'InpDocDestinationPath', 'InpDocTags', ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID, InputDocumentPeer::PRO_UID, InputDocumentPeer::INP_DOC_FORM_NEEDED, InputDocumentPeer::INP_DOC_ORIGINAL, InputDocumentPeer::INP_DOC_PUBLISHED, InputDocumentPeer::INP_DOC_VERSIONING, InputDocumentPeer::INP_DOC_DESTINATION_PATH, InputDocumentPeer::INP_DOC_TAGS, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID', 'PRO_UID', 'INP_DOC_FORM_NEEDED', 'INP_DOC_ORIGINAL', 'INP_DOC_PUBLISHED', 'INP_DOC_VERSIONING', 'INP_DOC_DESTINATION_PATH', 'INP_DOC_TAGS', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
BasePeer::TYPE_PHPNAME => array ('InpDocUid', 'ProUid', 'InpDocFormNeeded', 'InpDocOriginal', 'InpDocPublished', 'InpDocVersioning', 'InpDocDestinationPath', 'InpDocTags', 'InpDocTypeFile', ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID, InputDocumentPeer::PRO_UID, InputDocumentPeer::INP_DOC_FORM_NEEDED, InputDocumentPeer::INP_DOC_ORIGINAL, InputDocumentPeer::INP_DOC_PUBLISHED, InputDocumentPeer::INP_DOC_VERSIONING, InputDocumentPeer::INP_DOC_DESTINATION_PATH, InputDocumentPeer::INP_DOC_TAGS, InputDocumentPeer::INP_DOC_TYPE_FILE, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID', 'PRO_UID', 'INP_DOC_FORM_NEEDED', 'INP_DOC_ORIGINAL', 'INP_DOC_PUBLISHED', 'INP_DOC_VERSIONING', 'INP_DOC_DESTINATION_PATH', 'INP_DOC_TAGS', 'INP_DOC_TYPE_FILE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -79,10 +82,10 @@ abstract class BaseInputDocumentPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('InpDocUid' => 0, 'ProUid' => 1, 'InpDocFormNeeded' => 2, 'InpDocOriginal' => 3, 'InpDocPublished' => 4, 'InpDocVersioning' => 5, 'InpDocDestinationPath' => 6, 'InpDocTags' => 7, ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID => 0, InputDocumentPeer::PRO_UID => 1, InputDocumentPeer::INP_DOC_FORM_NEEDED => 2, InputDocumentPeer::INP_DOC_ORIGINAL => 3, InputDocumentPeer::INP_DOC_PUBLISHED => 4, InputDocumentPeer::INP_DOC_VERSIONING => 5, InputDocumentPeer::INP_DOC_DESTINATION_PATH => 6, InputDocumentPeer::INP_DOC_TAGS => 7, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID' => 0, 'PRO_UID' => 1, 'INP_DOC_FORM_NEEDED' => 2, 'INP_DOC_ORIGINAL' => 3, 'INP_DOC_PUBLISHED' => 4, 'INP_DOC_VERSIONING' => 5, 'INP_DOC_DESTINATION_PATH' => 6, 'INP_DOC_TAGS' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
BasePeer::TYPE_PHPNAME => array ('InpDocUid' => 0, 'ProUid' => 1, 'InpDocFormNeeded' => 2, 'InpDocOriginal' => 3, 'InpDocPublished' => 4, 'InpDocVersioning' => 5, 'InpDocDestinationPath' => 6, 'InpDocTags' => 7, 'InpDocTypeFile' => 8, ),
BasePeer::TYPE_COLNAME => array (InputDocumentPeer::INP_DOC_UID => 0, InputDocumentPeer::PRO_UID => 1, InputDocumentPeer::INP_DOC_FORM_NEEDED => 2, InputDocumentPeer::INP_DOC_ORIGINAL => 3, InputDocumentPeer::INP_DOC_PUBLISHED => 4, InputDocumentPeer::INP_DOC_VERSIONING => 5, InputDocumentPeer::INP_DOC_DESTINATION_PATH => 6, InputDocumentPeer::INP_DOC_TAGS => 7, InputDocumentPeer::INP_DOC_TYPE_FILE => 8, ),
BasePeer::TYPE_FIELDNAME => array ('INP_DOC_UID' => 0, 'PRO_UID' => 1, 'INP_DOC_FORM_NEEDED' => 2, 'INP_DOC_ORIGINAL' => 3, 'INP_DOC_PUBLISHED' => 4, 'INP_DOC_VERSIONING' => 5, 'INP_DOC_DESTINATION_PATH' => 6, 'INP_DOC_TAGS' => 7, 'INP_DOC_TYPE_FILE' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -199,6 +202,8 @@ abstract class BaseInputDocumentPeer
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_TAGS);
$criteria->addSelectColumn(InputDocumentPeer::INP_DOC_TYPE_FILE);
}
const COUNT = 'COUNT(INPUT_DOCUMENT.INP_DOC_UID)';