Merged in feature/HOR-3070 (pull request #5630)

HOR-3070

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Ronald Henry Quenta Apaza
2017-05-12 12:00:07 +00:00
committed by Julio Cesar Laura Avendaño
6 changed files with 90 additions and 10 deletions

View File

@@ -73,6 +73,8 @@ class UsersPropertiesMapBuilder
$tMap->addColumn('USR_PASSWORD_HISTORY', 'UsrPasswordHistory', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('USR_SETTING_DESIGNER', 'UsrSettingDesigner', 'string', CreoleTypes::LONGVARCHAR, false, null);
} // doBuild()
} // UsersPropertiesMapBuilder

View File

@@ -51,6 +51,12 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
*/
protected $usr_password_history;
/**
* The value for the usr_setting_designer field.
* @var string
*/
protected $usr_setting_designer;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -130,6 +136,17 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
return $this->usr_password_history;
}
/**
* Get the [usr_setting_designer] column value.
*
* @return string
*/
public function getUsrSettingDesigner()
{
return $this->usr_setting_designer;
}
/**
* Set the value of [usr_uid] column.
*
@@ -225,6 +242,28 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
} // setUsrPasswordHistory()
/**
* Set the value of [usr_setting_designer] column.
*
* @param string $v new value
* @return void
*/
public function setUsrSettingDesigner($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->usr_setting_designer !== $v) {
$this->usr_setting_designer = $v;
$this->modifiedColumns[] = UsersPropertiesPeer::USR_SETTING_DESIGNER;
}
} // setUsrSettingDesigner()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -250,12 +289,14 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$this->usr_password_history = $rs->getString($startcol + 3);
$this->usr_setting_designer = $rs->getString($startcol + 4);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = UsersPropertiesPeer::NUM_COLUMNS - UsersPropertiesPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 5; // 5 = UsersPropertiesPeer::NUM_COLUMNS - UsersPropertiesPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating UsersProperties object", $e);
@@ -471,6 +512,9 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
case 3:
return $this->getUsrPasswordHistory();
break;
case 4:
return $this->getUsrSettingDesigner();
break;
default:
return null;
break;
@@ -495,6 +539,7 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$keys[1] => $this->getUsrLastUpdateDate(),
$keys[2] => $this->getUsrLoggedNextTime(),
$keys[3] => $this->getUsrPasswordHistory(),
$keys[4] => $this->getUsrSettingDesigner(),
);
return $result;
}
@@ -538,6 +583,9 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
case 3:
$this->setUsrPasswordHistory($value);
break;
case 4:
$this->setUsrSettingDesigner($value);
break;
} // switch()
}
@@ -577,6 +625,10 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$this->setUsrPasswordHistory($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setUsrSettingDesigner($arr[$keys[4]]);
}
}
/**
@@ -604,6 +656,10 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$criteria->add(UsersPropertiesPeer::USR_PASSWORD_HISTORY, $this->usr_password_history);
}
if ($this->isColumnModified(UsersPropertiesPeer::USR_SETTING_DESIGNER)) {
$criteria->add(UsersPropertiesPeer::USR_SETTING_DESIGNER, $this->usr_setting_designer);
}
return $criteria;
}
@@ -664,6 +720,8 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$copyObj->setUsrPasswordHistory($this->usr_password_history);
$copyObj->setUsrSettingDesigner($this->usr_setting_designer);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseUsersPropertiesPeer
const CLASS_DEFAULT = 'classes.model.UsersProperties';
/** The total number of columns. */
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -43,6 +43,9 @@ abstract class BaseUsersPropertiesPeer
/** the column name for the USR_PASSWORD_HISTORY field */
const USR_PASSWORD_HISTORY = 'USERS_PROPERTIES.USR_PASSWORD_HISTORY';
/** the column name for the USR_SETTING_DESIGNER field */
const USR_SETTING_DESIGNER = 'USERS_PROPERTIES.USR_SETTING_DESIGNER';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -54,10 +57,10 @@ abstract class BaseUsersPropertiesPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('UsrUid', 'UsrLastUpdateDate', 'UsrLoggedNextTime', 'UsrPasswordHistory', ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID, UsersPropertiesPeer::USR_LAST_UPDATE_DATE, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME, UsersPropertiesPeer::USR_PASSWORD_HISTORY, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID', 'USR_LAST_UPDATE_DATE', 'USR_LOGGED_NEXT_TIME', 'USR_PASSWORD_HISTORY', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('UsrUid', 'UsrLastUpdateDate', 'UsrLoggedNextTime', 'UsrPasswordHistory', 'UsrSettingDesigner', ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID, UsersPropertiesPeer::USR_LAST_UPDATE_DATE, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME, UsersPropertiesPeer::USR_PASSWORD_HISTORY, UsersPropertiesPeer::USR_SETTING_DESIGNER, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID', 'USR_LAST_UPDATE_DATE', 'USR_LOGGED_NEXT_TIME', 'USR_PASSWORD_HISTORY', 'USR_SETTING_DESIGNER', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@@ -67,10 +70,10 @@ abstract class BaseUsersPropertiesPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrLastUpdateDate' => 1, 'UsrLoggedNextTime' => 2, 'UsrPasswordHistory' => 3, ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID => 0, UsersPropertiesPeer::USR_LAST_UPDATE_DATE => 1, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME => 2, UsersPropertiesPeer::USR_PASSWORD_HISTORY => 3, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_LAST_UPDATE_DATE' => 1, 'USR_LOGGED_NEXT_TIME' => 2, 'USR_PASSWORD_HISTORY' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrLastUpdateDate' => 1, 'UsrLoggedNextTime' => 2, 'UsrPasswordHistory' => 3, 'UsrSettingDesigner' => 4, ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID => 0, UsersPropertiesPeer::USR_LAST_UPDATE_DATE => 1, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME => 2, UsersPropertiesPeer::USR_PASSWORD_HISTORY => 3, UsersPropertiesPeer::USR_SETTING_DESIGNER => 4, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_LAST_UPDATE_DATE' => 1, 'USR_LOGGED_NEXT_TIME' => 2, 'USR_PASSWORD_HISTORY' => 3, 'USR_SETTING_DESIGNER' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@@ -179,6 +182,8 @@ abstract class BaseUsersPropertiesPeer
$criteria->addSelectColumn(UsersPropertiesPeer::USR_PASSWORD_HISTORY);
$criteria->addSelectColumn(UsersPropertiesPeer::USR_SETTING_DESIGNER);
}
const COUNT = 'COUNT(USERS_PROPERTIES.USR_UID)';

