id
int64 22
34.9k
| comment_id
int64 0
328
| comment
stringlengths 2
2.55k
| code
stringlengths 31
107k
| classification
stringclasses 6
values | isFinished
bool 1
class | code_context_2
stringlengths 21
27.3k
| code_context_10
stringlengths 29
27.3k
| code_context_20
stringlengths 29
27.3k
|
---|---|---|---|---|---|---|---|---|
30,992 | 1 | // FIXME Handle the ImageFileOptimizationException in one of the optimizations so it does not impact the other optimizations. | public File executeOptimization() throws IOException, InterruptedException {
final String path = workingFile.getCanonicalPath();
// FIXME Handle the ImageFileOptimizationException in one of the optimizations so it does not impact the other optimizations.
return executePngquant(executeOptipng(executePngout(executeAdvpng(executePngquant(executeOptipng(executePngout(executeAdvpng(workingFile, path), path), path), path), path), path), path), path);
} | DESIGN | true | public File executeOptimization() throws IOException, InterruptedException {
final String path = workingFile.getCanonicalPath();
// FIXME Handle the ImageFileOptimizationException in one of the optimizations so it does not impact the other optimizations.
return executePngquant(executeOptipng(executePngout(executeAdvpng(executePngquant(executeOptipng(executePngout(executeAdvpng(workingFile, path), path), path), path), path), path), path), path);
} | public File executeOptimization() throws IOException, InterruptedException {
final String path = workingFile.getCanonicalPath();
// FIXME Handle the ImageFileOptimizationException in one of the optimizations so it does not impact the other optimizations.
return executePngquant(executeOptipng(executePngout(executeAdvpng(executePngquant(executeOptipng(executePngout(executeAdvpng(workingFile, path), path), path), path), path), path), path), path);
} | public File executeOptimization() throws IOException, InterruptedException {
final String path = workingFile.getCanonicalPath();
// FIXME Handle the ImageFileOptimizationException in one of the optimizations so it does not impact the other optimizations.
return executePngquant(executeOptipng(executePngout(executeAdvpng(executePngquant(executeOptipng(executePngout(executeAdvpng(workingFile, path), path), path), path), path), path), path), path);
} |
31,003 | 0 | /**
* Creates a value representing an instance of a class type, with the values of the fields
* determined by the default member initializers only. Constructors are not considered
* when determining the values of the fields.
*/ | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} | NONSATD | true | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} |
31,003 | 1 | //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} | NONSATD | true | try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
} | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass; | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects |
31,003 | 2 | // Recursively create all the base class member variables. | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} | NONSATD | true | ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) { | if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) { | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
} |
31,003 | 3 | // TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy. | public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
}
try {
if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
}
} | DEFECT | true | }
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
} | if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field); | if (sDEBUG && nestingLevel > 0) {
System.out.println("CompositeValue.create(" + ASTTypeUtil.getType(classType) + ", " + nestingLevel + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
// Recursively create all the base class member variables.
ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
continue;
}
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
// as index a field position in classType's hierarchy.
values[fieldPos] = compValue.getSubValue(fieldPos);
}
}
}
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
for (ICPPField field : fields) {
if (field.isStatic())
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
}
record.update(field, value);
values[fieldPos] = value;
}
return new CompositeValue(null, values);
} finally {
recursionProtectionSet.remove(classType);
} |
22,813 | 0 | /**
* TODO: doc
*/ | public boolean syncPingSupplicant(AsyncChannel channel) {
Message resultMsg = channel.sendMessageSynchronously(CMD_PING_SUPPLICANT);
boolean result = (resultMsg.arg1 != FAILURE);
resultMsg.recycle();
return result;
} | DOCUMENTATION | true | public boolean syncPingSupplicant(AsyncChannel channel) {
Message resultMsg = channel.sendMessageSynchronously(CMD_PING_SUPPLICANT);
boolean result = (resultMsg.arg1 != FAILURE);
resultMsg.recycle();
return result;
} | public boolean syncPingSupplicant(AsyncChannel channel) {
Message resultMsg = channel.sendMessageSynchronously(CMD_PING_SUPPLICANT);
boolean result = (resultMsg.arg1 != FAILURE);
resultMsg.recycle();
return result;
} | public boolean syncPingSupplicant(AsyncChannel channel) {
Message resultMsg = channel.sendMessageSynchronously(CMD_PING_SUPPLICANT);
boolean result = (resultMsg.arg1 != FAILURE);
resultMsg.recycle();
return result;
} |
22,816 | 0 | /**
* TODO: doc
*/ | public void setSupplicantRunning(boolean enable) {
if (enable) {
sendMessage(CMD_START_SUPPLICANT);
} else {
sendMessage(CMD_STOP_SUPPLICANT);
}
} | DOCUMENTATION | true | public void setSupplicantRunning(boolean enable) {
if (enable) {
sendMessage(CMD_START_SUPPLICANT);
} else {
sendMessage(CMD_STOP_SUPPLICANT);
}
} | public void setSupplicantRunning(boolean enable) {
if (enable) {
sendMessage(CMD_START_SUPPLICANT);
} else {
sendMessage(CMD_STOP_SUPPLICANT);
}
} | public void setSupplicantRunning(boolean enable) {
if (enable) {
sendMessage(CMD_START_SUPPLICANT);
} else {
sendMessage(CMD_STOP_SUPPLICANT);
}
} |
22,817 | 0 | /**
* TODO: doc
*/ | public void setHostApRunning(WifiConfiguration wifiConfig, boolean enable) {
if (enable) {
sendMessage(CMD_START_AP, wifiConfig);
} else {
sendMessage(CMD_STOP_AP);
}
} | DOCUMENTATION | true | public void setHostApRunning(WifiConfiguration wifiConfig, boolean enable) {
if (enable) {
sendMessage(CMD_START_AP, wifiConfig);
} else {
sendMessage(CMD_STOP_AP);
}
} | public void setHostApRunning(WifiConfiguration wifiConfig, boolean enable) {
if (enable) {
sendMessage(CMD_START_AP, wifiConfig);
} else {
sendMessage(CMD_STOP_AP);
}
} | public void setHostApRunning(WifiConfiguration wifiConfig, boolean enable) {
if (enable) {
sendMessage(CMD_START_AP, wifiConfig);
} else {
sendMessage(CMD_STOP_AP);
}
} |
22,818 | 0 | /**
* TODO: doc
*/ | public int syncGetWifiState() {
return mWifiState.get();
} | DOCUMENTATION | true | public int syncGetWifiState() {
return mWifiState.get();
} | public int syncGetWifiState() {
return mWifiState.get();
} | public int syncGetWifiState() {
return mWifiState.get();
} |
22,819 | 0 | /**
* TODO: doc
*/ | public String syncGetWifiStateByName() {
switch (mWifiState.get()) {
case WIFI_STATE_DISABLING:
return "disabling";
case WIFI_STATE_DISABLED:
return "disabled";
case WIFI_STATE_ENABLING:
return "enabling";
case WIFI_STATE_ENABLED:
return "enabled";
case WIFI_STATE_UNKNOWN:
return "unknown state";
default:
return "[invalid state]";
}
} | DOCUMENTATION | true | public String syncGetWifiStateByName() {
switch (mWifiState.get()) {
case WIFI_STATE_DISABLING:
return "disabling";
case WIFI_STATE_DISABLED:
return "disabled";
case WIFI_STATE_ENABLING:
return "enabling";
case WIFI_STATE_ENABLED:
return "enabled";
case WIFI_STATE_UNKNOWN:
return "unknown state";
default:
return "[invalid state]";
}
} | public String syncGetWifiStateByName() {
switch (mWifiState.get()) {
case WIFI_STATE_DISABLING:
return "disabling";
case WIFI_STATE_DISABLED:
return "disabled";
case WIFI_STATE_ENABLING:
return "enabling";
case WIFI_STATE_ENABLED:
return "enabled";
case WIFI_STATE_UNKNOWN:
return "unknown state";
default:
return "[invalid state]";
}
} | public String syncGetWifiStateByName() {
switch (mWifiState.get()) {
case WIFI_STATE_DISABLING:
return "disabling";
case WIFI_STATE_DISABLED:
return "disabled";
case WIFI_STATE_ENABLING:
return "enabling";
case WIFI_STATE_ENABLED:
return "enabled";
case WIFI_STATE_UNKNOWN:
return "unknown state";
default:
return "[invalid state]";
}
} |
22,820 | 0 | /**
* TODO: doc
*/ | public int syncGetWifiApState() {
return mWifiApState.get();
} | DOCUMENTATION | true | public int syncGetWifiApState() {
return mWifiApState.get();
} | public int syncGetWifiApState() {
return mWifiApState.get();
} | public int syncGetWifiApState() {
return mWifiApState.get();
} |
22,821 | 0 | /**
* TODO: doc
*/ | public String syncGetWifiApStateByName() {
switch (mWifiApState.get()) {
case WIFI_AP_STATE_DISABLING:
return "disabling";
case WIFI_AP_STATE_DISABLED:
return "disabled";
case WIFI_AP_STATE_ENABLING:
return "enabling";
case WIFI_AP_STATE_ENABLED:
return "enabled";
case WIFI_AP_STATE_FAILED:
return "failed";
default:
return "[invalid state]";
}
} | DOCUMENTATION | true | public String syncGetWifiApStateByName() {
switch (mWifiApState.get()) {
case WIFI_AP_STATE_DISABLING:
return "disabling";
case WIFI_AP_STATE_DISABLED:
return "disabled";
case WIFI_AP_STATE_ENABLING:
return "enabling";
case WIFI_AP_STATE_ENABLED:
return "enabled";
case WIFI_AP_STATE_FAILED:
return "failed";
default:
return "[invalid state]";
}
} | public String syncGetWifiApStateByName() {
switch (mWifiApState.get()) {
case WIFI_AP_STATE_DISABLING:
return "disabling";
case WIFI_AP_STATE_DISABLED:
return "disabled";
case WIFI_AP_STATE_ENABLING:
return "enabling";
case WIFI_AP_STATE_ENABLED:
return "enabled";
case WIFI_AP_STATE_FAILED:
return "failed";
default:
return "[invalid state]";
}
} | public String syncGetWifiApStateByName() {
switch (mWifiApState.get()) {
case WIFI_AP_STATE_DISABLING:
return "disabling";
case WIFI_AP_STATE_DISABLED:
return "disabled";
case WIFI_AP_STATE_ENABLING:
return "enabling";
case WIFI_AP_STATE_ENABLED:
return "enabled";
case WIFI_AP_STATE_FAILED:
return "failed";
default:
return "[invalid state]";
}
} |
22,822 | 0 | /**
* TODO: doc
*/ | public void setDriverStart(boolean enable) {
if (enable) {
sendMessage(CMD_START_DRIVER);
} else {
sendMessage(CMD_STOP_DRIVER);
}
} | DOCUMENTATION | true | public void setDriverStart(boolean enable) {
if (enable) {
sendMessage(CMD_START_DRIVER);
} else {
sendMessage(CMD_STOP_DRIVER);
}
} | public void setDriverStart(boolean enable) {
if (enable) {
sendMessage(CMD_START_DRIVER);
} else {
sendMessage(CMD_STOP_DRIVER);
}
} | public void setDriverStart(boolean enable) {
if (enable) {
sendMessage(CMD_START_DRIVER);
} else {
sendMessage(CMD_STOP_DRIVER);
}
} |
22,823 | 0 | /**
* TODO: doc
*/ | public void setOperationalMode(int mode) {
if (DBG) log("setting operational mode to " + String.valueOf(mode));
sendMessage(CMD_SET_OPERATIONAL_MODE, mode, 0);
} | DOCUMENTATION | true | public void setOperationalMode(int mode) {
if (DBG) log("setting operational mode to " + String.valueOf(mode));
sendMessage(CMD_SET_OPERATIONAL_MODE, mode, 0);
} | public void setOperationalMode(int mode) {
if (DBG) log("setting operational mode to " + String.valueOf(mode));
sendMessage(CMD_SET_OPERATIONAL_MODE, mode, 0);
} | public void setOperationalMode(int mode) {
if (DBG) log("setting operational mode to " + String.valueOf(mode));
sendMessage(CMD_SET_OPERATIONAL_MODE, mode, 0);
} |
22,824 | 0 | /**
* TODO: doc
*/ | public List<ScanResult> syncGetScanResultsList() {
synchronized (mScanResultsLock) {
List<ScanResult> scanList = new ArrayList<ScanResult>();
for (ScanDetail result : mScanResults) {
scanList.add(new ScanResult(result.getScanResult()));
}
return scanList;
}
} | DOCUMENTATION | true | public List<ScanResult> syncGetScanResultsList() {
synchronized (mScanResultsLock) {
List<ScanResult> scanList = new ArrayList<ScanResult>();
for (ScanDetail result : mScanResults) {
scanList.add(new ScanResult(result.getScanResult()));
}
return scanList;
}
} | public List<ScanResult> syncGetScanResultsList() {
synchronized (mScanResultsLock) {
List<ScanResult> scanList = new ArrayList<ScanResult>();
for (ScanDetail result : mScanResults) {
scanList.add(new ScanResult(result.getScanResult()));
}
return scanList;
}
} | public List<ScanResult> syncGetScanResultsList() {
synchronized (mScanResultsLock) {
List<ScanResult> scanList = new ArrayList<ScanResult>();
for (ScanDetail result : mScanResults) {
scanList.add(new ScanResult(result.getScanResult()));
}
return scanList;
}
} |
22,840 | 0 | /**
* Send an ack
* @throws ForceReattemptException if the peer is no longer available
*/ | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | NONSATD | true | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} |
22,840 | 1 | // chunkEntries returns false if didn't finish | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | NONSATD | true | final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient); | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last); |
22,840 | 2 | /**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/ | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | NONSATD | true | int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last) | final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) { | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io); |
22,840 | 3 | // if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString()); | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | NONSATD | true | */
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0; | boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
} | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open"); |
22,840 | 4 | // TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open"); | public static void send(final InternalDistributedMember recipient, final int processorId,
final DM dm, Set keys) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message");
final int numSeries = 1;
final int seriesNum = 0;
// chunkEntries returns false if didn't finish
if (logger.isDebugEnabled()) {
logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient);
}
try {
boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false,
new ObjectIntProcedure() {
int msgNum = 0;
boolean last = false;
/**
* @param a byte[] chunk
* @param b positive if last chunk
* @return true to continue to next chunk
*/
public boolean executeWith(Object a, int b) {
// if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | IMPLEMENTATION | true | throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | }
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} | // if (this.last)
// throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString());
HeapDataOutputStream chunk = (HeapDataOutputStream)a;
this.last = b > 0;
try {
boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last);
return okay;
}
catch (CancelException e) {
return false;
}
}
});
if (logger.isDebugEnabled()) {
logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete"));
}
}
catch (IOException io) {
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io);
}
// TODO [bruce] pass a reference to the cache or region down here so we can do this test
//Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open");
} |
14,663 | 0 | // TODO: these could be optimised | private void initShape() {
// TODO: these could be optimised
float cx = dim * 0.5f;
float cy = dim * 0.5f + 1;
float r = (dim - 3) * 0.5f;
float rh = r * 0.4f;
for (int i = 0; i < 10; i++) {
double ang = Math.PI/180 * (i * 36 - 90);
float ri = i % 2 == 0 ? r : rh;
float x = (float) Math.cos(ang) * ri + cx;
float y = (float) Math.sin(ang) * ri + cy;
if (i == 0) {
gp.moveTo(x, y);
} else {
gp.lineTo(x, y);
}
}
gp.closePath();
} | DESIGN | true | private void initShape() {
// TODO: these could be optimised
float cx = dim * 0.5f;
float cy = dim * 0.5f + 1; | private void initShape() {
// TODO: these could be optimised
float cx = dim * 0.5f;
float cy = dim * 0.5f + 1;
float r = (dim - 3) * 0.5f;
float rh = r * 0.4f;
for (int i = 0; i < 10; i++) {
double ang = Math.PI/180 * (i * 36 - 90);
float ri = i % 2 == 0 ? r : rh;
float x = (float) Math.cos(ang) * ri + cx;
float y = (float) Math.sin(ang) * ri + cy;
if (i == 0) { | private void initShape() {
// TODO: these could be optimised
float cx = dim * 0.5f;
float cy = dim * 0.5f + 1;
float r = (dim - 3) * 0.5f;
float rh = r * 0.4f;
for (int i = 0; i < 10; i++) {
double ang = Math.PI/180 * (i * 36 - 90);
float ri = i % 2 == 0 ? r : rh;
float x = (float) Math.cos(ang) * ri + cx;
float y = (float) Math.sin(ang) * ri + cy;
if (i == 0) {
gp.moveTo(x, y);
} else {
gp.lineTo(x, y);
}
}
gp.closePath();
} |
14,669 | 0 | /* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | NONSATD | true | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy(); | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
} |
14,669 | 1 | /* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | NONSATD | true | int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null; | {
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
} | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) { |
14,669 | 2 | //Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize(); | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | DEFECT | true | if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView(); | int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets. | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/ |
14,669 | 3 | /* If there's a viewport add its preferredSize.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | NONSATD | true | view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width; | Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right; | JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height; |
14,669 | 4 | /* If there's a JScrollPane.viewportBorder, add its insets.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | NONSATD | true | prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) { | //viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) { | /* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth |
14,669 | 5 | /* If a header exists and it's visible, factor its
* preferred size in.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | NONSATD | true | prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width; | prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
* | extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the |
14,669 | 6 | /* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/ | public Dimension preferredLayoutSize(Container parent)
{
/* Sync the (now obsolete) policy fields with the
* JScrollPane.
*/
JScrollPane scrollPane = (JScrollPane)parent;
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
Insets insets = parent.getInsets();
int prefWidth = insets.left + insets.right;
int prefHeight = insets.top + insets.bottom;
/* Note that viewport.getViewSize() is equivalent to
* viewport.getView().getPreferredSize() modulo a null
* view or a view whose size was explicitly set.
*/
Dimension extentSize = null;
Dimension viewSize = null;
Component view = null;
if (viewport != null) {
extentSize = viewport.getPreferredSize();
//Bug fix: always use the preferred size for the client.
//viewSize = viewport.getViewSize();
viewSize = viewport.getView().getPreferredSize();
view = viewport.getView();
}
/* If there's a viewport add its preferredSize.
*/
if (extentSize != null) {
prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
}
if (canScroll && (viewSize.width > extentSize.width)) {
prefHeight += hsb.getPreferredSize().height;
}
}
}
Dimension dim = new Dimension(prefWidth, prefHeight);
return dim;
} | NONSATD | true | prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) { | }
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) { | prefWidth += extentSize.width;
prefHeight += extentSize.height;
}
/* If there's a JScrollPane.viewportBorder, add its insets.
*/
Border viewportBorder = scrollPane.getViewportBorder();
if (viewportBorder != null) {
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
prefWidth += vpbInsets.left + vpbInsets.right;
prefHeight += vpbInsets.top + vpbInsets.bottom;
}
/* If a header exists and it's visible, factor its
* preferred size in.
*/
if ((rowHead != null) && rowHead.isVisible()) {
prefWidth += rowHead.getPreferredSize().width;
}
if ((colHead != null) && colHead.isVisible()) {
prefHeight += colHead.getPreferredSize().height;
}
/* If a scrollbar is going to appear, factor its preferred size in.
* If the scrollbars policy is AS_NEEDED, this can be a little
* tricky:
*
* - If the view is a Scrollable then scrollableTracksViewportWidth
* and scrollableTracksViewportHeight can be used to effectively
* disable scrolling (if they're true) in their respective dimensions.
*
* - Assuming that a scrollbar hasn't been disabled by the
* previous constraint, we need to decide if the scrollbar is going
* to appear to correctly compute the JScrollPanes preferred size.
* To do this we compare the preferredSize of the viewport (the
* extentSize) to the preferredSize of the view. Although we're
* not responsible for laying out the view we'll assume that the
* JViewport will always give it its preferredSize.
*/
if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) {
if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
prefWidth += vsb.getPreferredSize().width;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true;
if (view instanceof Scrollable) {
canScroll = !((Scrollable)view).getScrollableTracksViewportHeight();
}
if (canScroll && (viewSize.height > extentSize.height)) {
prefWidth += vsb.getPreferredSize().width;
}
}
}
if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) {
if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
prefHeight += hsb.getPreferredSize().height;
}
else if ((viewSize != null) && (extentSize != null)) {
boolean canScroll = true; |
14,676 | 0 | //TODO: shouldn't this be in-fact an offline detector? | @Override
public Set<OperatorSet> detectPropertyOnline(
SearchState relevantState,
SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){
if(s1.stateID != s2.stateID){
OperatorSet opSet = new OperatorSet(EnumPrivacyProperty.PRIVATELY_NONDETERMINISTIC,true);
opSet.addAll(s1.responsibleOperators);
opSet.retainAll(s2.responsibleOperators);
if(!opSet.isEmpty()){
result.add(opSet);
}
}
}
}
return result;
} | DESIGN | true | SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result; | @Override
public Set<OperatorSet> detectPropertyOnline(
SearchState relevantState,
SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){
if(s1.stateID != s2.stateID){
OperatorSet opSet = new OperatorSet(EnumPrivacyProperty.PRIVATELY_NONDETERMINISTIC,true);
opSet.addAll(s1.responsibleOperators);
opSet.retainAll(s2.responsibleOperators);
if(!opSet.isEmpty()){ | @Override
public Set<OperatorSet> detectPropertyOnline(
SearchState relevantState,
SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){
if(s1.stateID != s2.stateID){
OperatorSet opSet = new OperatorSet(EnumPrivacyProperty.PRIVATELY_NONDETERMINISTIC,true);
opSet.addAll(s1.responsibleOperators);
opSet.retainAll(s2.responsibleOperators);
if(!opSet.isEmpty()){
result.add(opSet);
}
}
}
}
return result;
} |
14,676 | 1 | //TODO: optimize | @Override
public Set<OperatorSet> detectPropertyOnline(
SearchState relevantState,
SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){
if(s1.stateID != s2.stateID){
OperatorSet opSet = new OperatorSet(EnumPrivacyProperty.PRIVATELY_NONDETERMINISTIC,true);
opSet.addAll(s1.responsibleOperators);
opSet.retainAll(s2.responsibleOperators);
if(!opSet.isEmpty()){
result.add(opSet);
}
}
}
}
return result;
} | DESIGN | true | relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){ | @Override
public Set<OperatorSet> detectPropertyOnline(
SearchState relevantState,
SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){
if(s1.stateID != s2.stateID){
OperatorSet opSet = new OperatorSet(EnumPrivacyProperty.PRIVATELY_NONDETERMINISTIC,true);
opSet.addAll(s1.responsibleOperators);
opSet.retainAll(s2.responsibleOperators);
if(!opSet.isEmpty()){
result.add(opSet);
}
} | @Override
public Set<OperatorSet> detectPropertyOnline(
SearchState relevantState,
SearchTree tree) {
Set<OperatorSet> result = new HashSet<OperatorSet>();
//TODO: shouldn't this be in-fact an offline detector?
relevantState = tree.getSentState(relevantState.iparentID);
if(relevantState == null) return result;
//TODO: optimize
for(SearchState s1 : relevantState.successors){
for(SearchState s2 : relevantState.successors){
if(s1.stateID != s2.stateID){
OperatorSet opSet = new OperatorSet(EnumPrivacyProperty.PRIVATELY_NONDETERMINISTIC,true);
opSet.addAll(s1.responsibleOperators);
opSet.retainAll(s2.responsibleOperators);
if(!opSet.isEmpty()){
result.add(opSet);
}
}
}
}
return result;
} |
22,873 | 0 | /**
* Fill this collision map with a set of rectangles. A rectangle is added to a
* cell if it overlaps with it (that includes just touching it). Afterwards,
* each cell of the collision map should contain all rectangles that cover the
* cell.
*
* @param rectangles is a set of rectangles to insert, it must be != null
* @throws CollisionMapOutOfBoundsException if a rectangle is out of the bounds
* of this rectangle
*/ | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth());
if(endX == this.GRID_RESOLUTION_X){
endX = this.GRID_RESOLUTION_X - 1;
}
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight());
if(endY == this.GRID_RESOLUTION_Y){
endY = this.GRID_RESOLUTION_Y - 1;
}
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
map[j][i].add(rectangle);
}
}
}
} | NONSATD | true | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth());
if(endX == this.GRID_RESOLUTION_X){
endX = this.GRID_RESOLUTION_X - 1;
}
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight());
if(endY == this.GRID_RESOLUTION_Y){
endY = this.GRID_RESOLUTION_Y - 1;
}
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
map[j][i].add(rectangle);
}
}
}
} | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth());
if(endX == this.GRID_RESOLUTION_X){
endX = this.GRID_RESOLUTION_X - 1;
}
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight());
if(endY == this.GRID_RESOLUTION_Y){
endY = this.GRID_RESOLUTION_Y - 1;
}
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
map[j][i].add(rectangle);
}
}
}
} | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth());
if(endX == this.GRID_RESOLUTION_X){
endX = this.GRID_RESOLUTION_X - 1;
}
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight());
if(endY == this.GRID_RESOLUTION_Y){
endY = this.GRID_RESOLUTION_Y - 1;
}
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
map[j][i].add(rectangle);
}
}
}
} |
22,873 | 1 | // TODO Insert code for assignment 5.2.a | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth());
if(endX == this.GRID_RESOLUTION_X){
endX = this.GRID_RESOLUTION_X - 1;
}
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight());
if(endY == this.GRID_RESOLUTION_Y){
endY = this.GRID_RESOLUTION_Y - 1;
}
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
map[j][i].add(rectangle);
}
}
}
} | IMPLEMENTATION | true | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() || | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY()); | private void fillCollisionMap(Set<Rectangle> rectangles) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.a
for(Rectangle rectangle:rectangles){
if(rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth());
if(endX == this.GRID_RESOLUTION_X){
endX = this.GRID_RESOLUTION_X - 1;
}
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight());
if(endY == this.GRID_RESOLUTION_Y){
endY = this.GRID_RESOLUTION_Y - 1;
}
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){ |
22,874 | 0 | /**
* Given a rectangle, this method returns a set of potential colliding
* rectangles (rectangles in the same cells).
*
* @param rectangle the rectangle to test overlap with must be != null
* @return a set with all Rectangles that possibly overlap with rectangle
* @throws CollisionMapOutOfBoundsException if the rectangle is out of the
* bounding box for this CollisionMap
*/ | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth()) + 1;
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight()) + 1;
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
for(Rectangle re :map[j][i]){
rectangleSet.add(re);
}
}
}
return rectangleSet;
} | NONSATD | true | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth()) + 1;
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight()) + 1;
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
for(Rectangle re :map[j][i]){
rectangleSet.add(re);
}
}
}
return rectangleSet;
} | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth()) + 1;
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight()) + 1;
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
for(Rectangle re :map[j][i]){
rectangleSet.add(re);
}
}
}
return rectangleSet;
} | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth()) + 1;
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight()) + 1;
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
for(Rectangle re :map[j][i]){
rectangleSet.add(re);
}
}
}
return rectangleSet;
} |
22,874 | 1 | // TODO Insert code for assignment 5.2.b | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth()) + 1;
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight()) + 1;
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
for(Rectangle re :map[j][i]){
rectangleSet.add(re);
}
}
}
return rectangleSet;
} | IMPLEMENTATION | true | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() || | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX()); | private Set<Rectangle> getCollisionCandidates(final Rectangle rectangle) throws CollisionMapOutOfBoundsException {
// TODO Insert code for assignment 5.2.b
if(
rectangle.getX() < this.gridRectangle.getX() ||
rectangle.getX() + rectangle.getWidth() > this.gridRectangle.getX() + this.gridRectangle.getWidth() ||
rectangle.getY() < this.gridRectangle.getY() ||
rectangle.getY() + rectangle.getHeight() > this.gridRectangle.getY() + this.gridRectangle.getHeight()
){
throw new CollisionMapOutOfBoundsException("a rectangle is out of the bounds of this rectangle");
}
Set<Rectangle> rectangleSet = new HashSet<>();
int startX = (int)transformX(rectangle.getX());
int startY = (int)transformY(rectangle.getY());
int endX = (int)transformX(rectangle.getX() + rectangle.getWidth()) + 1;
int endY = (int)transformY(rectangle.getY() + rectangle.getHeight()) + 1;
for(int i = startX; i <= endX; i++){
for(int j = startY; j<=endY; j++){
for(Rectangle re :map[j][i]){
rectangleSet.add(re);
}
}
} |
22,875 | 0 | /**
* Check if the given rectangle collides with rectangles in the
* {@link CollisionMap}.
*
* @param rectangle the rectangle to check for collision
* @return true if the given rectangle intersects one of the rectangles in the
* collision map.
* @throws IllegalArgumentException if rectangle is null
*/ | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}finally {
return flag;
}
} | NONSATD | true | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}finally {
return flag;
}
} | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}finally {
return flag;
}
} | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}finally {
return flag;
}
} |
22,875 | 1 | // TODO Insert code for assignment 5.2.c | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}finally {
return flag;
}
} | IMPLEMENTATION | true | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null"); | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
} | public boolean collide(final Rectangle rectangle) {
// TODO Insert code for assignment 5.2.c
if(rectangle == null){
throw new IllegalArgumentException("rectangle is null");
}
boolean flag = false;
try{
Set<Rectangle> rectangleSet = this.getCollisionCandidates(rectangle);
for(Rectangle re:rectangleSet){
if(re.intersects(rectangle)){
flag = true;
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}finally {
return flag;
}
} |
14,690 | 0 | // TODO: 8/11/20 defensively copy all collections and check for nulls? | public MapperBuilder withInputNames(Iterable<String> inputNames) {
Objects.requireNonNull(inputNames);
this.inputNames = inputNames;
return this;
} | IMPLEMENTATION | true | public MapperBuilder withInputNames(Iterable<String> inputNames) {
Objects.requireNonNull(inputNames);
this.inputNames = inputNames;
return this;
} | public MapperBuilder withInputNames(Iterable<String> inputNames) {
Objects.requireNonNull(inputNames);
this.inputNames = inputNames;
return this;
} | public MapperBuilder withInputNames(Iterable<String> inputNames) {
Objects.requireNonNull(inputNames);
this.inputNames = inputNames;
return this;
} |
14,698 | 0 | // TODO: optimize | private <AH extends AssignmentHolderType> Collection<EvaluatedAssignment<AH>> evaluateAssignments(AH assignmentHolder, Collection<AssignmentType> assignments, boolean virtual, AssignmentEvaluator<AH> assignmentEvaluator, Task task, OperationResult result) {
List<EvaluatedAssignment<AH>> evaluatedAssignments = new ArrayList<>();
RepositoryCache.enter(cacheConfigurationManager);
try {
for (AssignmentType assignmentType: assignments) {
try {
PrismContainerDefinition definition = assignmentType.asPrismContainerValue().getDefinition();
if (definition == null) {
// TODO: optimize
definition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(AssignmentHolderType.class).findContainerDefinition(AssignmentHolderType.F_ASSIGNMENT);
}
ItemDeltaItem<PrismContainerValue<AssignmentType>,PrismContainerDefinition<AssignmentType>> assignmentIdi =
new ItemDeltaItem<>(LensUtil.createAssignmentSingleValueContainer(assignmentType), definition);
EvaluatedAssignment<AH> assignment = assignmentEvaluator.evaluate(assignmentIdi, PlusMinusZero.ZERO, false, assignmentHolder, assignmentHolder.toString(), virtual, task, result);
evaluatedAssignments.add(assignment);
} catch (SchemaException | ObjectNotFoundException | ExpressionEvaluationException | PolicyViolationException | SecurityViolationException | ConfigurationException | CommunicationException e) {
LOGGER.error("Error while processing assignment of {}: {}; assignment: {}",
assignmentHolder, e.getMessage(), assignmentType, e);
}
}
} finally {
RepositoryCache.exit();
}
return evaluatedAssignments;
} | DESIGN | true | PrismContainerDefinition definition = assignmentType.asPrismContainerValue().getDefinition();
if (definition == null) {
// TODO: optimize
definition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(AssignmentHolderType.class).findContainerDefinition(AssignmentHolderType.F_ASSIGNMENT);
} | private <AH extends AssignmentHolderType> Collection<EvaluatedAssignment<AH>> evaluateAssignments(AH assignmentHolder, Collection<AssignmentType> assignments, boolean virtual, AssignmentEvaluator<AH> assignmentEvaluator, Task task, OperationResult result) {
List<EvaluatedAssignment<AH>> evaluatedAssignments = new ArrayList<>();
RepositoryCache.enter(cacheConfigurationManager);
try {
for (AssignmentType assignmentType: assignments) {
try {
PrismContainerDefinition definition = assignmentType.asPrismContainerValue().getDefinition();
if (definition == null) {
// TODO: optimize
definition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(AssignmentHolderType.class).findContainerDefinition(AssignmentHolderType.F_ASSIGNMENT);
}
ItemDeltaItem<PrismContainerValue<AssignmentType>,PrismContainerDefinition<AssignmentType>> assignmentIdi =
new ItemDeltaItem<>(LensUtil.createAssignmentSingleValueContainer(assignmentType), definition);
EvaluatedAssignment<AH> assignment = assignmentEvaluator.evaluate(assignmentIdi, PlusMinusZero.ZERO, false, assignmentHolder, assignmentHolder.toString(), virtual, task, result);
evaluatedAssignments.add(assignment);
} catch (SchemaException | ObjectNotFoundException | ExpressionEvaluationException | PolicyViolationException | SecurityViolationException | ConfigurationException | CommunicationException e) {
LOGGER.error("Error while processing assignment of {}: {}; assignment: {}",
assignmentHolder, e.getMessage(), assignmentType, e);
} | private <AH extends AssignmentHolderType> Collection<EvaluatedAssignment<AH>> evaluateAssignments(AH assignmentHolder, Collection<AssignmentType> assignments, boolean virtual, AssignmentEvaluator<AH> assignmentEvaluator, Task task, OperationResult result) {
List<EvaluatedAssignment<AH>> evaluatedAssignments = new ArrayList<>();
RepositoryCache.enter(cacheConfigurationManager);
try {
for (AssignmentType assignmentType: assignments) {
try {
PrismContainerDefinition definition = assignmentType.asPrismContainerValue().getDefinition();
if (definition == null) {
// TODO: optimize
definition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(AssignmentHolderType.class).findContainerDefinition(AssignmentHolderType.F_ASSIGNMENT);
}
ItemDeltaItem<PrismContainerValue<AssignmentType>,PrismContainerDefinition<AssignmentType>> assignmentIdi =
new ItemDeltaItem<>(LensUtil.createAssignmentSingleValueContainer(assignmentType), definition);
EvaluatedAssignment<AH> assignment = assignmentEvaluator.evaluate(assignmentIdi, PlusMinusZero.ZERO, false, assignmentHolder, assignmentHolder.toString(), virtual, task, result);
evaluatedAssignments.add(assignment);
} catch (SchemaException | ObjectNotFoundException | ExpressionEvaluationException | PolicyViolationException | SecurityViolationException | ConfigurationException | CommunicationException e) {
LOGGER.error("Error while processing assignment of {}: {}; assignment: {}",
assignmentHolder, e.getMessage(), assignmentType, e);
}
}
} finally {
RepositoryCache.exit();
}
return evaluatedAssignments;
} |
22,911 | 0 | // Look for the raw contact if specified. | private void pickRawContactDelta() {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
}
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} | NONSATD | true | if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta; | }
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){ | private void pickRawContactDelta() {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
}
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} |
22,911 | 1 | // Otherwise try to find the one that matches the default. | private void pickRawContactDelta() {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
}
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} | NONSATD | true | } else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return; | final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} | private void pickRawContactDelta() {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
}
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} |
22,911 | 2 | // TODO: Find better raw contact delta
// Just select an arbitrary writable contact. | private void pickRawContactDelta() {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + mRawContactDeltas.size() + " rawContactDelta(s)");
}
for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} | DESIGN | true | return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
} | if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} | for (int j = 0; j < mRawContactDeltas.size(); j++) {
final RawContactDelta rawContactDelta = mRawContactDeltas.get(j);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "parse: " + j + " rawContactDelta" + rawContactDelta);
}
if (rawContactDelta == null || !rawContactDelta.isVisible()) continue;
final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager);
if (accountType == null) continue;
if (mRawContactIdToDisplayAlone > 0) {
// Look for the raw contact if specified.
if (rawContactDelta.getRawContactId().equals(mRawContactIdToDisplayAlone)) {
mCurrentRawContactDelta = rawContactDelta;
return;
}
} else if (mPrimaryAccount != null
&& mPrimaryAccount.equals(rawContactDelta.getAccountWithDataSet())) {
// Otherwise try to find the one that matches the default.
mCurrentRawContactDelta = rawContactDelta;
return;
} else if (accountType.areContactsWritable()){
// TODO: Find better raw contact delta
// Just select an arbitrary writable contact.
mCurrentRawContactDelta = rawContactDelta;
}
}
} |
14,723 | 0 | // Id de usuario | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution); | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{ |
14,723 | 1 | // Usuarios concurrentes | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | // Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes); | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability"); | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo"); |
14,723 | 2 | // Tiempo | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo); | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){ | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue(); |
14,723 | 3 | // Resolución | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution); | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN); | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting"); |
14,723 | 4 | // Disponibilidad | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0); | Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){ | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue(); |
14,723 | 5 | // TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | IMPLEMENTATION | true | }
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID"); | bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair | Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else { |
14,723 | 6 | // Hacemos llamada a Paypal para comprobar el estado del acuerdo | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created | bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null | }else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
} |
14,723 | 7 | // NVPDecoder object is created | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | // Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the | }
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) { | Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
} |
14,723 | 8 | // decode method of NVPDecoder will parse the request and decode the
// name and value pair | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | // NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display | // TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else { | bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){ |
14,723 | 9 | // checks for Acknowledgement and redirects accordingly to display
// error messages | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | // name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null | String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){ | Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado |
14,723 | 10 | // TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | DESIGN | true | && !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else { | NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo | }
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010"); |
14,723 | 11 | // En este punto todo ha ido bien así que obtenemos el status | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){ | resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement"; | try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito |
14,723 | 12 | // Comprobación del resultado del check del acuerdo | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | }
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){ | // TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010"); | NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"), |
14,723 | 13 | // Mostrar mensaje éxito
// Asignar título y contenido adecuado | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", ""); | String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"), | // checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm"); |
14,723 | 14 | // Acuerdo activo | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010"); | }
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error | && !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) { |
14,723 | 15 | // Mostrar alert informando al usuario del problema | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito | String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", ""); | resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) { |
14,723 | 16 | // Mostrar mensaje éxito
// Asignar título y contenido adecuado | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", ""); | String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"), | // checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm"); |
14,723 | 17 | // Mostrar mensaje error
// Asignar título y contenido adecuado | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", ""); | }else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block | }
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
} |
14,723 | 18 | // Cerramos la ventana de confirmación | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | }
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios | // Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) { | // Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} |
14,723 | 19 | // Cerramos el diálogo de precios | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | NONSATD | true | // Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) { | getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace(); | handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} |
14,723 | 20 | // TODO Auto-generated catch block | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | DESIGN | true | gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) { | // Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
} | IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} |
14,723 | 21 | // TODO Auto-generated catch block | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | DESIGN | true | gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) { | // Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
} | IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} |
14,723 | 22 | // TODO Auto-generated catch block | public void procesarAjaxChangeListener(GestorEstadoComponentes gestorEstados,
GestorDatosComponentes gestorDatos) {
// Id de usuario
Integer intCodUsuario = ContextUtils.getUserIdAsInteger();
// Usuarios concurrentes
String strNumUsersConcurrentes = (String)gestorDatos.getValue("numUsuariosConcu");
Integer intNumUserConcurrentes = Integer.valueOf(strNumUsersConcurrentes);
// Tiempo
String strIdUnidadTiempo = (String)gestorDatos.getValue("idUnidadTiempo");
Integer intIdUnidadTiempo = Integer.valueOf(strIdUnidadTiempo);
// Resolución
String strIdResolution = (String)gestorDatos.getValue("resolution");
Integer intIdResolution = Integer.valueOf(strIdResolution);
// Disponibilidad
Boolean highAvailability = (Boolean)gestorDatos.getValue("checkAvailability");
Integer intHighAvailability = highAvailability?new Integer(1):new Integer(0);
Float precioTotal = null;
if(gestorDatos.getValue("precioTotal") != null && !"".equals(gestorDatos.getValue("precioTotal")) && !"0.0".equals(gestorDatos.getValue("precioTotal"))){
precioTotal = (Float)gestorDatos.getValue("precioTotal");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotal);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
if(gestorDatos.getValue("precioTotalTiempo") != null && !"".equals(gestorDatos.getValue("precioTotalTiempo")) & !"0.0".equals(gestorDatos.getValue("precioTotalTiempo"))){
Float precioTotalTiempo = (Float)gestorDatos.getValue("precioTotalTiempo");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalTiempo);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}else{
Float precioTotalUso = (Float)gestorDatos.getValue("precioTotalUso");
Float precioHosting = (Float)gestorDatos.getValue("precioTotalHosting");
BigDecimal bidPrecioTotal = new BigDecimal(precioTotalUso+precioHosting);
bidPrecioTotal = bidPrecioTotal.setScale(2, RoundingMode.HALF_EVEN);
precioTotal = bidPrecioTotal.floatValue();
}
}
// TODO cambiar el segundo parámetro cuando podamos distinguir
// entre ficheros de varias configuraciones
try {
String billingAgreementId = HelperContext.getInstance().getValueContext("SECURE_USER_BILLING_AGREEMENT_ID");
String resultadoAcuerdo = "noAgreement";
if(billingAgreementId != null && !"".equals(billingAgreementId)){
// Hacemos llamada a Paypal para comprobar el estado del acuerdo
String ppresponse = PaypalUtilities.getInstance().baUpdate(billingAgreementId);
// NVPDecoder object is created
NVPDecoder resultValues = new NVPDecoder();
// decode method of NVPDecoder will parse the request and decode the
// name and value pair
resultValues.decode(ppresponse);
// checks for Acknowledgement and redirects accordingly to display
// error messages
String strAck = resultValues.get("ACK");
if (strAck != null
&& !(strAck.equals("Success") || strAck
.equals("SuccessWithWarning"))) {
// TODO: Indicar al usuario que el acuerdo previo ha sido cancelado y será necesaria la creación de uno nuevo
resultadoAcuerdo = "noAgreement";
} else {
// En este punto todo ha ido bien así que obtenemos el status
String status = resultValues.get("BILLINGAGREEMENTSTATUS");
if(status.compareToIgnoreCase("Active")==0){
resultadoAcuerdo = "agreement";
}
}
}
// Comprobación del resultado del check del acuerdo
String idAlert = "alertInfoUploadProduction";
if(resultadoAcuerdo.compareToIgnoreCase("noAgreement")==0){
idAlert = "alertInfoBillingAgreement";
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertBillAgreement.cabeceraPanel.valor", "Billing agreement needed!"),
getMessage("FIONA.alertBillAgreement.mensajeOK.valor", "You need to sign a new billing agreement!!"), "", "");
}else if(resultadoAcuerdo.compareToIgnoreCase("agreement")==0){// Acuerdo activo
IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} | DESIGN | true | gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) { | // Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
} | IContexto[] salida = invokeUploadToProduction(intCodUsuario, null,intNumUserConcurrentes,intIdUnidadTiempo, intIdResolution,intHighAvailability, precioTotal);
String mensaje = salida[0].getString("FIONEG003010");
// Mostrar alert informando al usuario del problema
if(mensaje.compareToIgnoreCase("OK")==0){
// Mostrar mensaje éxito
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "info", getMessage("FIONA.alertUploadProdOk.cabeceraPanel.valor", "Success!"),
getMessage("FIONA.alertUploadProdOk.mensajeOK.valor", "Request completed!!"), "", "");
}else{
// Mostrar mensaje error
// Asignar título y contenido adecuado
handleModalAlert(gestorDatos, gestorEstados, idAlert, "error", getMessage("FIONA.alertUploadProdOk.cabeceraPanelError.valor", "Error!"),
getMessage("FIONA.alertUploadProdOk.mensajeError.valor", "Something went wrong..."), "", "");
}
}
// Cerramos la ventana de confirmación
gestorEstados.closeModalAlert("alertUploadConfirm");
// Cerramos el diálogo de precios
gestorEstados.closeModalAlert("dialogoPrecios");
} catch (FactoriaDatosException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (PersistenciaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FawnaInvokerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PayPalException ppEx){
ppEx.printStackTrace();
}
} |
14,725 | 0 | // TODO: fix this so the label is a child of the Lane or Pool.
// There's a problem with Resize Feature if the label is a direct child of Lane/Pool. | protected ContainerShape getTargetContainer(PictogramElement ownerPE) {
// TODO: fix this so the label is a child of the Lane or Pool.
// There's a problem with Resize Feature if the label is a direct child of Lane/Pool.
return (ContainerShape) ownerPE.eContainer();
} | DESIGN | true | protected ContainerShape getTargetContainer(PictogramElement ownerPE) {
// TODO: fix this so the label is a child of the Lane or Pool.
// There's a problem with Resize Feature if the label is a direct child of Lane/Pool.
return (ContainerShape) ownerPE.eContainer();
} | protected ContainerShape getTargetContainer(PictogramElement ownerPE) {
// TODO: fix this so the label is a child of the Lane or Pool.
// There's a problem with Resize Feature if the label is a direct child of Lane/Pool.
return (ContainerShape) ownerPE.eContainer();
} | protected ContainerShape getTargetContainer(PictogramElement ownerPE) {
// TODO: fix this so the label is a child of the Lane or Pool.
// There's a problem with Resize Feature if the label is a direct child of Lane/Pool.
return (ContainerShape) ownerPE.eContainer();
} |
14,744 | 0 | //TODO: actually implement barrier contract | @Override
void processOFMessage(ControllerChannelHandler h, OFMessage m)
throws IOException {
switch (m.getType()) {
case HELLO:
processOFHello(h, (OFHello) m);
break;
case ECHO_REPLY:
break;
case ECHO_REQUEST:
processOFEchoRequest(h, (OFEchoRequest) m);
break;
case FEATURES_REQUEST:
processOFFeaturesRequest(h, (OFFeaturesRequest) m);
break;
case BARRIER_REQUEST:
//TODO: actually implement barrier contract
OFBarrierReply breply = new OFBarrierReply();
breply.setXid(m.getXid());
h.channel.write(Collections.singletonList(breply));
break;
case SET_CONFIG:
case ERROR:
case PACKET_OUT:
case PORT_MOD:
case QUEUE_GET_CONFIG_REQUEST:
case STATS_REQUEST:
case FLOW_MOD:
case GET_CONFIG_REQUEST:
h.sw.handleIO(m);
break;
case VENDOR:
unhandledMessageReceived(h, m);
break;
case FEATURES_REPLY:
case FLOW_REMOVED:
case PACKET_IN:
case PORT_STATUS:
case BARRIER_REPLY:
case GET_CONFIG_REPLY:
case STATS_REPLY:
case QUEUE_GET_CONFIG_REPLY:
illegalMessageReceived(h, m);
break;
}
} | IMPLEMENTATION | true | break;
case BARRIER_REQUEST:
//TODO: actually implement barrier contract
OFBarrierReply breply = new OFBarrierReply();
breply.setXid(m.getXid()); | break;
case ECHO_REPLY:
break;
case ECHO_REQUEST:
processOFEchoRequest(h, (OFEchoRequest) m);
break;
case FEATURES_REQUEST:
processOFFeaturesRequest(h, (OFFeaturesRequest) m);
break;
case BARRIER_REQUEST:
//TODO: actually implement barrier contract
OFBarrierReply breply = new OFBarrierReply();
breply.setXid(m.getXid());
h.channel.write(Collections.singletonList(breply));
break;
case SET_CONFIG:
case ERROR:
case PACKET_OUT:
case PORT_MOD:
case QUEUE_GET_CONFIG_REQUEST:
case STATS_REQUEST: | @Override
void processOFMessage(ControllerChannelHandler h, OFMessage m)
throws IOException {
switch (m.getType()) {
case HELLO:
processOFHello(h, (OFHello) m);
break;
case ECHO_REPLY:
break;
case ECHO_REQUEST:
processOFEchoRequest(h, (OFEchoRequest) m);
break;
case FEATURES_REQUEST:
processOFFeaturesRequest(h, (OFFeaturesRequest) m);
break;
case BARRIER_REQUEST:
//TODO: actually implement barrier contract
OFBarrierReply breply = new OFBarrierReply();
breply.setXid(m.getXid());
h.channel.write(Collections.singletonList(breply));
break;
case SET_CONFIG:
case ERROR:
case PACKET_OUT:
case PORT_MOD:
case QUEUE_GET_CONFIG_REQUEST:
case STATS_REQUEST:
case FLOW_MOD:
case GET_CONFIG_REQUEST:
h.sw.handleIO(m);
break;
case VENDOR:
unhandledMessageReceived(h, m);
break;
case FEATURES_REPLY:
case FLOW_REMOVED:
case PACKET_IN: |
22,947 | 0 | //TODO: complete decode calls using bye array data | private void decode(byte[] sensorData) {
kiwriousReader.setRawValues(sensorData);
switch (sensorData[KIWRIOUS_SENSOR_TYPE]) {
//TODO: complete decode calls using bye array data
case SENSOR_COLOUR:
String[] colorValues = sensorDecoder.decodeColor(sensorData);
kiwriousReader.setR(Integer.parseInt(colorValues[0]));
kiwriousReader.setG(Integer.parseInt(colorValues[1]));
kiwriousReader.setB(Integer.parseInt(colorValues[2]));
break;
case SENSOR_CONDUCTIVITY:
String[] conductivityValues = sensorDecoder.decodeConductivity(sensorData);
kiwriousReader.setResistance(Long.parseLong(conductivityValues[0]));
kiwriousReader.setConductivity(Float.parseFloat(conductivityValues[1]));
break;
case SENSOR_HEART_RATE:
String heartRateValue = sensorDecoder.decodeHeartRate(sensorData);
kiwriousReader.setHeartRate(Integer.parseInt(heartRateValue));
break;
case SENSOR_HUMIDITY:
Float[] humidityValues = sensorDecoder.decodeHumidity(sensorData);
kiwriousReader.setTemperature(humidityValues[0]);
kiwriousReader.setHumidity(humidityValues[1]);
break;
case SENSOR_SOUND:
// sensorDecoder.decodeSound(values);
break;
case SENSOR_TEMPERATURE:
String[] temperatureValues = sensorDecoder.decodeTemperature(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperatureValues[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperatureValues[1]));
break;
case SENSOR_TEMPERATURE2:
String[] temperature2Values = sensorDecoder.decodeTemperature2(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperature2Values[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperature2Values[1]));
break;
case SENSOR_UV:
String[] lightValues = sensorDecoder.decodeUV(sensorData);
kiwriousReader.setLux(Long.parseLong(lightValues[0]));
kiwriousReader.setUv(Float.parseFloat(lightValues[1]));
break;
case SENSOR_VOC:
String[] vocValues = sensorDecoder.decodeVOC(sensorData);
kiwriousReader.setVoc(Integer.parseInt(vocValues[0]));
kiwriousReader.setCo2(Integer.parseInt(vocValues[1]));
break;
default:
Log.e("kiwrious-plugin", "unexpected sensor type "+sensorData[KIWRIOUS_SENSOR_TYPE]);
break;
}
} | IMPLEMENTATION | true | kiwriousReader.setRawValues(sensorData);
switch (sensorData[KIWRIOUS_SENSOR_TYPE]) {
//TODO: complete decode calls using bye array data
case SENSOR_COLOUR:
String[] colorValues = sensorDecoder.decodeColor(sensorData); | private void decode(byte[] sensorData) {
kiwriousReader.setRawValues(sensorData);
switch (sensorData[KIWRIOUS_SENSOR_TYPE]) {
//TODO: complete decode calls using bye array data
case SENSOR_COLOUR:
String[] colorValues = sensorDecoder.decodeColor(sensorData);
kiwriousReader.setR(Integer.parseInt(colorValues[0]));
kiwriousReader.setG(Integer.parseInt(colorValues[1]));
kiwriousReader.setB(Integer.parseInt(colorValues[2]));
break;
case SENSOR_CONDUCTIVITY:
String[] conductivityValues = sensorDecoder.decodeConductivity(sensorData);
kiwriousReader.setResistance(Long.parseLong(conductivityValues[0]));
kiwriousReader.setConductivity(Float.parseFloat(conductivityValues[1])); | private void decode(byte[] sensorData) {
kiwriousReader.setRawValues(sensorData);
switch (sensorData[KIWRIOUS_SENSOR_TYPE]) {
//TODO: complete decode calls using bye array data
case SENSOR_COLOUR:
String[] colorValues = sensorDecoder.decodeColor(sensorData);
kiwriousReader.setR(Integer.parseInt(colorValues[0]));
kiwriousReader.setG(Integer.parseInt(colorValues[1]));
kiwriousReader.setB(Integer.parseInt(colorValues[2]));
break;
case SENSOR_CONDUCTIVITY:
String[] conductivityValues = sensorDecoder.decodeConductivity(sensorData);
kiwriousReader.setResistance(Long.parseLong(conductivityValues[0]));
kiwriousReader.setConductivity(Float.parseFloat(conductivityValues[1]));
break;
case SENSOR_HEART_RATE:
String heartRateValue = sensorDecoder.decodeHeartRate(sensorData);
kiwriousReader.setHeartRate(Integer.parseInt(heartRateValue));
break;
case SENSOR_HUMIDITY:
Float[] humidityValues = sensorDecoder.decodeHumidity(sensorData);
kiwriousReader.setTemperature(humidityValues[0]);
kiwriousReader.setHumidity(humidityValues[1]);
break; |
22,947 | 1 | // sensorDecoder.decodeSound(values); | private void decode(byte[] sensorData) {
kiwriousReader.setRawValues(sensorData);
switch (sensorData[KIWRIOUS_SENSOR_TYPE]) {
//TODO: complete decode calls using bye array data
case SENSOR_COLOUR:
String[] colorValues = sensorDecoder.decodeColor(sensorData);
kiwriousReader.setR(Integer.parseInt(colorValues[0]));
kiwriousReader.setG(Integer.parseInt(colorValues[1]));
kiwriousReader.setB(Integer.parseInt(colorValues[2]));
break;
case SENSOR_CONDUCTIVITY:
String[] conductivityValues = sensorDecoder.decodeConductivity(sensorData);
kiwriousReader.setResistance(Long.parseLong(conductivityValues[0]));
kiwriousReader.setConductivity(Float.parseFloat(conductivityValues[1]));
break;
case SENSOR_HEART_RATE:
String heartRateValue = sensorDecoder.decodeHeartRate(sensorData);
kiwriousReader.setHeartRate(Integer.parseInt(heartRateValue));
break;
case SENSOR_HUMIDITY:
Float[] humidityValues = sensorDecoder.decodeHumidity(sensorData);
kiwriousReader.setTemperature(humidityValues[0]);
kiwriousReader.setHumidity(humidityValues[1]);
break;
case SENSOR_SOUND:
// sensorDecoder.decodeSound(values);
break;
case SENSOR_TEMPERATURE:
String[] temperatureValues = sensorDecoder.decodeTemperature(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperatureValues[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperatureValues[1]));
break;
case SENSOR_TEMPERATURE2:
String[] temperature2Values = sensorDecoder.decodeTemperature2(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperature2Values[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperature2Values[1]));
break;
case SENSOR_UV:
String[] lightValues = sensorDecoder.decodeUV(sensorData);
kiwriousReader.setLux(Long.parseLong(lightValues[0]));
kiwriousReader.setUv(Float.parseFloat(lightValues[1]));
break;
case SENSOR_VOC:
String[] vocValues = sensorDecoder.decodeVOC(sensorData);
kiwriousReader.setVoc(Integer.parseInt(vocValues[0]));
kiwriousReader.setCo2(Integer.parseInt(vocValues[1]));
break;
default:
Log.e("kiwrious-plugin", "unexpected sensor type "+sensorData[KIWRIOUS_SENSOR_TYPE]);
break;
}
} | NONSATD | true | break;
case SENSOR_SOUND:
// sensorDecoder.decodeSound(values);
break;
case SENSOR_TEMPERATURE: | case SENSOR_HEART_RATE:
String heartRateValue = sensorDecoder.decodeHeartRate(sensorData);
kiwriousReader.setHeartRate(Integer.parseInt(heartRateValue));
break;
case SENSOR_HUMIDITY:
Float[] humidityValues = sensorDecoder.decodeHumidity(sensorData);
kiwriousReader.setTemperature(humidityValues[0]);
kiwriousReader.setHumidity(humidityValues[1]);
break;
case SENSOR_SOUND:
// sensorDecoder.decodeSound(values);
break;
case SENSOR_TEMPERATURE:
String[] temperatureValues = sensorDecoder.decodeTemperature(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperatureValues[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperatureValues[1]));
break;
case SENSOR_TEMPERATURE2:
String[] temperature2Values = sensorDecoder.decodeTemperature2(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperature2Values[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperature2Values[1])); | String[] colorValues = sensorDecoder.decodeColor(sensorData);
kiwriousReader.setR(Integer.parseInt(colorValues[0]));
kiwriousReader.setG(Integer.parseInt(colorValues[1]));
kiwriousReader.setB(Integer.parseInt(colorValues[2]));
break;
case SENSOR_CONDUCTIVITY:
String[] conductivityValues = sensorDecoder.decodeConductivity(sensorData);
kiwriousReader.setResistance(Long.parseLong(conductivityValues[0]));
kiwriousReader.setConductivity(Float.parseFloat(conductivityValues[1]));
break;
case SENSOR_HEART_RATE:
String heartRateValue = sensorDecoder.decodeHeartRate(sensorData);
kiwriousReader.setHeartRate(Integer.parseInt(heartRateValue));
break;
case SENSOR_HUMIDITY:
Float[] humidityValues = sensorDecoder.decodeHumidity(sensorData);
kiwriousReader.setTemperature(humidityValues[0]);
kiwriousReader.setHumidity(humidityValues[1]);
break;
case SENSOR_SOUND:
// sensorDecoder.decodeSound(values);
break;
case SENSOR_TEMPERATURE:
String[] temperatureValues = sensorDecoder.decodeTemperature(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperatureValues[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperatureValues[1]));
break;
case SENSOR_TEMPERATURE2:
String[] temperature2Values = sensorDecoder.decodeTemperature2(sensorData);
kiwriousReader.setAmbientTemperature(Integer.parseInt(temperature2Values[0]));
kiwriousReader.setInfraredTemperature(Integer.parseInt(temperature2Values[1]));
break;
case SENSOR_UV:
String[] lightValues = sensorDecoder.decodeUV(sensorData);
kiwriousReader.setLux(Long.parseLong(lightValues[0]));
kiwriousReader.setUv(Float.parseFloat(lightValues[1]));
break;
case SENSOR_VOC:
String[] vocValues = sensorDecoder.decodeVOC(sensorData);
kiwriousReader.setVoc(Integer.parseInt(vocValues[0]));
kiwriousReader.setCo2(Integer.parseInt(vocValues[1])); |
14,763 | 0 | //metodo para consultar usuario | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,763 | 1 | //a linha abaixo se refere ao combobox | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else { | String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) { | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,763 | 2 | //as linhas abaixo "limpam os campos" | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | } else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null); | rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | private void concultar() {
String sql = "select * from tbusuarios where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
rs = pst.executeQuery();
if (rs.next()) {
txtUsuNome.setText(rs.getString(2));
txtUsuFone.setText(rs.getString(3));
txtUsuLogin.setText(rs.getString(4));
txtUsuSenha.setText(rs.getString(5));
//a linha abaixo se refere ao combobox
cboUsuPerfil.setSelectedItem(rs.getString(6));
} else {
JOptionPane.showMessageDialog(null, "Usuário não cadastrado");
//as linhas abaixo "limpam os campos"
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,764 | 0 | //metodo para adicionar usuário | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,764 | 1 | //validição dos campos obrigatorios | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio"); | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso"); | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,764 | 2 | //a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica | pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
} | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,764 | 3 | // testando a logica
//System.out.println(adicionado); | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | NONSATD | true | //a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso"); | pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e); | private void adicionar() {
String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validição dos campos obrigatorios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio");
} else {
//a estrutura abaixo é usada para confirmar a inserção dos dados na tabela
//a linha abaixo atualiza a tabela usuario com os dados do formulario
int adicionado = pst.executeUpdate();
// testando a logica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso");
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} |
14,772 | 0 | // TODO figure out what to do with build info | @Override
public BundleDetails extract(final InputStream inputStream) throws IOException {
try (final JarInputStream jarInputStream = new JarInputStream(inputStream)) {
final Manifest manifest = jarInputStream.getManifest();
if (manifest == null) {
throw new IllegalArgumentException("NAR bundles must contain a valid MANIFEST");
}
final Attributes attributes = manifest.getMainAttributes();
final String groupId = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName());
final String artifactId = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName());
final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName());
final BundleCoordinate bundleCoordinate = new BundleCoordinate(groupId, artifactId, version);
final String dependencyGroupId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName());
final String dependencyArtifactId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName());
final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName());
final BundleCoordinate dependencyCoordinate;
if (dependencyArtifactId != null) {
dependencyCoordinate = new BundleCoordinate(dependencyGroupId, dependencyArtifactId, dependencyVersion);
} else {
dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
final String buildRevision = attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName());
final String buildTimestamp = attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName());
final String buildJdk = attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName());
final String builtBy = attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName());
final BundleDetails.Builder builder = new BundleDetails.Builder()
.coordinate(bundleCoordinate)
.dependencyCoordinate(dependencyCoordinate);
return builder.build();
}
} | DESIGN | true | dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName()); | final BundleCoordinate bundleCoordinate = new BundleCoordinate(groupId, artifactId, version);
final String dependencyGroupId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName());
final String dependencyArtifactId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName());
final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName());
final BundleCoordinate dependencyCoordinate;
if (dependencyArtifactId != null) {
dependencyCoordinate = new BundleCoordinate(dependencyGroupId, dependencyArtifactId, dependencyVersion);
} else {
dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
final String buildRevision = attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName());
final String buildTimestamp = attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName());
final String buildJdk = attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName());
final String builtBy = attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName());
final BundleDetails.Builder builder = new BundleDetails.Builder()
.coordinate(bundleCoordinate)
.dependencyCoordinate(dependencyCoordinate);
return builder.build(); | public BundleDetails extract(final InputStream inputStream) throws IOException {
try (final JarInputStream jarInputStream = new JarInputStream(inputStream)) {
final Manifest manifest = jarInputStream.getManifest();
if (manifest == null) {
throw new IllegalArgumentException("NAR bundles must contain a valid MANIFEST");
}
final Attributes attributes = manifest.getMainAttributes();
final String groupId = attributes.getValue(NarManifestEntry.NAR_GROUP.getManifestName());
final String artifactId = attributes.getValue(NarManifestEntry.NAR_ID.getManifestName());
final String version = attributes.getValue(NarManifestEntry.NAR_VERSION.getManifestName());
final BundleCoordinate bundleCoordinate = new BundleCoordinate(groupId, artifactId, version);
final String dependencyGroupId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_GROUP.getManifestName());
final String dependencyArtifactId = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_ID.getManifestName());
final String dependencyVersion = attributes.getValue(NarManifestEntry.NAR_DEPENDENCY_VERSION.getManifestName());
final BundleCoordinate dependencyCoordinate;
if (dependencyArtifactId != null) {
dependencyCoordinate = new BundleCoordinate(dependencyGroupId, dependencyArtifactId, dependencyVersion);
} else {
dependencyCoordinate = null;
}
// TODO figure out what to do with build info
final String buildBranch = attributes.getValue(NarManifestEntry.BUILD_BRANCH.getManifestName());
final String buildTag = attributes.getValue(NarManifestEntry.BUILD_TAG.getManifestName());
final String buildRevision = attributes.getValue(NarManifestEntry.BUILD_REVISION.getManifestName());
final String buildTimestamp = attributes.getValue(NarManifestEntry.BUILD_TIMESTAMP.getManifestName());
final String buildJdk = attributes.getValue(NarManifestEntry.BUILD_JDK.getManifestName());
final String builtBy = attributes.getValue(NarManifestEntry.BUILT_BY.getManifestName());
final BundleDetails.Builder builder = new BundleDetails.Builder()
.coordinate(bundleCoordinate)
.dependencyCoordinate(dependencyCoordinate);
return builder.build();
}
} |
22,966 | 0 | // FIXME: maybe skip writing the SOM at 0 iterations (0 mod x == 0 ...) | @Override
public void interruptionOccurred(int currentIteration, int numIterations) {
// FIXME: maybe skip writing the SOM at 0 iterations (0 mod x == 0 ...)
String filename = fileProperties.namePrefix(false) + "_" + currentIteration;
try {
SOMLibMapOutputter.writeWeightVectorFile(GrowingSOM.this, fileProperties.outputDirectory(), filename,
true, "$CURRENT_ITERATION=" + currentIteration, "$NUM_ITERATIONS=" + numIterations);
} catch (IOException e) {
Logger.getLogger("at.tuwien.ifs.somtoolbox").severe(
"Could not open or write to output file " + filename + ": " + e.getMessage());
}
} | DEFECT | true | @Override
public void interruptionOccurred(int currentIteration, int numIterations) {
// FIXME: maybe skip writing the SOM at 0 iterations (0 mod x == 0 ...)
String filename = fileProperties.namePrefix(false) + "_" + currentIteration;
try { | @Override
public void interruptionOccurred(int currentIteration, int numIterations) {
// FIXME: maybe skip writing the SOM at 0 iterations (0 mod x == 0 ...)
String filename = fileProperties.namePrefix(false) + "_" + currentIteration;
try {
SOMLibMapOutputter.writeWeightVectorFile(GrowingSOM.this, fileProperties.outputDirectory(), filename,
true, "$CURRENT_ITERATION=" + currentIteration, "$NUM_ITERATIONS=" + numIterations);
} catch (IOException e) {
Logger.getLogger("at.tuwien.ifs.somtoolbox").severe(
"Could not open or write to output file " + filename + ": " + e.getMessage());
}
} | @Override
public void interruptionOccurred(int currentIteration, int numIterations) {
// FIXME: maybe skip writing the SOM at 0 iterations (0 mod x == 0 ...)
String filename = fileProperties.namePrefix(false) + "_" + currentIteration;
try {
SOMLibMapOutputter.writeWeightVectorFile(GrowingSOM.this, fileProperties.outputDirectory(), filename,
true, "$CURRENT_ITERATION=" + currentIteration, "$NUM_ITERATIONS=" + numIterations);
} catch (IOException e) {
Logger.getLogger("at.tuwien.ifs.somtoolbox").severe(
"Could not open or write to output file " + filename + ": " + e.getMessage());
}
} |
14,786 | 0 | // Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough) | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} | IMPLEMENTATION | true | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl(); | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
} |
14,786 | 1 | // Use the name of a class and instantiate this tokenizer | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} | NONSATD | true | return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path... | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance(); | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} |
14,786 | 2 | // use classloader and search for named class in class path... | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} | NONSATD | true | // Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType ); | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
} | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} |
14,786 | 3 | // TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} | IMPLEMENTATION | true | ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) { | // Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
} | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} |
14,786 | 4 | // create the class using the unparametereized the constructor. | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} | NONSATD | true | Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
} | }
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} | public DataTokenizer buildTokenizerInstance( String tokenizerType ) {
// Use a predefined list of known Tokenizers
// TODO: publish more tokenizers... (when they are ready/good enough/abstract enough)
if ("CSVTokenizer".equals( tokenizerType )) {
return new CSVTokenizerImpl();
}
// Use the name of a class and instantiate this tokenizer
try {
// use classloader and search for named class in class path...
ClassLoader classLoader = this.getClass().getClassLoader();
Class<?> loadedClass = classLoader.loadClass( tokenizerType );
// TODO: check if superclass is registered as a DataTokenizer....
// and check if it implements DataTokenizer
Class<?>[] interfaces = loadedClass.getInterfaces();
if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) {
// create the class using the unparametereized the constructor.
return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance();
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
throw new IllegalArgumentException();
} |
22,978 | 0 | // TODO: Throw a subclass of CertificateException which indicates a pinning failure. | private void checkPins(List<X509Certificate> chain) throws CertificateException {
PinSet pinSet = mNetworkSecurityConfig.getPins();
if (pinSet.pins.isEmpty()
|| System.currentTimeMillis() > pinSet.expirationTime
|| !isPinningEnforced(chain)) {
return;
}
Set<String> pinAlgorithms = pinSet.getPinAlgorithms();
Map<String, MessageDigest> digestMap = new ArrayMap<String, MessageDigest>(
pinAlgorithms.size());
for (int i = chain.size() - 1; i >= 0 ; i--) {
X509Certificate cert = chain.get(i);
byte[] encodedSPKI = cert.getPublicKey().getEncoded();
for (String algorithm : pinAlgorithms) {
MessageDigest md = digestMap.get(algorithm);
if (md == null) {
try {
md = MessageDigest.getInstance(algorithm);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
digestMap.put(algorithm, md);
}
if (pinSet.pins.contains(new Pin(algorithm, md.digest(encodedSPKI)))) {
return;
}
}
}
// TODO: Throw a subclass of CertificateException which indicates a pinning failure.
throw new CertificateException("Pin verification failed");
} | IMPLEMENTATION | true | }
}
// TODO: Throw a subclass of CertificateException which indicates a pinning failure.
throw new CertificateException("Pin verification failed");
} | } catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
digestMap.put(algorithm, md);
}
if (pinSet.pins.contains(new Pin(algorithm, md.digest(encodedSPKI)))) {
return;
}
}
}
// TODO: Throw a subclass of CertificateException which indicates a pinning failure.
throw new CertificateException("Pin verification failed");
} | Map<String, MessageDigest> digestMap = new ArrayMap<String, MessageDigest>(
pinAlgorithms.size());
for (int i = chain.size() - 1; i >= 0 ; i--) {
X509Certificate cert = chain.get(i);
byte[] encodedSPKI = cert.getPublicKey().getEncoded();
for (String algorithm : pinAlgorithms) {
MessageDigest md = digestMap.get(algorithm);
if (md == null) {
try {
md = MessageDigest.getInstance(algorithm);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
digestMap.put(algorithm, md);
}
if (pinSet.pins.contains(new Pin(algorithm, md.digest(encodedSPKI)))) {
return;
}
}
}
// TODO: Throw a subclass of CertificateException which indicates a pinning failure.
throw new CertificateException("Pin verification failed");
} |
22,990 | 0 | // ===== Memory Events ===== | private void addEvent(Event e, int globalId, int localId) {
EventData data = eventMap.getOrCreate(e);
data.setId(globalId);
data.setLocalId(localId);
eventList.add(data);
data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | NONSATD | true | data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address); | private void addEvent(Event e, int globalId, int localId) {
EventData data = eventMap.getOrCreate(e);
data.setId(globalId);
data.setLocalId(localId);
eventList.add(data);
data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) { | private void addEvent(Event e, int globalId, int localId) {
EventData data = eventMap.getOrCreate(e);
data.setId(globalId);
data.setLocalId(localId);
eventList.add(data);
data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) { |
22,990 | 1 | // ===== Fences ===== | private void addEvent(Event e, int globalId, int localId) {
EventData data = eventMap.getOrCreate(e);
data.setId(globalId);
data.setLocalId(localId);
eventList.add(data);
data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | NONSATD | true | }
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data); | data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted | BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} |
22,990 | 2 | // ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true. | private void addEvent(Event e, int globalId, int localId) {
EventData data = eventMap.getOrCreate(e);
data.setId(globalId);
data.setLocalId(localId);
eventList.add(data);
data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | NONSATD | true | fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else { | addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} |
22,990 | 3 | //TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted | private void addEvent(Event e, int globalId, int localId) {
EventData data = eventMap.getOrCreate(e);
data.setId(globalId);
data.setLocalId(localId);
eventList.add(data);
data.setWasExecuted(true);
if (data.isMemoryEvent()) {
// ===== Memory Events =====
BigInteger address = ((MemEvent) e).getAddress().getIntValue(e, model, context);
data.setAccessedAddress(address);
if (!addressReadsMap.containsKey(address)) {
addressReadsMap.put(address, new HashSet<>());
addressWritesMap.put(address, new HashSet<>());
}
if (data.isRead()) {
data.setValue(new BigInteger(model.evaluate(((RegWriter)e).getResultRegisterExpr()).toString()));
addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | IMPLEMENTATION | true | data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | }
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} | addressReadsMap.get(address).add(data);
} else if (data.isWrite()) {
data.setValue(((MemEvent)e).getMemValue().getIntValue(e, model, context));
addressWritesMap.get(address).add(data);
writeReadsMap.put(data, new HashSet<>());
if (data.isInit()) {
addressInitMap.put(address, data);
}
} else {
throw new RuntimeException("Unexpected memory event");
}
} else if (data.isFence()) {
// ===== Fences =====
String name = ((Fence)data.getEvent()).getName();
fenceMap.computeIfAbsent(name, key -> new HashSet<>()).add(data);
} else if (data.isJump()) {
// ===== Jumps =====
// We override the meaning of execution here. A jump is executed IFF its condition was true.
data.setWasExecuted(((CondJump)e).didJump(model, context));
} else {
//TODO: Maybe add some other events (e.g. assertions)
// But for now all non-visible events are simply registered without
// having any data extracted
}
} |
23,001 | 0 | /**
* Generates structures in given cube.
*
* @param world the world that the structure is generated in
* @param cube the block buffer to be filled with blocks (Cube)
* @param cubePos position of the cube to generate structures in
*/ | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} | NONSATD | true | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} |
23,001 | 1 | //TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints) | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} | IMPLEMENTATION | true | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world; | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX(); | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed()); |
23,001 | 2 | //used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} | NONSATD | true | this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong(); | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) { | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} |
23,001 | 3 | //x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} | NONSATD | true | int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) { | this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
} | public void generate(ICubicWorld world, ICubePrimer cube, CubePos cubePos) {
//TODO: maybe skip some of this stuff if the cube is empty? (would need to use hints)
int radius = this.range;
this.world = world;
this.rand.setSeed(world.getSeed());
//used to randomize contribution of each coordinate to the cube seed
//without these swapping x/y/z coordinates would result in the same seed
//so structures would generate symmetrically
long randX = this.rand.nextLong();
long randY = this.rand.nextLong();
long randZ = this.rand.nextLong();
int cubeX = cubePos.getX();
int cubeY = cubePos.getY();
int cubeZ = cubePos.getZ();
//x/y/zOrigin is location of the structure "center", and cubeX/Y/Z is the currently generated cube
for (int xOrigin = cubeX - radius; xOrigin <= cubeX + radius; ++xOrigin) {
for (int yOrigin = cubeY - radius; yOrigin <= cubeY + radius; ++yOrigin) {
for (int zOrigin = cubeZ - radius; zOrigin <= cubeZ + radius; ++zOrigin) {
long randX_mul = xOrigin*randX;
long randY_mul = yOrigin*randY;
long randZ_mul = zOrigin*randZ;
this.rand.setSeed(randX_mul ^ randY_mul ^ randZ_mul ^ world.getSeed());
this.generate(world, cube, xOrigin, yOrigin, zOrigin, cubePos);
}
}
}
} |
23,007 | 0 | // Test if the filename contains an indication of the subtitles (VOSTFR, ...) | public static boolean isAlreadySubtitled( Downloadable videoDownloadable, Language subtitlesLanguage ) throws IOException, InterruptedException {
List<DownloadableFile> allFiles = DownloadableManager.getInstance().getAllFiles( videoDownloadable.getId() );
Path mainVideoFilePath;
String filename;
Optional<Path> optPath = selectMainVideoFile( allFiles );
if (optPath.isPresent()) {
mainVideoFilePath = optPath.get();
filename = mainVideoFilePath.getFileName().toString();
} else {
ErrorManager.getInstance().reportError(String.format("No video file found for %s", videoDownloadable.toString()));
return false;
}
if (subtitlesLanguage == null) {
return true;
}
if (subtitlesLanguage.getSubTokens() != null) {
// Test if the filename contains an indication of the subtitles (VOSTFR, ...)
for (String subToken : subtitlesLanguage.getSubTokens()) {
if ( StringUtils.containsIgnoreCase( filename, subToken) ) {
return true;
}
}
}
VideoMetaData metaData = getInstance().getMetaData(videoDownloadable, mainVideoFilePath);
if (metaData.getSubtitleLanguages() != null) {
for (Locale locale : metaData.getSubtitleLanguages()) {
if (locale.getLanguage().equals( subtitlesLanguage.getLocale().getLanguage() )) {
return true;
}
}
}
List<DownloadableFile> subtitleFiles =
allFiles.stream()
.filter( file -> SubtitlesFileFilter.getInstance().accept( file.getFilePath() ) )
.collect( Collectors.toList() );
String filenameWithoutExtension = filename;
if ( filenameWithoutExtension.lastIndexOf('.') > 0 ) {
filenameWithoutExtension = filenameWithoutExtension.substring( 0, filenameWithoutExtension.lastIndexOf('.'));
}
String targetFileNameRegExp = filenameWithoutExtension + "." + subtitlesLanguage.getShortName() + "\\.srt";
for (DownloadableFile subTitleFile : subtitleFiles) {
String subtitleFileName = subTitleFile.getFilePath().getFileName().toString();
if (RegExp.matches(subtitleFileName, targetFileNameRegExp )) {
return true;
}
}
// FIXME : this last test will accept any subtitle file without checking the language
if (!subtitleFiles.isEmpty()) {
return true;
}
return false;
} | NONSATD | true | }
if (subtitlesLanguage.getSubTokens() != null) {
// Test if the filename contains an indication of the subtitles (VOSTFR, ...)
for (String subToken : subtitlesLanguage.getSubTokens()) {
if ( StringUtils.containsIgnoreCase( filename, subToken) ) { | mainVideoFilePath = optPath.get();
filename = mainVideoFilePath.getFileName().toString();
} else {
ErrorManager.getInstance().reportError(String.format("No video file found for %s", videoDownloadable.toString()));
return false;
}
if (subtitlesLanguage == null) {
return true;
}
if (subtitlesLanguage.getSubTokens() != null) {
// Test if the filename contains an indication of the subtitles (VOSTFR, ...)
for (String subToken : subtitlesLanguage.getSubTokens()) {
if ( StringUtils.containsIgnoreCase( filename, subToken) ) {
return true;
}
}
}
VideoMetaData metaData = getInstance().getMetaData(videoDownloadable, mainVideoFilePath);
if (metaData.getSubtitleLanguages() != null) {
for (Locale locale : metaData.getSubtitleLanguages()) {
if (locale.getLanguage().equals( subtitlesLanguage.getLocale().getLanguage() )) { | public static boolean isAlreadySubtitled( Downloadable videoDownloadable, Language subtitlesLanguage ) throws IOException, InterruptedException {
List<DownloadableFile> allFiles = DownloadableManager.getInstance().getAllFiles( videoDownloadable.getId() );
Path mainVideoFilePath;
String filename;
Optional<Path> optPath = selectMainVideoFile( allFiles );
if (optPath.isPresent()) {
mainVideoFilePath = optPath.get();
filename = mainVideoFilePath.getFileName().toString();
} else {
ErrorManager.getInstance().reportError(String.format("No video file found for %s", videoDownloadable.toString()));
return false;
}
if (subtitlesLanguage == null) {
return true;
}
if (subtitlesLanguage.getSubTokens() != null) {
// Test if the filename contains an indication of the subtitles (VOSTFR, ...)
for (String subToken : subtitlesLanguage.getSubTokens()) {
if ( StringUtils.containsIgnoreCase( filename, subToken) ) {
return true;
}
}
}
VideoMetaData metaData = getInstance().getMetaData(videoDownloadable, mainVideoFilePath);
if (metaData.getSubtitleLanguages() != null) {
for (Locale locale : metaData.getSubtitleLanguages()) {
if (locale.getLanguage().equals( subtitlesLanguage.getLocale().getLanguage() )) {
return true;
}
}
}
List<DownloadableFile> subtitleFiles =
allFiles.stream()
.filter( file -> SubtitlesFileFilter.getInstance().accept( file.getFilePath() ) )
.collect( Collectors.toList() );
String filenameWithoutExtension = filename;
if ( filenameWithoutExtension.lastIndexOf('.') > 0 ) { |
23,007 | 1 | // FIXME : this last test will accept any subtitle file without checking the language | public static boolean isAlreadySubtitled( Downloadable videoDownloadable, Language subtitlesLanguage ) throws IOException, InterruptedException {
List<DownloadableFile> allFiles = DownloadableManager.getInstance().getAllFiles( videoDownloadable.getId() );
Path mainVideoFilePath;
String filename;
Optional<Path> optPath = selectMainVideoFile( allFiles );
if (optPath.isPresent()) {
mainVideoFilePath = optPath.get();
filename = mainVideoFilePath.getFileName().toString();
} else {
ErrorManager.getInstance().reportError(String.format("No video file found for %s", videoDownloadable.toString()));
return false;
}
if (subtitlesLanguage == null) {
return true;
}
if (subtitlesLanguage.getSubTokens() != null) {
// Test if the filename contains an indication of the subtitles (VOSTFR, ...)
for (String subToken : subtitlesLanguage.getSubTokens()) {
if ( StringUtils.containsIgnoreCase( filename, subToken) ) {
return true;
}
}
}
VideoMetaData metaData = getInstance().getMetaData(videoDownloadable, mainVideoFilePath);
if (metaData.getSubtitleLanguages() != null) {
for (Locale locale : metaData.getSubtitleLanguages()) {
if (locale.getLanguage().equals( subtitlesLanguage.getLocale().getLanguage() )) {
return true;
}
}
}
List<DownloadableFile> subtitleFiles =
allFiles.stream()
.filter( file -> SubtitlesFileFilter.getInstance().accept( file.getFilePath() ) )
.collect( Collectors.toList() );
String filenameWithoutExtension = filename;
if ( filenameWithoutExtension.lastIndexOf('.') > 0 ) {
filenameWithoutExtension = filenameWithoutExtension.substring( 0, filenameWithoutExtension.lastIndexOf('.'));
}
String targetFileNameRegExp = filenameWithoutExtension + "." + subtitlesLanguage.getShortName() + "\\.srt";
for (DownloadableFile subTitleFile : subtitleFiles) {
String subtitleFileName = subTitleFile.getFilePath().getFileName().toString();
if (RegExp.matches(subtitleFileName, targetFileNameRegExp )) {
return true;
}
}
// FIXME : this last test will accept any subtitle file without checking the language
if (!subtitleFiles.isEmpty()) {
return true;
}
return false;
} | DEFECT | true | }
}
// FIXME : this last test will accept any subtitle file without checking the language
if (!subtitleFiles.isEmpty()) {
return true; | if ( filenameWithoutExtension.lastIndexOf('.') > 0 ) {
filenameWithoutExtension = filenameWithoutExtension.substring( 0, filenameWithoutExtension.lastIndexOf('.'));
}
String targetFileNameRegExp = filenameWithoutExtension + "." + subtitlesLanguage.getShortName() + "\\.srt";
for (DownloadableFile subTitleFile : subtitleFiles) {
String subtitleFileName = subTitleFile.getFilePath().getFileName().toString();
if (RegExp.matches(subtitleFileName, targetFileNameRegExp )) {
return true;
}
}
// FIXME : this last test will accept any subtitle file without checking the language
if (!subtitleFiles.isEmpty()) {
return true;
}
return false;
} | if (locale.getLanguage().equals( subtitlesLanguage.getLocale().getLanguage() )) {
return true;
}
}
}
List<DownloadableFile> subtitleFiles =
allFiles.stream()
.filter( file -> SubtitlesFileFilter.getInstance().accept( file.getFilePath() ) )
.collect( Collectors.toList() );
String filenameWithoutExtension = filename;
if ( filenameWithoutExtension.lastIndexOf('.') > 0 ) {
filenameWithoutExtension = filenameWithoutExtension.substring( 0, filenameWithoutExtension.lastIndexOf('.'));
}
String targetFileNameRegExp = filenameWithoutExtension + "." + subtitlesLanguage.getShortName() + "\\.srt";
for (DownloadableFile subTitleFile : subtitleFiles) {
String subtitleFileName = subTitleFile.getFilePath().getFileName().toString();
if (RegExp.matches(subtitleFileName, targetFileNameRegExp )) {
return true;
}
}
// FIXME : this last test will accept any subtitle file without checking the language
if (!subtitleFiles.isEmpty()) {
return true;
}
return false;
} |
31,206 | 0 | // look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates. | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | NONSATD | true | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ; | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC")); | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid()); |
31,206 | 1 | // (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ; | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | NONSATD | true | // look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql); | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC")); | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid());
ps.execute();
} catch (SQLException ex) { |
31,206 | 2 | //timezone work needs to happen here | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | IMPLEMENTATION | true | ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid()); | ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | public static void createAppointment(Appointment TemplateAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "INSERT INTO appointments Values(NULL, ?, ?,?,?,?,?,Now(),'',Now(),'',?,?,?)";
// (Appointment_ID,Title,Description, Type, Phone, Division_ID) VALUES (5, '', 'test', '', 'test','')" ;
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, TemplateAppointment.getTitle());
ps.setString(2, TemplateAppointment.getDescription());
ps.setString(3, TemplateAppointment.getLocation());
ps.setString(4, TemplateAppointment.getType());
LocalDateTime start = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(TemplateAppointment.getDate(), TemplateAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, TemplateAppointment.getCustomerid());
ps.setInt(8, TemplateAppointment.getUserid());
ps.setInt(9, TemplateAppointment.getContactid());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} |
31,207 | 0 | // look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates. | public static void updateAppointments(Appointment PlaceholderAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "UPDATE appointments SET Title =?, Description=?, Location=?, Type=?, start=?, end=?, Customer_ID=?, User_ID=?, Contact_ID=? WHERE Appointment_ID = ?";
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, PlaceholderAppointment.getTitle());
ps.setString(2, PlaceholderAppointment.getDescription());
ps.setString(3, PlaceholderAppointment.getLocation());
ps.setString(4, PlaceholderAppointment.getType());
LocalDateTime start = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, PlaceholderAppointment.getCustomerid());
ps.setInt(8, PlaceholderAppointment.getUserid());
ps.setInt(9, PlaceholderAppointment.getContactid());
ps.setInt(10, PlaceholderAppointment.getAppointment_ID());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | NONSATD | true | public static void updateAppointments(Appointment PlaceholderAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "UPDATE appointments SET Title =?, Description=?, Location=?, Type=?, start=?, end=?, Customer_ID=?, User_ID=?, Contact_ID=? WHERE Appointment_ID = ?";
try { | public static void updateAppointments(Appointment PlaceholderAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "UPDATE appointments SET Title =?, Description=?, Location=?, Type=?, start=?, end=?, Customer_ID=?, User_ID=?, Contact_ID=? WHERE Appointment_ID = ?";
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, PlaceholderAppointment.getTitle());
ps.setString(2, PlaceholderAppointment.getDescription());
ps.setString(3, PlaceholderAppointment.getLocation());
ps.setString(4, PlaceholderAppointment.getType());
LocalDateTime start = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getEndTime()); | public static void updateAppointments(Appointment PlaceholderAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "UPDATE appointments SET Title =?, Description=?, Location=?, Type=?, start=?, end=?, Customer_ID=?, User_ID=?, Contact_ID=? WHERE Appointment_ID = ?";
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, PlaceholderAppointment.getTitle());
ps.setString(2, PlaceholderAppointment.getDescription());
ps.setString(3, PlaceholderAppointment.getLocation());
ps.setString(4, PlaceholderAppointment.getType());
LocalDateTime start = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, PlaceholderAppointment.getCustomerid());
ps.setInt(8, PlaceholderAppointment.getUserid());
ps.setInt(9, PlaceholderAppointment.getContactid());
ps.setInt(10, PlaceholderAppointment.getAppointment_ID()); |
31,207 | 1 | //timezone work needs to happen here | public static void updateAppointments(Appointment PlaceholderAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "UPDATE appointments SET Title =?, Description=?, Location=?, Type=?, start=?, end=?, Customer_ID=?, User_ID=?, Contact_ID=? WHERE Appointment_ID = ?";
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, PlaceholderAppointment.getTitle());
ps.setString(2, PlaceholderAppointment.getDescription());
ps.setString(3, PlaceholderAppointment.getLocation());
ps.setString(4, PlaceholderAppointment.getType());
LocalDateTime start = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, PlaceholderAppointment.getCustomerid());
ps.setInt(8, PlaceholderAppointment.getUserid());
ps.setInt(9, PlaceholderAppointment.getContactid());
ps.setInt(10, PlaceholderAppointment.getAppointment_ID());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | IMPLEMENTATION | true | ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, PlaceholderAppointment.getCustomerid());
ps.setInt(8, PlaceholderAppointment.getUserid()); | ps.setString(3, PlaceholderAppointment.getLocation());
ps.setString(4, PlaceholderAppointment.getType());
LocalDateTime start = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, PlaceholderAppointment.getCustomerid());
ps.setInt(8, PlaceholderAppointment.getUserid());
ps.setInt(9, PlaceholderAppointment.getContactid());
ps.setInt(10, PlaceholderAppointment.getAppointment_ID());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} | public static void updateAppointments(Appointment PlaceholderAppointment) {
// look up key to keys and "insert" to make everything work; //To change body of generated methods, choose Tools | Templates.
String sql = "UPDATE appointments SET Title =?, Description=?, Location=?, Type=?, start=?, end=?, Customer_ID=?, User_ID=?, Contact_ID=? WHERE Appointment_ID = ?";
try {
PreparedStatement ps = DBConnection.getConnection().prepareStatement(sql);
ps.setString(1, PlaceholderAppointment.getTitle());
ps.setString(2, PlaceholderAppointment.getDescription());
ps.setString(3, PlaceholderAppointment.getLocation());
ps.setString(4, PlaceholderAppointment.getType());
LocalDateTime start = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getStartTime());
start = WashTimeZone(start, ZoneId.systemDefault(), ZoneId.of("UTC"));
LocalDateTime end = LocalDateTime.of(PlaceholderAppointment.getDate(), PlaceholderAppointment.getEndTime());
end = WashTimeZone(end, ZoneId.systemDefault(), ZoneId.of("UTC"));
Timestamp Tstart = Timestamp.valueOf(start);
Timestamp Tend = Timestamp.valueOf(end);
ps.setTimestamp(5, Tstart);
ps.setTimestamp(6, Tend);
//timezone work needs to happen here
ps.setInt(7, PlaceholderAppointment.getCustomerid());
ps.setInt(8, PlaceholderAppointment.getUserid());
ps.setInt(9, PlaceholderAppointment.getContactid());
ps.setInt(10, PlaceholderAppointment.getAppointment_ID());
ps.execute();
} catch (SQLException ex) {
ex.printStackTrace();
}
} |
31,217 | 0 | // TODO subscribe to network events instead of using this | @Override
protected Void doInBackground(String... args) {
if (isCancelled()) {
return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText(
context,
getString(R.string.toast_nonetwork),
Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE
// avoid changing the code directly
Config.readConfigFile(ReplayConstants.CONFIG_FILE, context);
SharedPreferences sharedPrefs =
PreferenceManager.getDefaultSharedPreferences(context);
try {
// metadata here is user's network type device used geolocation if permitted etc
// Google storage forbids to store user related data
// So we send that data to a private server
server = sharedPrefs.getString("pref_server", "wehe2.meddle.mobi");
metadataServer = "wehe-metadata.meddle.mobi";
// We first resolve the IP of the server and then communicate with the server
// Using IP only, because we have multiple server under same domain and we want
// the client not to switch server during a test run
// TODO come up with a better way to handle Inet related queries, since this
// introduced inefficiency
final InetAddress[] address = {null, null};
new Thread() {
public void run() {
while (!(address[0] instanceof Inet4Address || address[0] instanceof Inet6Address)) {
try {
server = InetAddress.getByName(server).getHostAddress();
address[0] = InetAddress.getByName(server);
} catch (UnknownHostException e) {
Log.w("GetReplayServerIP", "get IP of replay server failed!");
e.printStackTrace();
}
}
}
}.start();
new Thread() {
public void run() {
while (!(address[1] instanceof Inet4Address || address[1] instanceof Inet6Address)) {
try {
metadataServer = InetAddress.getByName(metadataServer).getHostAddress();
address[1] = InetAddress.getByName(metadataServer);
} catch (UnknownHostException e) {
Log.w("GetReplayServerIP", "get IP of replay server failed!");
e.printStackTrace();
}
}
}
}.start();
int maxWaitTime = 5000;
int currentWaitTime = 500;
while (!(address[0] instanceof Inet4Address || address[0] instanceof Inet6Address)
&& !(address[1] instanceof Inet4Address || address[1] instanceof Inet6Address)) {
try {
if (currentWaitTime <= maxWaitTime) {
Thread.sleep(currentWaitTime);
currentWaitTime += 500;
} else {
Toast.makeText(context, R.string.server_unavailable,
Toast.LENGTH_LONG).show();
return null;
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (address[0] instanceof Inet6Address)
server = "[" + server + "]";
if (address[1] instanceof Inet6Address)
metadataServer = "[" + metadataServer + "]";
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate ca;
try (InputStream caInput = getResources().openRawResource(R.raw.main)) {
ca = cf.generateCertificate(caInput);
System.out.println("main=" + ((X509Certificate) ca).getIssuerDN());
}
// Create a KeyStore containing our trusted CAs
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(null, null);
keyStore.setCertificateEntry("main", ca);
// Create a TrustManager that trusts the CAs in our KeyStore
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
// Create an SSLContext that uses our TrustManager
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
sslSocketFactory = context.getSocketFactory();
hostnameVerifier = (hostname, session) -> true;
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate ca;
try (InputStream caInput = getResources().openRawResource(R.raw.metadata)) {
ca = cf.generateCertificate(caInput);
System.out.println("metadata=" + ((X509Certificate) ca).getIssuerDN());
}
// Create a KeyStore containing our trusted CAs
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(null, null);
keyStore.setCertificateEntry("metadata", ca);
// Create a TrustManager that trusts the CAs in our KeyStore
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
// Create an SSLContext that uses our TrustManager
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
metadataSocketFactory = context.getSocketFactory();
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Log.d("GetReplayServerIP", "Server IP: " + server);
} catch (NullPointerException e) {
e.printStackTrace();
Log.w("GetReplayServerIP", "Invalid IP address!");
}
// Extract data that was sent by previous activity. In our case, list of
// apps, server and timing
enableTiming = "true";
doTest = false;
int port = Integer.valueOf(Config.get("result_port"));
analyzerServerUrl = ("https://" + server + ":" + port + "/Results");
date = new Date();
results = new JSONArray();
Log.d("Result Channel",
"path: " + server + " port: " + port);
confirmationReplays = sharedPrefs.getBoolean("confirmationReplays", true);
// generate or retrieve an id for this phone
boolean hasID = sharedPrefs.getBoolean("hasID", false);
if (!hasID) {
randomID = new RandomString(10).nextString();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putBoolean("hasID", true);
editor.putString("ID", randomID);
editor.apply();
} else {
randomID = sharedPrefs.getString("ID", null);
}
a_threshold = Integer.parseInt(Objects.requireNonNull(sharedPrefs.getString("pref_threshold_area", "10")));
ks2pvalue_threshold = Integer.parseInt(Objects.requireNonNull(sharedPrefs.getString("pref_threshold_ks2p", "5")));
confirmationReplays = sharedPrefs.getBoolean("pref_multiple_tests", true);
// to get historyCount
settings = getSharedPreferences(STATUS, Context.MODE_PRIVATE);
// generate or retrieve an historyCount for this phone
boolean hasHistoryCount = settings.getBoolean("hasHistoryCount", false);
if (!hasHistoryCount) {
historyCount = 0;
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("hasHistoryCount", true);
editor.putInt("historyCount", historyCount);
editor.apply();
} else {
historyCount = settings.getInt("historyCount", -1);
}
// check if retrieve historyCount succeeded
if (historyCount == -1)
throw new RuntimeException();
Config.set("timing", enableTiming);
// make sure server is initialized!
while (server == null) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Config.set("server", server);
Config.set("jitter", "true");
Config.set("publicIP", "");
new Thread(new Runnable() {
public void run() {
Config.set("publicIP", getPublicIP("80"));
}
}).start();
// Find a way to switch to no wait
while (Config.get("publicIP").equals("")) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Log.d("Replay", "public IP: " + Config.get("publicIP"));
}
for (ApplicationBean app : selectedApps) {
rerun = false;
// Set the app to run test for
this.app = app;
// Run the test on this.app
runTest();
}
// Keep checking if the user exited from ReplayActivity or not
// TODO find a better way stop the tests immediately without continues checking
if (isCancelled()) {
return null;
}
if (results.length() > 0) {
Log.d("Result Channel", "Storing results");
saveResults();
}
if (isCancelled()) {
return null;
}
showFinishDialog();
Log.d("Result Channel", "Exiting normally");
return null;
} | DESIGN | true | return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText( | @Override
protected Void doInBackground(String... args) {
if (isCancelled()) {
return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText(
context,
getString(R.string.toast_nonetwork),
Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE
// avoid changing the code directly | @Override
protected Void doInBackground(String... args) {
if (isCancelled()) {
return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText(
context,
getString(R.string.toast_nonetwork),
Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE
// avoid changing the code directly
Config.readConfigFile(ReplayConstants.CONFIG_FILE, context);
SharedPreferences sharedPrefs =
PreferenceManager.getDefaultSharedPreferences(context);
try {
// metadata here is user's network type device used geolocation if permitted etc
// Google storage forbids to store user related data
// So we send that data to a private server
server = sharedPrefs.getString("pref_server", "wehe2.meddle.mobi");
metadataServer = "wehe-metadata.meddle.mobi";
// We first resolve the IP of the server and then communicate with the server |
31,217 | 1 | // TODO remove this but with caution | @Override
protected Void doInBackground(String... args) {
if (isCancelled()) {
return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText(
context,
getString(R.string.toast_nonetwork),
Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE
// avoid changing the code directly
Config.readConfigFile(ReplayConstants.CONFIG_FILE, context);
SharedPreferences sharedPrefs =
PreferenceManager.getDefaultSharedPreferences(context);
try {
// metadata here is user's network type device used geolocation if permitted etc
// Google storage forbids to store user related data
// So we send that data to a private server
server = sharedPrefs.getString("pref_server", "wehe2.meddle.mobi");
metadataServer = "wehe-metadata.meddle.mobi";
// We first resolve the IP of the server and then communicate with the server
// Using IP only, because we have multiple server under same domain and we want
// the client not to switch server during a test run
// TODO come up with a better way to handle Inet related queries, since this
// introduced inefficiency
final InetAddress[] address = {null, null};
new Thread() {
public void run() {
while (!(address[0] instanceof Inet4Address || address[0] instanceof Inet6Address)) {
try {
server = InetAddress.getByName(server).getHostAddress();
address[0] = InetAddress.getByName(server);
} catch (UnknownHostException e) {
Log.w("GetReplayServerIP", "get IP of replay server failed!");
e.printStackTrace();
}
}
}
}.start();
new Thread() {
public void run() {
while (!(address[1] instanceof Inet4Address || address[1] instanceof Inet6Address)) {
try {
metadataServer = InetAddress.getByName(metadataServer).getHostAddress();
address[1] = InetAddress.getByName(metadataServer);
} catch (UnknownHostException e) {
Log.w("GetReplayServerIP", "get IP of replay server failed!");
e.printStackTrace();
}
}
}
}.start();
int maxWaitTime = 5000;
int currentWaitTime = 500;
while (!(address[0] instanceof Inet4Address || address[0] instanceof Inet6Address)
&& !(address[1] instanceof Inet4Address || address[1] instanceof Inet6Address)) {
try {
if (currentWaitTime <= maxWaitTime) {
Thread.sleep(currentWaitTime);
currentWaitTime += 500;
} else {
Toast.makeText(context, R.string.server_unavailable,
Toast.LENGTH_LONG).show();
return null;
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (address[0] instanceof Inet6Address)
server = "[" + server + "]";
if (address[1] instanceof Inet6Address)
metadataServer = "[" + metadataServer + "]";
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate ca;
try (InputStream caInput = getResources().openRawResource(R.raw.main)) {
ca = cf.generateCertificate(caInput);
System.out.println("main=" + ((X509Certificate) ca).getIssuerDN());
}
// Create a KeyStore containing our trusted CAs
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(null, null);
keyStore.setCertificateEntry("main", ca);
// Create a TrustManager that trusts the CAs in our KeyStore
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
// Create an SSLContext that uses our TrustManager
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
sslSocketFactory = context.getSocketFactory();
hostnameVerifier = (hostname, session) -> true;
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate ca;
try (InputStream caInput = getResources().openRawResource(R.raw.metadata)) {
ca = cf.generateCertificate(caInput);
System.out.println("metadata=" + ((X509Certificate) ca).getIssuerDN());
}
// Create a KeyStore containing our trusted CAs
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(null, null);
keyStore.setCertificateEntry("metadata", ca);
// Create a TrustManager that trusts the CAs in our KeyStore
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
// Create an SSLContext that uses our TrustManager
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
metadataSocketFactory = context.getSocketFactory();
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Log.d("GetReplayServerIP", "Server IP: " + server);
} catch (NullPointerException e) {
e.printStackTrace();
Log.w("GetReplayServerIP", "Invalid IP address!");
}
// Extract data that was sent by previous activity. In our case, list of
// apps, server and timing
enableTiming = "true";
doTest = false;
int port = Integer.valueOf(Config.get("result_port"));
analyzerServerUrl = ("https://" + server + ":" + port + "/Results");
date = new Date();
results = new JSONArray();
Log.d("Result Channel",
"path: " + server + " port: " + port);
confirmationReplays = sharedPrefs.getBoolean("confirmationReplays", true);
// generate or retrieve an id for this phone
boolean hasID = sharedPrefs.getBoolean("hasID", false);
if (!hasID) {
randomID = new RandomString(10).nextString();
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putBoolean("hasID", true);
editor.putString("ID", randomID);
editor.apply();
} else {
randomID = sharedPrefs.getString("ID", null);
}
a_threshold = Integer.parseInt(Objects.requireNonNull(sharedPrefs.getString("pref_threshold_area", "10")));
ks2pvalue_threshold = Integer.parseInt(Objects.requireNonNull(sharedPrefs.getString("pref_threshold_ks2p", "5")));
confirmationReplays = sharedPrefs.getBoolean("pref_multiple_tests", true);
// to get historyCount
settings = getSharedPreferences(STATUS, Context.MODE_PRIVATE);
// generate or retrieve an historyCount for this phone
boolean hasHistoryCount = settings.getBoolean("hasHistoryCount", false);
if (!hasHistoryCount) {
historyCount = 0;
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("hasHistoryCount", true);
editor.putInt("historyCount", historyCount);
editor.apply();
} else {
historyCount = settings.getInt("historyCount", -1);
}
// check if retrieve historyCount succeeded
if (historyCount == -1)
throw new RuntimeException();
Config.set("timing", enableTiming);
// make sure server is initialized!
while (server == null) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Config.set("server", server);
Config.set("jitter", "true");
Config.set("publicIP", "");
new Thread(new Runnable() {
public void run() {
Config.set("publicIP", getPublicIP("80"));
}
}).start();
// Find a way to switch to no wait
while (Config.get("publicIP").equals("")) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Log.d("Replay", "public IP: " + Config.get("publicIP"));
}
for (ApplicationBean app : selectedApps) {
rerun = false;
// Set the app to run test for
this.app = app;
// Run the test on this.app
runTest();
}
// Keep checking if the user exited from ReplayActivity or not
// TODO find a better way stop the tests immediately without continues checking
if (isCancelled()) {
return null;
}
if (results.length() > 0) {
Log.d("Result Channel", "Storing results");
saveResults();
}
if (isCancelled()) {
return null;
}
showFinishDialog();
Log.d("Result Channel", "Exiting normally");
return null;
} | IMPLEMENTATION | true | Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE | if (isCancelled()) {
return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText(
context,
getString(R.string.toast_nonetwork),
Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE
// avoid changing the code directly
Config.readConfigFile(ReplayConstants.CONFIG_FILE, context);
SharedPreferences sharedPrefs =
PreferenceManager.getDefaultSharedPreferences(context);
try {
// metadata here is user's network type device used geolocation if permitted etc
// Google storage forbids to store user related data
// So we send that data to a private server | @Override
protected Void doInBackground(String... args) {
if (isCancelled()) {
return null;
}
// TODO subscribe to network events instead of using this
if (!networkAvailable) {
Toast.makeText(
context,
getString(R.string.toast_nonetwork),
Toast.LENGTH_LONG).show();
} else {
// TODO remove this but with caution
updateUIBean = new UpdateUIBean();
// TODO to test different configs change the files poiting by CONFIG_FILE
// avoid changing the code directly
Config.readConfigFile(ReplayConstants.CONFIG_FILE, context);
SharedPreferences sharedPrefs =
PreferenceManager.getDefaultSharedPreferences(context);
try {
// metadata here is user's network type device used geolocation if permitted etc
// Google storage forbids to store user related data
// So we send that data to a private server
server = sharedPrefs.getString("pref_server", "wehe2.meddle.mobi");
metadataServer = "wehe-metadata.meddle.mobi";
// We first resolve the IP of the server and then communicate with the server
// Using IP only, because we have multiple server under same domain and we want
// the client not to switch server during a test run
// TODO come up with a better way to handle Inet related queries, since this
// introduced inefficiency
final InetAddress[] address = {null, null};
new Thread() {
public void run() { |