repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java | ManyToOneAttribute.setLongAttribute | public void setLongAttribute(String name, Long value) {
ensureValue();
Attribute attribute = new LongAttribute(value);
attribute.setEditable(isEditable(name));
getValue().getAllAttributes().put(name, attribute);
} | java | public void setLongAttribute(String name, Long value) {
ensureValue();
Attribute attribute = new LongAttribute(value);
attribute.setEditable(isEditable(name));
getValue().getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setLongAttribute",
"(",
"String",
"name",
",",
"Long",
"value",
")",
"{",
"ensureValue",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"LongAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditable",
"(",
"name",
")",
")",
";",
"getValue",
"(",
")",
".",
"getAllAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"attribute",
")",
";",
"}"
] | Sets the specified long attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"long",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java#L216-L221 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java | ManyToOneAttribute.setShortAttribute | public void setShortAttribute(String name, Short value) {
ensureValue();
Attribute attribute = new ShortAttribute(value);
attribute.setEditable(isEditable(name));
getValue().getAllAttributes().put(name, attribute);
} | java | public void setShortAttribute(String name, Short value) {
ensureValue();
Attribute attribute = new ShortAttribute(value);
attribute.setEditable(isEditable(name));
getValue().getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setShortAttribute",
"(",
"String",
"name",
",",
"Short",
"value",
")",
"{",
"ensureValue",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"ShortAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditable",
"(",
"name",
")",
")",
";",
"getValue",
"(",
")",
".",
"getAllAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"attribute",
")",
";",
"}"
] | Sets the specified short attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"short",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java#L230-L235 | train |
kuali/ojb-1.0.4 | src/tools/org/apache/ojb/tools/mapping/reversedb2/ojbmetatreemodel/OjbMetaTreeNode.java | OjbMetaTreeNode.load | public boolean load()
{
_load();
java.util.Iterator it = this.alChildren.iterator();
while (it.hasNext())
{
Object o = it.next();
if (o instanceof OjbMetaTreeNode) ((OjbMetaTreeNode)o).load();
}
return true;
} | java | public boolean load()
{
_load();
java.util.Iterator it = this.alChildren.iterator();
while (it.hasNext())
{
Object o = it.next();
if (o instanceof OjbMetaTreeNode) ((OjbMetaTreeNode)o).load();
}
return true;
} | [
"public",
"boolean",
"load",
"(",
")",
"{",
"_load",
"(",
")",
";",
"java",
".",
"util",
".",
"Iterator",
"it",
"=",
"this",
".",
"alChildren",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"o",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"o",
"instanceof",
"OjbMetaTreeNode",
")",
"(",
"(",
"OjbMetaTreeNode",
")",
"o",
")",
".",
"load",
"(",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Recursively loads the metadata for this node | [
"Recursively",
"loads",
"the",
"metadata",
"for",
"this",
"node"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/ojbmetatreemodel/OjbMetaTreeNode.java#L120-L130 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.getAttributes | @Deprecated
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map<String, PrimitiveAttribute<?>> getAttributes() {
if (!isPrimitiveOnly()) {
throw new UnsupportedOperationException("Primitive API not supported for nested association values");
}
return (Map) attributes;
} | java | @Deprecated
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map<String, PrimitiveAttribute<?>> getAttributes() {
if (!isPrimitiveOnly()) {
throw new UnsupportedOperationException("Primitive API not supported for nested association values");
}
return (Map) attributes;
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"Map",
"<",
"String",
",",
"PrimitiveAttribute",
"<",
"?",
">",
">",
"getAttributes",
"(",
")",
"{",
"if",
"(",
"!",
"isPrimitiveOnly",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Primitive API not supported for nested association values\"",
")",
";",
"}",
"return",
"(",
"Map",
")",
"attributes",
";",
"}"
] | Get the primitive attributes for the associated object.
@return attributes for associated objects
@deprecated replaced by {@link #getAllAttributes()} after introduction of nested associations | [
"Get",
"the",
"primitive",
"attributes",
"for",
"the",
"associated",
"object",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L132-L139 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setAttributes | @Deprecated
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setAttributes(Map<String, PrimitiveAttribute<?>> attributes) {
if (!isPrimitiveOnly()) {
throw new UnsupportedOperationException("Primitive API not supported for nested association values");
}
this.attributes = (Map) attributes;
} | java | @Deprecated
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setAttributes(Map<String, PrimitiveAttribute<?>> attributes) {
if (!isPrimitiveOnly()) {
throw new UnsupportedOperationException("Primitive API not supported for nested association values");
}
this.attributes = (Map) attributes;
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"void",
"setAttributes",
"(",
"Map",
"<",
"String",
",",
"PrimitiveAttribute",
"<",
"?",
">",
">",
"attributes",
")",
"{",
"if",
"(",
"!",
"isPrimitiveOnly",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Primitive API not supported for nested association values\"",
")",
";",
"}",
"this",
".",
"attributes",
"=",
"(",
"Map",
")",
"attributes",
";",
"}"
] | Set the attributes for the associated object.
@param attributes attributes for associated objects
@deprecated replaced by {@link #setAllAttributes(Map)} after introduction of nested associations | [
"Set",
"the",
"attributes",
"for",
"the",
"associated",
"object",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L147-L154 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.getAttributeValue | public Object getAttributeValue(String attributeName) {
Attribute attribute = getAllAttributes().get(attributeName);
if (attribute != null) {
return attribute.getValue();
}
return null;
} | java | public Object getAttributeValue(String attributeName) {
Attribute attribute = getAllAttributes().get(attributeName);
if (attribute != null) {
return attribute.getValue();
}
return null;
} | [
"public",
"Object",
"getAttributeValue",
"(",
"String",
"attributeName",
")",
"{",
"Attribute",
"attribute",
"=",
"getAllAttributes",
"(",
")",
".",
"get",
"(",
"attributeName",
")",
";",
"if",
"(",
"attribute",
"!=",
"null",
")",
"{",
"return",
"attribute",
".",
"getValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Convenience method that returns the attribute value for the specified attribute name.
@param attributeName the name of the attribute
@return the value of the attribute or null if no such attribute exists
@since 1.9.0 | [
"Convenience",
"method",
"that",
"returns",
"the",
"attribute",
"value",
"for",
"the",
"specified",
"attribute",
"name",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L183-L189 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setDateAttribute | public void setDateAttribute(String name, Date value) {
ensureAttributes();
Attribute attribute = new DateAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | java | public void setDateAttribute(String name, Date value) {
ensureAttributes();
Attribute attribute = new DateAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setDateAttribute",
"(",
"String",
"name",
",",
"Date",
"value",
")",
"{",
"ensureAttributes",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"DateAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditable",
"(",
"name",
")",
")",
";",
"getAllAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"attribute",
")",
";",
"}"
] | Sets the specified date attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"date",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L246-L251 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setDoubleAttribute | public void setDoubleAttribute(String name, Double value) {
ensureAttributes();
Attribute attribute = new DoubleAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | java | public void setDoubleAttribute(String name, Double value) {
ensureAttributes();
Attribute attribute = new DoubleAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setDoubleAttribute",
"(",
"String",
"name",
",",
"Double",
"value",
")",
"{",
"ensureAttributes",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"DoubleAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditable",
"(",
"name",
")",
")",
";",
"getAllAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"attribute",
")",
";",
"}"
] | Sets the specified double attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"double",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L260-L266 | train |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setManyToOneAttribute | public void setManyToOneAttribute(String name, AssociationValue value) {
ensureAttributes();
Attribute attribute = new ManyToOneAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | java | public void setManyToOneAttribute(String name, AssociationValue value) {
ensureAttributes();
Attribute attribute = new ManyToOneAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setManyToOneAttribute",
"(",
"String",
"name",
",",
"AssociationValue",
"value",
")",
"{",
"ensureAttributes",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"ManyToOneAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditable",
"(",
"name",
")",
")",
";",
"getAllAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"attribute",
")",
";",
"}"
] | Sets the specified many-to-one attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"many",
"-",
"to",
"-",
"one",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L380-L386 | train |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/impl/RasterLayerComponentImpl.java | RasterLayerComponentImpl.addImage | protected void addImage(PdfContext context, ImageResult imageResult) throws BadElementException, IOException {
Bbox imageBounds = imageResult.getRasterImage().getBounds();
float scaleFactor = (float) (72 / getMap().getRasterResolution());
float width = (float) imageBounds.getWidth() * scaleFactor;
float height = (float) imageBounds.getHeight() * scaleFactor;
// subtract screen position of lower-left corner
float x = (float) (imageBounds.getX() - rasterScale * bbox.getMinX()) * scaleFactor;
// shift y to lowerleft corner, flip y to user space and subtract
// screen position of lower-left
// corner
float y = (float) (-imageBounds.getY() - imageBounds.getHeight() - rasterScale * bbox.getMinY()) * scaleFactor;
if (log.isDebugEnabled()) {
log.debug("adding image, width=" + width + ",height=" + height + ",x=" + x + ",y=" + y);
}
// opacity
log.debug("before drawImage");
context.drawImage(Image.getInstance(imageResult.getImage()), new Rectangle(x, y, x + width, y + height),
getSize(), getOpacity());
log.debug("after drawImage");
} | java | protected void addImage(PdfContext context, ImageResult imageResult) throws BadElementException, IOException {
Bbox imageBounds = imageResult.getRasterImage().getBounds();
float scaleFactor = (float) (72 / getMap().getRasterResolution());
float width = (float) imageBounds.getWidth() * scaleFactor;
float height = (float) imageBounds.getHeight() * scaleFactor;
// subtract screen position of lower-left corner
float x = (float) (imageBounds.getX() - rasterScale * bbox.getMinX()) * scaleFactor;
// shift y to lowerleft corner, flip y to user space and subtract
// screen position of lower-left
// corner
float y = (float) (-imageBounds.getY() - imageBounds.getHeight() - rasterScale * bbox.getMinY()) * scaleFactor;
if (log.isDebugEnabled()) {
log.debug("adding image, width=" + width + ",height=" + height + ",x=" + x + ",y=" + y);
}
// opacity
log.debug("before drawImage");
context.drawImage(Image.getInstance(imageResult.getImage()), new Rectangle(x, y, x + width, y + height),
getSize(), getOpacity());
log.debug("after drawImage");
} | [
"protected",
"void",
"addImage",
"(",
"PdfContext",
"context",
",",
"ImageResult",
"imageResult",
")",
"throws",
"BadElementException",
",",
"IOException",
"{",
"Bbox",
"imageBounds",
"=",
"imageResult",
".",
"getRasterImage",
"(",
")",
".",
"getBounds",
"(",
")",
";",
"float",
"scaleFactor",
"=",
"(",
"float",
")",
"(",
"72",
"/",
"getMap",
"(",
")",
".",
"getRasterResolution",
"(",
")",
")",
";",
"float",
"width",
"=",
"(",
"float",
")",
"imageBounds",
".",
"getWidth",
"(",
")",
"*",
"scaleFactor",
";",
"float",
"height",
"=",
"(",
"float",
")",
"imageBounds",
".",
"getHeight",
"(",
")",
"*",
"scaleFactor",
";",
"// subtract screen position of lower-left corner",
"float",
"x",
"=",
"(",
"float",
")",
"(",
"imageBounds",
".",
"getX",
"(",
")",
"-",
"rasterScale",
"*",
"bbox",
".",
"getMinX",
"(",
")",
")",
"*",
"scaleFactor",
";",
"// shift y to lowerleft corner, flip y to user space and subtract",
"// screen position of lower-left",
"// corner",
"float",
"y",
"=",
"(",
"float",
")",
"(",
"-",
"imageBounds",
".",
"getY",
"(",
")",
"-",
"imageBounds",
".",
"getHeight",
"(",
")",
"-",
"rasterScale",
"*",
"bbox",
".",
"getMinY",
"(",
")",
")",
"*",
"scaleFactor",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"adding image, width=\"",
"+",
"width",
"+",
"\",height=\"",
"+",
"height",
"+",
"\",x=\"",
"+",
"x",
"+",
"\",y=\"",
"+",
"y",
")",
";",
"}",
"// opacity",
"log",
".",
"debug",
"(",
"\"before drawImage\"",
")",
";",
"context",
".",
"drawImage",
"(",
"Image",
".",
"getInstance",
"(",
"imageResult",
".",
"getImage",
"(",
")",
")",
",",
"new",
"Rectangle",
"(",
"x",
",",
"y",
",",
"x",
"+",
"width",
",",
"y",
"+",
"height",
")",
",",
"getSize",
"(",
")",
",",
"getOpacity",
"(",
")",
")",
";",
"log",
".",
"debug",
"(",
"\"after drawImage\"",
")",
";",
"}"
] | Add image in the document.
@param context
PDF context
@param imageResult
image
@throws BadElementException
PDF construction problem
@throws IOException
PDF construction problem | [
"Add",
"image",
"in",
"the",
"document",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/impl/RasterLayerComponentImpl.java#L385-L404 | train |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/impl/RasterLayerComponentImpl.java | RasterLayerComponentImpl.addLoadError | protected void addLoadError(PdfContext context, ImageException e) {
Bbox imageBounds = e.getRasterImage().getBounds();
float scaleFactor = (float) (72 / getMap().getRasterResolution());
float width = (float) imageBounds.getWidth() * scaleFactor;
float height = (float) imageBounds.getHeight() * scaleFactor;
// subtract screen position of lower-left corner
float x = (float) (imageBounds.getX() - rasterScale * bbox.getMinX()) * scaleFactor;
// shift y to lower left corner, flip y to user space and subtract
// screen position of lower-left
// corner
float y = (float) (-imageBounds.getY() - imageBounds.getHeight() - rasterScale * bbox.getMinY()) * scaleFactor;
if (log.isDebugEnabled()) {
log.debug("adding failed message=" + width + ",height=" + height + ",x=" + x + ",y=" + y);
}
float textHeight = context.getTextSize("failed", ERROR_FONT).getHeight() * 3f;
Rectangle rec = new Rectangle(x, y, x + width, y + height);
context.strokeRectangle(rec, Color.RED, 0.5f);
context.drawText(getNlsString("RasterLayerComponent.loaderror.line1"), ERROR_FONT, new Rectangle(x, y
+ textHeight, x + width, y + height), Color.RED);
context.drawText(getNlsString("RasterLayerComponent.loaderror.line2"), ERROR_FONT, rec, Color.RED);
context.drawText(getNlsString("RasterLayerComponent.loaderror.line3"), ERROR_FONT, new Rectangle(x, y
- textHeight, x + width, y + height), Color.RED);
} | java | protected void addLoadError(PdfContext context, ImageException e) {
Bbox imageBounds = e.getRasterImage().getBounds();
float scaleFactor = (float) (72 / getMap().getRasterResolution());
float width = (float) imageBounds.getWidth() * scaleFactor;
float height = (float) imageBounds.getHeight() * scaleFactor;
// subtract screen position of lower-left corner
float x = (float) (imageBounds.getX() - rasterScale * bbox.getMinX()) * scaleFactor;
// shift y to lower left corner, flip y to user space and subtract
// screen position of lower-left
// corner
float y = (float) (-imageBounds.getY() - imageBounds.getHeight() - rasterScale * bbox.getMinY()) * scaleFactor;
if (log.isDebugEnabled()) {
log.debug("adding failed message=" + width + ",height=" + height + ",x=" + x + ",y=" + y);
}
float textHeight = context.getTextSize("failed", ERROR_FONT).getHeight() * 3f;
Rectangle rec = new Rectangle(x, y, x + width, y + height);
context.strokeRectangle(rec, Color.RED, 0.5f);
context.drawText(getNlsString("RasterLayerComponent.loaderror.line1"), ERROR_FONT, new Rectangle(x, y
+ textHeight, x + width, y + height), Color.RED);
context.drawText(getNlsString("RasterLayerComponent.loaderror.line2"), ERROR_FONT, rec, Color.RED);
context.drawText(getNlsString("RasterLayerComponent.loaderror.line3"), ERROR_FONT, new Rectangle(x, y
- textHeight, x + width, y + height), Color.RED);
} | [
"protected",
"void",
"addLoadError",
"(",
"PdfContext",
"context",
",",
"ImageException",
"e",
")",
"{",
"Bbox",
"imageBounds",
"=",
"e",
".",
"getRasterImage",
"(",
")",
".",
"getBounds",
"(",
")",
";",
"float",
"scaleFactor",
"=",
"(",
"float",
")",
"(",
"72",
"/",
"getMap",
"(",
")",
".",
"getRasterResolution",
"(",
")",
")",
";",
"float",
"width",
"=",
"(",
"float",
")",
"imageBounds",
".",
"getWidth",
"(",
")",
"*",
"scaleFactor",
";",
"float",
"height",
"=",
"(",
"float",
")",
"imageBounds",
".",
"getHeight",
"(",
")",
"*",
"scaleFactor",
";",
"// subtract screen position of lower-left corner",
"float",
"x",
"=",
"(",
"float",
")",
"(",
"imageBounds",
".",
"getX",
"(",
")",
"-",
"rasterScale",
"*",
"bbox",
".",
"getMinX",
"(",
")",
")",
"*",
"scaleFactor",
";",
"// shift y to lower left corner, flip y to user space and subtract",
"// screen position of lower-left",
"// corner",
"float",
"y",
"=",
"(",
"float",
")",
"(",
"-",
"imageBounds",
".",
"getY",
"(",
")",
"-",
"imageBounds",
".",
"getHeight",
"(",
")",
"-",
"rasterScale",
"*",
"bbox",
".",
"getMinY",
"(",
")",
")",
"*",
"scaleFactor",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"adding failed message=\"",
"+",
"width",
"+",
"\",height=\"",
"+",
"height",
"+",
"\",x=\"",
"+",
"x",
"+",
"\",y=\"",
"+",
"y",
")",
";",
"}",
"float",
"textHeight",
"=",
"context",
".",
"getTextSize",
"(",
"\"failed\"",
",",
"ERROR_FONT",
")",
".",
"getHeight",
"(",
")",
"*",
"3f",
";",
"Rectangle",
"rec",
"=",
"new",
"Rectangle",
"(",
"x",
",",
"y",
",",
"x",
"+",
"width",
",",
"y",
"+",
"height",
")",
";",
"context",
".",
"strokeRectangle",
"(",
"rec",
",",
"Color",
".",
"RED",
",",
"0.5f",
")",
";",
"context",
".",
"drawText",
"(",
"getNlsString",
"(",
"\"RasterLayerComponent.loaderror.line1\"",
")",
",",
"ERROR_FONT",
",",
"new",
"Rectangle",
"(",
"x",
",",
"y",
"+",
"textHeight",
",",
"x",
"+",
"width",
",",
"y",
"+",
"height",
")",
",",
"Color",
".",
"RED",
")",
";",
"context",
".",
"drawText",
"(",
"getNlsString",
"(",
"\"RasterLayerComponent.loaderror.line2\"",
")",
",",
"ERROR_FONT",
",",
"rec",
",",
"Color",
".",
"RED",
")",
";",
"context",
".",
"drawText",
"(",
"getNlsString",
"(",
"\"RasterLayerComponent.loaderror.line3\"",
")",
",",
"ERROR_FONT",
",",
"new",
"Rectangle",
"(",
"x",
",",
"y",
"-",
"textHeight",
",",
"x",
"+",
"width",
",",
"y",
"+",
"height",
")",
",",
"Color",
".",
"RED",
")",
";",
"}"
] | Add image with a exception message in the PDF document.
@param context
PDF context
@param e
exception to put in image | [
"Add",
"image",
"with",
"a",
"exception",
"message",
"in",
"the",
"PDF",
"document",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/impl/RasterLayerComponentImpl.java#L414-L436 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/cache/MaterializationCache.java | MaterializationCache.doLocalClear | public void doLocalClear()
{
if(log.isDebugEnabled()) log.debug("Clear materialization cache");
invokeCounter = 0;
enabledReadCache = false;
objectBuffer.clear();
} | java | public void doLocalClear()
{
if(log.isDebugEnabled()) log.debug("Clear materialization cache");
invokeCounter = 0;
enabledReadCache = false;
objectBuffer.clear();
} | [
"public",
"void",
"doLocalClear",
"(",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"Clear materialization cache\"",
")",
";",
"invokeCounter",
"=",
"0",
";",
"enabledReadCache",
"=",
"false",
";",
"objectBuffer",
".",
"clear",
"(",
")",
";",
"}"
] | Clears the internal used cache for object materialization. | [
"Clears",
"the",
"internal",
"used",
"cache",
"for",
"object",
"materialization",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/cache/MaterializationCache.java#L176-L182 | train |
hmsonline/cassandra-triggers | src/main/java/com/hmsonline/cassandra/triggers/CassandraServerTriggerAspect.java | CassandraServerTriggerAspect.logErrorFromThrownException | @AfterThrowing(pointcut = "execution(* org.apache.cassandra.thrift.CassandraServer.doInsert(..))", throwing = "throwable")
public void logErrorFromThrownException(final JoinPoint joinPoint, final Throwable throwable) {
final String className = joinPoint.getTarget().getClass().getName();
final String methodName = joinPoint.getSignature().getName();
logger.error("Could not write to cassandra! Method: " + className + "."+ methodName + "()", throwable);
} | java | @AfterThrowing(pointcut = "execution(* org.apache.cassandra.thrift.CassandraServer.doInsert(..))", throwing = "throwable")
public void logErrorFromThrownException(final JoinPoint joinPoint, final Throwable throwable) {
final String className = joinPoint.getTarget().getClass().getName();
final String methodName = joinPoint.getSignature().getName();
logger.error("Could not write to cassandra! Method: " + className + "."+ methodName + "()", throwable);
} | [
"@",
"AfterThrowing",
"(",
"pointcut",
"=",
"\"execution(* org.apache.cassandra.thrift.CassandraServer.doInsert(..))\"",
",",
"throwing",
"=",
"\"throwable\"",
")",
"public",
"void",
"logErrorFromThrownException",
"(",
"final",
"JoinPoint",
"joinPoint",
",",
"final",
"Throwable",
"throwable",
")",
"{",
"final",
"String",
"className",
"=",
"joinPoint",
".",
"getTarget",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"final",
"String",
"methodName",
"=",
"joinPoint",
".",
"getSignature",
"(",
")",
".",
"getName",
"(",
")",
";",
"logger",
".",
"error",
"(",
"\"Could not write to cassandra! Method: \"",
"+",
"className",
"+",
"\".\"",
"+",
"methodName",
"+",
"\"()\"",
",",
"throwable",
")",
";",
"}"
] | Logs an error message for unhandled exception thrown from the target method.
@param joinPoint - the joint point cut that contains information about the target
@param throwable - the cause of the exception from the target method invocation | [
"Logs",
"an",
"error",
"message",
"for",
"unhandled",
"exception",
"thrown",
"from",
"the",
"target",
"method",
"."
] | 022862c7e4bbdd3423b5926f360ea9bf8f81c8b7 | https://github.com/hmsonline/cassandra-triggers/blob/022862c7e4bbdd3423b5926f360ea9bf8f81c8b7/src/main/java/com/hmsonline/cassandra/triggers/CassandraServerTriggerAspect.java#L56-L62 | train |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java | AbstractResource.getDependencyJsonModel | public String getDependencyJsonModel() throws IOException {
final Artifact artifact = DataModelFactory.createArtifact("","","","","","","");
return JsonUtils.serialize(DataModelFactory.createDependency(artifact, Scope.COMPILE));
} | java | public String getDependencyJsonModel() throws IOException {
final Artifact artifact = DataModelFactory.createArtifact("","","","","","","");
return JsonUtils.serialize(DataModelFactory.createDependency(artifact, Scope.COMPILE));
} | [
"public",
"String",
"getDependencyJsonModel",
"(",
")",
"throws",
"IOException",
"{",
"final",
"Artifact",
"artifact",
"=",
"DataModelFactory",
".",
"createArtifact",
"(",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
",",
"\"\"",
")",
";",
"return",
"JsonUtils",
".",
"serialize",
"(",
"DataModelFactory",
".",
"createDependency",
"(",
"artifact",
",",
"Scope",
".",
"COMPILE",
")",
")",
";",
"}"
] | Returns an empty model of a Dependency in Json
@return String
@throws IOException | [
"Returns",
"an",
"empty",
"model",
"of",
"a",
"Dependency",
"in",
"Json"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java#L228-L231 | train |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java | AbstractResource.getPromotionDetailsJsonModel | public String getPromotionDetailsJsonModel() throws IOException {
final PromotionEvaluationReport sampleReport = new PromotionEvaluationReport();
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.UNPROMOTED_MSG, "com.acme.secure-smh:core-relay:1.2.0"), MAJOR);
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.DO_NOT_USE_MSG, "com.google.guava:guava:20.0"), MAJOR);
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.MISSING_LICENSE_MSG, "org.apache.maven.wagon:wagon-webdav-jackrabbit:2.12"), MINOR);
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.UNACCEPTABLE_LICENSE_MSG,
"aopaliance:aopaliance:1.0 licensed as Attribution-ShareAlike 2.5 Generic, " +
"org.polyjdbc:polyjdbc0.7.1 licensed as Creative Commons Attribution-ShareAlike 3.0 Unported License"),
MINOR);
sampleReport.addMessage(PromotionReportTranslator.SNAPSHOT_VERSION_MSG, Tag.CRITICAL);
return JsonUtils.serialize(sampleReport);
} | java | public String getPromotionDetailsJsonModel() throws IOException {
final PromotionEvaluationReport sampleReport = new PromotionEvaluationReport();
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.UNPROMOTED_MSG, "com.acme.secure-smh:core-relay:1.2.0"), MAJOR);
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.DO_NOT_USE_MSG, "com.google.guava:guava:20.0"), MAJOR);
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.MISSING_LICENSE_MSG, "org.apache.maven.wagon:wagon-webdav-jackrabbit:2.12"), MINOR);
sampleReport.addMessage(String.format(TWO_PLACES, PromotionReportTranslator.UNACCEPTABLE_LICENSE_MSG,
"aopaliance:aopaliance:1.0 licensed as Attribution-ShareAlike 2.5 Generic, " +
"org.polyjdbc:polyjdbc0.7.1 licensed as Creative Commons Attribution-ShareAlike 3.0 Unported License"),
MINOR);
sampleReport.addMessage(PromotionReportTranslator.SNAPSHOT_VERSION_MSG, Tag.CRITICAL);
return JsonUtils.serialize(sampleReport);
} | [
"public",
"String",
"getPromotionDetailsJsonModel",
"(",
")",
"throws",
"IOException",
"{",
"final",
"PromotionEvaluationReport",
"sampleReport",
"=",
"new",
"PromotionEvaluationReport",
"(",
")",
";",
"sampleReport",
".",
"addMessage",
"(",
"String",
".",
"format",
"(",
"TWO_PLACES",
",",
"PromotionReportTranslator",
".",
"UNPROMOTED_MSG",
",",
"\"com.acme.secure-smh:core-relay:1.2.0\"",
")",
",",
"MAJOR",
")",
";",
"sampleReport",
".",
"addMessage",
"(",
"String",
".",
"format",
"(",
"TWO_PLACES",
",",
"PromotionReportTranslator",
".",
"DO_NOT_USE_MSG",
",",
"\"com.google.guava:guava:20.0\"",
")",
",",
"MAJOR",
")",
";",
"sampleReport",
".",
"addMessage",
"(",
"String",
".",
"format",
"(",
"TWO_PLACES",
",",
"PromotionReportTranslator",
".",
"MISSING_LICENSE_MSG",
",",
"\"org.apache.maven.wagon:wagon-webdav-jackrabbit:2.12\"",
")",
",",
"MINOR",
")",
";",
"sampleReport",
".",
"addMessage",
"(",
"String",
".",
"format",
"(",
"TWO_PLACES",
",",
"PromotionReportTranslator",
".",
"UNACCEPTABLE_LICENSE_MSG",
",",
"\"aopaliance:aopaliance:1.0 licensed as Attribution-ShareAlike 2.5 Generic, \"",
"+",
"\"org.polyjdbc:polyjdbc0.7.1 licensed as Creative Commons Attribution-ShareAlike 3.0 Unported License\"",
")",
",",
"MINOR",
")",
";",
"sampleReport",
".",
"addMessage",
"(",
"PromotionReportTranslator",
".",
"SNAPSHOT_VERSION_MSG",
",",
"Tag",
".",
"CRITICAL",
")",
";",
"return",
"JsonUtils",
".",
"serialize",
"(",
"sampleReport",
")",
";",
"}"
] | Returns an empty Promotion details in Json
@return String
@throws IOException | [
"Returns",
"an",
"empty",
"Promotion",
"details",
"in",
"Json"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java#L252-L264 | train |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java | AbstractResource.getSearchJsonModel | public String getSearchJsonModel() throws IOException {
DbSearch search = new DbSearch();
search.setArtifacts(new ArrayList<>());
search.setModules(new ArrayList<>());
return JsonUtils.serialize(search);
} | java | public String getSearchJsonModel() throws IOException {
DbSearch search = new DbSearch();
search.setArtifacts(new ArrayList<>());
search.setModules(new ArrayList<>());
return JsonUtils.serialize(search);
} | [
"public",
"String",
"getSearchJsonModel",
"(",
")",
"throws",
"IOException",
"{",
"DbSearch",
"search",
"=",
"new",
"DbSearch",
"(",
")",
";",
"search",
".",
"setArtifacts",
"(",
"new",
"ArrayList",
"<>",
"(",
")",
")",
";",
"search",
".",
"setModules",
"(",
"new",
"ArrayList",
"<>",
"(",
")",
")",
";",
"return",
"JsonUtils",
".",
"serialize",
"(",
"search",
")",
";",
"}"
] | Returns an empty Search object in Json
@return String
@throws IOException | [
"Returns",
"an",
"empty",
"Search",
"object",
"in",
"Json"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java#L271-L276 | train |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java | AbstractResource.getScopes | public String getScopes() {
final StringBuilder sb = new StringBuilder();
for (final Scope scope : Scope.values()) {
sb.append(scope);
sb.append(", ");
}
final String scopes = sb.toString().trim();
return scopes.substring(0, scopes.length() - 1);
} | java | public String getScopes() {
final StringBuilder sb = new StringBuilder();
for (final Scope scope : Scope.values()) {
sb.append(scope);
sb.append(", ");
}
final String scopes = sb.toString().trim();
return scopes.substring(0, scopes.length() - 1);
} | [
"public",
"String",
"getScopes",
"(",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"Scope",
"scope",
":",
"Scope",
".",
"values",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"scope",
")",
";",
"sb",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"final",
"String",
"scopes",
"=",
"sb",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"return",
"scopes",
".",
"substring",
"(",
"0",
",",
"scopes",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}"
] | Returns the comma separated list of available scopes
@return String | [
"Returns",
"the",
"comma",
"separated",
"list",
"of",
"available",
"scopes"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java#L283-L291 | train |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java | AbstractResource.getReportSamples | public String[] getReportSamples() {
final Map<String, String> sampleValues = new HashMap<>();
sampleValues.put("name1", "Secure Transpiler Mars");
sampleValues.put("version1", "4.7.0");
sampleValues.put("name2", "Secure Transpiler Bounty");
sampleValues.put("version2", "5.0.0");
sampleValues.put("license", "CDDL-1.1");
sampleValues.put("name", "Secure Pretender");
sampleValues.put("version", "2.7.0");
sampleValues.put("organization", "Axway");
return ReportsRegistry.allReports()
.stream()
.map(report -> ReportUtils.generateSampleRequest(report, sampleValues))
.map(request -> {
try {
String desc = "";
final Optional<Report> byId = ReportsRegistry.findById(request.getReportId());
if(byId.isPresent()) {
desc = byId.get().getDescription() + "<br/><br/>";
}
return String.format(TWO_PLACES, desc, JsonUtils.serialize(request));
} catch(IOException e) {
return "Error " + e.getMessage();
}
})
.collect(Collectors.toList())
.toArray(new String[] {});
} | java | public String[] getReportSamples() {
final Map<String, String> sampleValues = new HashMap<>();
sampleValues.put("name1", "Secure Transpiler Mars");
sampleValues.put("version1", "4.7.0");
sampleValues.put("name2", "Secure Transpiler Bounty");
sampleValues.put("version2", "5.0.0");
sampleValues.put("license", "CDDL-1.1");
sampleValues.put("name", "Secure Pretender");
sampleValues.put("version", "2.7.0");
sampleValues.put("organization", "Axway");
return ReportsRegistry.allReports()
.stream()
.map(report -> ReportUtils.generateSampleRequest(report, sampleValues))
.map(request -> {
try {
String desc = "";
final Optional<Report> byId = ReportsRegistry.findById(request.getReportId());
if(byId.isPresent()) {
desc = byId.get().getDescription() + "<br/><br/>";
}
return String.format(TWO_PLACES, desc, JsonUtils.serialize(request));
} catch(IOException e) {
return "Error " + e.getMessage();
}
})
.collect(Collectors.toList())
.toArray(new String[] {});
} | [
"public",
"String",
"[",
"]",
"getReportSamples",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"sampleValues",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"name1\"",
",",
"\"Secure Transpiler Mars\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"version1\"",
",",
"\"4.7.0\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"name2\"",
",",
"\"Secure Transpiler Bounty\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"version2\"",
",",
"\"5.0.0\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"license\"",
",",
"\"CDDL-1.1\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"name\"",
",",
"\"Secure Pretender\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"version\"",
",",
"\"2.7.0\"",
")",
";",
"sampleValues",
".",
"put",
"(",
"\"organization\"",
",",
"\"Axway\"",
")",
";",
"return",
"ReportsRegistry",
".",
"allReports",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"report",
"->",
"ReportUtils",
".",
"generateSampleRequest",
"(",
"report",
",",
"sampleValues",
")",
")",
".",
"map",
"(",
"request",
"->",
"{",
"try",
"{",
"String",
"desc",
"=",
"\"\"",
";",
"final",
"Optional",
"<",
"Report",
">",
"byId",
"=",
"ReportsRegistry",
".",
"findById",
"(",
"request",
".",
"getReportId",
"(",
")",
")",
";",
"if",
"(",
"byId",
".",
"isPresent",
"(",
")",
")",
"{",
"desc",
"=",
"byId",
".",
"get",
"(",
")",
".",
"getDescription",
"(",
")",
"+",
"\"<br/><br/>\"",
";",
"}",
"return",
"String",
".",
"format",
"(",
"TWO_PLACES",
",",
"desc",
",",
"JsonUtils",
".",
"serialize",
"(",
"request",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"\"Error \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"}",
"}",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
")",
";",
"}"
] | Displays a sample model for the report request.
@return A string describing the structure of a certain report execution | [
"Displays",
"a",
"sample",
"model",
"for",
"the",
"report",
"request",
"."
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/AbstractResource.java#L306-L336 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/MockManager.java | MockManager.startMockJadexAgent | public static void startMockJadexAgent(String agent_name,
String agent_path, MockConfiguration configuration,
BeastTestCase story) {
story.startAgent(agent_name, agent_path);
story.sendMessageToAgent(agent_name, SFipa.INFORM, configuration);
story.setExecutionTime(2000); // To get time to execute the DF rename goal
} | java | public static void startMockJadexAgent(String agent_name,
String agent_path, MockConfiguration configuration,
BeastTestCase story) {
story.startAgent(agent_name, agent_path);
story.sendMessageToAgent(agent_name, SFipa.INFORM, configuration);
story.setExecutionTime(2000); // To get time to execute the DF rename goal
} | [
"public",
"static",
"void",
"startMockJadexAgent",
"(",
"String",
"agent_name",
",",
"String",
"agent_path",
",",
"MockConfiguration",
"configuration",
",",
"BeastTestCase",
"story",
")",
"{",
"story",
".",
"startAgent",
"(",
"agent_name",
",",
"agent_path",
")",
";",
"story",
".",
"sendMessageToAgent",
"(",
"agent_name",
",",
"SFipa",
".",
"INFORM",
",",
"configuration",
")",
";",
"story",
".",
"setExecutionTime",
"(",
"2000",
")",
";",
"// To get time to execute the DF rename goal",
"}"
] | This method is used to launch mock agents. First it creates them, with
the generic df_service_name \"mock_agent\", and then the method sends to
the agent a message with the new df_service_name and its behaviour.
@param agent_name
The name of the mock agent
@param agent_path
The path of the agent, described in
mocks/jadex/common/Definitions file
@param configuration
Where the new df_service_name and the agents behaviour is
saved
@param scenario
The Scenario of the Test | [
"This",
"method",
"is",
"used",
"to",
"launch",
"mock",
"agents",
".",
"First",
"it",
"creates",
"them",
"with",
"the",
"generic",
"df_service_name",
"\\",
"mock_agent",
"\\",
"and",
"then",
"the",
"method",
"sends",
"to",
"the",
"agent",
"a",
"message",
"with",
"the",
"new",
"df_service_name",
"and",
"its",
"behaviour",
"."
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/MockManager.java#L41-L48 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.changeFirstLetterToCapital | public static String changeFirstLetterToCapital(String word) {
char[] letras = word.toCharArray();
char a = letras[0];
letras[0] = Character.toUpperCase(a);
return new String(letras);
} | java | public static String changeFirstLetterToCapital(String word) {
char[] letras = word.toCharArray();
char a = letras[0];
letras[0] = Character.toUpperCase(a);
return new String(letras);
} | [
"public",
"static",
"String",
"changeFirstLetterToCapital",
"(",
"String",
"word",
")",
"{",
"char",
"[",
"]",
"letras",
"=",
"word",
".",
"toCharArray",
"(",
")",
";",
"char",
"a",
"=",
"letras",
"[",
"0",
"]",
";",
"letras",
"[",
"0",
"]",
"=",
"Character",
".",
"toUpperCase",
"(",
"a",
")",
";",
"return",
"new",
"String",
"(",
"letras",
")",
";",
"}"
] | Method used to write the name of the scenarios
@param word
@return the same word starting with capital letter | [
"Method",
"used",
"to",
"write",
"the",
"name",
"of",
"the",
"scenarios"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L113-L118 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.changeFirstLetterToLowerCase | public static String changeFirstLetterToLowerCase(String word) {
char[] letras = word.toCharArray();
char a = letras[0];
letras[0] = Character.toLowerCase(a);
return new String(letras);
} | java | public static String changeFirstLetterToLowerCase(String word) {
char[] letras = word.toCharArray();
char a = letras[0];
letras[0] = Character.toLowerCase(a);
return new String(letras);
} | [
"public",
"static",
"String",
"changeFirstLetterToLowerCase",
"(",
"String",
"word",
")",
"{",
"char",
"[",
"]",
"letras",
"=",
"word",
".",
"toCharArray",
"(",
")",
";",
"char",
"a",
"=",
"letras",
"[",
"0",
"]",
";",
"letras",
"[",
"0",
"]",
"=",
"Character",
".",
"toLowerCase",
"(",
"a",
")",
";",
"return",
"new",
"String",
"(",
"letras",
")",
";",
"}"
] | Method used to write the name of the scenarios methods
@param word
@return the same word starting with lower case | [
"Method",
"used",
"to",
"write",
"the",
"name",
"of",
"the",
"scenarios",
"methods"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L126-L131 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createClassName | public static String createClassName(String scenarioDescription) {
String[] words = scenarioDescription.trim().split(" ");
String name = "";
for (int i = 0; i < words.length; i++) {
name += changeFirstLetterToCapital(words[i]);
}
return name;
} | java | public static String createClassName(String scenarioDescription) {
String[] words = scenarioDescription.trim().split(" ");
String name = "";
for (int i = 0; i < words.length; i++) {
name += changeFirstLetterToCapital(words[i]);
}
return name;
} | [
"public",
"static",
"String",
"createClassName",
"(",
"String",
"scenarioDescription",
")",
"{",
"String",
"[",
"]",
"words",
"=",
"scenarioDescription",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\" \"",
")",
";",
"String",
"name",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"words",
".",
"length",
";",
"i",
"++",
")",
"{",
"name",
"+=",
"changeFirstLetterToCapital",
"(",
"words",
"[",
"i",
"]",
")",
";",
"}",
"return",
"name",
";",
"}"
] | Given a string with the scenario or story name, creates a Class Name with
no spaces and first letter capital
@param String
- The name of the scenario/story. It should be in lower case.
@returns String - The class name | [
"Given",
"a",
"string",
"with",
"the",
"scenario",
"or",
"story",
"name",
"creates",
"a",
"Class",
"Name",
"with",
"no",
"spaces",
"and",
"first",
"letter",
"capital"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L141-L148 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createFirstLowCaseName | public static String createFirstLowCaseName(String scenarioDescription) {
String[] words = scenarioDescription.trim().split(" ");
String name = "";
for (int i = 0; i < words.length; i++) {
name += changeFirstLetterToCapital(words[i]);
}
return changeFirstLetterToLowerCase(name);
} | java | public static String createFirstLowCaseName(String scenarioDescription) {
String[] words = scenarioDescription.trim().split(" ");
String name = "";
for (int i = 0; i < words.length; i++) {
name += changeFirstLetterToCapital(words[i]);
}
return changeFirstLetterToLowerCase(name);
} | [
"public",
"static",
"String",
"createFirstLowCaseName",
"(",
"String",
"scenarioDescription",
")",
"{",
"String",
"[",
"]",
"words",
"=",
"scenarioDescription",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\" \"",
")",
";",
"String",
"name",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"words",
".",
"length",
";",
"i",
"++",
")",
"{",
"name",
"+=",
"changeFirstLetterToCapital",
"(",
"words",
"[",
"i",
"]",
")",
";",
"}",
"return",
"changeFirstLetterToLowerCase",
"(",
"name",
")",
";",
"}"
] | Given a string with method or package name, creates a Class Name with no
spaces and first letter lower case
@param String
- The name of the scenario/story. It should be in lower case.
@returns String - The class name | [
"Given",
"a",
"string",
"with",
"method",
"or",
"package",
"name",
"creates",
"a",
"Class",
"Name",
"with",
"no",
"spaces",
"and",
"first",
"letter",
"lower",
"case"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L158-L165 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.fileDoesNotExist | protected static boolean fileDoesNotExist(String file, String path,
String dest_dir) {
File f = new File(dest_dir);
if (!f.isDirectory())
return false;
String folderPath = createFolderPath(path);
f = new File(f, folderPath);
File javaFile = new File(f, file);
boolean result = !javaFile.exists();
return result;
} | java | protected static boolean fileDoesNotExist(String file, String path,
String dest_dir) {
File f = new File(dest_dir);
if (!f.isDirectory())
return false;
String folderPath = createFolderPath(path);
f = new File(f, folderPath);
File javaFile = new File(f, file);
boolean result = !javaFile.exists();
return result;
} | [
"protected",
"static",
"boolean",
"fileDoesNotExist",
"(",
"String",
"file",
",",
"String",
"path",
",",
"String",
"dest_dir",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"dest_dir",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"return",
"false",
";",
"String",
"folderPath",
"=",
"createFolderPath",
"(",
"path",
")",
";",
"f",
"=",
"new",
"File",
"(",
"f",
",",
"folderPath",
")",
";",
"File",
"javaFile",
"=",
"new",
"File",
"(",
"f",
",",
"file",
")",
";",
"boolean",
"result",
"=",
"!",
"javaFile",
".",
"exists",
"(",
")",
";",
"return",
"result",
";",
"}"
] | Method to know if already exists one file with the same name in the same
folder
@param scenario_name
@param path
@param dest_dir
@return true when the file does not exist | [
"Method",
"to",
"know",
"if",
"already",
"exists",
"one",
"file",
"with",
"the",
"same",
"name",
"in",
"the",
"same",
"folder"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L176-L191 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createFolder | public static File createFolder(String path, String dest_dir)
throws BeastException {
File f = new File(dest_dir);
if (!f.isDirectory()) {
try {
f.mkdirs();
} catch (Exception e) {
logger.severe("Problem creating directory: " + path
+ File.separator + dest_dir);
}
}
String folderPath = createFolderPath(path);
f = new File(f, folderPath);
if (!f.isDirectory()) {
try {
f.mkdirs();
} catch (Exception e) {
String message = "Problem creating directory: " + path
+ File.separator + dest_dir;
logger.severe(message);
throw new BeastException(message, e);
}
}
return f;
} | java | public static File createFolder(String path, String dest_dir)
throws BeastException {
File f = new File(dest_dir);
if (!f.isDirectory()) {
try {
f.mkdirs();
} catch (Exception e) {
logger.severe("Problem creating directory: " + path
+ File.separator + dest_dir);
}
}
String folderPath = createFolderPath(path);
f = new File(f, folderPath);
if (!f.isDirectory()) {
try {
f.mkdirs();
} catch (Exception e) {
String message = "Problem creating directory: " + path
+ File.separator + dest_dir;
logger.severe(message);
throw new BeastException(message, e);
}
}
return f;
} | [
"public",
"static",
"File",
"createFolder",
"(",
"String",
"path",
",",
"String",
"dest_dir",
")",
"throws",
"BeastException",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"dest_dir",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"try",
"{",
"f",
".",
"mkdirs",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"severe",
"(",
"\"Problem creating directory: \"",
"+",
"path",
"+",
"File",
".",
"separator",
"+",
"dest_dir",
")",
";",
"}",
"}",
"String",
"folderPath",
"=",
"createFolderPath",
"(",
"path",
")",
";",
"f",
"=",
"new",
"File",
"(",
"f",
",",
"folderPath",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"try",
"{",
"f",
".",
"mkdirs",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"message",
"=",
"\"Problem creating directory: \"",
"+",
"path",
"+",
"File",
".",
"separator",
"+",
"dest_dir",
";",
"logger",
".",
"severe",
"(",
"message",
")",
";",
"throw",
"new",
"BeastException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}",
"return",
"f",
";",
"}"
] | This method returns the existing folder, and if it does not exist, the
method generates it.
@param path
@param dest_dir
@return the folder
@throws BeastException | [
"This",
"method",
"returns",
"the",
"existing",
"folder",
"and",
"if",
"it",
"does",
"not",
"exist",
"the",
"method",
"generates",
"it",
"."
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L202-L229 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createFolderPath | public static String createFolderPath(String path) {
String[] pathParts = path.split("\\.");
String path2 = "";
for (String part : pathParts) {
if (path2.equals("")) {
path2 = part;
} else {
path2 = path2 + File.separator
+ changeFirstLetterToLowerCase(createClassName(part));
}
}
return path2;
} | java | public static String createFolderPath(String path) {
String[] pathParts = path.split("\\.");
String path2 = "";
for (String part : pathParts) {
if (path2.equals("")) {
path2 = part;
} else {
path2 = path2 + File.separator
+ changeFirstLetterToLowerCase(createClassName(part));
}
}
return path2;
} | [
"public",
"static",
"String",
"createFolderPath",
"(",
"String",
"path",
")",
"{",
"String",
"[",
"]",
"pathParts",
"=",
"path",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"String",
"path2",
"=",
"\"\"",
";",
"for",
"(",
"String",
"part",
":",
"pathParts",
")",
"{",
"if",
"(",
"path2",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"path2",
"=",
"part",
";",
"}",
"else",
"{",
"path2",
"=",
"path2",
"+",
"File",
".",
"separator",
"+",
"changeFirstLetterToLowerCase",
"(",
"createClassName",
"(",
"part",
")",
")",
";",
"}",
"}",
"return",
"path2",
";",
"}"
] | This method changes package_path into folder's path
@param path
, as es.upm.gsi
@return the new path, es/upm/gsi | [
"This",
"method",
"changes",
"package_path",
"into",
"folder",
"s",
"path"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L238-L252 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createFileReader | protected static BufferedReader createFileReader(String file_name)
throws BeastException {
try {
return new BufferedReader(new FileReader(file_name));
} catch (FileNotFoundException e) {
Logger logger = Logger.getLogger(MASReader.class.getName());
logger.severe("ERROR: " + e.toString());
throw new BeastException("ERROR: " + e.toString(), e);
}
} | java | protected static BufferedReader createFileReader(String file_name)
throws BeastException {
try {
return new BufferedReader(new FileReader(file_name));
} catch (FileNotFoundException e) {
Logger logger = Logger.getLogger(MASReader.class.getName());
logger.severe("ERROR: " + e.toString());
throw new BeastException("ERROR: " + e.toString(), e);
}
} | [
"protected",
"static",
"BufferedReader",
"createFileReader",
"(",
"String",
"file_name",
")",
"throws",
"BeastException",
"{",
"try",
"{",
"return",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"file_name",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"MASReader",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"logger",
".",
"severe",
"(",
"\"ERROR: \"",
"+",
"e",
".",
"toString",
"(",
")",
")",
";",
"throw",
"new",
"BeastException",
"(",
"\"ERROR: \"",
"+",
"e",
".",
"toString",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Method to read our client's plain text
@param file_name
@return the filereader to translate client's plain text into our files
@throws BeastException
if any problem is found whit the file | [
"Method",
"to",
"read",
"our",
"client",
"s",
"plain",
"text"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L277-L286 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createDotStoryFile | public static void createDotStoryFile(String scenarioName,
String srcTestRootFolder, String packagePath,
String givenDescription, String whenDescription,
String thenDescription) throws BeastException {
String[] folders = packagePath.split(".");
for (String folder : folders) {
srcTestRootFolder += "/" + folder;
}
FileWriter writer = createFileWriter(createDotStoryName(scenarioName),
packagePath, srcTestRootFolder);
try {
writer.write("Scenario: " + scenarioName + "\n");
writer.write("Given " + givenDescription + "\n");
writer.write("When " + whenDescription + "\n");
writer.write("Then " + thenDescription + "\n");
writer.close();
} catch (Exception e) {
String message = "Unable to write the .story file for the scenario "
+ scenarioName;
logger.severe(message);
logger.severe(e.getMessage());
throw new BeastException(message, e);
}
} | java | public static void createDotStoryFile(String scenarioName,
String srcTestRootFolder, String packagePath,
String givenDescription, String whenDescription,
String thenDescription) throws BeastException {
String[] folders = packagePath.split(".");
for (String folder : folders) {
srcTestRootFolder += "/" + folder;
}
FileWriter writer = createFileWriter(createDotStoryName(scenarioName),
packagePath, srcTestRootFolder);
try {
writer.write("Scenario: " + scenarioName + "\n");
writer.write("Given " + givenDescription + "\n");
writer.write("When " + whenDescription + "\n");
writer.write("Then " + thenDescription + "\n");
writer.close();
} catch (Exception e) {
String message = "Unable to write the .story file for the scenario "
+ scenarioName;
logger.severe(message);
logger.severe(e.getMessage());
throw new BeastException(message, e);
}
} | [
"public",
"static",
"void",
"createDotStoryFile",
"(",
"String",
"scenarioName",
",",
"String",
"srcTestRootFolder",
",",
"String",
"packagePath",
",",
"String",
"givenDescription",
",",
"String",
"whenDescription",
",",
"String",
"thenDescription",
")",
"throws",
"BeastException",
"{",
"String",
"[",
"]",
"folders",
"=",
"packagePath",
".",
"split",
"(",
"\".\"",
")",
";",
"for",
"(",
"String",
"folder",
":",
"folders",
")",
"{",
"srcTestRootFolder",
"+=",
"\"/\"",
"+",
"folder",
";",
"}",
"FileWriter",
"writer",
"=",
"createFileWriter",
"(",
"createDotStoryName",
"(",
"scenarioName",
")",
",",
"packagePath",
",",
"srcTestRootFolder",
")",
";",
"try",
"{",
"writer",
".",
"write",
"(",
"\"Scenario: \"",
"+",
"scenarioName",
"+",
"\"\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"Given \"",
"+",
"givenDescription",
"+",
"\"\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"When \"",
"+",
"whenDescription",
"+",
"\"\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"Then \"",
"+",
"thenDescription",
"+",
"\"\\n\"",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"message",
"=",
"\"Unable to write the .story file for the scenario \"",
"+",
"scenarioName",
";",
"logger",
".",
"severe",
"(",
"message",
")",
";",
"logger",
".",
"severe",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"BeastException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Creates the .story file necessary for every Beast Test Case.
@param scenarioName
- The name of the scenario, with spaces
@param srcTestRootFolder
- The test root folder
@param packagePath
- The package of the BeastTestCase
@param scenarioDescription
- the scenario name
@param givenDescription
- The given description
@param whenDescription
- The when description
@param thenDescription
- The then description
@throws BeastException | [
"Creates",
"the",
".",
"story",
"file",
"necessary",
"for",
"every",
"Beast",
"Test",
"Case",
"."
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L307-L331 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createFileWriter | protected static FileWriter createFileWriter(String scenarioName,
String aux_package_path, String dest_dir) throws BeastException {
try {
return new FileWriter(new File(createFolder(aux_package_path,
dest_dir), scenarioName + ".story"));
} catch (IOException e) {
String message = "ERROR writing the " + scenarioName
+ ".story file: " + e.toString();
logger.severe(message);
throw new BeastException(message, e);
}
} | java | protected static FileWriter createFileWriter(String scenarioName,
String aux_package_path, String dest_dir) throws BeastException {
try {
return new FileWriter(new File(createFolder(aux_package_path,
dest_dir), scenarioName + ".story"));
} catch (IOException e) {
String message = "ERROR writing the " + scenarioName
+ ".story file: " + e.toString();
logger.severe(message);
throw new BeastException(message, e);
}
} | [
"protected",
"static",
"FileWriter",
"createFileWriter",
"(",
"String",
"scenarioName",
",",
"String",
"aux_package_path",
",",
"String",
"dest_dir",
")",
"throws",
"BeastException",
"{",
"try",
"{",
"return",
"new",
"FileWriter",
"(",
"new",
"File",
"(",
"createFolder",
"(",
"aux_package_path",
",",
"dest_dir",
")",
",",
"scenarioName",
"+",
"\".story\"",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"String",
"message",
"=",
"\"ERROR writing the \"",
"+",
"scenarioName",
"+",
"\".story file: \"",
"+",
"e",
".",
"toString",
"(",
")",
";",
"logger",
".",
"severe",
"(",
"message",
")",
";",
"throw",
"new",
"BeastException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Method to get the file writer required for the .story files
@param scenarioName
@param aux_package_path
@param dest_dir
@return The file writer that generates the .story files for each test
@throws BeastException | [
"Method",
"to",
"get",
"the",
"file",
"writer",
"required",
"for",
"the",
".",
"story",
"files"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L342-L353 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.createDotStoryName | protected static String createDotStoryName(String scenarioName) {
String[] words = scenarioName.trim().split(" ");
String result = "";
for (int i = 0; i < words.length; i++) {
String word1 = words[i];
String word2 = word1.toLowerCase();
if (!word1.equals(word2)) {
String finalWord = "";
for (int j = 0; j < word1.length(); j++) {
if (i != 0) {
char c = word1.charAt(j);
if (Character.isUpperCase(c)) {
if (j==0) {
finalWord += Character.toLowerCase(c);
} else {
finalWord += "_" + Character.toLowerCase(c);
}
} else {
finalWord += c;
}
} else {
finalWord = word2;
break;
}
}
result += finalWord;
} else {
result += word2;
}
// I don't add the '_' to the last word.
if (!(i == words.length - 1))
result += "_";
}
return result;
} | java | protected static String createDotStoryName(String scenarioName) {
String[] words = scenarioName.trim().split(" ");
String result = "";
for (int i = 0; i < words.length; i++) {
String word1 = words[i];
String word2 = word1.toLowerCase();
if (!word1.equals(word2)) {
String finalWord = "";
for (int j = 0; j < word1.length(); j++) {
if (i != 0) {
char c = word1.charAt(j);
if (Character.isUpperCase(c)) {
if (j==0) {
finalWord += Character.toLowerCase(c);
} else {
finalWord += "_" + Character.toLowerCase(c);
}
} else {
finalWord += c;
}
} else {
finalWord = word2;
break;
}
}
result += finalWord;
} else {
result += word2;
}
// I don't add the '_' to the last word.
if (!(i == words.length - 1))
result += "_";
}
return result;
} | [
"protected",
"static",
"String",
"createDotStoryName",
"(",
"String",
"scenarioName",
")",
"{",
"String",
"[",
"]",
"words",
"=",
"scenarioName",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\" \"",
")",
";",
"String",
"result",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"words",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"word1",
"=",
"words",
"[",
"i",
"]",
";",
"String",
"word2",
"=",
"word1",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"!",
"word1",
".",
"equals",
"(",
"word2",
")",
")",
"{",
"String",
"finalWord",
"=",
"\"\"",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"word1",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"0",
")",
"{",
"char",
"c",
"=",
"word1",
".",
"charAt",
"(",
"j",
")",
";",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"c",
")",
")",
"{",
"if",
"(",
"j",
"==",
"0",
")",
"{",
"finalWord",
"+=",
"Character",
".",
"toLowerCase",
"(",
"c",
")",
";",
"}",
"else",
"{",
"finalWord",
"+=",
"\"_\"",
"+",
"Character",
".",
"toLowerCase",
"(",
"c",
")",
";",
"}",
"}",
"else",
"{",
"finalWord",
"+=",
"c",
";",
"}",
"}",
"else",
"{",
"finalWord",
"=",
"word2",
";",
"break",
";",
"}",
"}",
"result",
"+=",
"finalWord",
";",
"}",
"else",
"{",
"result",
"+=",
"word2",
";",
"}",
"// I don't add the '_' to the last word.",
"if",
"(",
"!",
"(",
"i",
"==",
"words",
".",
"length",
"-",
"1",
")",
")",
"result",
"+=",
"\"_\"",
";",
"}",
"return",
"result",
";",
"}"
] | Creates the name of the .story file to be wrote with the testcase. The
name of the scenario must be given with spaces.
@param scenarioName
- The scenario name, with spaces
@return the .story file name. | [
"Creates",
"the",
"name",
"of",
"the",
".",
"story",
"file",
"to",
"be",
"wrote",
"with",
"the",
"testcase",
".",
"The",
"name",
"of",
"the",
"scenario",
"must",
"be",
"given",
"with",
"spaces",
"."
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L363-L398 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/BasePrefetcher.java | BasePrefetcher.buildPrefetchCriteriaMultipleKeys | private Criteria buildPrefetchCriteriaMultipleKeys(Collection ids, FieldDescriptor fields[])
{
Criteria crit = new Criteria();
Iterator iter = ids.iterator();
Object[] val;
Identity id;
while (iter.hasNext())
{
Criteria c = new Criteria();
id = (Identity) iter.next();
val = id.getPrimaryKeyValues();
for (int i = 0; i < val.length; i++)
{
if (val[i] == null)
{
c.addIsNull(fields[i].getAttributeName());
}
else
{
c.addEqualTo(fields[i].getAttributeName(), val[i]);
}
}
crit.addOrCriteria(c);
}
return crit;
} | java | private Criteria buildPrefetchCriteriaMultipleKeys(Collection ids, FieldDescriptor fields[])
{
Criteria crit = new Criteria();
Iterator iter = ids.iterator();
Object[] val;
Identity id;
while (iter.hasNext())
{
Criteria c = new Criteria();
id = (Identity) iter.next();
val = id.getPrimaryKeyValues();
for (int i = 0; i < val.length; i++)
{
if (val[i] == null)
{
c.addIsNull(fields[i].getAttributeName());
}
else
{
c.addEqualTo(fields[i].getAttributeName(), val[i]);
}
}
crit.addOrCriteria(c);
}
return crit;
} | [
"private",
"Criteria",
"buildPrefetchCriteriaMultipleKeys",
"(",
"Collection",
"ids",
",",
"FieldDescriptor",
"fields",
"[",
"]",
")",
"{",
"Criteria",
"crit",
"=",
"new",
"Criteria",
"(",
")",
";",
"Iterator",
"iter",
"=",
"ids",
".",
"iterator",
"(",
")",
";",
"Object",
"[",
"]",
"val",
";",
"Identity",
"id",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Criteria",
"c",
"=",
"new",
"Criteria",
"(",
")",
";",
"id",
"=",
"(",
"Identity",
")",
"iter",
".",
"next",
"(",
")",
";",
"val",
"=",
"id",
".",
"getPrimaryKeyValues",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"val",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"val",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"c",
".",
"addIsNull",
"(",
"fields",
"[",
"i",
"]",
".",
"getAttributeName",
"(",
")",
")",
";",
"}",
"else",
"{",
"c",
".",
"addEqualTo",
"(",
"fields",
"[",
"i",
"]",
".",
"getAttributeName",
"(",
")",
",",
"val",
"[",
"i",
"]",
")",
";",
"}",
"}",
"crit",
".",
"addOrCriteria",
"(",
"c",
")",
";",
"}",
"return",
"crit",
";",
"}"
] | Build the Criteria using multiple ORs
@param ids collection of identities
@param fields
@return Criteria | [
"Build",
"the",
"Criteria",
"using",
"multiple",
"ORs"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/BasePrefetcher.java#L203-L230 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerThreadMapping.java | PersistenceBrokerThreadMapping.setCurrentPersistenceBroker | public static void setCurrentPersistenceBroker(PBKey key, PersistenceBrokerInternal broker)
throws PBFactoryException
{
HashMap map = (HashMap) currentBrokerMap.get();
WeakHashMap set = null;
if(map == null)
{
map = new HashMap();
currentBrokerMap.set(map);
synchronized(lock) {
loadedHMs.add(map);
}
}
else
{
set = (WeakHashMap) map.get(key);
}
if(set == null)
{
// We emulate weak HashSet using WeakHashMap
set = new WeakHashMap();
map.put(key, set);
}
set.put(broker, null);
} | java | public static void setCurrentPersistenceBroker(PBKey key, PersistenceBrokerInternal broker)
throws PBFactoryException
{
HashMap map = (HashMap) currentBrokerMap.get();
WeakHashMap set = null;
if(map == null)
{
map = new HashMap();
currentBrokerMap.set(map);
synchronized(lock) {
loadedHMs.add(map);
}
}
else
{
set = (WeakHashMap) map.get(key);
}
if(set == null)
{
// We emulate weak HashSet using WeakHashMap
set = new WeakHashMap();
map.put(key, set);
}
set.put(broker, null);
} | [
"public",
"static",
"void",
"setCurrentPersistenceBroker",
"(",
"PBKey",
"key",
",",
"PersistenceBrokerInternal",
"broker",
")",
"throws",
"PBFactoryException",
"{",
"HashMap",
"map",
"=",
"(",
"HashMap",
")",
"currentBrokerMap",
".",
"get",
"(",
")",
";",
"WeakHashMap",
"set",
"=",
"null",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"HashMap",
"(",
")",
";",
"currentBrokerMap",
".",
"set",
"(",
"map",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"loadedHMs",
".",
"add",
"(",
"map",
")",
";",
"}",
"}",
"else",
"{",
"set",
"=",
"(",
"WeakHashMap",
")",
"map",
".",
"get",
"(",
"key",
")",
";",
"}",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"// We emulate weak HashSet using WeakHashMap\r",
"set",
"=",
"new",
"WeakHashMap",
"(",
")",
";",
"map",
".",
"put",
"(",
"key",
",",
"set",
")",
";",
"}",
"set",
".",
"put",
"(",
"broker",
",",
"null",
")",
";",
"}"
] | Mark a PersistenceBroker as preferred choice for current Thread
@param key The PBKey the broker is associated to
@param broker The PersistenceBroker to mark as current | [
"Mark",
"a",
"PersistenceBroker",
"as",
"preferred",
"choice",
"for",
"current",
"Thread"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerThreadMapping.java#L59-L85 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerThreadMapping.java | PersistenceBrokerThreadMapping.unsetCurrentPersistenceBroker | public static void unsetCurrentPersistenceBroker(PBKey key, PersistenceBrokerInternal broker)
throws PBFactoryException
{
HashMap map = (HashMap) currentBrokerMap.get();
WeakHashMap set = null;
if(map != null)
{
set = (WeakHashMap) map.get(key);
if(set != null)
{
set.remove(broker);
if(set.isEmpty())
{
map.remove(key);
}
}
if(map.isEmpty())
{
currentBrokerMap.set(null);
synchronized(lock) {
loadedHMs.remove(map);
}
}
}
} | java | public static void unsetCurrentPersistenceBroker(PBKey key, PersistenceBrokerInternal broker)
throws PBFactoryException
{
HashMap map = (HashMap) currentBrokerMap.get();
WeakHashMap set = null;
if(map != null)
{
set = (WeakHashMap) map.get(key);
if(set != null)
{
set.remove(broker);
if(set.isEmpty())
{
map.remove(key);
}
}
if(map.isEmpty())
{
currentBrokerMap.set(null);
synchronized(lock) {
loadedHMs.remove(map);
}
}
}
} | [
"public",
"static",
"void",
"unsetCurrentPersistenceBroker",
"(",
"PBKey",
"key",
",",
"PersistenceBrokerInternal",
"broker",
")",
"throws",
"PBFactoryException",
"{",
"HashMap",
"map",
"=",
"(",
"HashMap",
")",
"currentBrokerMap",
".",
"get",
"(",
")",
";",
"WeakHashMap",
"set",
"=",
"null",
";",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"set",
"=",
"(",
"WeakHashMap",
")",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"set",
"!=",
"null",
")",
"{",
"set",
".",
"remove",
"(",
"broker",
")",
";",
"if",
"(",
"set",
".",
"isEmpty",
"(",
")",
")",
"{",
"map",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"if",
"(",
"map",
".",
"isEmpty",
"(",
")",
")",
"{",
"currentBrokerMap",
".",
"set",
"(",
"null",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"loadedHMs",
".",
"remove",
"(",
"map",
")",
";",
"}",
"}",
"}",
"}"
] | Unmark a PersistenceBroker as preferred choice for current Thread
@param key The PBKey the broker is associated to
@param broker The PersistenceBroker to unmark | [
"Unmark",
"a",
"PersistenceBroker",
"as",
"preferred",
"choice",
"for",
"current",
"Thread"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerThreadMapping.java#L93-L117 | train |
kuali/ojb-1.0.4 | src/tools/org/apache/ojb/tools/mapping/reversedb2/actions/ActionOpenDatabase.java | ActionOpenDatabase.actionPerformed | public void actionPerformed(java.awt.event.ActionEvent actionEvent)
{
new Thread()
{
public void run()
{
final java.sql.Connection conn = new JDlgDBConnection(containingFrame, false).showAndReturnConnection();
if (conn != null)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
JIFrmDatabase frm = new JIFrmDatabase(conn);
containingFrame.getContentPane().add(frm);
frm.setVisible(true);
}
});
}
}
}.start();
} | java | public void actionPerformed(java.awt.event.ActionEvent actionEvent)
{
new Thread()
{
public void run()
{
final java.sql.Connection conn = new JDlgDBConnection(containingFrame, false).showAndReturnConnection();
if (conn != null)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
JIFrmDatabase frm = new JIFrmDatabase(conn);
containingFrame.getContentPane().add(frm);
frm.setVisible(true);
}
});
}
}
}.start();
} | [
"public",
"void",
"actionPerformed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"ActionEvent",
"actionEvent",
")",
"{",
"new",
"Thread",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"final",
"java",
".",
"sql",
".",
"Connection",
"conn",
"=",
"new",
"JDlgDBConnection",
"(",
"containingFrame",
",",
"false",
")",
".",
"showAndReturnConnection",
"(",
")",
";",
"if",
"(",
"conn",
"!=",
"null",
")",
"{",
"javax",
".",
"swing",
".",
"SwingUtilities",
".",
"invokeLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"JIFrmDatabase",
"frm",
"=",
"new",
"JIFrmDatabase",
"(",
"conn",
")",
";",
"containingFrame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"frm",
")",
";",
"frm",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}",
".",
"start",
"(",
")",
";",
"}"
] | Called to execute this action.
@param actionEvent | [
"Called",
"to",
"execute",
"this",
"action",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/actions/ActionOpenDatabase.java#L47-L68 | train |
geomajas/geomajas-project-server | plugin/staticsecurity/staticsecurity/src/main/java/org/geomajas/plugin/staticsecurity/configuration/UserInfo.java | UserInfo.setRoles | public void setRoles(List<NamedRoleInfo> roles) {
this.roles = roles;
List<AuthorizationInfo> authorizations = new ArrayList<AuthorizationInfo>();
for (NamedRoleInfo role : roles) {
authorizations.addAll(role.getAuthorizations());
}
super.setAuthorizations(authorizations);
} | java | public void setRoles(List<NamedRoleInfo> roles) {
this.roles = roles;
List<AuthorizationInfo> authorizations = new ArrayList<AuthorizationInfo>();
for (NamedRoleInfo role : roles) {
authorizations.addAll(role.getAuthorizations());
}
super.setAuthorizations(authorizations);
} | [
"public",
"void",
"setRoles",
"(",
"List",
"<",
"NamedRoleInfo",
">",
"roles",
")",
"{",
"this",
".",
"roles",
"=",
"roles",
";",
"List",
"<",
"AuthorizationInfo",
">",
"authorizations",
"=",
"new",
"ArrayList",
"<",
"AuthorizationInfo",
">",
"(",
")",
";",
"for",
"(",
"NamedRoleInfo",
"role",
":",
"roles",
")",
"{",
"authorizations",
".",
"addAll",
"(",
"role",
".",
"getAuthorizations",
"(",
")",
")",
";",
"}",
"super",
".",
"setAuthorizations",
"(",
"authorizations",
")",
";",
"}"
] | Set the role info for this user. If set, this will be used to set the user's authorizations.
@param roles the roles
@since 1.10.0 | [
"Set",
"the",
"role",
"info",
"for",
"this",
"user",
".",
"If",
"set",
"this",
"will",
"be",
"used",
"to",
"set",
"the",
"user",
"s",
"authorizations",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/staticsecurity/staticsecurity/src/main/java/org/geomajas/plugin/staticsecurity/configuration/UserInfo.java#L105-L112 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java | TileUtil.getTileLayerSize | public static double[] getTileLayerSize(TileCode code, Envelope maxExtent, double scale) {
double div = Math.pow(2, code.getTileLevel());
double tileWidth = Math.ceil((scale * maxExtent.getWidth()) / div) / scale;
double tileHeight = Math.ceil((scale * maxExtent.getHeight()) / div) / scale;
return new double[] { tileWidth, tileHeight };
} | java | public static double[] getTileLayerSize(TileCode code, Envelope maxExtent, double scale) {
double div = Math.pow(2, code.getTileLevel());
double tileWidth = Math.ceil((scale * maxExtent.getWidth()) / div) / scale;
double tileHeight = Math.ceil((scale * maxExtent.getHeight()) / div) / scale;
return new double[] { tileWidth, tileHeight };
} | [
"public",
"static",
"double",
"[",
"]",
"getTileLayerSize",
"(",
"TileCode",
"code",
",",
"Envelope",
"maxExtent",
",",
"double",
"scale",
")",
"{",
"double",
"div",
"=",
"Math",
".",
"pow",
"(",
"2",
",",
"code",
".",
"getTileLevel",
"(",
")",
")",
";",
"double",
"tileWidth",
"=",
"Math",
".",
"ceil",
"(",
"(",
"scale",
"*",
"maxExtent",
".",
"getWidth",
"(",
")",
")",
"/",
"div",
")",
"/",
"scale",
";",
"double",
"tileHeight",
"=",
"Math",
".",
"ceil",
"(",
"(",
"scale",
"*",
"maxExtent",
".",
"getHeight",
"(",
")",
")",
"/",
"div",
")",
"/",
"scale",
";",
"return",
"new",
"double",
"[",
"]",
"{",
"tileWidth",
",",
"tileHeight",
"}",
";",
"}"
] | Calculates the tiles width and height.
@param code
The unique tile code. Determines what tile we're talking about.
@param maxExtent
The maximum extent of the grid to which this tile belongs.
@param scale
The current client side scale.
@return Returns an array of double values where the first value is the tile width and the second value is the
tile height. | [
"Calculates",
"the",
"tiles",
"width",
"and",
"height",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java#L42-L47 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java | TileUtil.getTileScreenSize | public static int[] getTileScreenSize(double[] worldSize, double scale) {
int screenWidth = (int) Math.round(scale * worldSize[0]);
int screenHeight = (int) Math.round(scale * worldSize[1]);
return new int[] { screenWidth, screenHeight };
} | java | public static int[] getTileScreenSize(double[] worldSize, double scale) {
int screenWidth = (int) Math.round(scale * worldSize[0]);
int screenHeight = (int) Math.round(scale * worldSize[1]);
return new int[] { screenWidth, screenHeight };
} | [
"public",
"static",
"int",
"[",
"]",
"getTileScreenSize",
"(",
"double",
"[",
"]",
"worldSize",
",",
"double",
"scale",
")",
"{",
"int",
"screenWidth",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"scale",
"*",
"worldSize",
"[",
"0",
"]",
")",
";",
"int",
"screenHeight",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"scale",
"*",
"worldSize",
"[",
"1",
"]",
")",
";",
"return",
"new",
"int",
"[",
"]",
"{",
"screenWidth",
",",
"screenHeight",
"}",
";",
"}"
] | Calculate the screen size of a tile. Normally the screen size is expressed in pixels and should therefore be
integers, but for the sake of accuracy we try to keep a double value as long as possible.
@param worldSize
The width and height of a tile in the layer's world coordinate system.
@param scale
The current client side scale.
@return Returns an array of double values where the first value is the tile screen width and the second value is
the tile screen height. | [
"Calculate",
"the",
"screen",
"size",
"of",
"a",
"tile",
".",
"Normally",
"the",
"screen",
"size",
"is",
"expressed",
"in",
"pixels",
"and",
"should",
"therefore",
"be",
"integers",
"but",
"for",
"the",
"sake",
"of",
"accuracy",
"we",
"try",
"to",
"keep",
"a",
"double",
"value",
"as",
"long",
"as",
"possible",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java#L60-L64 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java | TileUtil.getTileBounds | public static Envelope getTileBounds(TileCode code, Envelope maxExtent, double scale) {
double[] layerSize = getTileLayerSize(code, maxExtent, scale);
if (layerSize[0] == 0) {
return null;
}
double cX = maxExtent.getMinX() + code.getX() * layerSize[0];
double cY = maxExtent.getMinY() + code.getY() * layerSize[1];
return new Envelope(cX, cX + layerSize[0], cY, cY + layerSize[1]);
} | java | public static Envelope getTileBounds(TileCode code, Envelope maxExtent, double scale) {
double[] layerSize = getTileLayerSize(code, maxExtent, scale);
if (layerSize[0] == 0) {
return null;
}
double cX = maxExtent.getMinX() + code.getX() * layerSize[0];
double cY = maxExtent.getMinY() + code.getY() * layerSize[1];
return new Envelope(cX, cX + layerSize[0], cY, cY + layerSize[1]);
} | [
"public",
"static",
"Envelope",
"getTileBounds",
"(",
"TileCode",
"code",
",",
"Envelope",
"maxExtent",
",",
"double",
"scale",
")",
"{",
"double",
"[",
"]",
"layerSize",
"=",
"getTileLayerSize",
"(",
"code",
",",
"maxExtent",
",",
"scale",
")",
";",
"if",
"(",
"layerSize",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"double",
"cX",
"=",
"maxExtent",
".",
"getMinX",
"(",
")",
"+",
"code",
".",
"getX",
"(",
")",
"*",
"layerSize",
"[",
"0",
"]",
";",
"double",
"cY",
"=",
"maxExtent",
".",
"getMinY",
"(",
")",
"+",
"code",
".",
"getY",
"(",
")",
"*",
"layerSize",
"[",
"1",
"]",
";",
"return",
"new",
"Envelope",
"(",
"cX",
",",
"cX",
"+",
"layerSize",
"[",
"0",
"]",
",",
"cY",
",",
"cY",
"+",
"layerSize",
"[",
"1",
"]",
")",
";",
"}"
] | Get the bounding box for a certain tile.
@param code
The unique tile code. Determines what tile we're talking about.
@param maxExtent
The maximum extent of the grid to which this tile belongs.
@param scale
The current client side scale.
@return Returns the bounding box for the tile, expressed in the layer's coordinate system. | [
"Get",
"the",
"bounding",
"box",
"for",
"a",
"certain",
"tile",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java#L77-L85 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java | ReferenceDescriptorConstraints.check | public void check(ReferenceDescriptorDef refDef, String checkLevel) throws ConstraintException
{
ensureClassRef(refDef, checkLevel);
checkProxyPrefetchingLimit(refDef, checkLevel);
} | java | public void check(ReferenceDescriptorDef refDef, String checkLevel) throws ConstraintException
{
ensureClassRef(refDef, checkLevel);
checkProxyPrefetchingLimit(refDef, checkLevel);
} | [
"public",
"void",
"check",
"(",
"ReferenceDescriptorDef",
"refDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"ensureClassRef",
"(",
"refDef",
",",
"checkLevel",
")",
";",
"checkProxyPrefetchingLimit",
"(",
"refDef",
",",
"checkLevel",
")",
";",
"}"
] | Checks the given reference descriptor.
@param refDef The reference descriptor
@param checkLevel The amount of checks to perform
@exception ConstraintException If a constraint has been violated | [
"Checks",
"the",
"given",
"reference",
"descriptor",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java#L39-L43 | train |
geomajas/geomajas-project-server | plugin/staticsecurity/staticsecurity/src/main/java/org/geomajas/plugin/staticsecurity/configuration/SecurityServiceInfo.java | SecurityServiceInfo.postConstruct | @PostConstruct
protected void postConstruct() {
if (null == authenticationServices) {
authenticationServices = new ArrayList<AuthenticationService>();
}
if (!excludeDefault) {
authenticationServices.add(staticAuthenticationService);
}
} | java | @PostConstruct
protected void postConstruct() {
if (null == authenticationServices) {
authenticationServices = new ArrayList<AuthenticationService>();
}
if (!excludeDefault) {
authenticationServices.add(staticAuthenticationService);
}
} | [
"@",
"PostConstruct",
"protected",
"void",
"postConstruct",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"authenticationServices",
")",
"{",
"authenticationServices",
"=",
"new",
"ArrayList",
"<",
"AuthenticationService",
">",
"(",
")",
";",
"}",
"if",
"(",
"!",
"excludeDefault",
")",
"{",
"authenticationServices",
".",
"add",
"(",
"staticAuthenticationService",
")",
";",
"}",
"}"
] | Finish initialization of the configuration. | [
"Finish",
"initialization",
"of",
"the",
"configuration",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/staticsecurity/staticsecurity/src/main/java/org/geomajas/plugin/staticsecurity/configuration/SecurityServiceInfo.java#L119-L127 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.getMemberName | public static String getMemberName() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getName();
}
else if (getCurrentMethod() != null) {
return MethodTagsHandler.getPropertyNameFor(getCurrentMethod());
}
else {
return null;
}
} | java | public static String getMemberName() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getName();
}
else if (getCurrentMethod() != null) {
return MethodTagsHandler.getPropertyNameFor(getCurrentMethod());
}
else {
return null;
}
} | [
"public",
"static",
"String",
"getMemberName",
"(",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getCurrentField",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"MethodTagsHandler",
".",
"getPropertyNameFor",
"(",
"getCurrentMethod",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Returns the name of the current member which is the name in the case of a field, or the property name for an
accessor method.
@return The member name
@exception XDocletException if an error occurs | [
"Returns",
"the",
"name",
"of",
"the",
"current",
"member",
"which",
"is",
"the",
"name",
"in",
"the",
"case",
"of",
"a",
"field",
"or",
"the",
"property",
"name",
"for",
"an",
"accessor",
"method",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L44-L55 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.getMemberType | public static XClass getMemberType() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getType();
}
else if (getCurrentMethod() != null) {
XMethod method = getCurrentMethod();
if (MethodTagsHandler.isGetterMethod(method)) {
return method.getReturnType().getType();
}
else if (MethodTagsHandler.isSetterMethod(method)) {
XParameter param = (XParameter)method.getParameters().iterator().next();
return param.getType();
}
}
return null;
} | java | public static XClass getMemberType() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getType();
}
else if (getCurrentMethod() != null) {
XMethod method = getCurrentMethod();
if (MethodTagsHandler.isGetterMethod(method)) {
return method.getReturnType().getType();
}
else if (MethodTagsHandler.isSetterMethod(method)) {
XParameter param = (XParameter)method.getParameters().iterator().next();
return param.getType();
}
}
return null;
} | [
"public",
"static",
"XClass",
"getMemberType",
"(",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getCurrentField",
"(",
")",
".",
"getType",
"(",
")",
";",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"XMethod",
"method",
"=",
"getCurrentMethod",
"(",
")",
";",
"if",
"(",
"MethodTagsHandler",
".",
"isGetterMethod",
"(",
"method",
")",
")",
"{",
"return",
"method",
".",
"getReturnType",
"(",
")",
".",
"getType",
"(",
")",
";",
"}",
"else",
"if",
"(",
"MethodTagsHandler",
".",
"isSetterMethod",
"(",
"method",
")",
")",
"{",
"XParameter",
"param",
"=",
"(",
"XParameter",
")",
"method",
".",
"getParameters",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"return",
"param",
".",
"getType",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Returns the type of the current member which is the type in the case of a field, the return type for a getter
method, or the type of the parameter for a setter method.
@return The member type
@exception XDocletException if an error occurs | [
"Returns",
"the",
"type",
"of",
"the",
"current",
"member",
"which",
"is",
"the",
"type",
"in",
"the",
"case",
"of",
"a",
"field",
"the",
"return",
"type",
"for",
"a",
"getter",
"method",
"or",
"the",
"type",
"of",
"the",
"parameter",
"for",
"a",
"setter",
"method",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L64-L82 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.getMemberDimension | public static int getMemberDimension() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getDimension();
}
else if (getCurrentMethod() != null) {
XMethod method = getCurrentMethod();
if (MethodTagsHandler.isGetterMethod(method)) {
return method.getReturnType().getDimension();
}
else if (MethodTagsHandler.isSetterMethod(method)) {
XParameter param = (XParameter)method.getParameters().iterator().next();
return param.getDimension();
}
}
return 0;
} | java | public static int getMemberDimension() throws XDocletException
{
if (getCurrentField() != null) {
return getCurrentField().getDimension();
}
else if (getCurrentMethod() != null) {
XMethod method = getCurrentMethod();
if (MethodTagsHandler.isGetterMethod(method)) {
return method.getReturnType().getDimension();
}
else if (MethodTagsHandler.isSetterMethod(method)) {
XParameter param = (XParameter)method.getParameters().iterator().next();
return param.getDimension();
}
}
return 0;
} | [
"public",
"static",
"int",
"getMemberDimension",
"(",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getCurrentField",
"(",
")",
".",
"getDimension",
"(",
")",
";",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"XMethod",
"method",
"=",
"getCurrentMethod",
"(",
")",
";",
"if",
"(",
"MethodTagsHandler",
".",
"isGetterMethod",
"(",
"method",
")",
")",
"{",
"return",
"method",
".",
"getReturnType",
"(",
")",
".",
"getDimension",
"(",
")",
";",
"}",
"else",
"if",
"(",
"MethodTagsHandler",
".",
"isSetterMethod",
"(",
"method",
")",
")",
"{",
"XParameter",
"param",
"=",
"(",
"XParameter",
")",
"method",
".",
"getParameters",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"return",
"param",
".",
"getDimension",
"(",
")",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | Returns the dimension of the type of the current member.
@return The member dimension
@exception XDocletException if an error occurs
@see OjbMemberTagsHandler#getMemberType() | [
"Returns",
"the",
"dimension",
"of",
"the",
"type",
"of",
"the",
"current",
"member",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L91-L109 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.forAllMemberTags | public void forAllMemberTags(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTags(template, attributes, FOR_FIELD, XDocletTagshandlerMessages.ONLY_CALL_FIELD_NOT_NULL, new String[]{"forAllMemberTags"});
}
else if (getCurrentMethod() != null) {
forAllMemberTags(template, attributes, FOR_METHOD, XDocletTagshandlerMessages.ONLY_CALL_METHOD_NOT_NULL, new String[]{"forAllMemberTags"});
}
} | java | public void forAllMemberTags(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTags(template, attributes, FOR_FIELD, XDocletTagshandlerMessages.ONLY_CALL_FIELD_NOT_NULL, new String[]{"forAllMemberTags"});
}
else if (getCurrentMethod() != null) {
forAllMemberTags(template, attributes, FOR_METHOD, XDocletTagshandlerMessages.ONLY_CALL_METHOD_NOT_NULL, new String[]{"forAllMemberTags"});
}
} | [
"public",
"void",
"forAllMemberTags",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"forAllMemberTags",
"(",
"template",
",",
"attributes",
",",
"FOR_FIELD",
",",
"XDocletTagshandlerMessages",
".",
"ONLY_CALL_FIELD_NOT_NULL",
",",
"new",
"String",
"[",
"]",
"{",
"\"forAllMemberTags\"",
"}",
")",
";",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"forAllMemberTags",
"(",
"template",
",",
"attributes",
",",
"FOR_METHOD",
",",
"XDocletTagshandlerMessages",
".",
"ONLY_CALL_METHOD_NOT_NULL",
",",
"new",
"String",
"[",
"]",
"{",
"\"forAllMemberTags\"",
"}",
")",
";",
"}",
"}"
] | Iterates over all tags of current member and evaluates the template for each one.
@param template The template to be evaluated
@param attributes The attributes of the template tag
@exception XDocletException If an error occurs
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" optional="true" description="The parameter name." | [
"Iterates",
"over",
"all",
"tags",
"of",
"current",
"member",
"and",
"evaluates",
"the",
"template",
"for",
"each",
"one",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L239-L247 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.forAllMemberTagTokens | public void forAllMemberTagTokens(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTagTokens(template, attributes, FOR_FIELD);
}
else if (getCurrentMethod() != null) {
forAllMemberTagTokens(template, attributes, FOR_METHOD);
}
} | java | public void forAllMemberTagTokens(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTagTokens(template, attributes, FOR_FIELD);
}
else if (getCurrentMethod() != null) {
forAllMemberTagTokens(template, attributes, FOR_METHOD);
}
} | [
"public",
"void",
"forAllMemberTagTokens",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"forAllMemberTagTokens",
"(",
"template",
",",
"attributes",
",",
"FOR_FIELD",
")",
";",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"forAllMemberTagTokens",
"(",
"template",
",",
"attributes",
",",
"FOR_METHOD",
")",
";",
"}",
"}"
] | Iterates over all tokens in current member tag with the name tagName and evaluates the body for every token.
@param template The body of the block tag
@param attributes The attributes of the template tag
@exception XDocletException If an error occurs
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="delimiter" description="delimiter for the StringTokenizer. consult javadoc for
java.util.StringTokenizer default is ','"
@doc.param name="skip" description="how many tokens to skip on start" | [
"Iterates",
"over",
"all",
"tokens",
"in",
"current",
"member",
"tag",
"with",
"the",
"name",
"tagName",
"and",
"evaluates",
"the",
"body",
"for",
"every",
"token",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L261-L269 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.ifDoesntHaveMemberTag | public void ifDoesntHaveMemberTag(String template, Properties attributes) throws XDocletException
{
boolean result = false;
if (getCurrentField() != null) {
if (!hasTag(attributes, FOR_FIELD)) {
result = true;
generate(template);
}
}
else if (getCurrentMethod() != null) {
if (!hasTag(attributes, FOR_METHOD)) {
result = true;
generate(template);
}
}
if (!result) {
String error = attributes.getProperty("error");
if (error != null) {
getEngine().print(error);
}
}
} | java | public void ifDoesntHaveMemberTag(String template, Properties attributes) throws XDocletException
{
boolean result = false;
if (getCurrentField() != null) {
if (!hasTag(attributes, FOR_FIELD)) {
result = true;
generate(template);
}
}
else if (getCurrentMethod() != null) {
if (!hasTag(attributes, FOR_METHOD)) {
result = true;
generate(template);
}
}
if (!result) {
String error = attributes.getProperty("error");
if (error != null) {
getEngine().print(error);
}
}
} | [
"public",
"void",
"ifDoesntHaveMemberTag",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"hasTag",
"(",
"attributes",
",",
"FOR_FIELD",
")",
")",
"{",
"result",
"=",
"true",
";",
"generate",
"(",
"template",
")",
";",
"}",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"hasTag",
"(",
"attributes",
",",
"FOR_METHOD",
")",
")",
"{",
"result",
"=",
"true",
";",
"generate",
"(",
"template",
")",
";",
"}",
"}",
"if",
"(",
"!",
"result",
")",
"{",
"String",
"error",
"=",
"attributes",
".",
"getProperty",
"(",
"\"error\"",
")",
";",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"getEngine",
"(",
")",
".",
"print",
"(",
"error",
")",
";",
"}",
"}",
"}"
] | Evaluates the body if current member has no tag with the specified name.
@param template The body of the block tag
@param attributes The attributes of the template tag
@exception XDocletException Description of Exception
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" description="The parameter name. If not specified, then the raw
content of the tag is returned."
@doc.param name="paramNum" description="The zero-based parameter number. It's used if the user
used the space-separated format for specifying parameters."
@doc.param name="error" description="Show this error message if no tag found." | [
"Evaluates",
"the",
"body",
"if",
"current",
"member",
"has",
"no",
"tag",
"with",
"the",
"specified",
"name",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L299-L322 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.ifHasMemberWithTag | public void ifHasMemberWithTag(String template, Properties attributes) throws XDocletException
{
ArrayList allMemberNames = new ArrayList();
HashMap allMembers = new HashMap();
boolean hasTag = false;
addMembers(allMemberNames, allMembers, getCurrentClass(), null, null, null);
for (Iterator it = allMemberNames.iterator(); it.hasNext(); ) {
XMember member = (XMember) allMembers.get(it.next());
if (member instanceof XField) {
setCurrentField((XField)member);
if (hasTag(attributes, FOR_FIELD)) {
hasTag = true;
}
setCurrentField(null);
}
else if (member instanceof XMethod) {
setCurrentMethod((XMethod)member);
if (hasTag(attributes, FOR_METHOD)) {
hasTag = true;
}
setCurrentMethod(null);
}
if (hasTag) {
generate(template);
break;
}
}
} | java | public void ifHasMemberWithTag(String template, Properties attributes) throws XDocletException
{
ArrayList allMemberNames = new ArrayList();
HashMap allMembers = new HashMap();
boolean hasTag = false;
addMembers(allMemberNames, allMembers, getCurrentClass(), null, null, null);
for (Iterator it = allMemberNames.iterator(); it.hasNext(); ) {
XMember member = (XMember) allMembers.get(it.next());
if (member instanceof XField) {
setCurrentField((XField)member);
if (hasTag(attributes, FOR_FIELD)) {
hasTag = true;
}
setCurrentField(null);
}
else if (member instanceof XMethod) {
setCurrentMethod((XMethod)member);
if (hasTag(attributes, FOR_METHOD)) {
hasTag = true;
}
setCurrentMethod(null);
}
if (hasTag) {
generate(template);
break;
}
}
} | [
"public",
"void",
"ifHasMemberWithTag",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"ArrayList",
"allMemberNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"HashMap",
"allMembers",
"=",
"new",
"HashMap",
"(",
")",
";",
"boolean",
"hasTag",
"=",
"false",
";",
"addMembers",
"(",
"allMemberNames",
",",
"allMembers",
",",
"getCurrentClass",
"(",
")",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"for",
"(",
"Iterator",
"it",
"=",
"allMemberNames",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"XMember",
"member",
"=",
"(",
"XMember",
")",
"allMembers",
".",
"get",
"(",
"it",
".",
"next",
"(",
")",
")",
";",
"if",
"(",
"member",
"instanceof",
"XField",
")",
"{",
"setCurrentField",
"(",
"(",
"XField",
")",
"member",
")",
";",
"if",
"(",
"hasTag",
"(",
"attributes",
",",
"FOR_FIELD",
")",
")",
"{",
"hasTag",
"=",
"true",
";",
"}",
"setCurrentField",
"(",
"null",
")",
";",
"}",
"else",
"if",
"(",
"member",
"instanceof",
"XMethod",
")",
"{",
"setCurrentMethod",
"(",
"(",
"XMethod",
")",
"member",
")",
";",
"if",
"(",
"hasTag",
"(",
"attributes",
",",
"FOR_METHOD",
")",
")",
"{",
"hasTag",
"=",
"true",
";",
"}",
"setCurrentMethod",
"(",
"null",
")",
";",
"}",
"if",
"(",
"hasTag",
")",
"{",
"generate",
"(",
"template",
")",
";",
"break",
";",
"}",
"}",
"}"
] | Evaluates the body if the current class has at least one member with at least one tag with the specified name.
@param template The body of the block tag
@param attributes The attributes of the template tag
@exception XDocletException Description of Exception
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" description="The parameter name. If not specified, then the raw
content of the tag is returned."
@doc.param name="error" description="Show this error message if no tag found." | [
"Evaluates",
"the",
"body",
"if",
"the",
"current",
"class",
"has",
"at",
"least",
"one",
"member",
"with",
"at",
"least",
"one",
"tag",
"with",
"the",
"specified",
"name",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L336-L365 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.ifMemberTagValueEquals | public void ifMemberTagValueEquals(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
if (isTagValueEqual(attributes, FOR_FIELD)) {
generate(template);
}
}
else if (getCurrentMethod() != null) {
if (isTagValueEqual(attributes, FOR_METHOD)) {
generate(template);
}
}
} | java | public void ifMemberTagValueEquals(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
if (isTagValueEqual(attributes, FOR_FIELD)) {
generate(template);
}
}
else if (getCurrentMethod() != null) {
if (isTagValueEqual(attributes, FOR_METHOD)) {
generate(template);
}
}
} | [
"public",
"void",
"ifMemberTagValueEquals",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"isTagValueEqual",
"(",
"attributes",
",",
"FOR_FIELD",
")",
")",
"{",
"generate",
"(",
"template",
")",
";",
"}",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"isTagValueEqual",
"(",
"attributes",
",",
"FOR_METHOD",
")",
")",
"{",
"generate",
"(",
"template",
")",
";",
"}",
"}",
"}"
] | Evaluates the body if value for the member tag equals the specified value.
@param template The body of the block tag
@param attributes The attributes of the template tag
@exception XDocletException If an error occurs
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" description="The parameter name. If not specified, then the raw
content of the tag is returned."
@doc.param name="paramNum" description="The zero-based parameter number. It's used if the user
used the space-separated format for specifying parameters."
@doc.param name="value" optional="false" description="The expected value." | [
"Evaluates",
"the",
"body",
"if",
"value",
"for",
"the",
"member",
"tag",
"equals",
"the",
"specified",
"value",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L452-L464 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.addMembersInclSupertypes | private void addMembersInclSupertypes(Collection memberNames, HashMap members, XClass type, String tagName, String paramName, String paramValue) throws XDocletException
{
addMembers(memberNames, members, type, tagName, paramName, paramValue);
if (type.getInterfaces() != null) {
for (Iterator it = type.getInterfaces().iterator(); it.hasNext(); ) {
addMembersInclSupertypes(memberNames, members, (XClass)it.next(), tagName, paramName, paramValue);
}
}
if (!type.isInterface() && (type.getSuperclass() != null)) {
addMembersInclSupertypes(memberNames, members, type.getSuperclass(), tagName, paramName, paramValue);
}
} | java | private void addMembersInclSupertypes(Collection memberNames, HashMap members, XClass type, String tagName, String paramName, String paramValue) throws XDocletException
{
addMembers(memberNames, members, type, tagName, paramName, paramValue);
if (type.getInterfaces() != null) {
for (Iterator it = type.getInterfaces().iterator(); it.hasNext(); ) {
addMembersInclSupertypes(memberNames, members, (XClass)it.next(), tagName, paramName, paramValue);
}
}
if (!type.isInterface() && (type.getSuperclass() != null)) {
addMembersInclSupertypes(memberNames, members, type.getSuperclass(), tagName, paramName, paramValue);
}
} | [
"private",
"void",
"addMembersInclSupertypes",
"(",
"Collection",
"memberNames",
",",
"HashMap",
"members",
",",
"XClass",
"type",
",",
"String",
"tagName",
",",
"String",
"paramName",
",",
"String",
"paramValue",
")",
"throws",
"XDocletException",
"{",
"addMembers",
"(",
"memberNames",
",",
"members",
",",
"type",
",",
"tagName",
",",
"paramName",
",",
"paramValue",
")",
";",
"if",
"(",
"type",
".",
"getInterfaces",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"type",
".",
"getInterfaces",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"addMembersInclSupertypes",
"(",
"memberNames",
",",
"members",
",",
"(",
"XClass",
")",
"it",
".",
"next",
"(",
")",
",",
"tagName",
",",
"paramName",
",",
"paramValue",
")",
";",
"}",
"}",
"if",
"(",
"!",
"type",
".",
"isInterface",
"(",
")",
"&&",
"(",
"type",
".",
"getSuperclass",
"(",
")",
"!=",
"null",
")",
")",
"{",
"addMembersInclSupertypes",
"(",
"memberNames",
",",
"members",
",",
"type",
".",
"getSuperclass",
"(",
")",
",",
"tagName",
",",
"paramName",
",",
"paramValue",
")",
";",
"}",
"}"
] | Retrieves the members of the type and of its super types.
@param memberNames Will receive the names of the members (for sorting)
@param members Will receive the members
@param type The type to process
@param tagName An optional tag for filtering the types
@param paramName The feature to be added to the MembersInclSupertypes attribute
@param paramValue The feature to be added to the MembersInclSupertypes attribute
@throws XDocletException If an error occurs | [
"Retrieves",
"the",
"members",
"of",
"the",
"type",
"and",
"of",
"its",
"super",
"types",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L477-L488 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.addMembers | private void addMembers(Collection memberNames, HashMap members, XClass type, String tagName, String paramName, String paramValue) throws XDocletException
{
if (!type.isInterface() && (type.getFields() != null)) {
XField field;
for (Iterator it = type.getFields().iterator(); it.hasNext(); ) {
field = (XField)it.next();
if (!field.isFinal() && !field.isStatic() && !field.isTransient()) {
if (checkTagAndParam(field.getDoc(), tagName, paramName, paramValue)) {
// already processed ?
if (!members.containsKey(field.getName())) {
memberNames.add(field.getName());
members.put(field.getName(), field);
}
}
}
}
}
if (type.getMethods() != null) {
XMethod method;
String propertyName;
for (Iterator it = type.getMethods().iterator(); it.hasNext(); ) {
method = (XMethod)it.next();
if (!method.isConstructor() && !method.isNative() && !method.isStatic()) {
if (checkTagAndParam(method.getDoc(), tagName, paramName, paramValue)) {
if (MethodTagsHandler.isGetterMethod(method) || MethodTagsHandler.isSetterMethod(method)) {
propertyName = MethodTagsHandler.getPropertyNameFor(method);
if (!members.containsKey(propertyName)) {
memberNames.add(propertyName);
members.put(propertyName, method);
}
}
}
}
}
}
} | java | private void addMembers(Collection memberNames, HashMap members, XClass type, String tagName, String paramName, String paramValue) throws XDocletException
{
if (!type.isInterface() && (type.getFields() != null)) {
XField field;
for (Iterator it = type.getFields().iterator(); it.hasNext(); ) {
field = (XField)it.next();
if (!field.isFinal() && !field.isStatic() && !field.isTransient()) {
if (checkTagAndParam(field.getDoc(), tagName, paramName, paramValue)) {
// already processed ?
if (!members.containsKey(field.getName())) {
memberNames.add(field.getName());
members.put(field.getName(), field);
}
}
}
}
}
if (type.getMethods() != null) {
XMethod method;
String propertyName;
for (Iterator it = type.getMethods().iterator(); it.hasNext(); ) {
method = (XMethod)it.next();
if (!method.isConstructor() && !method.isNative() && !method.isStatic()) {
if (checkTagAndParam(method.getDoc(), tagName, paramName, paramValue)) {
if (MethodTagsHandler.isGetterMethod(method) || MethodTagsHandler.isSetterMethod(method)) {
propertyName = MethodTagsHandler.getPropertyNameFor(method);
if (!members.containsKey(propertyName)) {
memberNames.add(propertyName);
members.put(propertyName, method);
}
}
}
}
}
}
} | [
"private",
"void",
"addMembers",
"(",
"Collection",
"memberNames",
",",
"HashMap",
"members",
",",
"XClass",
"type",
",",
"String",
"tagName",
",",
"String",
"paramName",
",",
"String",
"paramValue",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"!",
"type",
".",
"isInterface",
"(",
")",
"&&",
"(",
"type",
".",
"getFields",
"(",
")",
"!=",
"null",
")",
")",
"{",
"XField",
"field",
";",
"for",
"(",
"Iterator",
"it",
"=",
"type",
".",
"getFields",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"field",
"=",
"(",
"XField",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"field",
".",
"isFinal",
"(",
")",
"&&",
"!",
"field",
".",
"isStatic",
"(",
")",
"&&",
"!",
"field",
".",
"isTransient",
"(",
")",
")",
"{",
"if",
"(",
"checkTagAndParam",
"(",
"field",
".",
"getDoc",
"(",
")",
",",
"tagName",
",",
"paramName",
",",
"paramValue",
")",
")",
"{",
"// already processed ?\r",
"if",
"(",
"!",
"members",
".",
"containsKey",
"(",
"field",
".",
"getName",
"(",
")",
")",
")",
"{",
"memberNames",
".",
"add",
"(",
"field",
".",
"getName",
"(",
")",
")",
";",
"members",
".",
"put",
"(",
"field",
".",
"getName",
"(",
")",
",",
"field",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"type",
".",
"getMethods",
"(",
")",
"!=",
"null",
")",
"{",
"XMethod",
"method",
";",
"String",
"propertyName",
";",
"for",
"(",
"Iterator",
"it",
"=",
"type",
".",
"getMethods",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"method",
"=",
"(",
"XMethod",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"method",
".",
"isConstructor",
"(",
")",
"&&",
"!",
"method",
".",
"isNative",
"(",
")",
"&&",
"!",
"method",
".",
"isStatic",
"(",
")",
")",
"{",
"if",
"(",
"checkTagAndParam",
"(",
"method",
".",
"getDoc",
"(",
")",
",",
"tagName",
",",
"paramName",
",",
"paramValue",
")",
")",
"{",
"if",
"(",
"MethodTagsHandler",
".",
"isGetterMethod",
"(",
"method",
")",
"||",
"MethodTagsHandler",
".",
"isSetterMethod",
"(",
"method",
")",
")",
"{",
"propertyName",
"=",
"MethodTagsHandler",
".",
"getPropertyNameFor",
"(",
"method",
")",
";",
"if",
"(",
"!",
"members",
".",
"containsKey",
"(",
"propertyName",
")",
")",
"{",
"memberNames",
".",
"add",
"(",
"propertyName",
")",
";",
"members",
".",
"put",
"(",
"propertyName",
",",
"method",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}"
] | Retrieves the members of the given type.
@param memberNames Will receive the names of the members (for sorting)
@param members Will receive the members
@param type The type to process
@param tagName An optional tag for filtering the types
@param paramName The feature to be added to the Members attribute
@param paramValue The feature to be added to the Members attribute
@throws XDocletException If an error occurs | [
"Retrieves",
"the",
"members",
"of",
"the",
"given",
"type",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L501-L539 | train |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.checkTagAndParam | private boolean checkTagAndParam(XDoc doc, String tagName, String paramName, String paramValue)
{
if (tagName == null) {
return true;
}
if (!doc.hasTag(tagName)) {
return false;
}
if (paramName == null) {
return true;
}
if (!doc.getTag(tagName).getAttributeNames().contains(paramName)) {
return false;
}
return (paramValue == null) || paramValue.equals(doc.getTagAttributeValue(tagName, paramName));
} | java | private boolean checkTagAndParam(XDoc doc, String tagName, String paramName, String paramValue)
{
if (tagName == null) {
return true;
}
if (!doc.hasTag(tagName)) {
return false;
}
if (paramName == null) {
return true;
}
if (!doc.getTag(tagName).getAttributeNames().contains(paramName)) {
return false;
}
return (paramValue == null) || paramValue.equals(doc.getTagAttributeValue(tagName, paramName));
} | [
"private",
"boolean",
"checkTagAndParam",
"(",
"XDoc",
"doc",
",",
"String",
"tagName",
",",
"String",
"paramName",
",",
"String",
"paramValue",
")",
"{",
"if",
"(",
"tagName",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"doc",
".",
"hasTag",
"(",
"tagName",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"paramName",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"doc",
".",
"getTag",
"(",
"tagName",
")",
".",
"getAttributeNames",
"(",
")",
".",
"contains",
"(",
"paramName",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"paramValue",
"==",
"null",
")",
"||",
"paramValue",
".",
"equals",
"(",
"doc",
".",
"getTagAttributeValue",
"(",
"tagName",
",",
"paramName",
")",
")",
";",
"}"
] | Determines whether the given documentation part contains the specified tag with the given parameter having the
given value.
@param doc The documentation part
@param tagName The tag to be searched for
@param paramName The parameter that the tag is required to have
@param paramValue The value of the parameter
@return boolean Whether the documentation part has the tag and parameter | [
"Determines",
"whether",
"the",
"given",
"documentation",
"part",
"contains",
"the",
"specified",
"tag",
"with",
"the",
"given",
"parameter",
"having",
"the",
"given",
"value",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L551-L566 | train |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/LogFileCompressor.java | LogFileCompressor.waitForSizeQueue | final void waitForSizeQueue(final int queueSize) {
synchronized (this.queue) {
while (this.queue.size() > queueSize) {
try {
this.queue.wait(250L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
this.queue.notifyAll();
}
} | java | final void waitForSizeQueue(final int queueSize) {
synchronized (this.queue) {
while (this.queue.size() > queueSize) {
try {
this.queue.wait(250L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
this.queue.notifyAll();
}
} | [
"final",
"void",
"waitForSizeQueue",
"(",
"final",
"int",
"queueSize",
")",
"{",
"synchronized",
"(",
"this",
".",
"queue",
")",
"{",
"while",
"(",
"this",
".",
"queue",
".",
"size",
"(",
")",
">",
"queueSize",
")",
"{",
"try",
"{",
"this",
".",
"queue",
".",
"wait",
"(",
"250L",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"}",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"500L",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"this",
".",
"queue",
".",
"notifyAll",
"(",
")",
";",
"}",
"}"
] | For test purposes only. | [
"For",
"test",
"purposes",
"only",
"."
] | cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6 | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/LogFileCompressor.java#L122-L138 | train |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/LogFileCompressor.java | LogFileCompressor.begin | final void begin() {
if (LogFileCompressionStrategy.existsFor(this.properties)) {
final Thread thread = new Thread(this, "Log4J File Compressor");
thread.setDaemon(true);
thread.start();
this.threadRef = thread;
}
} | java | final void begin() {
if (LogFileCompressionStrategy.existsFor(this.properties)) {
final Thread thread = new Thread(this, "Log4J File Compressor");
thread.setDaemon(true);
thread.start();
this.threadRef = thread;
}
} | [
"final",
"void",
"begin",
"(",
")",
"{",
"if",
"(",
"LogFileCompressionStrategy",
".",
"existsFor",
"(",
"this",
".",
"properties",
")",
")",
"{",
"final",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"this",
",",
"\"Log4J File Compressor\"",
")",
";",
"thread",
".",
"setDaemon",
"(",
"true",
")",
";",
"thread",
".",
"start",
"(",
")",
";",
"this",
".",
"threadRef",
"=",
"thread",
";",
"}",
"}"
] | Starts the compressor. | [
"Starts",
"the",
"compressor",
"."
] | cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6 | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/LogFileCompressor.java#L143-L150 | train |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/LogFileCompressor.java | LogFileCompressor.end | final void end() {
final Thread thread = this.threadRef;
this.keepRunning.set(false);
if (thread != null) {
// thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
this.threadRef = null;
} | java | final void end() {
final Thread thread = this.threadRef;
this.keepRunning.set(false);
if (thread != null) {
// thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
this.threadRef = null;
} | [
"final",
"void",
"end",
"(",
")",
"{",
"final",
"Thread",
"thread",
"=",
"this",
".",
"threadRef",
";",
"this",
".",
"keepRunning",
".",
"set",
"(",
"false",
")",
";",
"if",
"(",
"thread",
"!=",
"null",
")",
"{",
"// thread.interrupt();",
"try",
"{",
"thread",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"}",
"this",
".",
"threadRef",
"=",
"null",
";",
"}"
] | Stops the compressor. | [
"Stops",
"the",
"compressor",
"."
] | cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6 | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/LogFileCompressor.java#L155-L167 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java | CreateMASCaseManager.addStory | public static void addStory(File caseManager, String storyName,
String testPath, String user, String feature, String benefit) throws BeastException {
FileWriter caseManagerWriter;
String storyClass = SystemReader.createClassName(storyName);
try {
BufferedReader reader = new BufferedReader(new FileReader(
caseManager));
String targetLine1 = " public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {";
String targetLine2 = " Result result = JUnitCore.runClasses(" + testPath + "."
+ storyClass + ".class);";
String in;
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine1)) {
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine2)) {
reader.close();
// This test is already written in the case manager.
return;
}
}
reader.close();
throw new BeastException("Two different stories with the same name (same method name) are being created in the same CaseManager file. That is not possible. Please, change the name of the story: " + testPath + "."
+ storyClass + ".java");
}
}
reader.close();
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write(" /**\n");
caseManagerWriter.write(" * This is the story: " + storyName
+ "\n");
caseManagerWriter.write(" * requested by: " + user + "\n");
caseManagerWriter.write(" * providing the feature: " + feature
+ "\n");
caseManagerWriter.write(" * so the user gets the benefit: "
+ benefit + "\n");
caseManagerWriter.write(" */\n");
caseManagerWriter.write(" @Test\n");
caseManagerWriter.write(" public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {\n");
caseManagerWriter.write(" Result result = JUnitCore.runClasses(" + testPath
+ "." + storyClass + ".class);\n");
caseManagerWriter.write(" Assert.assertTrue(result.wasSuccessful());\n");
caseManagerWriter.write(" }\n");
caseManagerWriter.write("\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger.getLogger("CreateMASCaseManager.createTest");
logger.info("ERROR writing the file");
}
} | java | public static void addStory(File caseManager, String storyName,
String testPath, String user, String feature, String benefit) throws BeastException {
FileWriter caseManagerWriter;
String storyClass = SystemReader.createClassName(storyName);
try {
BufferedReader reader = new BufferedReader(new FileReader(
caseManager));
String targetLine1 = " public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {";
String targetLine2 = " Result result = JUnitCore.runClasses(" + testPath + "."
+ storyClass + ".class);";
String in;
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine1)) {
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine2)) {
reader.close();
// This test is already written in the case manager.
return;
}
}
reader.close();
throw new BeastException("Two different stories with the same name (same method name) are being created in the same CaseManager file. That is not possible. Please, change the name of the story: " + testPath + "."
+ storyClass + ".java");
}
}
reader.close();
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write(" /**\n");
caseManagerWriter.write(" * This is the story: " + storyName
+ "\n");
caseManagerWriter.write(" * requested by: " + user + "\n");
caseManagerWriter.write(" * providing the feature: " + feature
+ "\n");
caseManagerWriter.write(" * so the user gets the benefit: "
+ benefit + "\n");
caseManagerWriter.write(" */\n");
caseManagerWriter.write(" @Test\n");
caseManagerWriter.write(" public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {\n");
caseManagerWriter.write(" Result result = JUnitCore.runClasses(" + testPath
+ "." + storyClass + ".class);\n");
caseManagerWriter.write(" Assert.assertTrue(result.wasSuccessful());\n");
caseManagerWriter.write(" }\n");
caseManagerWriter.write("\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger.getLogger("CreateMASCaseManager.createTest");
logger.info("ERROR writing the file");
}
} | [
"public",
"static",
"void",
"addStory",
"(",
"File",
"caseManager",
",",
"String",
"storyName",
",",
"String",
"testPath",
",",
"String",
"user",
",",
"String",
"feature",
",",
"String",
"benefit",
")",
"throws",
"BeastException",
"{",
"FileWriter",
"caseManagerWriter",
";",
"String",
"storyClass",
"=",
"SystemReader",
".",
"createClassName",
"(",
"storyName",
")",
";",
"try",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"caseManager",
")",
")",
";",
"String",
"targetLine1",
"=",
"\" public void \"",
"+",
"MASReader",
".",
"createFirstLowCaseName",
"(",
"storyName",
")",
"+",
"\"() {\"",
";",
"String",
"targetLine2",
"=",
"\" Result result = JUnitCore.runClasses(\"",
"+",
"testPath",
"+",
"\".\"",
"+",
"storyClass",
"+",
"\".class);\"",
";",
"String",
"in",
";",
"while",
"(",
"(",
"in",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"in",
".",
"equals",
"(",
"targetLine1",
")",
")",
"{",
"while",
"(",
"(",
"in",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"in",
".",
"equals",
"(",
"targetLine2",
")",
")",
"{",
"reader",
".",
"close",
"(",
")",
";",
"// This test is already written in the case manager.",
"return",
";",
"}",
"}",
"reader",
".",
"close",
"(",
")",
";",
"throw",
"new",
"BeastException",
"(",
"\"Two different stories with the same name (same method name) are being created in the same CaseManager file. That is not possible. Please, change the name of the story: \"",
"+",
"testPath",
"+",
"\".\"",
"+",
"storyClass",
"+",
"\".java\"",
")",
";",
"}",
"}",
"reader",
".",
"close",
"(",
")",
";",
"caseManagerWriter",
"=",
"new",
"FileWriter",
"(",
"caseManager",
",",
"true",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" /**\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" * This is the story: \"",
"+",
"storyName",
"+",
"\"\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" * requested by: \"",
"+",
"user",
"+",
"\"\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" * providing the feature: \"",
"+",
"feature",
"+",
"\"\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" * so the user gets the benefit: \"",
"+",
"benefit",
"+",
"\"\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" */\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" @Test\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" public void \"",
"+",
"MASReader",
".",
"createFirstLowCaseName",
"(",
"storyName",
")",
"+",
"\"() {\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" Result result = JUnitCore.runClasses(\"",
"+",
"testPath",
"+",
"\".\"",
"+",
"storyClass",
"+",
"\".class);\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" Assert.assertTrue(result.wasSuccessful());\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\" }\\n\"",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\"\\n\"",
")",
";",
"caseManagerWriter",
".",
"flush",
"(",
")",
";",
"caseManagerWriter",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"CreateMASCaseManager.createTest\"",
")",
";",
"logger",
".",
"info",
"(",
"\"ERROR writing the file\"",
")",
";",
"}",
"}"
] | The third method to write caseManager. Its task is to write the call to
the story to be run.
@param caseManager
the file where the test must be written
@param storyName
the name of the story
@param test_path
the path where the story can be found
@param user
the user requesting the story
@param feature
the feature requested by the user
@param benefit
the benefit provided by the feature
@throws BeastException | [
"The",
"third",
"method",
"to",
"write",
"caseManager",
".",
"Its",
"task",
"is",
"to",
"write",
"the",
"call",
"to",
"the",
"story",
"to",
"be",
"run",
"."
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java#L183-L236 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java | CreateMASCaseManager.closeMASCaseManager | public static void closeMASCaseManager(File caseManager) {
FileWriter caseManagerWriter;
try {
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write("}\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger
.getLogger("CreateMASCaseManager.closeMASCaseManager");
logger.info("ERROR: There is a mistake closing caseManager file.\n");
}
} | java | public static void closeMASCaseManager(File caseManager) {
FileWriter caseManagerWriter;
try {
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write("}\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger
.getLogger("CreateMASCaseManager.closeMASCaseManager");
logger.info("ERROR: There is a mistake closing caseManager file.\n");
}
} | [
"public",
"static",
"void",
"closeMASCaseManager",
"(",
"File",
"caseManager",
")",
"{",
"FileWriter",
"caseManagerWriter",
";",
"try",
"{",
"caseManagerWriter",
"=",
"new",
"FileWriter",
"(",
"caseManager",
",",
"true",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\"}\\n\"",
")",
";",
"caseManagerWriter",
".",
"flush",
"(",
")",
";",
"caseManagerWriter",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"CreateMASCaseManager.closeMASCaseManager\"",
")",
";",
"logger",
".",
"info",
"(",
"\"ERROR: There is a mistake closing caseManager file.\\n\"",
")",
";",
"}",
"}"
] | Method to close the file caseManager. It is called just one time, by the
MASReader, once every test and stroy have been added.
@param caseManager | [
"Method",
"to",
"close",
"the",
"file",
"caseManager",
".",
"It",
"is",
"called",
"just",
"one",
"time",
"by",
"the",
"MASReader",
"once",
"every",
"test",
"and",
"stroy",
"have",
"been",
"added",
"."
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java#L244-L258 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java | TiledFeatureService.fillTile | public void fillTile(InternalTile tile, Envelope maxTileExtent)
throws GeomajasException {
List<InternalFeature> origFeatures = tile.getFeatures();
tile.setFeatures(new ArrayList<InternalFeature>());
for (InternalFeature feature : origFeatures) {
if (!addTileCode(tile, maxTileExtent, feature.getGeometry())) {
log.debug("add feature");
tile.addFeature(feature);
}
}
} | java | public void fillTile(InternalTile tile, Envelope maxTileExtent)
throws GeomajasException {
List<InternalFeature> origFeatures = tile.getFeatures();
tile.setFeatures(new ArrayList<InternalFeature>());
for (InternalFeature feature : origFeatures) {
if (!addTileCode(tile, maxTileExtent, feature.getGeometry())) {
log.debug("add feature");
tile.addFeature(feature);
}
}
} | [
"public",
"void",
"fillTile",
"(",
"InternalTile",
"tile",
",",
"Envelope",
"maxTileExtent",
")",
"throws",
"GeomajasException",
"{",
"List",
"<",
"InternalFeature",
">",
"origFeatures",
"=",
"tile",
".",
"getFeatures",
"(",
")",
";",
"tile",
".",
"setFeatures",
"(",
"new",
"ArrayList",
"<",
"InternalFeature",
">",
"(",
")",
")",
";",
"for",
"(",
"InternalFeature",
"feature",
":",
"origFeatures",
")",
"{",
"if",
"(",
"!",
"addTileCode",
"(",
"tile",
",",
"maxTileExtent",
",",
"feature",
".",
"getGeometry",
"(",
")",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"add feature\"",
")",
";",
"tile",
".",
"addFeature",
"(",
"feature",
")",
";",
"}",
"}",
"}"
] | Put features in a tile. This will assure all features are only added in one tile. When a feature's unique tile
is different from this one a link is added in the tile.
@param tile
tile to put features in
@param maxTileExtent
the maximum tile extent
@throws GeomajasException oops | [
"Put",
"features",
"in",
"a",
"tile",
".",
"This",
"will",
"assure",
"all",
"features",
"are",
"only",
"added",
"in",
"one",
"tile",
".",
"When",
"a",
"feature",
"s",
"unique",
"tile",
"is",
"different",
"from",
"this",
"one",
"a",
"link",
"is",
"added",
"in",
"the",
"tile",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java#L71-L81 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java | TiledFeatureService.clipTile | public void clipTile(InternalTile tile, double scale, Coordinate panOrigin) throws GeomajasException {
log.debug("clipTile before {}", tile);
List<InternalFeature> orgFeatures = tile.getFeatures();
tile.setFeatures(new ArrayList<InternalFeature>());
Geometry maxScreenBbox = null; // The tile's maximum bounds in screen space. Used for clipping.
for (InternalFeature feature : orgFeatures) {
// clip feature if necessary
if (exceedsScreenDimensions(feature, scale)) {
log.debug("feature {} exceeds screen dimensions", feature);
InternalFeatureImpl vectorFeature = (InternalFeatureImpl) feature.clone();
tile.setClipped(true);
vectorFeature.setClipped(true);
if (null == maxScreenBbox) {
maxScreenBbox = JTS.toGeometry(getMaxScreenEnvelope(tile, panOrigin));
}
Geometry clipped = maxScreenBbox.intersection(feature.getGeometry());
vectorFeature.setClippedGeometry(clipped);
tile.addFeature(vectorFeature);
} else {
tile.addFeature(feature);
}
}
log.debug("clipTile after {}", tile);
} | java | public void clipTile(InternalTile tile, double scale, Coordinate panOrigin) throws GeomajasException {
log.debug("clipTile before {}", tile);
List<InternalFeature> orgFeatures = tile.getFeatures();
tile.setFeatures(new ArrayList<InternalFeature>());
Geometry maxScreenBbox = null; // The tile's maximum bounds in screen space. Used for clipping.
for (InternalFeature feature : orgFeatures) {
// clip feature if necessary
if (exceedsScreenDimensions(feature, scale)) {
log.debug("feature {} exceeds screen dimensions", feature);
InternalFeatureImpl vectorFeature = (InternalFeatureImpl) feature.clone();
tile.setClipped(true);
vectorFeature.setClipped(true);
if (null == maxScreenBbox) {
maxScreenBbox = JTS.toGeometry(getMaxScreenEnvelope(tile, panOrigin));
}
Geometry clipped = maxScreenBbox.intersection(feature.getGeometry());
vectorFeature.setClippedGeometry(clipped);
tile.addFeature(vectorFeature);
} else {
tile.addFeature(feature);
}
}
log.debug("clipTile after {}", tile);
} | [
"public",
"void",
"clipTile",
"(",
"InternalTile",
"tile",
",",
"double",
"scale",
",",
"Coordinate",
"panOrigin",
")",
"throws",
"GeomajasException",
"{",
"log",
".",
"debug",
"(",
"\"clipTile before {}\"",
",",
"tile",
")",
";",
"List",
"<",
"InternalFeature",
">",
"orgFeatures",
"=",
"tile",
".",
"getFeatures",
"(",
")",
";",
"tile",
".",
"setFeatures",
"(",
"new",
"ArrayList",
"<",
"InternalFeature",
">",
"(",
")",
")",
";",
"Geometry",
"maxScreenBbox",
"=",
"null",
";",
"// The tile's maximum bounds in screen space. Used for clipping.",
"for",
"(",
"InternalFeature",
"feature",
":",
"orgFeatures",
")",
"{",
"// clip feature if necessary",
"if",
"(",
"exceedsScreenDimensions",
"(",
"feature",
",",
"scale",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"feature {} exceeds screen dimensions\"",
",",
"feature",
")",
";",
"InternalFeatureImpl",
"vectorFeature",
"=",
"(",
"InternalFeatureImpl",
")",
"feature",
".",
"clone",
"(",
")",
";",
"tile",
".",
"setClipped",
"(",
"true",
")",
";",
"vectorFeature",
".",
"setClipped",
"(",
"true",
")",
";",
"if",
"(",
"null",
"==",
"maxScreenBbox",
")",
"{",
"maxScreenBbox",
"=",
"JTS",
".",
"toGeometry",
"(",
"getMaxScreenEnvelope",
"(",
"tile",
",",
"panOrigin",
")",
")",
";",
"}",
"Geometry",
"clipped",
"=",
"maxScreenBbox",
".",
"intersection",
"(",
"feature",
".",
"getGeometry",
"(",
")",
")",
";",
"vectorFeature",
".",
"setClippedGeometry",
"(",
"clipped",
")",
";",
"tile",
".",
"addFeature",
"(",
"vectorFeature",
")",
";",
"}",
"else",
"{",
"tile",
".",
"addFeature",
"(",
"feature",
")",
";",
"}",
"}",
"log",
".",
"debug",
"(",
"\"clipTile after {}\"",
",",
"tile",
")",
";",
"}"
] | Apply clipping to the features in a tile. The tile and its features should already be in map space.
@param tile
tile to put features in
@param scale
scale
@param panOrigin
When panning on the client, only this parameter changes. So we need to be aware of it as we calculate
the maxScreenEnvelope.
@throws GeomajasException oops | [
"Apply",
"clipping",
"to",
"the",
"features",
"in",
"a",
"tile",
".",
"The",
"tile",
"and",
"its",
"features",
"should",
"already",
"be",
"in",
"map",
"space",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java#L95-L118 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java | TiledFeatureService.exceedsScreenDimensions | private boolean exceedsScreenDimensions(InternalFeature f, double scale) {
Envelope env = f.getBounds();
return (env.getWidth() * scale > MAXIMUM_TILE_COORDINATE) ||
(env.getHeight() * scale > MAXIMUM_TILE_COORDINATE);
} | java | private boolean exceedsScreenDimensions(InternalFeature f, double scale) {
Envelope env = f.getBounds();
return (env.getWidth() * scale > MAXIMUM_TILE_COORDINATE) ||
(env.getHeight() * scale > MAXIMUM_TILE_COORDINATE);
} | [
"private",
"boolean",
"exceedsScreenDimensions",
"(",
"InternalFeature",
"f",
",",
"double",
"scale",
")",
"{",
"Envelope",
"env",
"=",
"f",
".",
"getBounds",
"(",
")",
";",
"return",
"(",
"env",
".",
"getWidth",
"(",
")",
"*",
"scale",
">",
"MAXIMUM_TILE_COORDINATE",
")",
"||",
"(",
"env",
".",
"getHeight",
"(",
")",
"*",
"scale",
">",
"MAXIMUM_TILE_COORDINATE",
")",
";",
"}"
] | The test that checks if clipping is needed.
@param f
feature to test
@param scale
scale
@return true if clipping is needed | [
"The",
"test",
"that",
"checks",
"if",
"clipping",
"is",
"needed",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java#L190-L194 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java | TiledFeatureService.getMaxScreenEnvelope | private Envelope getMaxScreenEnvelope(InternalTile tile, Coordinate panOrigin) {
int nrOfTilesX = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenWidth());
int nrOfTilesY = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenHeight());
double x1 = panOrigin.x - nrOfTilesX * tile.getTileWidth();
// double x2 = x1 + (nrOfTilesX * tileWidth * 2);
double x2 = panOrigin.x + nrOfTilesX * tile.getTileWidth();
double y1 = panOrigin.y - nrOfTilesY * tile.getTileHeight();
// double y2 = y1 + (nrOfTilesY * tileHeight * 2);
double y2 = panOrigin.y + nrOfTilesY * tile.getTileHeight();
return new Envelope(x1, x2, y1, y2);
} | java | private Envelope getMaxScreenEnvelope(InternalTile tile, Coordinate panOrigin) {
int nrOfTilesX = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenWidth());
int nrOfTilesY = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenHeight());
double x1 = panOrigin.x - nrOfTilesX * tile.getTileWidth();
// double x2 = x1 + (nrOfTilesX * tileWidth * 2);
double x2 = panOrigin.x + nrOfTilesX * tile.getTileWidth();
double y1 = panOrigin.y - nrOfTilesY * tile.getTileHeight();
// double y2 = y1 + (nrOfTilesY * tileHeight * 2);
double y2 = panOrigin.y + nrOfTilesY * tile.getTileHeight();
return new Envelope(x1, x2, y1, y2);
} | [
"private",
"Envelope",
"getMaxScreenEnvelope",
"(",
"InternalTile",
"tile",
",",
"Coordinate",
"panOrigin",
")",
"{",
"int",
"nrOfTilesX",
"=",
"Math",
".",
"max",
"(",
"1",
",",
"MAXIMUM_TILE_COORDINATE",
"/",
"tile",
".",
"getScreenWidth",
"(",
")",
")",
";",
"int",
"nrOfTilesY",
"=",
"Math",
".",
"max",
"(",
"1",
",",
"MAXIMUM_TILE_COORDINATE",
"/",
"tile",
".",
"getScreenHeight",
"(",
")",
")",
";",
"double",
"x1",
"=",
"panOrigin",
".",
"x",
"-",
"nrOfTilesX",
"*",
"tile",
".",
"getTileWidth",
"(",
")",
";",
"// double x2 = x1 + (nrOfTilesX * tileWidth * 2);",
"double",
"x2",
"=",
"panOrigin",
".",
"x",
"+",
"nrOfTilesX",
"*",
"tile",
".",
"getTileWidth",
"(",
")",
";",
"double",
"y1",
"=",
"panOrigin",
".",
"y",
"-",
"nrOfTilesY",
"*",
"tile",
".",
"getTileHeight",
"(",
")",
";",
"// double y2 = y1 + (nrOfTilesY * tileHeight * 2);",
"double",
"y2",
"=",
"panOrigin",
".",
"y",
"+",
"nrOfTilesY",
"*",
"tile",
".",
"getTileHeight",
"(",
")",
";",
"return",
"new",
"Envelope",
"(",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
")",
";",
"}"
] | What is the maximum bounds in screen space? Needed for correct clipping calculation.
@param tile
tile
@param panOrigin
pan origin
@return max screen bbox | [
"What",
"is",
"the",
"maximum",
"bounds",
"in",
"screen",
"space?",
"Needed",
"for",
"correct",
"clipping",
"calculation",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TiledFeatureService.java#L205-L216 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getClient | private Client getClient(){
final ClientConfig cfg = new DefaultClientConfig();
cfg.getClasses().add(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider.class);
cfg.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, timeout);
return Client.create(cfg);
} | java | private Client getClient(){
final ClientConfig cfg = new DefaultClientConfig();
cfg.getClasses().add(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider.class);
cfg.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, timeout);
return Client.create(cfg);
} | [
"private",
"Client",
"getClient",
"(",
")",
"{",
"final",
"ClientConfig",
"cfg",
"=",
"new",
"DefaultClientConfig",
"(",
")",
";",
"cfg",
".",
"getClasses",
"(",
")",
".",
"add",
"(",
"com",
".",
"fasterxml",
".",
"jackson",
".",
"jaxrs",
".",
"json",
".",
"JacksonJsonProvider",
".",
"class",
")",
";",
"cfg",
".",
"getProperties",
"(",
")",
".",
"put",
"(",
"ClientConfig",
".",
"PROPERTY_CONNECT_TIMEOUT",
",",
"timeout",
")",
";",
"return",
"Client",
".",
"create",
"(",
"cfg",
")",
";",
"}"
] | Provide Jersey client for the targeted Grapes server
@return webResource | [
"Provide",
"Jersey",
"client",
"for",
"the",
"targeted",
"Grapes",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L69-L75 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.isServerAvailable | public boolean isServerAvailable(){
final Client client = getClient();
final ClientResponse response = client.resource(serverURL).get(ClientResponse.class);
if(ClientResponse.Status.OK.getStatusCode() == response.getStatus()){
return true;
}
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, "Failed to reach the targeted Grapes server", response.getStatus()));
}
client.destroy();
return false;
} | java | public boolean isServerAvailable(){
final Client client = getClient();
final ClientResponse response = client.resource(serverURL).get(ClientResponse.class);
if(ClientResponse.Status.OK.getStatusCode() == response.getStatus()){
return true;
}
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, "Failed to reach the targeted Grapes server", response.getStatus()));
}
client.destroy();
return false;
} | [
"public",
"boolean",
"isServerAvailable",
"(",
")",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"==",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"\"Failed to reach the targeted Grapes server\"",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"client",
".",
"destroy",
"(",
")",
";",
"return",
"false",
";",
"}"
] | Checks if the dependency server is available
@return true if the server is reachable, false otherwise | [
"Checks",
"if",
"the",
"dependency",
"server",
"is",
"available"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L103-L117 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postBuildInfo | public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion));
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST buildInfo";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion));
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST buildInfo";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postBuildInfo",
"(",
"final",
"String",
"moduleName",
",",
"final",
"String",
"moduleVersion",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"buildInfo",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getBuildInfoPath",
"(",
"moduleName",
",",
"moduleVersion",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
",",
"buildInfo",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"CREATED",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to POST buildInfo\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Post a build info to the server
@param moduleName String
@param moduleVersion String
@param buildInfo Map<String,String>
@param user String
@param password String
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Post",
"a",
"build",
"info",
"to",
"the",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L130-L143 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postModule | public void postModule(final Module module, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.moduleResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, module);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST module";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postModule(final Module module, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.moduleResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, module);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST module";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postModule",
"(",
"final",
"Module",
"module",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"moduleResourcePath",
"(",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
",",
"module",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"CREATED",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to POST module\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Post a module to the server
@param module
@param user
@param password
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Post",
"a",
"module",
"to",
"the",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L178-L191 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.deleteModule | public void deleteModule(final String name, final String version, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version));
final ClientResponse response = resource.delete(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "to delete module", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void deleteModule(final String name, final String version, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version));
final ClientResponse response = resource.delete(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "to delete module", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"deleteModule",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"version",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getModulePath",
"(",
"name",
",",
"version",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"delete",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"FAILED_TO_GET_MODULE",
",",
"\"to delete module\"",
",",
"name",
",",
"version",
")",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Delete a module from Grapes server
@param name
@param version
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Delete",
"a",
"module",
"from",
"Grapes",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L201-L215 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getModule | public Module getModule(final String name, final String version) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version));
final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "get module details", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(Module.class);
} | java | public Module getModule(final String name, final String version) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version));
final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "get module details", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(Module.class);
} | [
"public",
"Module",
"getModule",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"version",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getModulePath",
"(",
"name",
",",
"version",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"FAILED_TO_GET_MODULE",
",",
"\"get module details\"",
",",
"name",
",",
"version",
")",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"Module",
".",
"class",
")",
";",
"}"
] | Send a get module request
@param name
@param version
@return the targeted module
@throws GrapesCommunicationException | [
"Send",
"a",
"get",
"module",
"request"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L225-L240 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getModules | public List<Module> getModules(final Map<String, String> filters) throws GrapesCommunicationException {
final Client client = getClient();
WebResource resource = client.resource(serverURL).path(RequestUtils.getAllModulesPath());
for(final Map.Entry<String,String> queryParam: filters.entrySet()){
resource = resource.queryParam(queryParam.getKey(), queryParam.getValue());
}
final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get filtered modules.";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<Module>>(){});
} | java | public List<Module> getModules(final Map<String, String> filters) throws GrapesCommunicationException {
final Client client = getClient();
WebResource resource = client.resource(serverURL).path(RequestUtils.getAllModulesPath());
for(final Map.Entry<String,String> queryParam: filters.entrySet()){
resource = resource.queryParam(queryParam.getKey(), queryParam.getValue());
}
final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get filtered modules.";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<Module>>(){});
} | [
"public",
"List",
"<",
"Module",
">",
"getModules",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"filters",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getAllModulesPath",
"(",
")",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"queryParam",
":",
"filters",
".",
"entrySet",
"(",
")",
")",
"{",
"resource",
"=",
"resource",
".",
"queryParam",
"(",
"queryParam",
".",
"getKey",
"(",
")",
",",
"queryParam",
".",
"getValue",
"(",
")",
")",
";",
"}",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to get filtered modules.\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"Module",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Get a list of modules regarding filters
@param filters Map<String,String>
@return List<Module>
@throws GrapesCommunicationException | [
"Get",
"a",
"list",
"of",
"modules",
"regarding",
"filters"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L249-L268 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.promoteModule | public void promoteModule(final String name, final String version, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.promoteModulePath(name, version));
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "promote module", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void promoteModule(final String name, final String version, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.promoteModulePath(name, version));
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "promote module", name, version);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"promoteModule",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"version",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"promoteModulePath",
"(",
"name",
",",
"version",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"FAILED_TO_GET_MODULE",
",",
"\"promote module\"",
",",
"name",
",",
"version",
")",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Promote a module in the Grapes server
@param name
@param version
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Promote",
"a",
"module",
"in",
"the",
"Grapes",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L328-L341 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getModulePromotionReport | public PromotionEvaluationReport getModulePromotionReport(final String name, final String version) throws GrapesCommunicationException {
return getModulePromotionReportRaw(name, version, false, PromotionEvaluationReport.class);
} | java | public PromotionEvaluationReport getModulePromotionReport(final String name, final String version) throws GrapesCommunicationException {
return getModulePromotionReportRaw(name, version, false, PromotionEvaluationReport.class);
} | [
"public",
"PromotionEvaluationReport",
"getModulePromotionReport",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"version",
")",
"throws",
"GrapesCommunicationException",
"{",
"return",
"getModulePromotionReportRaw",
"(",
"name",
",",
"version",
",",
"false",
",",
"PromotionEvaluationReport",
".",
"class",
")",
";",
"}"
] | Check if a module can be promoted in the Grapes server
@param name
@param version
@return a boolean which is true only if the module can be promoted
@throws GrapesCommunicationException | [
"Check",
"if",
"a",
"module",
"can",
"be",
"promoted",
"in",
"the",
"Grapes",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L405-L407 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postArtifact | public void postArtifact(final Artifact artifact, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.artifactResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, artifact);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST artifact";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postArtifact(final Artifact artifact, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.artifactResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, artifact);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST artifact";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postArtifact",
"(",
"final",
"Artifact",
"artifact",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"artifactResourcePath",
"(",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
",",
"artifact",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"CREATED",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to POST artifact\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Post an artifact to the Grapes server
@param artifact The artifact to post
@param user The user posting the information
@param password The user password
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Post",
"an",
"artifact",
"to",
"the",
"Grapes",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L418-L431 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.deleteArtifact | public void deleteArtifact(final String gavc, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactPath(gavc));
final ClientResponse response = resource.delete(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to DELETE artifact " + gavc;
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void deleteArtifact(final String gavc, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactPath(gavc));
final ClientResponse response = resource.delete(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to DELETE artifact " + gavc;
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"deleteArtifact",
"(",
"final",
"String",
"gavc",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getArtifactPath",
"(",
"gavc",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"delete",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to DELETE artifact \"",
"+",
"gavc",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Delete an artifact in the Grapes server
@param gavc
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Delete",
"an",
"artifact",
"in",
"the",
"Grapes",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L440-L453 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getArtifacts | public List<Artifact> getArtifacts(final Boolean hasLicense) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactsPath());
final ClientResponse response = resource.queryParam(ServerAPI.HAS_LICENSE_PARAM, hasLicense.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get artifacts";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(ArtifactList.class);
} | java | public List<Artifact> getArtifacts(final Boolean hasLicense) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactsPath());
final ClientResponse response = resource.queryParam(ServerAPI.HAS_LICENSE_PARAM, hasLicense.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get artifacts";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(ArtifactList.class);
} | [
"public",
"List",
"<",
"Artifact",
">",
"getArtifacts",
"(",
"final",
"Boolean",
"hasLicense",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getArtifactsPath",
"(",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"queryParam",
"(",
"ServerAPI",
".",
"HAS_LICENSE_PARAM",
",",
"hasLicense",
".",
"toString",
"(",
")",
")",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to get artifacts\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"ArtifactList",
".",
"class",
")",
";",
"}"
] | Send a get artifacts request
@param hasLicense
@return list of artifact
@throws GrapesCommunicationException | [
"Send",
"a",
"get",
"artifacts",
"request"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L486-L502 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postDoNotUseArtifact | public void postDoNotUseArtifact(final String gavc, final Boolean doNotUse, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getDoNotUseArtifact(gavc));
final ClientResponse response = resource.queryParam(ServerAPI.DO_NOT_USE, doNotUse.toString())
.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to post do not use artifact";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postDoNotUseArtifact(final String gavc, final Boolean doNotUse, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getDoNotUseArtifact(gavc));
final ClientResponse response = resource.queryParam(ServerAPI.DO_NOT_USE, doNotUse.toString())
.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to post do not use artifact";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postDoNotUseArtifact",
"(",
"final",
"String",
"gavc",
",",
"final",
"Boolean",
"doNotUse",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getDoNotUseArtifact",
"(",
"gavc",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"queryParam",
"(",
"ServerAPI",
".",
"DO_NOT_USE",
",",
"doNotUse",
".",
"toString",
"(",
")",
")",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to post do not use artifact\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Post boolean flag "DO_NOT_USE" to an artifact
@param gavc
@param doNotUse
@param user
@param password
@throws GrapesCommunicationException | [
"Post",
"boolean",
"flag",
"DO_NOT_USE",
"to",
"an",
"artifact"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L513-L527 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getArtifactVersions | public List<String> getArtifactVersions(final String gavc) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactVersions(gavc));
final ClientResponse response = resource
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = FAILED_TO_GET_CORPORATE_FILTERS;
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<String>>(){});
} | java | public List<String> getArtifactVersions(final String gavc) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactVersions(gavc));
final ClientResponse response = resource
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = FAILED_TO_GET_CORPORATE_FILTERS;
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<String>>(){});
} | [
"public",
"List",
"<",
"String",
">",
"getArtifactVersions",
"(",
"final",
"String",
"gavc",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getArtifactVersions",
"(",
"gavc",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"FAILED_TO_GET_CORPORATE_FILTERS",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"String",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Returns the artifact available versions
@param gavc String
@return List<String> | [
"Returns",
"the",
"artifact",
"available",
"versions"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L561-L578 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postLicense | public void postLicense(final License license, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.licenseResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, license);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST license";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postLicense(final License license, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.licenseResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, license);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST license";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postLicense",
"(",
"final",
"License",
"license",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"licenseResourcePath",
"(",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
",",
"license",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"CREATED",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to POST license\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Post a license to the server
@param license
@param user
@param password
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Post",
"a",
"license",
"to",
"the",
"server"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L668-L681 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getModuleAncestors | public List<Dependency> getModuleAncestors(final String moduleName, final String moduleVersion) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactAncestors(moduleName, moduleVersion));
final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true")
.queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true")
.queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true")
.queryParam(ServerAPI.SCOPE_TEST_PARAM, "true")
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "get module ancestors", moduleName, moduleVersion);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<Dependency>>(){});
} | java | public List<Dependency> getModuleAncestors(final String moduleName, final String moduleVersion) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactAncestors(moduleName, moduleVersion));
final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true")
.queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true")
.queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true")
.queryParam(ServerAPI.SCOPE_TEST_PARAM, "true")
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "get module ancestors", moduleName, moduleVersion);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<Dependency>>(){});
} | [
"public",
"List",
"<",
"Dependency",
">",
"getModuleAncestors",
"(",
"final",
"String",
"moduleName",
",",
"final",
"String",
"moduleVersion",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getArtifactAncestors",
"(",
"moduleName",
",",
"moduleVersion",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_COMPILE_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_PROVIDED_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_RUNTIME_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_TEST_PARAM",
",",
"\"true\"",
")",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"FAILED_TO_GET_MODULE",
",",
"\"get module ancestors\"",
",",
"moduleName",
",",
"moduleVersion",
")",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"Dependency",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Return the list of module ancestors
@param moduleName
@param moduleVersion
@return List<Dependency>
@throws GrapesCommunicationException | [
"Return",
"the",
"list",
"of",
"module",
"ancestors"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L760-L779 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getModuleDependencies | public List<Dependency> getModuleDependencies(final String moduleName, final String moduleVersion, final Boolean fullRecursive, final Boolean corporate, final Boolean thirdParty) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactDependencies(moduleName, moduleVersion));
final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true")
.queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true")
.queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true")
.queryParam(ServerAPI.SCOPE_TEST_PARAM, "true")
.queryParam(ServerAPI.RECURSIVE_PARAM, fullRecursive.toString())
.queryParam(ServerAPI.SHOW_CORPORATE_PARAM, corporate.toString())
.queryParam(ServerAPI.SHOW_THIRPARTY_PARAM, thirdParty.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "get module ancestors ", moduleName, moduleVersion);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<Dependency>>(){});
} | java | public List<Dependency> getModuleDependencies(final String moduleName, final String moduleVersion, final Boolean fullRecursive, final Boolean corporate, final Boolean thirdParty) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactDependencies(moduleName, moduleVersion));
final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true")
.queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true")
.queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true")
.queryParam(ServerAPI.SCOPE_TEST_PARAM, "true")
.queryParam(ServerAPI.RECURSIVE_PARAM, fullRecursive.toString())
.queryParam(ServerAPI.SHOW_CORPORATE_PARAM, corporate.toString())
.queryParam(ServerAPI.SHOW_THIRPARTY_PARAM, thirdParty.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = String.format(FAILED_TO_GET_MODULE, "get module ancestors ", moduleName, moduleVersion);
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(new GenericType<List<Dependency>>(){});
} | [
"public",
"List",
"<",
"Dependency",
">",
"getModuleDependencies",
"(",
"final",
"String",
"moduleName",
",",
"final",
"String",
"moduleVersion",
",",
"final",
"Boolean",
"fullRecursive",
",",
"final",
"Boolean",
"corporate",
",",
"final",
"Boolean",
"thirdParty",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getArtifactDependencies",
"(",
"moduleName",
",",
"moduleVersion",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_COMPILE_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_PROVIDED_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_RUNTIME_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SCOPE_TEST_PARAM",
",",
"\"true\"",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"RECURSIVE_PARAM",
",",
"fullRecursive",
".",
"toString",
"(",
")",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SHOW_CORPORATE_PARAM",
",",
"corporate",
".",
"toString",
"(",
")",
")",
".",
"queryParam",
"(",
"ServerAPI",
".",
"SHOW_THIRPARTY_PARAM",
",",
"thirdParty",
".",
"toString",
"(",
")",
")",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"FAILED_TO_GET_MODULE",
",",
"\"get module ancestors \"",
",",
"moduleName",
",",
"moduleVersion",
")",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"new",
"GenericType",
"<",
"List",
"<",
"Dependency",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Return the list of module dependencies
@param moduleName
@param moduleVersion
@param fullRecursive
@param corporate
@param thirdParty
@return List<Dependency>
@throws GrapesCommunicationException | [
"Return",
"the",
"list",
"of",
"module",
"dependencies"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L792-L814 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.getModuleOrganization | public Organization getModuleOrganization(final String moduleName, final String moduleVersion) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModuleOrganizationPath(moduleName, moduleVersion));
final ClientResponse response = resource
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get module's organization";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(Organization.class);
} | java | public Organization getModuleOrganization(final String moduleName, final String moduleVersion) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getModuleOrganizationPath(moduleName, moduleVersion));
final ClientResponse response = resource
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get module's organization";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(Organization.class);
} | [
"public",
"Organization",
"getModuleOrganization",
"(",
"final",
"String",
"moduleName",
",",
"final",
"String",
"moduleVersion",
")",
"throws",
"GrapesCommunicationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getModuleOrganizationPath",
"(",
"moduleName",
",",
"moduleVersion",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"get",
"(",
"ClientResponse",
".",
"class",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"OK",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to get module's organization\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"return",
"response",
".",
"getEntity",
"(",
"Organization",
".",
"class",
")",
";",
"}"
] | Returns the organization of a given module
@return Organization | [
"Returns",
"the",
"organization",
"of",
"a",
"given",
"module"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L822-L839 | train |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.createProductDelivery | public void createProductDelivery(final String productLogicalName, final Delivery delivery, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getProductDelivery(productLogicalName));
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, delivery);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to create a delivery";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void createProductDelivery(final String productLogicalName, final Delivery delivery, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.getProductDelivery(productLogicalName));
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, delivery);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to create a delivery";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"createProductDelivery",
"(",
"final",
"String",
"productLogicalName",
",",
"final",
"Delivery",
"delivery",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
"(",
"user",
",",
"password",
")",
";",
"final",
"WebResource",
"resource",
"=",
"client",
".",
"resource",
"(",
"serverURL",
")",
".",
"path",
"(",
"RequestUtils",
".",
"getProductDelivery",
"(",
"productLogicalName",
")",
")",
";",
"final",
"ClientResponse",
"response",
"=",
"resource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"post",
"(",
"ClientResponse",
".",
"class",
",",
"delivery",
")",
";",
"client",
".",
"destroy",
"(",
")",
";",
"if",
"(",
"ClientResponse",
".",
"Status",
".",
"CREATED",
".",
"getStatusCode",
"(",
")",
"!=",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Failed to create a delivery\"",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"String",
".",
"format",
"(",
"HTTP_STATUS_TEMPLATE_MSG",
",",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
")",
";",
"}",
"throw",
"new",
"GrapesCommunicationException",
"(",
"message",
",",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"}",
"}"
] | Create an Product delivery
@throws AuthenticationException, GrapesCommunicationException, IOException | [
"Create",
"an",
"Product",
"delivery"
] | ce9cc73d85f83eaa5fbc991abb593915a8c8374e | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L940-L953 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelope.java | ObjectEnvelope.refreshIdentity | public Identity refreshIdentity()
{
Identity oldOid = getIdentity();
this.oid = getBroker().serviceIdentity().buildIdentity(myObj);
return oldOid;
} | java | public Identity refreshIdentity()
{
Identity oldOid = getIdentity();
this.oid = getBroker().serviceIdentity().buildIdentity(myObj);
return oldOid;
} | [
"public",
"Identity",
"refreshIdentity",
"(",
")",
"{",
"Identity",
"oldOid",
"=",
"getIdentity",
"(",
")",
";",
"this",
".",
"oid",
"=",
"getBroker",
"(",
")",
".",
"serviceIdentity",
"(",
")",
".",
"buildIdentity",
"(",
"myObj",
")",
";",
"return",
"oldOid",
";",
"}"
] | Replace the current with a new generated identity object and
returns the old one. | [
"Replace",
"the",
"current",
"with",
"a",
"new",
"generated",
"identity",
"object",
"and",
"returns",
"the",
"old",
"one",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelope.java#L256-L261 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelope.java | ObjectEnvelope.prepareInitialState | private void prepareInitialState(boolean isNewObject)
{
// determine appropriate modification state
ModificationState initialState;
if(isNewObject)
{
// if object is not already persistent it must be marked as new
// it must be marked as dirty because it must be stored even if it will not modified during tx
initialState = StateNewDirty.getInstance();
}
else if(isDeleted(oid))
{
// if object is already persistent it will be marked as old.
// it is marked as dirty as it has been deleted during tx and now it is inserted again,
// possibly with new field values.
initialState = StateOldDirty.getInstance();
}
else
{
// if object is already persistent it will be marked as old.
// it is marked as clean as it has not been modified during tx already
initialState = StateOldClean.getInstance();
}
// remember it:
modificationState = initialState;
} | java | private void prepareInitialState(boolean isNewObject)
{
// determine appropriate modification state
ModificationState initialState;
if(isNewObject)
{
// if object is not already persistent it must be marked as new
// it must be marked as dirty because it must be stored even if it will not modified during tx
initialState = StateNewDirty.getInstance();
}
else if(isDeleted(oid))
{
// if object is already persistent it will be marked as old.
// it is marked as dirty as it has been deleted during tx and now it is inserted again,
// possibly with new field values.
initialState = StateOldDirty.getInstance();
}
else
{
// if object is already persistent it will be marked as old.
// it is marked as clean as it has not been modified during tx already
initialState = StateOldClean.getInstance();
}
// remember it:
modificationState = initialState;
} | [
"private",
"void",
"prepareInitialState",
"(",
"boolean",
"isNewObject",
")",
"{",
"// determine appropriate modification state\r",
"ModificationState",
"initialState",
";",
"if",
"(",
"isNewObject",
")",
"{",
"// if object is not already persistent it must be marked as new\r",
"// it must be marked as dirty because it must be stored even if it will not modified during tx\r",
"initialState",
"=",
"StateNewDirty",
".",
"getInstance",
"(",
")",
";",
"}",
"else",
"if",
"(",
"isDeleted",
"(",
"oid",
")",
")",
"{",
"// if object is already persistent it will be marked as old.\r",
"// it is marked as dirty as it has been deleted during tx and now it is inserted again,\r",
"// possibly with new field values.\r",
"initialState",
"=",
"StateOldDirty",
".",
"getInstance",
"(",
")",
";",
"}",
"else",
"{",
"// if object is already persistent it will be marked as old.\r",
"// it is marked as clean as it has not been modified during tx already\r",
"initialState",
"=",
"StateOldClean",
".",
"getInstance",
"(",
")",
";",
"}",
"// remember it:\r",
"modificationState",
"=",
"initialState",
";",
"}"
] | Sets the initial MoificationState of the wrapped object myObj. The initial state will be StateNewDirty if myObj
is not persisten already. The state will be set to StateOldClean if the object is already persistent. | [
"Sets",
"the",
"initial",
"MoificationState",
"of",
"the",
"wrapped",
"object",
"myObj",
".",
"The",
"initial",
"state",
"will",
"be",
"StateNewDirty",
"if",
"myObj",
"is",
"not",
"persisten",
"already",
".",
"The",
"state",
"will",
"be",
"set",
"to",
"StateOldClean",
"if",
"the",
"object",
"is",
"already",
"persistent",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelope.java#L482-L507 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelope.java | ObjectEnvelope.isDeleted | public boolean isDeleted(Identity id)
{
ObjectEnvelope envelope = buffer.getByIdentity(id);
return (envelope != null && envelope.needsDelete());
} | java | public boolean isDeleted(Identity id)
{
ObjectEnvelope envelope = buffer.getByIdentity(id);
return (envelope != null && envelope.needsDelete());
} | [
"public",
"boolean",
"isDeleted",
"(",
"Identity",
"id",
")",
"{",
"ObjectEnvelope",
"envelope",
"=",
"buffer",
".",
"getByIdentity",
"(",
"id",
")",
";",
"return",
"(",
"envelope",
"!=",
"null",
"&&",
"envelope",
".",
"needsDelete",
"(",
")",
")",
";",
"}"
] | Checks if the object with the given identity has been deleted
within the transaction.
@param id The identity
@return true if the object has been deleted
@throws PersistenceBrokerException | [
"Checks",
"if",
"the",
"object",
"with",
"the",
"given",
"identity",
"has",
"been",
"deleted",
"within",
"the",
"transaction",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelope.java#L516-L521 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelope.java | ObjectEnvelope.setModificationState | public void setModificationState(ModificationState newModificationState)
{
if(newModificationState != modificationState)
{
if(log.isDebugEnabled())
{
log.debug("object state transition for object " + this.oid + " ("
+ modificationState + " --> " + newModificationState + ")");
// try{throw new Exception();}catch(Exception e)
// {
// e.printStackTrace();
// }
}
modificationState = newModificationState;
}
} | java | public void setModificationState(ModificationState newModificationState)
{
if(newModificationState != modificationState)
{
if(log.isDebugEnabled())
{
log.debug("object state transition for object " + this.oid + " ("
+ modificationState + " --> " + newModificationState + ")");
// try{throw new Exception();}catch(Exception e)
// {
// e.printStackTrace();
// }
}
modificationState = newModificationState;
}
} | [
"public",
"void",
"setModificationState",
"(",
"ModificationState",
"newModificationState",
")",
"{",
"if",
"(",
"newModificationState",
"!=",
"modificationState",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"object state transition for object \"",
"+",
"this",
".",
"oid",
"+",
"\" (\"",
"+",
"modificationState",
"+",
"\" --> \"",
"+",
"newModificationState",
"+",
"\")\"",
")",
";",
"// try{throw new Exception();}catch(Exception e)\r",
"// {\r",
"// e.printStackTrace();\r",
"// }\r",
"}",
"modificationState",
"=",
"newModificationState",
";",
"}",
"}"
] | set the Modification state to a new value. Used during state transitions.
@param newModificationState org.apache.ojb.server.states.ModificationState | [
"set",
"the",
"Modification",
"state",
"to",
"a",
"new",
"value",
".",
"Used",
"during",
"state",
"transitions",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelope.java#L527-L542 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelope.java | ObjectEnvelope.markReferenceElements | void markReferenceElements(PersistenceBroker broker)
{
// these cases will be handled by ObjectEnvelopeTable#cascadingDependents()
// if(getModificationState().needsInsert() || getModificationState().needsDelete()) return;
Map oldImage = getBeforeImage();
Map newImage = getCurrentImage();
Iterator iter = newImage.entrySet().iterator();
while (iter.hasNext())
{
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
// we only interested in references
if(key instanceof ObjectReferenceDescriptor)
{
Image oldRefImage = (Image) oldImage.get(key);
Image newRefImage = (Image) entry.getValue();
newRefImage.performReferenceDetection(oldRefImage);
}
}
} | java | void markReferenceElements(PersistenceBroker broker)
{
// these cases will be handled by ObjectEnvelopeTable#cascadingDependents()
// if(getModificationState().needsInsert() || getModificationState().needsDelete()) return;
Map oldImage = getBeforeImage();
Map newImage = getCurrentImage();
Iterator iter = newImage.entrySet().iterator();
while (iter.hasNext())
{
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
// we only interested in references
if(key instanceof ObjectReferenceDescriptor)
{
Image oldRefImage = (Image) oldImage.get(key);
Image newRefImage = (Image) entry.getValue();
newRefImage.performReferenceDetection(oldRefImage);
}
}
} | [
"void",
"markReferenceElements",
"(",
"PersistenceBroker",
"broker",
")",
"{",
"// these cases will be handled by ObjectEnvelopeTable#cascadingDependents()\r",
"// if(getModificationState().needsInsert() || getModificationState().needsDelete()) return;\r",
"Map",
"oldImage",
"=",
"getBeforeImage",
"(",
")",
";",
"Map",
"newImage",
"=",
"getCurrentImage",
"(",
")",
";",
"Iterator",
"iter",
"=",
"newImage",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"iter",
".",
"next",
"(",
")",
";",
"Object",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"// we only interested in references\r",
"if",
"(",
"key",
"instanceof",
"ObjectReferenceDescriptor",
")",
"{",
"Image",
"oldRefImage",
"=",
"(",
"Image",
")",
"oldImage",
".",
"get",
"(",
"key",
")",
";",
"Image",
"newRefImage",
"=",
"(",
"Image",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"newRefImage",
".",
"performReferenceDetection",
"(",
"oldRefImage",
")",
";",
"}",
"}",
"}"
] | Mark new or deleted reference elements
@param broker | [
"Mark",
"new",
"or",
"deleted",
"reference",
"elements"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelope.java#L610-L631 | train |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/platform/jade/JadeConnector.java | JadeConnector.createContainer | public void createContainer(String container) {
ContainerController controller = this.platformContainers.get(container);
if (controller == null) {
// TODO make this configurable
Profile p = new ProfileImpl();
p.setParameter(Profile.PLATFORM_ID, PLATFORM_ID);
p.setParameter(Profile.MAIN_HOST, MAIN_HOST);
p.setParameter(Profile.MAIN_PORT, MAIN_PORT);
p.setParameter(Profile.LOCAL_HOST, MAIN_HOST);
int port = Integer.parseInt(MAIN_PORT);
port = port + 1 + this.platformContainers.size();
p.setParameter(Profile.LOCAL_PORT, Integer.toString(port));
p.setParameter(Profile.CONTAINER_NAME, container);
logger.fine("Creating container " + container + "...");
ContainerController agentContainer = this.runtime
.createAgentContainer(p);
this.platformContainers.put(container, agentContainer);
logger.fine("Container " + container + " created successfully.");
} else {
logger.fine("Container " + container + " is already created.");
}
} | java | public void createContainer(String container) {
ContainerController controller = this.platformContainers.get(container);
if (controller == null) {
// TODO make this configurable
Profile p = new ProfileImpl();
p.setParameter(Profile.PLATFORM_ID, PLATFORM_ID);
p.setParameter(Profile.MAIN_HOST, MAIN_HOST);
p.setParameter(Profile.MAIN_PORT, MAIN_PORT);
p.setParameter(Profile.LOCAL_HOST, MAIN_HOST);
int port = Integer.parseInt(MAIN_PORT);
port = port + 1 + this.platformContainers.size();
p.setParameter(Profile.LOCAL_PORT, Integer.toString(port));
p.setParameter(Profile.CONTAINER_NAME, container);
logger.fine("Creating container " + container + "...");
ContainerController agentContainer = this.runtime
.createAgentContainer(p);
this.platformContainers.put(container, agentContainer);
logger.fine("Container " + container + " created successfully.");
} else {
logger.fine("Container " + container + " is already created.");
}
} | [
"public",
"void",
"createContainer",
"(",
"String",
"container",
")",
"{",
"ContainerController",
"controller",
"=",
"this",
".",
"platformContainers",
".",
"get",
"(",
"container",
")",
";",
"if",
"(",
"controller",
"==",
"null",
")",
"{",
"// TODO make this configurable",
"Profile",
"p",
"=",
"new",
"ProfileImpl",
"(",
")",
";",
"p",
".",
"setParameter",
"(",
"Profile",
".",
"PLATFORM_ID",
",",
"PLATFORM_ID",
")",
";",
"p",
".",
"setParameter",
"(",
"Profile",
".",
"MAIN_HOST",
",",
"MAIN_HOST",
")",
";",
"p",
".",
"setParameter",
"(",
"Profile",
".",
"MAIN_PORT",
",",
"MAIN_PORT",
")",
";",
"p",
".",
"setParameter",
"(",
"Profile",
".",
"LOCAL_HOST",
",",
"MAIN_HOST",
")",
";",
"int",
"port",
"=",
"Integer",
".",
"parseInt",
"(",
"MAIN_PORT",
")",
";",
"port",
"=",
"port",
"+",
"1",
"+",
"this",
".",
"platformContainers",
".",
"size",
"(",
")",
";",
"p",
".",
"setParameter",
"(",
"Profile",
".",
"LOCAL_PORT",
",",
"Integer",
".",
"toString",
"(",
"port",
")",
")",
";",
"p",
".",
"setParameter",
"(",
"Profile",
".",
"CONTAINER_NAME",
",",
"container",
")",
";",
"logger",
".",
"fine",
"(",
"\"Creating container \"",
"+",
"container",
"+",
"\"...\"",
")",
";",
"ContainerController",
"agentContainer",
"=",
"this",
".",
"runtime",
".",
"createAgentContainer",
"(",
"p",
")",
";",
"this",
".",
"platformContainers",
".",
"put",
"(",
"container",
",",
"agentContainer",
")",
";",
"logger",
".",
"fine",
"(",
"\"Container \"",
"+",
"container",
"+",
"\" created successfully.\"",
")",
";",
"}",
"else",
"{",
"logger",
".",
"fine",
"(",
"\"Container \"",
"+",
"container",
"+",
"\" is already created.\"",
")",
";",
"}",
"}"
] | Create a container in the platform
@param container
The name of the container | [
"Create",
"a",
"container",
"in",
"the",
"platform"
] | cc7fdc75cb818c5d60802aaf32c27829e0ca144c | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/platform/jade/JadeConnector.java#L198-L222 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/QueryCustomizerDefaultImpl.java | QueryCustomizerDefaultImpl.customizeQuery | public Query customizeQuery(Object anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery)
{
return aQuery;
} | java | public Query customizeQuery(Object anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery)
{
return aQuery;
} | [
"public",
"Query",
"customizeQuery",
"(",
"Object",
"anObject",
",",
"PersistenceBroker",
"aBroker",
",",
"CollectionDescriptor",
"aCod",
",",
"QueryByCriteria",
"aQuery",
")",
"{",
"return",
"aQuery",
";",
"}"
] | Default implementation returns unmodified original Query
@see org.apache.ojb.broker.accesslayer.QueryCustomizer#customizeQuery | [
"Default",
"implementation",
"returns",
"unmodified",
"original",
"Query"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/QueryCustomizerDefaultImpl.java#L50-L53 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/layer/bean/BeanLayer.java | BeanLayer.getElements | public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException {
if (null == filter) {
filter = Filter.INCLUDE;
}
List<Object> filteredList = new ArrayList<Object>();
try {
synchronized (featuresById) {
for (Object feature : featuresById.values()) {
if (filter.evaluate(feature)) {
filteredList.add(feature);
}
}
}
} catch (Exception e) { // NOSONAR
throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId());
}
// Sorting of elements.
if (comparator != null) {
Collections.sort(filteredList, comparator);
}
if (maxResultSize > 0) {
int fromIndex = Math.max(0, offset);
int toIndex = Math.min(offset + maxResultSize, filteredList.size());
toIndex = Math.max(fromIndex, toIndex);
return filteredList.subList(fromIndex, toIndex).iterator();
} else {
return filteredList.iterator();
}
} | java | public Iterator<?> getElements(Filter filter, int offset, int maxResultSize) throws LayerException {
if (null == filter) {
filter = Filter.INCLUDE;
}
List<Object> filteredList = new ArrayList<Object>();
try {
synchronized (featuresById) {
for (Object feature : featuresById.values()) {
if (filter.evaluate(feature)) {
filteredList.add(feature);
}
}
}
} catch (Exception e) { // NOSONAR
throw new LayerException(e, ExceptionCode.FILTER_EVALUATION_PROBLEM, filter, getId());
}
// Sorting of elements.
if (comparator != null) {
Collections.sort(filteredList, comparator);
}
if (maxResultSize > 0) {
int fromIndex = Math.max(0, offset);
int toIndex = Math.min(offset + maxResultSize, filteredList.size());
toIndex = Math.max(fromIndex, toIndex);
return filteredList.subList(fromIndex, toIndex).iterator();
} else {
return filteredList.iterator();
}
} | [
"public",
"Iterator",
"<",
"?",
">",
"getElements",
"(",
"Filter",
"filter",
",",
"int",
"offset",
",",
"int",
"maxResultSize",
")",
"throws",
"LayerException",
"{",
"if",
"(",
"null",
"==",
"filter",
")",
"{",
"filter",
"=",
"Filter",
".",
"INCLUDE",
";",
"}",
"List",
"<",
"Object",
">",
"filteredList",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"try",
"{",
"synchronized",
"(",
"featuresById",
")",
"{",
"for",
"(",
"Object",
"feature",
":",
"featuresById",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"filter",
".",
"evaluate",
"(",
"feature",
")",
")",
"{",
"filteredList",
".",
"add",
"(",
"feature",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// NOSONAR",
"throw",
"new",
"LayerException",
"(",
"e",
",",
"ExceptionCode",
".",
"FILTER_EVALUATION_PROBLEM",
",",
"filter",
",",
"getId",
"(",
")",
")",
";",
"}",
"// Sorting of elements.",
"if",
"(",
"comparator",
"!=",
"null",
")",
"{",
"Collections",
".",
"sort",
"(",
"filteredList",
",",
"comparator",
")",
";",
"}",
"if",
"(",
"maxResultSize",
">",
"0",
")",
"{",
"int",
"fromIndex",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"offset",
")",
";",
"int",
"toIndex",
"=",
"Math",
".",
"min",
"(",
"offset",
"+",
"maxResultSize",
",",
"filteredList",
".",
"size",
"(",
")",
")",
";",
"toIndex",
"=",
"Math",
".",
"max",
"(",
"fromIndex",
",",
"toIndex",
")",
";",
"return",
"filteredList",
".",
"subList",
"(",
"fromIndex",
",",
"toIndex",
")",
".",
"iterator",
"(",
")",
";",
"}",
"else",
"{",
"return",
"filteredList",
".",
"iterator",
"(",
")",
";",
"}",
"}"
] | This implementation does not support the 'offset' and 'maxResultSize' parameters. | [
"This",
"implementation",
"does",
"not",
"support",
"the",
"offset",
"and",
"maxResultSize",
"parameters",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/layer/bean/BeanLayer.java#L148-L176 | train |
geomajas/geomajas-project-server | plugin/layer-openstreetmap/openstreetmap/src/main/java/org/geomajas/layer/osm/TiledRasterLayerServiceState.java | TiledRasterLayerServiceState.setTileUrls | public void setTileUrls(List<String> tileUrls) {
this.tileUrls = tileUrls;
if (null != urlStrategy) {
urlStrategy.setUrls(tileUrls);
}
} | java | public void setTileUrls(List<String> tileUrls) {
this.tileUrls = tileUrls;
if (null != urlStrategy) {
urlStrategy.setUrls(tileUrls);
}
} | [
"public",
"void",
"setTileUrls",
"(",
"List",
"<",
"String",
">",
"tileUrls",
")",
"{",
"this",
".",
"tileUrls",
"=",
"tileUrls",
";",
"if",
"(",
"null",
"!=",
"urlStrategy",
")",
"{",
"urlStrategy",
".",
"setUrls",
"(",
"tileUrls",
")",
";",
"}",
"}"
] | Set possible tile URLs.
@param tileUrls tile URLs | [
"Set",
"possible",
"tile",
"URLs",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-openstreetmap/openstreetmap/src/main/java/org/geomajas/layer/osm/TiledRasterLayerServiceState.java#L171-L176 | train |
geomajas/geomajas-project-server | plugin/layer-openstreetmap/openstreetmap/src/main/java/org/geomajas/layer/osm/TiledRasterLayerServiceState.java | TiledRasterLayerServiceState.postConstruct | public void postConstruct(GeoService geoService, DtoConverterService converterService) throws GeomajasException {
if (null == layerInfo) {
layerInfo = new RasterLayerInfo();
}
layerInfo.setCrs(TiledRasterLayerService.MERCATOR);
crs = geoService.getCrs2(TiledRasterLayerService.MERCATOR);
layerInfo.setTileWidth(tileSize);
layerInfo.setTileHeight(tileSize);
Bbox bbox = new Bbox(-TiledRasterLayerService.HALF_EQUATOR_IN_METERS,
-TiledRasterLayerService.HALF_EQUATOR_IN_METERS, TiledRasterLayerService.EQUATOR_IN_METERS,
TiledRasterLayerService.EQUATOR_IN_METERS);
layerInfo.setMaxExtent(bbox);
maxBounds = converterService.toInternal(bbox);
resolutions = new double[maxZoomLevel + 1];
double powerOfTwo = 1;
for (int zoomLevel = 0; zoomLevel <= maxZoomLevel; zoomLevel++) {
double resolution = (TiledRasterLayerService.EQUATOR_IN_METERS) / (tileSize * powerOfTwo);
resolutions[zoomLevel] = resolution;
powerOfTwo *= 2;
}
} | java | public void postConstruct(GeoService geoService, DtoConverterService converterService) throws GeomajasException {
if (null == layerInfo) {
layerInfo = new RasterLayerInfo();
}
layerInfo.setCrs(TiledRasterLayerService.MERCATOR);
crs = geoService.getCrs2(TiledRasterLayerService.MERCATOR);
layerInfo.setTileWidth(tileSize);
layerInfo.setTileHeight(tileSize);
Bbox bbox = new Bbox(-TiledRasterLayerService.HALF_EQUATOR_IN_METERS,
-TiledRasterLayerService.HALF_EQUATOR_IN_METERS, TiledRasterLayerService.EQUATOR_IN_METERS,
TiledRasterLayerService.EQUATOR_IN_METERS);
layerInfo.setMaxExtent(bbox);
maxBounds = converterService.toInternal(bbox);
resolutions = new double[maxZoomLevel + 1];
double powerOfTwo = 1;
for (int zoomLevel = 0; zoomLevel <= maxZoomLevel; zoomLevel++) {
double resolution = (TiledRasterLayerService.EQUATOR_IN_METERS) / (tileSize * powerOfTwo);
resolutions[zoomLevel] = resolution;
powerOfTwo *= 2;
}
} | [
"public",
"void",
"postConstruct",
"(",
"GeoService",
"geoService",
",",
"DtoConverterService",
"converterService",
")",
"throws",
"GeomajasException",
"{",
"if",
"(",
"null",
"==",
"layerInfo",
")",
"{",
"layerInfo",
"=",
"new",
"RasterLayerInfo",
"(",
")",
";",
"}",
"layerInfo",
".",
"setCrs",
"(",
"TiledRasterLayerService",
".",
"MERCATOR",
")",
";",
"crs",
"=",
"geoService",
".",
"getCrs2",
"(",
"TiledRasterLayerService",
".",
"MERCATOR",
")",
";",
"layerInfo",
".",
"setTileWidth",
"(",
"tileSize",
")",
";",
"layerInfo",
".",
"setTileHeight",
"(",
"tileSize",
")",
";",
"Bbox",
"bbox",
"=",
"new",
"Bbox",
"(",
"-",
"TiledRasterLayerService",
".",
"HALF_EQUATOR_IN_METERS",
",",
"-",
"TiledRasterLayerService",
".",
"HALF_EQUATOR_IN_METERS",
",",
"TiledRasterLayerService",
".",
"EQUATOR_IN_METERS",
",",
"TiledRasterLayerService",
".",
"EQUATOR_IN_METERS",
")",
";",
"layerInfo",
".",
"setMaxExtent",
"(",
"bbox",
")",
";",
"maxBounds",
"=",
"converterService",
".",
"toInternal",
"(",
"bbox",
")",
";",
"resolutions",
"=",
"new",
"double",
"[",
"maxZoomLevel",
"+",
"1",
"]",
";",
"double",
"powerOfTwo",
"=",
"1",
";",
"for",
"(",
"int",
"zoomLevel",
"=",
"0",
";",
"zoomLevel",
"<=",
"maxZoomLevel",
";",
"zoomLevel",
"++",
")",
"{",
"double",
"resolution",
"=",
"(",
"TiledRasterLayerService",
".",
"EQUATOR_IN_METERS",
")",
"/",
"(",
"tileSize",
"*",
"powerOfTwo",
")",
";",
"resolutions",
"[",
"zoomLevel",
"]",
"=",
"resolution",
";",
"powerOfTwo",
"*=",
"2",
";",
"}",
"}"
] | Finish initialization of state object.
@param geoService geo service
@param converterService converter service
@throws GeomajasException oops | [
"Finish",
"initialization",
"of",
"state",
"object",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-openstreetmap/openstreetmap/src/main/java/org/geomajas/layer/osm/TiledRasterLayerServiceState.java#L203-L224 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java | AbstractIndirectionHandler.addListener | public synchronized void addListener(MaterializationListener listener)
{
if (_listeners == null)
{
_listeners = new ArrayList();
}
// add listener only once
if (!_listeners.contains(listener))
{
_listeners.add(listener);
}
} | java | public synchronized void addListener(MaterializationListener listener)
{
if (_listeners == null)
{
_listeners = new ArrayList();
}
// add listener only once
if (!_listeners.contains(listener))
{
_listeners.add(listener);
}
} | [
"public",
"synchronized",
"void",
"addListener",
"(",
"MaterializationListener",
"listener",
")",
"{",
"if",
"(",
"_listeners",
"==",
"null",
")",
"{",
"_listeners",
"=",
"new",
"ArrayList",
"(",
")",
";",
"}",
"// add listener only once\r",
"if",
"(",
"!",
"_listeners",
".",
"contains",
"(",
"listener",
")",
")",
"{",
"_listeners",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}"
] | Adds a materialization listener.
@param listener
The listener to add | [
"Adds",
"a",
"materialization",
"listener",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java#L106-L117 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java | AbstractIndirectionHandler.beforeMaterialization | protected void beforeMaterialization()
{
if (_listeners != null)
{
MaterializationListener listener;
for (int idx = _listeners.size() - 1; idx >= 0; idx--)
{
listener = (MaterializationListener) _listeners.get(idx);
listener.beforeMaterialization(this, _id);
}
}
} | java | protected void beforeMaterialization()
{
if (_listeners != null)
{
MaterializationListener listener;
for (int idx = _listeners.size() - 1; idx >= 0; idx--)
{
listener = (MaterializationListener) _listeners.get(idx);
listener.beforeMaterialization(this, _id);
}
}
} | [
"protected",
"void",
"beforeMaterialization",
"(",
")",
"{",
"if",
"(",
"_listeners",
"!=",
"null",
")",
"{",
"MaterializationListener",
"listener",
";",
"for",
"(",
"int",
"idx",
"=",
"_listeners",
".",
"size",
"(",
")",
"-",
"1",
";",
"idx",
">=",
"0",
";",
"idx",
"--",
")",
"{",
"listener",
"=",
"(",
"MaterializationListener",
")",
"_listeners",
".",
"get",
"(",
"idx",
")",
";",
"listener",
".",
"beforeMaterialization",
"(",
"this",
",",
"_id",
")",
";",
"}",
"}",
"}"
] | Calls beforeMaterialization on all registered listeners in the reverse
order of registration. | [
"Calls",
"beforeMaterialization",
"on",
"all",
"registered",
"listeners",
"in",
"the",
"reverse",
"order",
"of",
"registration",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java#L137-L149 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java | AbstractIndirectionHandler.afterMaterialization | protected void afterMaterialization()
{
if (_listeners != null)
{
MaterializationListener listener;
// listeners may remove themselves during the afterMaterialization
// callback.
// thus we must iterate through the listeners vector from back to
// front
// to avoid index problems.
for (int idx = _listeners.size() - 1; idx >= 0; idx--)
{
listener = (MaterializationListener) _listeners.get(idx);
listener.afterMaterialization(this, _realSubject);
}
}
} | java | protected void afterMaterialization()
{
if (_listeners != null)
{
MaterializationListener listener;
// listeners may remove themselves during the afterMaterialization
// callback.
// thus we must iterate through the listeners vector from back to
// front
// to avoid index problems.
for (int idx = _listeners.size() - 1; idx >= 0; idx--)
{
listener = (MaterializationListener) _listeners.get(idx);
listener.afterMaterialization(this, _realSubject);
}
}
} | [
"protected",
"void",
"afterMaterialization",
"(",
")",
"{",
"if",
"(",
"_listeners",
"!=",
"null",
")",
"{",
"MaterializationListener",
"listener",
";",
"// listeners may remove themselves during the afterMaterialization\r",
"// callback.\r",
"// thus we must iterate through the listeners vector from back to\r",
"// front\r",
"// to avoid index problems.\r",
"for",
"(",
"int",
"idx",
"=",
"_listeners",
".",
"size",
"(",
")",
"-",
"1",
";",
"idx",
">=",
"0",
";",
"idx",
"--",
")",
"{",
"listener",
"=",
"(",
"MaterializationListener",
")",
"_listeners",
".",
"get",
"(",
"idx",
")",
";",
"listener",
".",
"afterMaterialization",
"(",
"this",
",",
"_realSubject",
")",
";",
"}",
"}",
"}"
] | Calls afterMaterialization on all registered listeners in the reverse
order of registration. | [
"Calls",
"afterMaterialization",
"on",
"all",
"registered",
"listeners",
"in",
"the",
"reverse",
"order",
"of",
"registration",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java#L155-L172 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java | AbstractIndirectionHandler.getBroker | protected TemporaryBrokerWrapper getBroker() throws PBFactoryException
{
PersistenceBrokerInternal broker;
boolean needsClose = false;
if (getBrokerKey() == null)
{
/*
arminw:
if no PBKey is set we throw an exception, because we don't
know which PB (connection) should be used.
*/
throw new OJBRuntimeException("Can't find associated PBKey. Need PBKey to obtain a valid" +
"PersistenceBroker instance from intern resources.");
}
// first try to use the current threaded broker to avoid blocking
broker = PersistenceBrokerThreadMapping.currentPersistenceBroker(getBrokerKey());
// current broker not found, create a intern new one
if ((broker == null) || broker.isClosed())
{
broker = (PersistenceBrokerInternal) PersistenceBrokerFactory.createPersistenceBroker(getBrokerKey());
/** Specifies whether we obtained a fresh broker which we have to close after we used it */
needsClose = true;
}
return new TemporaryBrokerWrapper(broker, needsClose);
} | java | protected TemporaryBrokerWrapper getBroker() throws PBFactoryException
{
PersistenceBrokerInternal broker;
boolean needsClose = false;
if (getBrokerKey() == null)
{
/*
arminw:
if no PBKey is set we throw an exception, because we don't
know which PB (connection) should be used.
*/
throw new OJBRuntimeException("Can't find associated PBKey. Need PBKey to obtain a valid" +
"PersistenceBroker instance from intern resources.");
}
// first try to use the current threaded broker to avoid blocking
broker = PersistenceBrokerThreadMapping.currentPersistenceBroker(getBrokerKey());
// current broker not found, create a intern new one
if ((broker == null) || broker.isClosed())
{
broker = (PersistenceBrokerInternal) PersistenceBrokerFactory.createPersistenceBroker(getBrokerKey());
/** Specifies whether we obtained a fresh broker which we have to close after we used it */
needsClose = true;
}
return new TemporaryBrokerWrapper(broker, needsClose);
} | [
"protected",
"TemporaryBrokerWrapper",
"getBroker",
"(",
")",
"throws",
"PBFactoryException",
"{",
"PersistenceBrokerInternal",
"broker",
";",
"boolean",
"needsClose",
"=",
"false",
";",
"if",
"(",
"getBrokerKey",
"(",
")",
"==",
"null",
")",
"{",
"/*\r\n arminw:\r\n if no PBKey is set we throw an exception, because we don't\r\n know which PB (connection) should be used.\r\n */",
"throw",
"new",
"OJBRuntimeException",
"(",
"\"Can't find associated PBKey. Need PBKey to obtain a valid\"",
"+",
"\"PersistenceBroker instance from intern resources.\"",
")",
";",
"}",
"// first try to use the current threaded broker to avoid blocking\r",
"broker",
"=",
"PersistenceBrokerThreadMapping",
".",
"currentPersistenceBroker",
"(",
"getBrokerKey",
"(",
")",
")",
";",
"// current broker not found, create a intern new one\r",
"if",
"(",
"(",
"broker",
"==",
"null",
")",
"||",
"broker",
".",
"isClosed",
"(",
")",
")",
"{",
"broker",
"=",
"(",
"PersistenceBrokerInternal",
")",
"PersistenceBrokerFactory",
".",
"createPersistenceBroker",
"(",
"getBrokerKey",
"(",
")",
")",
";",
"/** Specifies whether we obtained a fresh broker which we have to close after we used it */",
"needsClose",
"=",
"true",
";",
"}",
"return",
"new",
"TemporaryBrokerWrapper",
"(",
"broker",
",",
"needsClose",
")",
";",
"}"
] | Gets the persistence broker used by this indirection handler.
If no PBKey is available a runtime exception will be thrown.
@return a PersistenceBroker | [
"Gets",
"the",
"persistence",
"broker",
"used",
"by",
"this",
"indirection",
"handler",
".",
"If",
"no",
"PBKey",
"is",
"available",
"a",
"runtime",
"exception",
"will",
"be",
"thrown",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java#L180-L205 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java | AbstractIndirectionHandler.getRealSubject | public Object getRealSubject() throws PersistenceBrokerException
{
if (_realSubject == null)
{
beforeMaterialization();
_realSubject = materializeSubject();
afterMaterialization();
}
return _realSubject;
} | java | public Object getRealSubject() throws PersistenceBrokerException
{
if (_realSubject == null)
{
beforeMaterialization();
_realSubject = materializeSubject();
afterMaterialization();
}
return _realSubject;
} | [
"public",
"Object",
"getRealSubject",
"(",
")",
"throws",
"PersistenceBrokerException",
"{",
"if",
"(",
"_realSubject",
"==",
"null",
")",
"{",
"beforeMaterialization",
"(",
")",
";",
"_realSubject",
"=",
"materializeSubject",
"(",
")",
";",
"afterMaterialization",
"(",
")",
";",
"}",
"return",
"_realSubject",
";",
"}"
] | Returns the proxies real subject. The subject will be materialized if
necessary.
@return The subject | [
"Returns",
"the",
"proxies",
"real",
"subject",
".",
"The",
"subject",
"will",
"be",
"materialized",
"if",
"necessary",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java#L377-L386 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java | AbstractIndirectionHandler.materializeSubject | protected synchronized Object materializeSubject() throws PersistenceBrokerException
{
TemporaryBrokerWrapper tmp = getBroker();
try
{
Object realSubject = tmp.broker.getObjectByIdentity(_id);
if (realSubject == null)
{
LoggerFactory.getLogger(IndirectionHandler.class).warn(
"Can not materialize object for Identity " + _id + " - using PBKey " + getBrokerKey());
}
return realSubject;
} catch (Exception ex)
{
throw new PersistenceBrokerException(ex);
} finally
{
tmp.close();
}
} | java | protected synchronized Object materializeSubject() throws PersistenceBrokerException
{
TemporaryBrokerWrapper tmp = getBroker();
try
{
Object realSubject = tmp.broker.getObjectByIdentity(_id);
if (realSubject == null)
{
LoggerFactory.getLogger(IndirectionHandler.class).warn(
"Can not materialize object for Identity " + _id + " - using PBKey " + getBrokerKey());
}
return realSubject;
} catch (Exception ex)
{
throw new PersistenceBrokerException(ex);
} finally
{
tmp.close();
}
} | [
"protected",
"synchronized",
"Object",
"materializeSubject",
"(",
")",
"throws",
"PersistenceBrokerException",
"{",
"TemporaryBrokerWrapper",
"tmp",
"=",
"getBroker",
"(",
")",
";",
"try",
"{",
"Object",
"realSubject",
"=",
"tmp",
".",
"broker",
".",
"getObjectByIdentity",
"(",
"_id",
")",
";",
"if",
"(",
"realSubject",
"==",
"null",
")",
"{",
"LoggerFactory",
".",
"getLogger",
"(",
"IndirectionHandler",
".",
"class",
")",
".",
"warn",
"(",
"\"Can not materialize object for Identity \"",
"+",
"_id",
"+",
"\" - using PBKey \"",
"+",
"getBrokerKey",
"(",
")",
")",
";",
"}",
"return",
"realSubject",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"PersistenceBrokerException",
"(",
"ex",
")",
";",
"}",
"finally",
"{",
"tmp",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Retrieves the real subject from the underlying RDBMS. Override this
method if the object is to be materialized in a specific way.
@return The real subject of the proxy | [
"Retrieves",
"the",
"real",
"subject",
"from",
"the",
"underlying",
"RDBMS",
".",
"Override",
"this",
"method",
"if",
"the",
"object",
"is",
"to",
"be",
"materialized",
"in",
"a",
"specific",
"way",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java#L404-L423 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/collections/DSetImpl.java | DSetImpl.ojbAdd | public void ojbAdd(Object anObject)
{
DSetEntry entry = prepareEntry(anObject);
entry.setPosition(elements.size());
elements.add(entry);
} | java | public void ojbAdd(Object anObject)
{
DSetEntry entry = prepareEntry(anObject);
entry.setPosition(elements.size());
elements.add(entry);
} | [
"public",
"void",
"ojbAdd",
"(",
"Object",
"anObject",
")",
"{",
"DSetEntry",
"entry",
"=",
"prepareEntry",
"(",
"anObject",
")",
";",
"entry",
".",
"setPosition",
"(",
"elements",
".",
"size",
"(",
")",
")",
";",
"elements",
".",
"add",
"(",
"entry",
")",
";",
"}"
] | add a single Object to the Collection. This method is used during reading Collection elements
from the database. Thus it is is save to cast anObject to the underlying element type of the
collection. | [
"add",
"a",
"single",
"Object",
"to",
"the",
"Collection",
".",
"This",
"method",
"is",
"used",
"during",
"reading",
"Collection",
"elements",
"from",
"the",
"database",
".",
"Thus",
"it",
"is",
"is",
"save",
"to",
"cast",
"anObject",
"to",
"the",
"underlying",
"element",
"type",
"of",
"the",
"collection",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/collections/DSetImpl.java#L479-L484 | train |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/converters/FoundationLoggingThrowableInformationPatternConverter.java | FoundationLoggingThrowableInformationPatternConverter.generateAbbreviatedExceptionMessage | private String generateAbbreviatedExceptionMessage(final Throwable throwable) {
final StringBuilder builder = new StringBuilder();
builder.append(": ");
builder.append(throwable.getClass().getCanonicalName());
builder.append(": ");
builder.append(throwable.getMessage());
Throwable cause = throwable.getCause();
while (cause != null) {
builder.append('\n');
builder.append("Caused by: ");
builder.append(cause.getClass().getCanonicalName());
builder.append(": ");
builder.append(cause.getMessage());
// make sure the exception cause is not itself to prevent infinite
// looping
assert (cause != cause.getCause());
cause = (cause == cause.getCause() ? null : cause.getCause());
}
return builder.toString();
} | java | private String generateAbbreviatedExceptionMessage(final Throwable throwable) {
final StringBuilder builder = new StringBuilder();
builder.append(": ");
builder.append(throwable.getClass().getCanonicalName());
builder.append(": ");
builder.append(throwable.getMessage());
Throwable cause = throwable.getCause();
while (cause != null) {
builder.append('\n');
builder.append("Caused by: ");
builder.append(cause.getClass().getCanonicalName());
builder.append(": ");
builder.append(cause.getMessage());
// make sure the exception cause is not itself to prevent infinite
// looping
assert (cause != cause.getCause());
cause = (cause == cause.getCause() ? null : cause.getCause());
}
return builder.toString();
} | [
"private",
"String",
"generateAbbreviatedExceptionMessage",
"(",
"final",
"Throwable",
"throwable",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\": \"",
")",
";",
"builder",
".",
"append",
"(",
"throwable",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\": \"",
")",
";",
"builder",
".",
"append",
"(",
"throwable",
".",
"getMessage",
"(",
")",
")",
";",
"Throwable",
"cause",
"=",
"throwable",
".",
"getCause",
"(",
")",
";",
"while",
"(",
"cause",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"\"Caused by: \"",
")",
";",
"builder",
".",
"append",
"(",
"cause",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\": \"",
")",
";",
"builder",
".",
"append",
"(",
"cause",
".",
"getMessage",
"(",
")",
")",
";",
"// make sure the exception cause is not itself to prevent infinite",
"// looping",
"assert",
"(",
"cause",
"!=",
"cause",
".",
"getCause",
"(",
")",
")",
";",
"cause",
"=",
"(",
"cause",
"==",
"cause",
".",
"getCause",
"(",
")",
"?",
"null",
":",
"cause",
".",
"getCause",
"(",
")",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Method generates abbreviated exception message.
@param message
Original log message
@param throwable
The attached throwable
@return Abbreviated exception message | [
"Method",
"generates",
"abbreviated",
"exception",
"message",
"."
] | cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6 | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/converters/FoundationLoggingThrowableInformationPatternConverter.java#L122-L143 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/service/GeoServiceImpl.java | GeoServiceImpl.postConstruct | @PostConstruct
protected void postConstruct() throws GeomajasException {
if (null != crsDefinitions) {
for (CrsInfo crsInfo : crsDefinitions.values()) {
try {
CoordinateReferenceSystem crs = CRS.parseWKT(crsInfo.getCrsWkt());
String code = crsInfo.getKey();
crsCache.put(code, CrsFactory.getCrs(code, crs));
} catch (FactoryException e) {
throw new GeomajasException(e, ExceptionCode.CRS_DECODE_FAILURE_FOR_MAP, crsInfo.getKey());
}
}
}
if (null != crsTransformDefinitions) {
for (CrsTransformInfo crsTransformInfo : crsTransformDefinitions.values()) {
String key = getTransformKey(crsTransformInfo);
transformCache.put(key, getCrsTransform(key, crsTransformInfo));
}
}
GeometryFactory factory = new GeometryFactory();
EMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));
EMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));
EMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));
EMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));
EMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!
EMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!
EMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));
} | java | @PostConstruct
protected void postConstruct() throws GeomajasException {
if (null != crsDefinitions) {
for (CrsInfo crsInfo : crsDefinitions.values()) {
try {
CoordinateReferenceSystem crs = CRS.parseWKT(crsInfo.getCrsWkt());
String code = crsInfo.getKey();
crsCache.put(code, CrsFactory.getCrs(code, crs));
} catch (FactoryException e) {
throw new GeomajasException(e, ExceptionCode.CRS_DECODE_FAILURE_FOR_MAP, crsInfo.getKey());
}
}
}
if (null != crsTransformDefinitions) {
for (CrsTransformInfo crsTransformInfo : crsTransformDefinitions.values()) {
String key = getTransformKey(crsTransformInfo);
transformCache.put(key, getCrsTransform(key, crsTransformInfo));
}
}
GeometryFactory factory = new GeometryFactory();
EMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));
EMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));
EMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));
EMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));
EMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!
EMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!
EMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));
} | [
"@",
"PostConstruct",
"protected",
"void",
"postConstruct",
"(",
")",
"throws",
"GeomajasException",
"{",
"if",
"(",
"null",
"!=",
"crsDefinitions",
")",
"{",
"for",
"(",
"CrsInfo",
"crsInfo",
":",
"crsDefinitions",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"CoordinateReferenceSystem",
"crs",
"=",
"CRS",
".",
"parseWKT",
"(",
"crsInfo",
".",
"getCrsWkt",
"(",
")",
")",
";",
"String",
"code",
"=",
"crsInfo",
".",
"getKey",
"(",
")",
";",
"crsCache",
".",
"put",
"(",
"code",
",",
"CrsFactory",
".",
"getCrs",
"(",
"code",
",",
"crs",
")",
")",
";",
"}",
"catch",
"(",
"FactoryException",
"e",
")",
"{",
"throw",
"new",
"GeomajasException",
"(",
"e",
",",
"ExceptionCode",
".",
"CRS_DECODE_FAILURE_FOR_MAP",
",",
"crsInfo",
".",
"getKey",
"(",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"null",
"!=",
"crsTransformDefinitions",
")",
"{",
"for",
"(",
"CrsTransformInfo",
"crsTransformInfo",
":",
"crsTransformDefinitions",
".",
"values",
"(",
")",
")",
"{",
"String",
"key",
"=",
"getTransformKey",
"(",
"crsTransformInfo",
")",
";",
"transformCache",
".",
"put",
"(",
"key",
",",
"getCrsTransform",
"(",
"key",
",",
"crsTransformInfo",
")",
")",
";",
"}",
"}",
"GeometryFactory",
"factory",
"=",
"new",
"GeometryFactory",
"(",
")",
";",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"Point",
".",
"class",
",",
"factory",
".",
"createPoint",
"(",
"(",
"Coordinate",
")",
"null",
")",
")",
";",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"LineString",
".",
"class",
",",
"factory",
".",
"createLineString",
"(",
"(",
"Coordinate",
"[",
"]",
")",
"null",
")",
")",
";",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"Polygon",
".",
"class",
",",
"factory",
".",
"createPolygon",
"(",
"null",
",",
"null",
")",
")",
";",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"MultiPoint",
".",
"class",
",",
"factory",
".",
"createMultiPoint",
"(",
"(",
"Coordinate",
"[",
"]",
")",
"null",
")",
")",
";",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"MultiLineString",
".",
"class",
",",
"factory",
".",
"createMultiLineString",
"(",
"(",
"LineString",
"[",
"]",
")",
"null",
")",
")",
";",
"// cast needed!",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"MultiPolygon",
".",
"class",
",",
"factory",
".",
"createMultiPolygon",
"(",
"(",
"Polygon",
"[",
"]",
")",
"null",
")",
")",
";",
"// cast needed!",
"EMPTY_GEOMETRIES",
".",
"put",
"(",
"Geometry",
".",
"class",
",",
"factory",
".",
"createGeometryCollection",
"(",
"null",
")",
")",
";",
"}"
] | Finish service initialization.
@throws GeomajasException oops | [
"Finish",
"service",
"initialization",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/service/GeoServiceImpl.java#L90-L117 | train |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/service/GeoServiceImpl.java | GeoServiceImpl.getSridFromCrs | public int getSridFromCrs(String crs) {
int crsInt;
if (crs.indexOf(':') != -1) {
crsInt = Integer.parseInt(crs.substring(crs.indexOf(':') + 1));
} else {
try {
crsInt = Integer.parseInt(crs);
} catch (NumberFormatException e) {
crsInt = 0;
}
}
return crsInt;
} | java | public int getSridFromCrs(String crs) {
int crsInt;
if (crs.indexOf(':') != -1) {
crsInt = Integer.parseInt(crs.substring(crs.indexOf(':') + 1));
} else {
try {
crsInt = Integer.parseInt(crs);
} catch (NumberFormatException e) {
crsInt = 0;
}
}
return crsInt;
} | [
"public",
"int",
"getSridFromCrs",
"(",
"String",
"crs",
")",
"{",
"int",
"crsInt",
";",
"if",
"(",
"crs",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{",
"crsInt",
"=",
"Integer",
".",
"parseInt",
"(",
"crs",
".",
"substring",
"(",
"crs",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
")",
";",
"}",
"else",
"{",
"try",
"{",
"crsInt",
"=",
"Integer",
".",
"parseInt",
"(",
"crs",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"crsInt",
"=",
"0",
";",
"}",
"}",
"return",
"crsInt",
";",
"}"
] | Isn't there a method for this in GeoTools?
@param crs
CRS string in the form of 'EPSG:<srid>'.
@return SRID as integer. | [
"Isn",
"t",
"there",
"a",
"method",
"for",
"this",
"in",
"GeoTools?"
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/service/GeoServiceImpl.java#L172-L184 | train |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PBPoolInfo.java | PBPoolInfo.configure | public void configure(Configuration pConfig) throws ConfigurationException
{
if (pConfig instanceof PBPoolConfiguration)
{
PBPoolConfiguration conf = (PBPoolConfiguration) pConfig;
this.setMaxActive(conf.getMaxActive());
this.setMaxIdle(conf.getMaxIdle());
this.setMaxWait(conf.getMaxWaitMillis());
this.setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis());
this.setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMilli());
this.setWhenExhaustedAction(conf.getWhenExhaustedAction());
}
else
{
LoggerFactory.getDefaultLogger().error(this.getClass().getName() +
" cannot read configuration properties, use default.");
}
} | java | public void configure(Configuration pConfig) throws ConfigurationException
{
if (pConfig instanceof PBPoolConfiguration)
{
PBPoolConfiguration conf = (PBPoolConfiguration) pConfig;
this.setMaxActive(conf.getMaxActive());
this.setMaxIdle(conf.getMaxIdle());
this.setMaxWait(conf.getMaxWaitMillis());
this.setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis());
this.setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMilli());
this.setWhenExhaustedAction(conf.getWhenExhaustedAction());
}
else
{
LoggerFactory.getDefaultLogger().error(this.getClass().getName() +
" cannot read configuration properties, use default.");
}
} | [
"public",
"void",
"configure",
"(",
"Configuration",
"pConfig",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"pConfig",
"instanceof",
"PBPoolConfiguration",
")",
"{",
"PBPoolConfiguration",
"conf",
"=",
"(",
"PBPoolConfiguration",
")",
"pConfig",
";",
"this",
".",
"setMaxActive",
"(",
"conf",
".",
"getMaxActive",
"(",
")",
")",
";",
"this",
".",
"setMaxIdle",
"(",
"conf",
".",
"getMaxIdle",
"(",
")",
")",
";",
"this",
".",
"setMaxWait",
"(",
"conf",
".",
"getMaxWaitMillis",
"(",
")",
")",
";",
"this",
".",
"setMinEvictableIdleTimeMillis",
"(",
"conf",
".",
"getMinEvictableIdleTimeMillis",
"(",
")",
")",
";",
"this",
".",
"setTimeBetweenEvictionRunsMillis",
"(",
"conf",
".",
"getTimeBetweenEvictionRunsMilli",
"(",
")",
")",
";",
"this",
".",
"setWhenExhaustedAction",
"(",
"conf",
".",
"getWhenExhaustedAction",
"(",
")",
")",
";",
"}",
"else",
"{",
"LoggerFactory",
".",
"getDefaultLogger",
"(",
")",
".",
"error",
"(",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" cannot read configuration properties, use default.\"",
")",
";",
"}",
"}"
] | Read in the configuration properties. | [
"Read",
"in",
"the",
"configuration",
"properties",
"."
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PBPoolInfo.java#L49-L66 | train |
Subsets and Splits