View File

@@ -2305,6 +2305,7 @@
<column name="USR_LAST_UPDATE_DATE" type="TIMESTAMP"/>
<column name="USR_LOGGED_NEXT_TIME" type="INTEGER" default="0"/>
<column name="USR_PASSWORD_HISTORY" type="LONGVARCHAR" required="false"/>
<column name="USR_SETTING_DESIGNER" type="LONGVARCHAR"/>
</table>
<table name="ADDITIONAL_TABLES">
<vendor type="mysql">

View File

@@ -1084,6 +1084,7 @@ CREATE TABLE `USERS_PROPERTIES`
`USR_LAST_UPDATE_DATE` DATETIME,
`USR_LOGGED_NEXT_TIME` INTEGER default 0,
`USR_PASSWORD_HISTORY` MEDIUMTEXT,
`USR_SETTING_DESIGNER` MEDIUMTEXT,
PRIMARY KEY (`USR_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
#-----------------------------------------------------------------------------

View File

@@ -57,6 +57,9 @@ class Project extends Api
try {
$project = Adapter\BpmnWorkflow::getStruct($prj_uid);
$userProperty = new \UsersProperties();
$property = $userProperty->loadOrCreateIfNotExists($this->getUserId());
$project['usr_setting_designer'] = isset($property['USR_SETTING_DESIGNER']) ? \G::json_decode($property['USR_SETTING_DESIGNER']) : null;
return DateTime::convertUtcToIso8601($project, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
@@ -96,6 +99,16 @@ class Project extends Api
public function doPutProject($prj_uid, $request_data)
{
try {
if (array_key_exists('usr_setting_designer', $request_data)) {
$oUserProperty = new \UsersProperties();
$property = $oUserProperty->loadOrCreateIfNotExists($this->getUserId());
$propertyArray = isset($property['USR_SETTING_DESIGNER']) ? \G::json_decode($property['USR_SETTING_DESIGNER'], true) : [];
$usrSettingDesigner = array_merge($propertyArray, $request_data['usr_setting_designer']);
$property['USR_SETTING_DESIGNER'] = \G::json_encode($usrSettingDesigner);
$oUserProperty->update($property);
unset($request_data['usr_setting_designer']);
}
Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
return Adapter\BpmnWorkflow::updateFromStruct($prj_uid, DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
} catch (\Exception $e) {