The following document contains the results of PMD's CPD 5.2.3.
Duplications
| File |
Line |
| org/efaps/db/databases/DerbyDatabase.java |
466 |
| org/efaps/db/databases/PostgreSQLDatabase.java |
634 |
super.initTableInfoUniqueKeys(_con, sqlStmt, _cache4Name);
}
/**
* {@inheritDoc}
*/
@Override
protected StringBuilder getAlterColumn(final String _columnName,
final org.efaps.db.databases.AbstractDatabase.ColumnType _columnType)
{
final StringBuilder ret = new StringBuilder()
.append(" alter ").append(getColumnQuote()).append(_columnName).append(getColumnQuote())
.append(" type ")
.append(getWriteSQLTypeName(_columnType));
return ret;
}
/**
* {@inheritDoc}
*/
@Override
protected StringBuilder getAlterColumnIsNotNull(final String _columnName,
final boolean _isNotNull)
{
final StringBuilder ret = new StringBuilder()
.append(" alter column ").append(getColumnQuote()).append(_columnName).append(getColumnQuote());
if (_isNotNull) {
ret.append(" set ");
} else {
ret.append(" drop ");
}
ret.append(" not null");
return ret;
}
/**
* {@inheritDoc}
*/
@Override
protected boolean check4NullValues(final Connection _con,
final String _tableName,
final String _columnName)
throws SQLException
{
boolean ret = true;
final StringBuilder cmd = new StringBuilder();
cmd.append("select count(*) from ").append(getTableQuote()).append(_tableName).append(getTableQuote())
.append(" where ").append(getColumnQuote()).append(_columnName).append(getColumnQuote())
.append(" is null");
|
| File |
Line |
| org/efaps/admin/user/Person.java |
775 |
| org/efaps/admin/user/Person.java |
1361 |
.append(" where ID=").append(getId());
stmt = rsrc.getConnection().createStatement();
final int rows = stmt.executeUpdate(cmd.toString());
if (rows == 0) {
Person.LOG.error("could not execute '" + cmd.toString()
+ "' to update last login information for person '" + toString() + "'");
throw new EFapsException(getClass(), "updateLastLogin.NotUpdated", cmd.toString(), getName());
}
} catch (final SQLException e) {
Person.LOG.error("could not execute '" + cmd.toString()
+ "' to update last login information for person '" + toString() + "'", e);
throw new EFapsException(getClass(), "updateLastLogin.SQLException", e, cmd.toString(), getName());
} finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (final SQLException e) {
throw new EFapsException(getClass(), "updateLastLogin.SQLException", e, cmd.toString(), getName());
}
}
rsrc.commit();
} finally {
if (rsrc != null && rsrc.isOpened()) {
rsrc.abort();
}
}
}
/**
* The instance method sets the new password for the current context user.
* Before the new password is set, some checks are made.
*
* @param _newPasswd new Password to set
* @throws EFapsException on error
* @return true if password set, else false
*/
public Status setPassword(final String _newPasswd)
|
| File |
Line |
| org/efaps/admin/datamodel/Status.java |
437 |
| org/efaps/admin/datamodel/Status.java |
512 |
boolean ret = false;
ConnectionResource con = null;
try {
final List<Object[]> values = new ArrayList<Object[]>();
con = Context.getThreadContext().getConnectionResource();
PreparedStatement stmt = null;
try {
stmt = con.getConnection().prepareStatement(_sql);
stmt.setObject(1, _criteria);
final ResultSet rs = stmt.executeQuery();
while (rs.next()) {
values.add(new Object[] {
rs.getLong(1),
rs.getLong(2),
rs.getString(3).trim(),
rs.getString(4).trim()
});
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
for (final Object[] row : values) {
final long id = (Long) row[0];
final long typeid = (Long) row[1];
final String key = (String) row[2];
|
| File |
Line |
| org/efaps/admin/datamodel/ui/DecimalWithUoMUI.java |
129 |
| org/efaps/admin/datamodel/ui/StringWithUoMUI.java |
91 |
ret.append("<input type=\"text\" size=\"").append(field.getCols())
.append("\" name=\"").append(field.getName())
.append("\" value=\"").append(value != null ? value : "*").append("\" />");
} else {
ret.append("<span><input type=\"text\" size=\"").append(field.getCols())
.append("\" name=\"").append(field.getName())
.append("\" value=\"").append(strValue != null ? strValue : "").append("\"")
.append(UIInterface.EFAPSTMPTAG).append("/>")
.append("<select name=\"").append(_fieldValue.getField().getName()).append("UoM\" size=\"1\">");
final Dimension dim = _fieldValue.getAttribute().getDimension();
for (final UoM uom : dim.getUoMs()) {
ret.append("<option value=\"").append(uom.getId());
if (uomValue == null && uom.equals(dim.getBaseUoM()) || uomValue != null && uomValue.equals(uom)) {
|
| File |
Line |
| org/efaps/db/databases/DerbyDatabase.java |
478 |
| org/efaps/db/databases/MySQLDatabase.java |
612 |
| org/efaps/db/databases/PostgreSQLDatabase.java |
646 |
.append(" type ")
.append(getWriteSQLTypeName(_columnType));
return ret;
}
/**
* {@inheritDoc}
*/
@Override
protected StringBuilder getAlterColumnIsNotNull(final String _columnName,
final boolean _isNotNull)
{
final StringBuilder ret = new StringBuilder()
.append(" alter column ").append(getColumnQuote()).append(_columnName).append(getColumnQuote());
if (_isNotNull) {
ret.append(" set ");
} else {
ret.append(" drop ");
}
ret.append(" not null");
return ret;
}
/**
* {@inheritDoc}
*/
@Override
protected boolean check4NullValues(final Connection _con,
final String _tableName,
final String _columnName)
throws SQLException
{
boolean ret = true;
final StringBuilder cmd = new StringBuilder();
cmd.append("select count(*) from ").append(getTableQuote()).append(_tableName).append(getTableQuote())
.append(" where ").append(getColumnQuote()).append(_columnName).append(getColumnQuote())
.append(" is null");
|
| File |
Line |
| org/efaps/admin/datamodel/ui/DecimalUI.java |
142 |
| org/efaps/admin/datamodel/ui/StringUI.java |
121 |
if (field.getRows() > 1) {
ret.append("<textarea type=\"text\"")
.append(" cols=\"").append(field.getCols())
.append("\" rows=\"").append(field.getRows())
.append("\" name=\"").append(field.getName()).append("\"")
.append(UIInterface.EFAPSTMPTAG).append("/>");
if (value != null) {
ret.append(StringEscapeUtils.escapeHtml4(tmp));
}
ret.append("</textarea>");
} else {
ret.append("<input type=\"text\" size=\"").append(field.getCols())
.append("\" name=\"").append(field.getName())
.append("\" value=\"").append(StringEscapeUtils.escapeHtml4(tmp)).append("\"")
.append(UIInterface.EFAPSTMPTAG).append("/>");
}
}
return ret.toString();
}
|
| File |
Line |
| org/efaps/admin/datamodel/ui/DateTimeUI.java |
60 |
| org/efaps/admin/datamodel/ui/DateUI.java |
66 |
ret = datetime.withChronology(Context.getThreadContext().getChronology()).toString(
formatter.withLocale(Context.getThreadContext().getLocale()));
}
} else if (_fieldValue.getValue() instanceof String) {
ret = (String) _fieldValue.getValue();
} else if (_fieldValue.getValue() != null) {
throw new EFapsException(this.getClass(), "getViewHtml.noDateTime", (Object[]) null);
}
return ret;
}
/**
* {@inheritDoc}
*/
@Override
public String getStringValue(final FieldValue _fieldValue)
throws EFapsException
{
String ret = null;
if (_fieldValue.getValue() != null) {
ret = _fieldValue.getValue().toString();
}
return ret;
}
/**
* {@inheritDoc}
*/
@Override
public Object getObject4Compare(final FieldValue _fieldValue)
throws EFapsException
{
Object ret;
if (_fieldValue != null && _fieldValue.getValue() instanceof DateTime) {
final DateTime datetime = (DateTime) _fieldValue.getValue();
ret = datetime.withChronology(Context.getThreadContext().getChronology());
|
| File |
Line |
| org/efaps/update/schema/datamodel/TypeUpdate.java |
751 |
| org/efaps/update/schema/ui/FormUpdate.java |
95 |
addLink(TypeUpdate.LINK2STORE, new LinkInstance(_attributes.get("name")));
} else if ("trigger".equals(value)) {
if (_tags.size() == 1) {
addEvent(new Event(_attributes.get("name"), EventType.valueOf(_attributes.get("event")),
_attributes.get("program"), _attributes.get("method"), _attributes.get("index")));
} else if ((_tags.size() == 2) && "property".equals(_tags.get(1))) {
getEvents().get(getEvents().size() - 1).addProperty(_attributes.get("name"), _text);
} else {
super.readXML(_tags, _attributes, _text);
}
} else {
super.readXML(_tags, _attributes, _text);
}
}
|
| File |
Line |
| org/efaps/admin/datamodel/attributetype/CompanyLinkType.java |
40 |
| org/efaps/admin/datamodel/attributetype/ConsortiumLinkType.java |
40 |
| org/efaps/admin/datamodel/attributetype/GroupLinkType.java |
42 |
extends PersonLinkType
{
/**
* Needed for serialization.
*/
private static final long serialVersionUID = 1L;
/**
* @param _insertUpdate insert / update SQL statement
* @param _attribute Attribute to be prepared
* @param _values values for the insert or update
* @throws SQLException if not exact one SQL column for the attribute is
* defined of the company id could not be fetched
*/
@Override
protected void prepare(final AbstractSQLInsertUpdate<?> _insertUpdate,
final Attribute _attribute,
final Object... _values)
throws SQLException
{
checkSQLColumnSize(_attribute, 1);
// if a value was explicitly set the value is used, else the company
// id from the context
if ((_values != null) && (_values.length > 0) && _values[0] != null) {
if (_values[0] instanceof Long) {
_insertUpdate.column(_attribute.getSqlColNames().get(0), (Long) _values[0]);
} else {
_insertUpdate.column(_attribute.getSqlColNames().get(0), Long.parseLong(_values[0].toString()));
}
} else {
try {
|
| File |
Line |
| org/efaps/db/AbstractPrintQuery.java |
833 |
| org/efaps/db/print/LinkFromSelect.java |
280 |
AbstractPrintQuery.LOG.debug("Executing SQL: {}", _complStmt);
List<Object[]> rows = null;
boolean cached = false;
if (isCacheEnabled()) {
final QueryKey querykey = QueryKey.get(getKey(), _complStmt);
final Cache<QueryKey, Object> cache = QueryCache.getSqlCache();
if (cache.containsKey(querykey)) {
final Object object = cache.get(querykey);
if (object instanceof List) {
rows = (List<Object[]>) object;
}
cached = true;
}
}
if (!cached) {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.getConnection().createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt);
|
| File |
Line |
| org/efaps/update/schema/datamodel/TypeUpdate.java |
754 |
| org/efaps/update/schema/ui/AbstractCollectionUpdate.java |
162 |
addEvent(new Event(_attributes.get("name"), EventType.valueOf(_attributes.get("event")),
_attributes.get("program"), _attributes.get("method"), _attributes.get("index")));
} else if ((_tags.size() == 2) && "property".equals(_tags.get(1))) {
getEvents().get(getEvents().size() - 1).addProperty(_attributes.get("name"), _text);
} else {
super.readXML(_tags, _attributes, _text);
}
} else {
super.readXML(_tags, _attributes, _text);
}
}
/**
* If a parent type in {@link #parentType} is defined, the type id is
* evaluated and added to attributes to update (if no parent type is
* defined, the parent type id is set to <code>null</code>). After the
* type is updated (or inserted if needed), all attributes must be
* updated.
*
* @param _step lifecycle step
* @param _allLinkTypes set of all links
* @throws InstallationException on error
*
* @see #parentType
* @see #attributes
*/
@Override
public void updateInDB(final UpdateLifecycle _step,
|
| File |
Line |
| org/efaps/update/schema/program/staticsource/BPMImporter.java |
73 |
| org/efaps/update/schema/program/staticsource/BPMImporter.java |
117 |
protected String evalProgramName()
throws InstallationException
{
String ret = "";
try {
final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
final DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
final Document doc = dBuilder.parse(getUrl().openStream(), AbstractSourceImporter.ENCODING);
doc.getDocumentElement().normalize();
for (final String tagName : BPMImporter.PROCESSTAGNAMES) {
final NodeList processNodeList = doc.getElementsByTagName(tagName);
if (processNodeList != null && processNodeList.getLength() > 0) {
final Node processNode = processNodeList.item(0);
if (processNode.getNodeType() == Node.ELEMENT_NODE) {
final Element eElement = (Element) processNode;
ret = eElement.getAttribute("id");
|
| File |
Line |
| org/efaps/update/schema/ui/AbstractCollectionUpdate.java |
162 |
| org/efaps/update/schema/ui/FormUpdate.java |
98 |
getEvents().add(new Event(_attributes.get("name"), EventType.valueOf(_attributes.get("event")),
_attributes.get("program"), _attributes.get("method"), _attributes.get("index")));
} else if ((_tags.size() == 2) && "property".equals(_tags.get(1))) {
getEvents().get(getEvents().size() - 1).addProperty(_attributes.get("name"), _text);
} else {
super.readXML(_tags, _attributes, _text);
}
} else {
super.readXML(_tags, _attributes, _text);
}
}
|
| File |
Line |
| org/efaps/admin/datamodel/attributetype/IntegerWithUoMType.java |
89 |
| org/efaps/admin/datamodel/attributetype/StringWithUoMType.java |
78 |
value = ((Number) _values[0]).intValue();
} else {
value = null;
}
final UoM uom;
if (_values[1] instanceof UoM) {
uom = (UoM) _values[1];
} else if ((_values[1] instanceof String) && (((String) _values[1]).length() > 0)) {
uom = Dimension.getUoM(Long.parseLong((String) _values[1]));
} else if (_values[1] instanceof Number) {
uom = Dimension.getUoM(((Number) _values[1]).longValue());
} else {
uom = null;
}
ret = new IntegerWithUoM(value, uom);
|
| File |
Line |
| org/efaps/admin/common/NumberGenerator.java |
427 |
| org/efaps/admin/user/Company.java |
307 |
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
return ret;
}
@Override
public boolean equals(final Object _obj)
{
boolean ret;
if (_obj instanceof NumberGenerator) {
|
| File |
Line |
| org/efaps/admin/datamodel/ui/FormatedStringUI.java |
36 |
| org/efaps/admin/datamodel/ui/StringUI.java |
42 |
extends AbstractUI
{
/**
* Needed for serialization.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
public String getReadOnlyHtml(final FieldValue _fieldValue)
{
final StringBuilder ret = new StringBuilder();
final Field field = _fieldValue.getField();
final Object value = _fieldValue.getValue();
if (value instanceof List<?>) {
final List<?> values = (List<?>) value;
boolean first = true;
for (final Object obj : values) {
final String tmp = obj.toString();
if (tmp != null) {
if (first) {
first = false;
} else {
ret.append("<br/>");
}
ret.append(tmp);
|
| File |
Line |
| org/efaps/admin/user/Company.java |
283 |
| org/efaps/admin/user/Group.java |
322 |
| org/efaps/admin/user/Role.java |
288 |
private static boolean getCompanyFromDB(final String _sql,
final Object _criteria)
throws CacheReloadException
{
boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
PreparedStatement stmt = null;
try {
stmt = con.getConnection().prepareStatement(_sql);
stmt.setObject(1, _criteria);
final ResultSet rs = stmt.executeQuery();
if (rs.next()) {
final long id = rs.getLong(1);
final String uuid = rs.getString(2);
final String name = rs.getString(3).trim();
final boolean status = rs.getBoolean(4);
|
| File |
Line |
| org/efaps/admin/datamodel/ui/DecimalWithUoMUI.java |
165 |
| org/efaps/admin/datamodel/ui/NumberWithUoMUI.java |
58 |
ret = DBProperties.getProperty(DecimalUI.class.getName() + ".InvalidValue");
}
return ret;
}
/**
* {@inheritDoc}
*/
@Override
public Object format(final Object _object,
final String _pattern)
throws EFapsException
{
final Object ret;
final DecimalFormat formatter
= (DecimalFormat) NumberFormat.getInstance(Context.getThreadContext().getLocale());
formatter.applyPattern(_pattern);
if (_object instanceof Object[]) {
final String tmp = formatter.format(((Object[]) _object)[0]);
((Object[]) _object)[0] = tmp;
ret = _object;
} else {
ret = formatter.format(_object);
}
return ret;
}
|
| File |
Line |
| org/efaps/admin/ui/AbstractUserInterfaceObject.java |
272 |
| org/efaps/admin/ui/field/FieldClassification.java |
93 |
}
}
}
if ((ret || AppAccessHandler.excludeMode()) && super.hasEvents(EventType.UI_ACCESSCHECK)) {
ret = false;
final List<EventDefinition> events = super.getEvents(EventType.UI_ACCESSCHECK);
final Parameter parameter = new Parameter();
parameter.put(ParameterValues.UIOBJECT, this);
parameter.put(ParameterValues.ACCESSMODE, _targetMode);
parameter.put(ParameterValues.INSTANCE, _instance);
parameter.put(ParameterValues.CALL_CMD, _callCmd);
parameter.put(ParameterValues.CALL_INSTANCE, _callInstance);
for (final EventDefinition event : events) {
final Return retIn = event.execute(parameter);
|
| File |
Line |
| org/efaps/admin/datamodel/Dimension.java |
348 |
| org/efaps/admin/datamodel/Status.java |
438 |
| org/efaps/admin/datamodel/Status.java |
513 |
ConnectionResource con = null;
try {
final List<Object[]> values = new ArrayList<Object[]>();
con = Context.getThreadContext().getConnectionResource();
PreparedStatement stmt = null;
try {
stmt = con.getConnection().prepareStatement(_sql);
stmt.setObject(1, _criteria);
final ResultSet rs = stmt.executeQuery();
while (rs.next()) {
values.add(new Object[] {
rs.getLong(1),
rs.getLong(2),
rs.getString(3).trim(),
rs.getInt(4),
|
| File |
Line |
| org/efaps/admin/user/Company.java |
304 |
| org/efaps/admin/user/Role.java |
311 |
Company.cacheCompany(role);
ret = true;
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
return ret;
}
|
| File |
Line |
| org/efaps/jaas/LoginHandler.java |
212 |
| org/efaps/jaas/LoginHandler.java |
250 |
person.assignToJAASSystem(system, persKey);
}
} catch (final IllegalAccessException e) {
LoginHandler.LOG.error("could not execute a person method for system " + system.getName(), e);
throw new EFapsException(LoginHandler.class, "IllegalAccessException", e);
} catch (final IllegalArgumentException e) {
LoginHandler.LOG.error("could not execute a person method for system " + system.getName(), e);
throw new EFapsException(LoginHandler.class, "IllegalArgumentException", e);
} catch (final InvocationTargetException e) {
LoginHandler.LOG.error("could not execute a person method for system " + system.getName(), e);
throw new EFapsException(LoginHandler.class, "InvocationTargetException", e);
}
}
}
|
| File |
Line |
| org/efaps/admin/common/NumberGenerator.java |
424 |
| org/efaps/admin/datamodel/AttributeType.java |
415 |
NumberGenerator.cacheNumberGenerator(generator);
}
ret = true;
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
return ret;
}
|
| File |
Line |
| org/efaps/bpm/BPM.java |
612 |
| org/efaps/bpm/BPM.java |
634 |
public static List<TaskSummary> getTasksAssignedAsPotentialOwner()
{
final List<TaskSummary> ret = new ArrayList<TaskSummary>();
final RuntimeEngine runtimeEngine = BPM.SMANAGER.getRuntimeEngine(EmptyContext.get());
final TaskService taskService = runtimeEngine.getTaskService();
try {
if (Context.getThreadContext().getPerson().getUUID() == null) {
BPM.LOG.error("User '{}' has no UUID assigned.", Context.getThreadContext().getPerson().getName());
} else {
final String persId = EntityMapper.getUserId(Context.getThreadContext().getPerson().getUUID());
|
| File |
Line |
| org/efaps/db/Context.java |
129 |
| org/efaps/db/Context.java |
1281 |
Context.TRANSMANAG = (TransactionManager) envCtx.lookup(INamingBinds.RESOURCE_TRANSMANAG);
try {
Context.TRANSMANAGTIMEOUT = 0;
final Map<?, ?> props = (Map<?, ?>) envCtx.lookup(INamingBinds.RESOURCE_CONFIGPROPERTIES);
if (props != null) {
final String transactionTimeoutString = (String) props.get(IeFapsProperties.TRANSACTIONTIMEOUT);
if (transactionTimeoutString != null) {
Context.TRANSMANAGTIMEOUT = Integer.parseInt(transactionTimeoutString);
}
}
} catch (final NamingException e) {
// this is actual no error, so nothing is presented
Context.TRANSMANAGTIMEOUT = 0;
}
} catch (final NamingException e) {
|
| File |
Line |
| org/efaps/admin/datamodel/Type.java |
1578 |
| org/efaps/admin/datamodel/Type.java |
1627 |
ret = rs.getLong(1);
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read child type ids", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read child type ids", e);
} finally {
if (con != null && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read child type ids", e);
}
}
}
}
return ret;
}
/**
* During the initial caching of types, the mapping does not exists but is necessary.
* @param _typeId id of the type the UUID is wanted for
* @return id of the type
* @throws CacheReloadException on error
*/
public static UUID getUUID4Id(final long _typeId)
|
| File |
Line |
| org/efaps/db/store/AbstractStoreResource.java |
271 |
| org/efaps/db/store/JDBCStoreResource.java |
147 |
.append(AbstractStoreResource.COLNAME_FILELENGTH)
.append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ")
.append(db.getSQLPart(SQLPart.WHERE)).append(" ")
.append(db.getColumnQuote()).append("ID").append(db.getColumnQuote())
.append(db.getSQLPart(SQLPart.EQUAL)).append(getGeneralID());
final PreparedStatement stmt = res.getConnection().prepareStatement(cmd.toString());
try {
stmt.setString(1, _filename);
|
| File |
Line |
| org/efaps/admin/common/NumberGenerator.java |
427 |
| org/efaps/admin/user/Role.java |
314 |
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
return ret;
}
|
| File |
Line |
| org/efaps/admin/datamodel/AttributeType.java |
418 |
| org/efaps/admin/user/Company.java |
307 |
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
return ret;
}
|
| File |
Line |
| org/efaps/admin/datamodel/ui/DecimalWithUoMUI.java |
61 |
| org/efaps/admin/datamodel/ui/DecimalWithUoMUI.java |
90 |
final Field field = _fieldValue.getField();
final Object value = _fieldValue.getValue();
if (value instanceof Object[]) {
final Object[] values = (Object[]) value;
final DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Context.getThreadContext()
.getLocale());
final String strValue = values[0] != null ? values[0] instanceof Number
? formatter.format(values[0]) : values[0].toString() : "";
final UoM uom = (UoM) values[1];
ret.append("<span><span name=\"").append(field.getName()).append("\" ")
|
| File |
Line |
| org/efaps/admin/user/Company.java |
306 |
| org/efaps/admin/user/JAASSystem.java |
516 |
| org/efaps/admin/user/Role.java |
313 |
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
|
| File |
Line |
| org/efaps/admin/common/NumberGenerator.java |
427 |
| org/efaps/admin/datamodel/AttributeType.java |
418 |
| org/efaps/admin/user/JAASSystem.java |
517 |
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read roles", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
} finally {
if ((con != null) && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read roles", e);
}
}
}
|
| File |
Line |
| org/efaps/admin/datamodel/Attribute.java |
601 |
| org/efaps/admin/datamodel/Attribute.java |
628 |
public void prepareDBInsert(final SQLInsert _insert,
final Object... _values)
throws SQLException
{
Object[] tmp = _values;
try {
final List<Return> returns = executeEvents(EventType.UPDATE_VALUE, ParameterValues.CLASS, this,
ParameterValues.OTHERS, _values);
for (final Return aRet : returns) {
if (aRet.contains(ReturnValues.VALUES)) {
tmp = (Object[]) aRet.get(ReturnValues.VALUES);
}
}
} catch (final EFapsException e) {
throw new SQLException(e);
}
this.attributeType.getDbAttrType().prepareInsert(_insert, this, tmp);
|
| File |
Line |
| org/efaps/admin/datamodel/Type.java |
1371 |
| org/efaps/admin/datamodel/Type.java |
1528 |
| org/efaps/admin/datamodel/Type.java |
1578 |
| org/efaps/admin/datamodel/Type.java |
1627 |
ret.add(new Object[] { rs.getLong(1), rs.getInt(2) });
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
} catch (final SQLException e) {
throw new CacheReloadException("could not read child type ids", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read child type ids", e);
} finally {
if (con != null && con.isOpened()) {
try {
con.abort();
} catch (final EFapsException e) {
throw new CacheReloadException("could not read child type ids", e);
}
}
}
|
| File |
Line |
| org/efaps/db/databases/OracleDatabase.java |
114 |
| org/efaps/db/databases/PostgreSQLDatabase.java |
108 |
private static final RowProcessor ROWPROCESSOR = new BasicRowProcessor()
{
/**
* Convert a <code>ResultSet</code> row into an <code>Object[]</code>.
* This implementation copies column values into the array in the same
* order they're returned from the <code>ResultSet</code>. Array
* elements will be set to <code>null</code> if the column was SQL NULL.
*
* @see org.apache.commons.dbutils.RowProcessor#toArray(java.sql.ResultSet)
* @param _rs ResultSet that supplies the array data
* @throws SQLException if a database access error occurs
* @return the newly created array
*/
@Override
public Object[] toArray(final ResultSet _rs)
throws SQLException
{
final ResultSetMetaData metaData = _rs.getMetaData();
final int cols = metaData.getColumnCount();
final Object[] result = new Object[cols];
for (int i = 0; i < cols; i++) {
switch (metaData.getColumnType(i + 1)) {
case java.sql.Types.TIMESTAMP:
result[i] = _rs.getTimestamp(i + 1);
break;
|
| File |
Line |
| org/efaps/admin/user/Person.java |
189 |
| org/efaps/admin/user/Person.java |
213 |
.from("V_USERPERSON2COMPANY", 0)
.innerJoin("T_USERABSTRACT", 1, "ID", 0, "USERABSTRACTTO")
.addPart(SQLPart.WHERE).addColumnPart(1, "STATUS").addPart(SQLPart.EQUAL).addBooleanValue(true)
.addPart(SQLPart.AND).addColumnPart(0, "USERABSTRACTFROM")
.addPart(SQLPart.EQUAL).addValuePart("?")
.addPart(SQLPart.AND).addColumnPart(0, "JAASSYSID").addPart(SQLPart.EQUAL).addValuePart("?")
.toString();
/**
* SQL select statement to select the relation to active roles.
*/
private static final String SQL_ROLE = new SQLSelect()
|
| File |
Line |
| org/efaps/admin/common/NumberGenerator.java |
404 |
| org/efaps/admin/datamodel/AttributeType.java |
379 |
private static boolean getNumberGeneratorFromDB(final String _sql,
final Object _criteria)
throws CacheReloadException
{
boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
PreparedStatement stmt = null;
try {
stmt = con.getConnection().prepareStatement(_sql);
stmt.setObject(1, _criteria);
final ResultSet rs = stmt.executeQuery();
if (rs.next()) {
final long id = rs.getLong(1);
final String name = rs.getString(2).trim();
|
| File |
Line |
| org/efaps/db/search/compare/QEqual.java |
57 |
| org/efaps/db/search/compare/QNotEqual.java |
56 |
public QEqual(final QAttribute _attribute,
final AbstractQValue... _values)
{
super(_attribute, null);
for (final AbstractQValue value : _values) {
this.values.add(value);
}
}
/**
* Get the first value from the value list.
*
* @return null if list is empty else first value
*/
@Override
public AbstractQValue getValue()
{
return this.values.isEmpty() ? null : this.values.get(0);
}
/**
* Getter method for the instance variable {@link #values}.
*
* @return value of instance variable {@link #values}
*/
public List<AbstractQValue> getValues()
{
return this.values;
}
/**
* Add a value to be included in the equal.
* @param _value value to be include
* @return this
*/
public AbstractQPart addValue(final AbstractQValue _value)
{
this.values.add(_value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public QEqual appendSQL(final SQLSelect _sql)
|
| File |
Line |
| org/efaps/jaas/LoginHandler.java |
415 |
| org/efaps/jaas/SetPasswordHandler.java |
145 |
}
/**
* The handler sets for instances of {@link NameCallback} the given
* {@link #name} and for instances of {@link PasswordCallback} the given
* {@link #password}. {@link TextOutputCallback} instances are ignored.
*
* @param _callbacks callback instances to handle
* @throws UnsupportedCallbackException for all {@link Callback}
* instances which are not {@link NameCallback},
* {@link PasswordCallback} or
* {@link TextOutputCallback}
*/
public void handle(final Callback[] _callbacks)
throws UnsupportedCallbackException
{
for (int i = 0; i < _callbacks.length; i++) {
if (_callbacks[i] instanceof ActionCallback) {
final ActionCallback ac = (ActionCallback) _callbacks[i];
ac.setMode(this.mode);
} else if (_callbacks[i] instanceof NameCallback) {
final NameCallback nc = (NameCallback) _callbacks[i];
nc.setName(this.name);
} else if (_callbacks[i] instanceof PasswordCallback) {
|
| File |
Line |
| org/efaps/admin/user/Person.java |
189 |
| org/efaps/admin/user/Person.java |
213 |
| org/efaps/admin/user/Person.java |
237 |
.from("V_USERPERSON2COMPANY", 0)
.innerJoin("T_USERABSTRACT", 1, "ID", 0, "USERABSTRACTTO")
.addPart(SQLPart.WHERE).addColumnPart(1, "STATUS").addPart(SQLPart.EQUAL).addBooleanValue(true)
.addPart(SQLPart.AND).addColumnPart(0, "USERABSTRACTFROM")
.addPart(SQLPart.EQUAL).addValuePart("?")
.addPart(SQLPart.AND).addColumnPart(0, "JAASSYSID").addPart(SQLPart.EQUAL).addValuePart("?")
.toString();
/**
* SQL select statement to select the relation to active roles.
*/
private static final String SQL_ROLE = new SQLSelect()
|