id
int32 0
165k
| 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
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
153,100
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java
|
ByteBuffer.getPhysicalData
|
public Object getPhysicalData()
{
if (m_baOut == null)
{
if (m_baIn == null)
return null;
m_baIn.reset();
int iLen = m_baIn.available();
byte[] rgby = new byte[iLen];
m_baIn.read(rgby, 0, iLen);
return rgby;
}
return m_baOut.toByteArray();
}
|
java
|
public Object getPhysicalData()
{
if (m_baOut == null)
{
if (m_baIn == null)
return null;
m_baIn.reset();
int iLen = m_baIn.available();
byte[] rgby = new byte[iLen];
m_baIn.read(rgby, 0, iLen);
return rgby;
}
return m_baOut.toByteArray();
}
|
[
"public",
"Object",
"getPhysicalData",
"(",
")",
"{",
"if",
"(",
"m_baOut",
"==",
"null",
")",
"{",
"if",
"(",
"m_baIn",
"==",
"null",
")",
"return",
"null",
";",
"m_baIn",
".",
"reset",
"(",
")",
";",
"int",
"iLen",
"=",
"m_baIn",
".",
"available",
"(",
")",
";",
"byte",
"[",
"]",
"rgby",
"=",
"new",
"byte",
"[",
"iLen",
"]",
";",
"m_baIn",
".",
"read",
"(",
"rgby",
",",
"0",
",",
"iLen",
")",
";",
"return",
"rgby",
";",
"}",
"return",
"m_baOut",
".",
"toByteArray",
"(",
")",
";",
"}"
] |
Get the physical data that this Buffer uses.
You must override this method.
@return The physical data object.
|
[
"Get",
"the",
"physical",
"data",
"that",
"this",
"Buffer",
"uses",
".",
"You",
"must",
"override",
"this",
"method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java#L230-L243
|
153,101
|
inkstand-io/scribble
|
scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java
|
TemporaryZipFile.addEntries
|
private void addEntries(final FileSystem zipFs) throws IOException {
for (Map.Entry<String, URL> entry : contentMap.entrySet()) {
final Path pathToFile = zipFs.getPath(entry.getKey());
final URL resource = entry.getValue();
addResource(pathToFile, resource);
}
}
|
java
|
private void addEntries(final FileSystem zipFs) throws IOException {
for (Map.Entry<String, URL> entry : contentMap.entrySet()) {
final Path pathToFile = zipFs.getPath(entry.getKey());
final URL resource = entry.getValue();
addResource(pathToFile, resource);
}
}
|
[
"private",
"void",
"addEntries",
"(",
"final",
"FileSystem",
"zipFs",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"URL",
">",
"entry",
":",
"contentMap",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"Path",
"pathToFile",
"=",
"zipFs",
".",
"getPath",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"final",
"URL",
"resource",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"addResource",
"(",
"pathToFile",
",",
"resource",
")",
";",
"}",
"}"
] |
Adds the entries to the zip file, that have been defined by the builder.
@param zipFs
the zip file system that represents the new zip file.
@throws IOException
|
[
"Adds",
"the",
"entries",
"to",
"the",
"zip",
"file",
"that",
"have",
"been",
"defined",
"by",
"the",
"builder",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java#L78-L85
|
153,102
|
inkstand-io/scribble
|
scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java
|
TemporaryZipFile.newZipFileSystem
|
private FileSystem newZipFileSystem(final File file) throws IOException {
final Map<String, String> env = new HashMap<>();
env.put("create", "true");
return newFileSystem(URI.create("jar:" + file.toURI()), env);
}
|
java
|
private FileSystem newZipFileSystem(final File file) throws IOException {
final Map<String, String> env = new HashMap<>();
env.put("create", "true");
return newFileSystem(URI.create("jar:" + file.toURI()), env);
}
|
[
"private",
"FileSystem",
"newZipFileSystem",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"env",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"env",
".",
"put",
"(",
"\"create\"",
",",
"\"true\"",
")",
";",
"return",
"newFileSystem",
"(",
"URI",
".",
"create",
"(",
"\"jar:\"",
"+",
"file",
".",
"toURI",
"(",
")",
")",
",",
"env",
")",
";",
"}"
] |
Creates a new zip file and exposes the zip file as a filesystem to which paths and files can be added.
@param file
the file handle that denotes the zip file
@return the FileSystem that represents the zip file
@throws IOException
|
[
"Creates",
"a",
"new",
"zip",
"file",
"and",
"exposes",
"the",
"zip",
"file",
"as",
"a",
"filesystem",
"to",
"which",
"paths",
"and",
"files",
"can",
"be",
"added",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java#L97-L102
|
153,103
|
inkstand-io/scribble
|
scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java
|
TemporaryZipFile.addResource
|
private void addResource(final Path pathToFile, final URL resource) throws IOException {
if (resource == null) {
addFolder(pathToFile);
} else {
addEntry(pathToFile, resource);
}
}
|
java
|
private void addResource(final Path pathToFile, final URL resource) throws IOException {
if (resource == null) {
addFolder(pathToFile);
} else {
addEntry(pathToFile, resource);
}
}
|
[
"private",
"void",
"addResource",
"(",
"final",
"Path",
"pathToFile",
",",
"final",
"URL",
"resource",
")",
"throws",
"IOException",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"addFolder",
"(",
"pathToFile",
")",
";",
"}",
"else",
"{",
"addEntry",
"(",
"pathToFile",
",",
"resource",
")",
";",
"}",
"}"
] |
Adds a resource respectively it's content to the filesystem at the position specified by the pathToFile
@param pathToFile
the path to the file or folder to which the resource's content should be written
@param resource
the resource providing the content for the entry. If the resource is null, a folder will be created
@throws IOException
|
[
"Adds",
"a",
"resource",
"respectively",
"it",
"s",
"content",
"to",
"the",
"filesystem",
"at",
"the",
"position",
"specified",
"by",
"the",
"pathToFile"
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java#L114-L121
|
153,104
|
inkstand-io/scribble
|
scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java
|
TemporaryZipFile.addEntry
|
private void addEntry(final Path pathToFile, final URL resource) throws IOException {
final Path parent = pathToFile.getParent();
if (parent != null) {
addFolder(parent);
}
try (InputStream inputStream = resource.openStream()) {
Files.copy(inputStream, pathToFile);
}
}
|
java
|
private void addEntry(final Path pathToFile, final URL resource) throws IOException {
final Path parent = pathToFile.getParent();
if (parent != null) {
addFolder(parent);
}
try (InputStream inputStream = resource.openStream()) {
Files.copy(inputStream, pathToFile);
}
}
|
[
"private",
"void",
"addEntry",
"(",
"final",
"Path",
"pathToFile",
",",
"final",
"URL",
"resource",
")",
"throws",
"IOException",
"{",
"final",
"Path",
"parent",
"=",
"pathToFile",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"addFolder",
"(",
"parent",
")",
";",
"}",
"try",
"(",
"InputStream",
"inputStream",
"=",
"resource",
".",
"openStream",
"(",
")",
")",
"{",
"Files",
".",
"copy",
"(",
"inputStream",
",",
"pathToFile",
")",
";",
"}",
"}"
] |
Creates an entry under the specifeid path with the content from the provided resource.
@param pathToFile
the path to the file in the zip file.
@param resource
the resource providing the content for the file. Must not be null.
@throws IOException
|
[
"Creates",
"an",
"entry",
"under",
"the",
"specifeid",
"path",
"with",
"the",
"content",
"from",
"the",
"provided",
"resource",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryZipFile.java#L146-L155
|
153,105
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java
|
EndpointHandler.handleGet
|
public void handleGet(HttpRequest request, HttpResponse response) throws HttpException, IOException {
String uri = request.getRequestLine().getUri();
LOG.debug("uri {}", uri);
try {
ResponseUpdater ru = this.findResponseUpdater(request);
LOG.debug("request updater {}", ru);
ru.update(response);
} catch (IllegalStateException t) {
LOG.error("Cannot handle request", t);
throw new HttpException("Cannot handle request", t);
}
}
|
java
|
public void handleGet(HttpRequest request, HttpResponse response) throws HttpException, IOException {
String uri = request.getRequestLine().getUri();
LOG.debug("uri {}", uri);
try {
ResponseUpdater ru = this.findResponseUpdater(request);
LOG.debug("request updater {}", ru);
ru.update(response);
} catch (IllegalStateException t) {
LOG.error("Cannot handle request", t);
throw new HttpException("Cannot handle request", t);
}
}
|
[
"public",
"void",
"handleGet",
"(",
"HttpRequest",
"request",
",",
"HttpResponse",
"response",
")",
"throws",
"HttpException",
",",
"IOException",
"{",
"String",
"uri",
"=",
"request",
".",
"getRequestLine",
"(",
")",
".",
"getUri",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"uri {}\"",
",",
"uri",
")",
";",
"try",
"{",
"ResponseUpdater",
"ru",
"=",
"this",
".",
"findResponseUpdater",
"(",
"request",
")",
";",
"LOG",
".",
"debug",
"(",
"\"request updater {}\"",
",",
"ru",
")",
";",
"ru",
".",
"update",
"(",
"response",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"t",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Cannot handle request\"",
",",
"t",
")",
";",
"throw",
"new",
"HttpException",
"(",
"\"Cannot handle request\"",
",",
"t",
")",
";",
"}",
"}"
] |
Handles GET requests by calling response updater based on uri pattern.
@param request HTTP request
@param response HTTP response
@throws HttpException in case of HTTP related issue
@throws IOException in case of IO related issue
|
[
"Handles",
"GET",
"requests",
"by",
"calling",
"response",
"updater",
"based",
"on",
"uri",
"pattern",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java#L110-L121
|
153,106
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java
|
EndpointHandler.findResponseUpdater
|
private ResponseUpdater findResponseUpdater(final HttpRequest request) throws HttpException {
ResponseUpdater updater = this.responseUpdaterSet.stream()
.filter(ru -> ru.matches(request))
.findFirst().get();
if (updater == null) {
throw new HttpException("cannot find correpsonding response updater");
} else {
return updater;
}
}
|
java
|
private ResponseUpdater findResponseUpdater(final HttpRequest request) throws HttpException {
ResponseUpdater updater = this.responseUpdaterSet.stream()
.filter(ru -> ru.matches(request))
.findFirst().get();
if (updater == null) {
throw new HttpException("cannot find correpsonding response updater");
} else {
return updater;
}
}
|
[
"private",
"ResponseUpdater",
"findResponseUpdater",
"(",
"final",
"HttpRequest",
"request",
")",
"throws",
"HttpException",
"{",
"ResponseUpdater",
"updater",
"=",
"this",
".",
"responseUpdaterSet",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"ru",
"->",
"ru",
".",
"matches",
"(",
"request",
")",
")",
".",
"findFirst",
"(",
")",
".",
"get",
"(",
")",
";",
"if",
"(",
"updater",
"==",
"null",
")",
"{",
"throw",
"new",
"HttpException",
"(",
"\"cannot find correpsonding response updater\"",
")",
";",
"}",
"else",
"{",
"return",
"updater",
";",
"}",
"}"
] |
Finds the first ResponseUpdater by url pattern match.
@param request http request
@return the corresponding ResponseUpdater
@throws HttpException if no ResponseUpdater found
|
[
"Finds",
"the",
"first",
"ResponseUpdater",
"by",
"url",
"pattern",
"match",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java#L176-L185
|
153,107
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java
|
EndpointHandler.getParameter
|
public static String getParameter(HttpRequest request, String name) throws URISyntaxException {
NameValuePair nv = URLEncodedUtils.parse(new URI(request.getRequestLine().getUri()), "UTF-8").stream()
.filter(param -> param.getName().equals(name))
.findFirst().get();
if (nv == null) {
return null;
}
return nv.getValue();
}
|
java
|
public static String getParameter(HttpRequest request, String name) throws URISyntaxException {
NameValuePair nv = URLEncodedUtils.parse(new URI(request.getRequestLine().getUri()), "UTF-8").stream()
.filter(param -> param.getName().equals(name))
.findFirst().get();
if (nv == null) {
return null;
}
return nv.getValue();
}
|
[
"public",
"static",
"String",
"getParameter",
"(",
"HttpRequest",
"request",
",",
"String",
"name",
")",
"throws",
"URISyntaxException",
"{",
"NameValuePair",
"nv",
"=",
"URLEncodedUtils",
".",
"parse",
"(",
"new",
"URI",
"(",
"request",
".",
"getRequestLine",
"(",
")",
".",
"getUri",
"(",
")",
")",
",",
"\"UTF-8\"",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"param",
"->",
"param",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
".",
"findFirst",
"(",
")",
".",
"get",
"(",
")",
";",
"if",
"(",
"nv",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"nv",
".",
"getValue",
"(",
")",
";",
"}"
] |
Gets parameter value of request line.
@param request HTTP request
@param name name of the request line parameter
@return parameter value, only the first is returned if there are multiple values for the same name
@throws URISyntaxException in case of URL issue
|
[
"Gets",
"parameter",
"value",
"of",
"request",
"line",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java#L202-L210
|
153,108
|
jbundle/jbundle
|
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java
|
DynamicTreeNode.getChildCount
|
public int getChildCount()
{
if(!m_bHasLoaded)
{
NodeData data = (NodeData)this.getUserObject();
if ((data == null) || (!data.isLeaf()))
this.loadChildren();
}
return super.getChildCount();
}
|
java
|
public int getChildCount()
{
if(!m_bHasLoaded)
{
NodeData data = (NodeData)this.getUserObject();
if ((data == null) || (!data.isLeaf()))
this.loadChildren();
}
return super.getChildCount();
}
|
[
"public",
"int",
"getChildCount",
"(",
")",
"{",
"if",
"(",
"!",
"m_bHasLoaded",
")",
"{",
"NodeData",
"data",
"=",
"(",
"NodeData",
")",
"this",
".",
"getUserObject",
"(",
")",
";",
"if",
"(",
"(",
"data",
"==",
"null",
")",
"||",
"(",
"!",
"data",
".",
"isLeaf",
"(",
")",
")",
")",
"this",
".",
"loadChildren",
"(",
")",
";",
"}",
"return",
"super",
".",
"getChildCount",
"(",
")",
";",
"}"
] |
If hasLoaded is false, meaning the children have not yet been
loaded, loadChildren is messaged and super is messaged for
the return value.
|
[
"If",
"hasLoaded",
"is",
"false",
"meaning",
"the",
"children",
"have",
"not",
"yet",
"been",
"loaded",
"loadChildren",
"is",
"messaged",
"and",
"super",
"is",
"messaged",
"for",
"the",
"return",
"value",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java#L53-L62
|
153,109
|
jbundle/jbundle
|
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java
|
DynamicTreeNode.loadChildren
|
protected void loadChildren()
{
DynamicTreeNode newNode;
// Font font;
// int randomIndex;
NodeData dataParent = (NodeData)this.getUserObject();
FieldList fieldList = dataParent.makeRecord();
FieldTable fieldTable = fieldList.getTable();
m_fNameCount = 0;
try {
fieldTable.close();
// while (fieldTable.hasNext())
while (fieldTable.next() != null)
{
String objID = fieldList.getField(0).toString();
String strDescription = fieldList.getField(3).toString();
NodeData data = new NodeData(dataParent.getBaseApplet(), dataParent.getRemoteSession(), strDescription, objID, dataParent.getSubRecordClassName());
newNode = new DynamicTreeNode(data);
/** Don't use add() here, add calls insert(newNode, getChildCount())
so if you want to use add, just be sure to set hasLoaded = true first. */
this.insert(newNode, (int)m_fNameCount);
m_fNameCount++;
}
} catch (Exception ex) {
ex.printStackTrace();
}
/** This node has now been loaded, mark it so. */
m_bHasLoaded = true;
}
|
java
|
protected void loadChildren()
{
DynamicTreeNode newNode;
// Font font;
// int randomIndex;
NodeData dataParent = (NodeData)this.getUserObject();
FieldList fieldList = dataParent.makeRecord();
FieldTable fieldTable = fieldList.getTable();
m_fNameCount = 0;
try {
fieldTable.close();
// while (fieldTable.hasNext())
while (fieldTable.next() != null)
{
String objID = fieldList.getField(0).toString();
String strDescription = fieldList.getField(3).toString();
NodeData data = new NodeData(dataParent.getBaseApplet(), dataParent.getRemoteSession(), strDescription, objID, dataParent.getSubRecordClassName());
newNode = new DynamicTreeNode(data);
/** Don't use add() here, add calls insert(newNode, getChildCount())
so if you want to use add, just be sure to set hasLoaded = true first. */
this.insert(newNode, (int)m_fNameCount);
m_fNameCount++;
}
} catch (Exception ex) {
ex.printStackTrace();
}
/** This node has now been loaded, mark it so. */
m_bHasLoaded = true;
}
|
[
"protected",
"void",
"loadChildren",
"(",
")",
"{",
"DynamicTreeNode",
"newNode",
";",
"// Font font;",
"// int randomIndex;",
"NodeData",
"dataParent",
"=",
"(",
"NodeData",
")",
"this",
".",
"getUserObject",
"(",
")",
";",
"FieldList",
"fieldList",
"=",
"dataParent",
".",
"makeRecord",
"(",
")",
";",
"FieldTable",
"fieldTable",
"=",
"fieldList",
".",
"getTable",
"(",
")",
";",
"m_fNameCount",
"=",
"0",
";",
"try",
"{",
"fieldTable",
".",
"close",
"(",
")",
";",
"// while (fieldTable.hasNext())",
"while",
"(",
"fieldTable",
".",
"next",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"objID",
"=",
"fieldList",
".",
"getField",
"(",
"0",
")",
".",
"toString",
"(",
")",
";",
"String",
"strDescription",
"=",
"fieldList",
".",
"getField",
"(",
"3",
")",
".",
"toString",
"(",
")",
";",
"NodeData",
"data",
"=",
"new",
"NodeData",
"(",
"dataParent",
".",
"getBaseApplet",
"(",
")",
",",
"dataParent",
".",
"getRemoteSession",
"(",
")",
",",
"strDescription",
",",
"objID",
",",
"dataParent",
".",
"getSubRecordClassName",
"(",
")",
")",
";",
"newNode",
"=",
"new",
"DynamicTreeNode",
"(",
"data",
")",
";",
"/** Don't use add() here, add calls insert(newNode, getChildCount())\n so if you want to use add, just be sure to set hasLoaded = true first. */",
"this",
".",
"insert",
"(",
"newNode",
",",
"(",
"int",
")",
"m_fNameCount",
")",
";",
"m_fNameCount",
"++",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"/** This node has now been loaded, mark it so. */",
"m_bHasLoaded",
"=",
"true",
";",
"}"
] |
Messaged the first time getChildCount is messaged. Creates
children with random names from names.
|
[
"Messaged",
"the",
"first",
"time",
"getChildCount",
"is",
"messaged",
".",
"Creates",
"children",
"with",
"random",
"names",
"from",
"names",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java#L67-L97
|
153,110
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/zip/Zip4jExtensions.java
|
Zip4jExtensions.zipFiles
|
public static void zipFiles(final ZipFile zipFile4j, final File... toAdd) throws ZipException
{
zipFiles(zipFile4j, Zip4jConstants.COMP_DEFLATE, Zip4jConstants.DEFLATE_LEVEL_NORMAL,
toAdd);
}
|
java
|
public static void zipFiles(final ZipFile zipFile4j, final File... toAdd) throws ZipException
{
zipFiles(zipFile4j, Zip4jConstants.COMP_DEFLATE, Zip4jConstants.DEFLATE_LEVEL_NORMAL,
toAdd);
}
|
[
"public",
"static",
"void",
"zipFiles",
"(",
"final",
"ZipFile",
"zipFile4j",
",",
"final",
"File",
"...",
"toAdd",
")",
"throws",
"ZipException",
"{",
"zipFiles",
"(",
"zipFile4j",
",",
"Zip4jConstants",
".",
"COMP_DEFLATE",
",",
"Zip4jConstants",
".",
"DEFLATE_LEVEL_NORMAL",
",",
"toAdd",
")",
";",
"}"
] |
Adds a file or several files to the given zip file with the parameters
Zip4jConstants.COMP_DEFLATE for the compression method and
Zip4jConstants.DEFLATE_LEVEL_NORMAL as the compression level.
@param zipFile4j
the zip file4j
@param toAdd
the to add
@throws ZipException
the zip exception
|
[
"Adds",
"a",
"file",
"or",
"several",
"files",
"to",
"the",
"given",
"zip",
"file",
"with",
"the",
"parameters",
"Zip4jConstants",
".",
"COMP_DEFLATE",
"for",
"the",
"compression",
"method",
"and",
"Zip4jConstants",
".",
"DEFLATE_LEVEL_NORMAL",
"as",
"the",
"compression",
"level",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/zip/Zip4jExtensions.java#L78-L82
|
153,111
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/zip/Zip4jExtensions.java
|
Zip4jExtensions.zipFiles
|
public static void zipFiles(final ZipFile zipFile4j, final int compressionMethod,
final int compressionLevel, final File... toAdd) throws ZipException
{
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
final ZipParameters parameters = new ZipParameters();
// set compression method to store compression
// Zip4jConstants.COMP_STORE is for no compression
// Zip4jConstants.COMP_DEFLATE is for compression
parameters.setCompressionMethod(compressionMethod);
// Set the compression level
// DEFLATE_LEVEL_ULTRA = ultra maximum compression
// DEFLATE_LEVEL_MAXIMUM = maximum compression
// DEFLATE_LEVEL_NORMAL = normal compression
// DEFLATE_LEVEL_FAST = fast compression
// DEFLATE_LEVEL_FASTEST = fastest compression
parameters.setCompressionLevel(compressionLevel);
zipFiles(zipFile4j, parameters, toAdd);
}
|
java
|
public static void zipFiles(final ZipFile zipFile4j, final int compressionMethod,
final int compressionLevel, final File... toAdd) throws ZipException
{
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
final ZipParameters parameters = new ZipParameters();
// set compression method to store compression
// Zip4jConstants.COMP_STORE is for no compression
// Zip4jConstants.COMP_DEFLATE is for compression
parameters.setCompressionMethod(compressionMethod);
// Set the compression level
// DEFLATE_LEVEL_ULTRA = ultra maximum compression
// DEFLATE_LEVEL_MAXIMUM = maximum compression
// DEFLATE_LEVEL_NORMAL = normal compression
// DEFLATE_LEVEL_FAST = fast compression
// DEFLATE_LEVEL_FASTEST = fastest compression
parameters.setCompressionLevel(compressionLevel);
zipFiles(zipFile4j, parameters, toAdd);
}
|
[
"public",
"static",
"void",
"zipFiles",
"(",
"final",
"ZipFile",
"zipFile4j",
",",
"final",
"int",
"compressionMethod",
",",
"final",
"int",
"compressionLevel",
",",
"final",
"File",
"...",
"toAdd",
")",
"throws",
"ZipException",
"{",
"// Initiate Zip Parameters which define various properties such",
"// as compression method, etc.",
"final",
"ZipParameters",
"parameters",
"=",
"new",
"ZipParameters",
"(",
")",
";",
"// set compression method to store compression",
"// Zip4jConstants.COMP_STORE is for no compression",
"// Zip4jConstants.COMP_DEFLATE is for compression",
"parameters",
".",
"setCompressionMethod",
"(",
"compressionMethod",
")",
";",
"// Set the compression level",
"// DEFLATE_LEVEL_ULTRA = ultra maximum compression",
"// DEFLATE_LEVEL_MAXIMUM = maximum compression",
"// DEFLATE_LEVEL_NORMAL = normal compression",
"// DEFLATE_LEVEL_FAST = fast compression",
"// DEFLATE_LEVEL_FASTEST = fastest compression",
"parameters",
".",
"setCompressionLevel",
"(",
"compressionLevel",
")",
";",
"zipFiles",
"(",
"zipFile4j",
",",
"parameters",
",",
"toAdd",
")",
";",
"}"
] |
Adds a file or several files to the given zip file with the given parameters for the
compression method and the compression level.
@param zipFile4j
the zip file4j
@param compressionMethod
The compression method
@param compressionLevel
the compression level
@param toAdd
the to add
@throws ZipException
the zip exception
|
[
"Adds",
"a",
"file",
"or",
"several",
"files",
"to",
"the",
"given",
"zip",
"file",
"with",
"the",
"given",
"parameters",
"for",
"the",
"compression",
"method",
"and",
"the",
"compression",
"level",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/zip/Zip4jExtensions.java#L99-L119
|
153,112
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/BaseFixData.java
|
BaseFixData.getRecordFromDescription
|
public static Record getRecordFromDescription(BaseField field, String strDesc)
{
Record recSecond = ((ReferenceField)field).getReferenceRecord();
return BaseFixData.getRecordFromDescription(strDesc, null, recSecond);
}
|
java
|
public static Record getRecordFromDescription(BaseField field, String strDesc)
{
Record recSecond = ((ReferenceField)field).getReferenceRecord();
return BaseFixData.getRecordFromDescription(strDesc, null, recSecond);
}
|
[
"public",
"static",
"Record",
"getRecordFromDescription",
"(",
"BaseField",
"field",
",",
"String",
"strDesc",
")",
"{",
"Record",
"recSecond",
"=",
"(",
"(",
"ReferenceField",
")",
"field",
")",
".",
"getReferenceRecord",
"(",
")",
";",
"return",
"BaseFixData",
".",
"getRecordFromDescription",
"(",
"strDesc",
",",
"null",
",",
"recSecond",
")",
";",
"}"
] |
GetRecordFromDescription Method.
|
[
"GetRecordFromDescription",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/BaseFixData.java#L72-L76
|
153,113
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/BaseFixData.java
|
BaseFixData.checkAbreviations
|
public static boolean checkAbreviations(String string, int i)
{
// Check first character
for (int index = 0; index < ABREVIATIONS.length; index++)
{
if (ABREVIATIONS[index].length() > 1)
if (string.charAt(i) == ABREVIATIONS[index].charAt(0))
if (string.length() > i + 1)
if (string.charAt(i+1) == ABREVIATIONS[index].charAt(1))
if (string.length() > i + 2)
if (string.charAt(i+2) == ABREVIATIONS[index].charAt(2))
return true;
}
// Check second character
for (int index = 0; index < ABREVIATIONS.length; index++)
{
if (ABREVIATIONS[index].length() > 2)
if (i > 0)
if (string.charAt(i-1) == ABREVIATIONS[index].charAt(0))
if (string.charAt(i) == ABREVIATIONS[index].charAt(1))
if (string.length() > i + 1)
if (string.charAt(i+1) == ABREVIATIONS[index].charAt(2))
return true;
}
return false;
}
|
java
|
public static boolean checkAbreviations(String string, int i)
{
// Check first character
for (int index = 0; index < ABREVIATIONS.length; index++)
{
if (ABREVIATIONS[index].length() > 1)
if (string.charAt(i) == ABREVIATIONS[index].charAt(0))
if (string.length() > i + 1)
if (string.charAt(i+1) == ABREVIATIONS[index].charAt(1))
if (string.length() > i + 2)
if (string.charAt(i+2) == ABREVIATIONS[index].charAt(2))
return true;
}
// Check second character
for (int index = 0; index < ABREVIATIONS.length; index++)
{
if (ABREVIATIONS[index].length() > 2)
if (i > 0)
if (string.charAt(i-1) == ABREVIATIONS[index].charAt(0))
if (string.charAt(i) == ABREVIATIONS[index].charAt(1))
if (string.length() > i + 1)
if (string.charAt(i+1) == ABREVIATIONS[index].charAt(2))
return true;
}
return false;
}
|
[
"public",
"static",
"boolean",
"checkAbreviations",
"(",
"String",
"string",
",",
"int",
"i",
")",
"{",
"// Check first character",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"ABREVIATIONS",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"length",
"(",
")",
">",
"1",
")",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
")",
"==",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"charAt",
"(",
"0",
")",
")",
"if",
"(",
"string",
".",
"length",
"(",
")",
">",
"i",
"+",
"1",
")",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
"==",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"charAt",
"(",
"1",
")",
")",
"if",
"(",
"string",
".",
"length",
"(",
")",
">",
"i",
"+",
"2",
")",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
"+",
"2",
")",
"==",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"charAt",
"(",
"2",
")",
")",
"return",
"true",
";",
"}",
"// Check second character",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"ABREVIATIONS",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"length",
"(",
")",
">",
"2",
")",
"if",
"(",
"i",
">",
"0",
")",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
"-",
"1",
")",
"==",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"charAt",
"(",
"0",
")",
")",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
")",
"==",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"charAt",
"(",
"1",
")",
")",
"if",
"(",
"string",
".",
"length",
"(",
")",
">",
"i",
"+",
"1",
")",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
"==",
"ABREVIATIONS",
"[",
"index",
"]",
".",
"charAt",
"(",
"2",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
CheckAbreviations Method.
|
[
"CheckAbreviations",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/BaseFixData.java#L192-L217
|
153,114
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/util/UserProperties.java
|
UserProperties.getProperty
|
public String getProperty(String strName)
{
Record recUserRegistration = this.getUserRegistration();
return ((PropertiesField)recUserRegistration.getField(UserRegistrationModel.PROPERTIES)).getProperty(strName);
}
|
java
|
public String getProperty(String strName)
{
Record recUserRegistration = this.getUserRegistration();
return ((PropertiesField)recUserRegistration.getField(UserRegistrationModel.PROPERTIES)).getProperty(strName);
}
|
[
"public",
"String",
"getProperty",
"(",
"String",
"strName",
")",
"{",
"Record",
"recUserRegistration",
"=",
"this",
".",
"getUserRegistration",
"(",
")",
";",
"return",
"(",
"(",
"PropertiesField",
")",
"recUserRegistration",
".",
"getField",
"(",
"UserRegistrationModel",
".",
"PROPERTIES",
")",
")",
".",
"getProperty",
"(",
"strName",
")",
";",
"}"
] |
Get the value associated with this key.
@param strName The key to lookup.
@return The value for this sub-key.
|
[
"Get",
"the",
"value",
"associated",
"with",
"this",
"key",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/UserProperties.java#L178-L182
|
153,115
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/filter/ConstructorFilterBuilder.java
|
ConstructorFilterBuilder.isDefault
|
public ConstructorFilterBuilder isDefault() {
add(new NegationConstructorFilter(new ModifierConstructorFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE)));
return this;
}
|
java
|
public ConstructorFilterBuilder isDefault() {
add(new NegationConstructorFilter(new ModifierConstructorFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE)));
return this;
}
|
[
"public",
"ConstructorFilterBuilder",
"isDefault",
"(",
")",
"{",
"add",
"(",
"new",
"NegationConstructorFilter",
"(",
"new",
"ModifierConstructorFilter",
"(",
"Modifier",
".",
"PUBLIC",
"&",
"Modifier",
".",
"PROTECTED",
"&",
"Modifier",
".",
"PRIVATE",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a filter for default access constructors only.
@return The builder to support method chaining.
|
[
"Adds",
"a",
"filter",
"for",
"default",
"access",
"constructors",
"only",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/ConstructorFilterBuilder.java#L130-L133
|
153,116
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/filter/ConstructorFilterBuilder.java
|
ConstructorFilterBuilder.build
|
public ConstructorFilter build() {
if(filters.isEmpty()) {
throw new IllegalStateException("No filter specified.");
}
if(filters.size() == 1) {
return filters.get(0);
}
ConstructorFilter[] methodFilters = new ConstructorFilter[filters.size()];
filters.toArray(methodFilters);
return new ConstructorFilterList(methodFilters);
}
|
java
|
public ConstructorFilter build() {
if(filters.isEmpty()) {
throw new IllegalStateException("No filter specified.");
}
if(filters.size() == 1) {
return filters.get(0);
}
ConstructorFilter[] methodFilters = new ConstructorFilter[filters.size()];
filters.toArray(methodFilters);
return new ConstructorFilterList(methodFilters);
}
|
[
"public",
"ConstructorFilter",
"build",
"(",
")",
"{",
"if",
"(",
"filters",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No filter specified.\"",
")",
";",
"}",
"if",
"(",
"filters",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"filters",
".",
"get",
"(",
"0",
")",
";",
"}",
"ConstructorFilter",
"[",
"]",
"methodFilters",
"=",
"new",
"ConstructorFilter",
"[",
"filters",
".",
"size",
"(",
")",
"]",
";",
"filters",
".",
"toArray",
"(",
"methodFilters",
")",
";",
"return",
"new",
"ConstructorFilterList",
"(",
"methodFilters",
")",
";",
"}"
] |
Returns the ConstructorFilter built.
@return the ConstructorFilter built.
@throws IllegalStateException if no filter was specified before calling build()
|
[
"Returns",
"the",
"ConstructorFilter",
"built",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/ConstructorFilterBuilder.java#L304-L314
|
153,117
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/DataKey.java
|
DataKey.create
|
public static <T> DataKey<T> create(String name, Class<T> dataClass) {
return create(name, dataClass, true, null);
}
|
java
|
public static <T> DataKey<T> create(String name, Class<T> dataClass) {
return create(name, dataClass, true, null);
}
|
[
"public",
"static",
"<",
"T",
">",
"DataKey",
"<",
"T",
">",
"create",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"dataClass",
")",
"{",
"return",
"create",
"(",
"name",
",",
"dataClass",
",",
"true",
",",
"null",
")",
";",
"}"
] |
creates a data key with the given name and type. This data
key allows for null values and sets no default value.
@param <T> the type
@param name the name of the key that is stored in the xdata file
@param dataClass the type's class
@return
|
[
"creates",
"a",
"data",
"key",
"with",
"the",
"given",
"name",
"and",
"type",
".",
"This",
"data",
"key",
"allows",
"for",
"null",
"values",
"and",
"sets",
"no",
"default",
"value",
"."
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataKey.java#L78-L80
|
153,118
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/DataKey.java
|
DataKey.create
|
public static <T> DataKey<T> create(String name, Class<T> dataClass, boolean allowNull, T defaultValue) {
if (dataClass.isPrimitive()) {
throw new IllegalArgumentException("primitives are not supported - please use their corresponding wrappers");
}
if (dataClass.isArray()) {
throw new IllegalArgumentException("arrays are not supported - please use a list with their corresponding wrapper");
}
return new DataKey(name, dataClass, allowNull, defaultValue);
}
|
java
|
public static <T> DataKey<T> create(String name, Class<T> dataClass, boolean allowNull, T defaultValue) {
if (dataClass.isPrimitive()) {
throw new IllegalArgumentException("primitives are not supported - please use their corresponding wrappers");
}
if (dataClass.isArray()) {
throw new IllegalArgumentException("arrays are not supported - please use a list with their corresponding wrapper");
}
return new DataKey(name, dataClass, allowNull, defaultValue);
}
|
[
"public",
"static",
"<",
"T",
">",
"DataKey",
"<",
"T",
">",
"create",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"dataClass",
",",
"boolean",
"allowNull",
",",
"T",
"defaultValue",
")",
"{",
"if",
"(",
"dataClass",
".",
"isPrimitive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"primitives are not supported - please use their corresponding wrappers\"",
")",
";",
"}",
"if",
"(",
"dataClass",
".",
"isArray",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"arrays are not supported - please use a list with their corresponding wrapper\"",
")",
";",
"}",
"return",
"new",
"DataKey",
"(",
"name",
",",
"dataClass",
",",
"allowNull",
",",
"defaultValue",
")",
";",
"}"
] |
creates a data key with the given name, data type, the given permission
to allow null values and a default value. You can set the default value to
null to signal that there should be no default value.
@param <T> the type
@param name the name of the key that is stored in the xdata file
@param dataClass the type's class
@param allowNull allow null values?
@param defaultValue the default value to use when there is no value set for this key.
If set to null this will be the same as setting no default value.
@return
|
[
"creates",
"a",
"data",
"key",
"with",
"the",
"given",
"name",
"data",
"type",
"the",
"given",
"permission",
"to",
"allow",
"null",
"values",
"and",
"a",
"default",
"value",
".",
"You",
"can",
"set",
"the",
"default",
"value",
"to",
"null",
"to",
"signal",
"that",
"there",
"should",
"be",
"no",
"default",
"value",
"."
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataKey.java#L124-L132
|
153,119
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/DataKey.java
|
DataKey.create
|
public static <T> DataKey<T> create(String name, GenericType<T> genType, boolean allowNull) {
return create(name, genType.getRawType(), allowNull, null);
}
|
java
|
public static <T> DataKey<T> create(String name, GenericType<T> genType, boolean allowNull) {
return create(name, genType.getRawType(), allowNull, null);
}
|
[
"public",
"static",
"<",
"T",
">",
"DataKey",
"<",
"T",
">",
"create",
"(",
"String",
"name",
",",
"GenericType",
"<",
"T",
">",
"genType",
",",
"boolean",
"allowNull",
")",
"{",
"return",
"create",
"(",
"name",
",",
"genType",
".",
"getRawType",
"(",
")",
",",
"allowNull",
",",
"null",
")",
";",
"}"
] |
creates a data key with the given name, data type and the given permission
to allow null values. No default value will be specified.
@param <T> the type
@param name the name of the key that is stored in the xdata file
@param genType the type's class' generic type
@param allowNull allow null values?
@return
|
[
"creates",
"a",
"data",
"key",
"with",
"the",
"given",
"name",
"data",
"type",
"and",
"the",
"given",
"permission",
"to",
"allow",
"null",
"values",
".",
"No",
"default",
"value",
"will",
"be",
"specified",
"."
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataKey.java#L172-L174
|
153,120
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java
|
AnalysisLog.logAddRecord
|
public void logAddRecord(Rec record, int iSystemID)
{
try {
this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);
this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE);
this.addNew();
this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID);
this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, false));
this.getField(AnalysisLog.CLASS_NAME).setString(Debug.getClassName(record));
this.getField(AnalysisLog.DATABASE_NAME).setString(record.getDatabaseName());
((DateTimeField)this.getField(AnalysisLog.INIT_TIME)).setValue(DateTimeField.currentTime());
this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner()));
this.getField(AnalysisLog.STACK_TRACE).setString(Debug.getStackTrace());
this.add();
} catch (DBException ex) {
ex.printStackTrace();
}
}
|
java
|
public void logAddRecord(Rec record, int iSystemID)
{
try {
this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);
this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE);
this.addNew();
this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID);
this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, false));
this.getField(AnalysisLog.CLASS_NAME).setString(Debug.getClassName(record));
this.getField(AnalysisLog.DATABASE_NAME).setString(record.getDatabaseName());
((DateTimeField)this.getField(AnalysisLog.INIT_TIME)).setValue(DateTimeField.currentTime());
this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner()));
this.getField(AnalysisLog.STACK_TRACE).setString(Debug.getStackTrace());
this.add();
} catch (DBException ex) {
ex.printStackTrace();
}
}
|
[
"public",
"void",
"logAddRecord",
"(",
"Rec",
"record",
",",
"int",
"iSystemID",
")",
"{",
"try",
"{",
"this",
".",
"getTable",
"(",
")",
".",
"setProperty",
"(",
"DBParams",
".",
"SUPRESSREMOTEDBMESSAGES",
",",
"DBConstants",
".",
"TRUE",
")",
";",
"this",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
".",
"setProperty",
"(",
"DBParams",
".",
"MESSAGES_TO_REMOTE",
",",
"DBConstants",
".",
"FALSE",
")",
";",
"this",
".",
"addNew",
"(",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"SYSTEM_ID",
")",
".",
"setValue",
"(",
"iSystemID",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"OBJECT_ID",
")",
".",
"setValue",
"(",
"Debug",
".",
"getObjectID",
"(",
"record",
",",
"false",
")",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"CLASS_NAME",
")",
".",
"setString",
"(",
"Debug",
".",
"getClassName",
"(",
"record",
")",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"DATABASE_NAME",
")",
".",
"setString",
"(",
"record",
".",
"getDatabaseName",
"(",
")",
")",
";",
"(",
"(",
"DateTimeField",
")",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"INIT_TIME",
")",
")",
".",
"setValue",
"(",
"DateTimeField",
".",
"currentTime",
"(",
")",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"RECORD_OWNER",
")",
".",
"setString",
"(",
"Debug",
".",
"getClassName",
"(",
"(",
"(",
"Record",
")",
"record",
")",
".",
"getRecordOwner",
"(",
")",
")",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"STACK_TRACE",
")",
".",
"setString",
"(",
"Debug",
".",
"getStackTrace",
"(",
")",
")",
";",
"this",
".",
"add",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Log that this record has been added.
Call this from the end of record.init
@param record the record that is being added.
|
[
"Log",
"that",
"this",
"record",
"has",
"been",
"added",
".",
"Call",
"this",
"from",
"the",
"end",
"of",
"record",
".",
"init"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java#L143-L161
|
153,121
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java
|
AnalysisLog.logRemoveRecord
|
public void logRemoveRecord(Rec record, int iSystemID)
{
try {
this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);
this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE);
this.addNew();
this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID);
this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, true));
this.setKeyArea(AnalysisLog.OBJECT_ID_KEY);
if (this.seek(null))
{
this.edit();
((DateTimeField)this.getField(AnalysisLog.FREE_TIME)).setValue(DateTimeField.currentTime());
if (this.getField(AnalysisLog.RECORD_OWNER).isNull())
this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner()));
this.set();
}
else
{
// Ignore for now System.exit(1);
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
|
java
|
public void logRemoveRecord(Rec record, int iSystemID)
{
try {
this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);
this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE);
this.addNew();
this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID);
this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, true));
this.setKeyArea(AnalysisLog.OBJECT_ID_KEY);
if (this.seek(null))
{
this.edit();
((DateTimeField)this.getField(AnalysisLog.FREE_TIME)).setValue(DateTimeField.currentTime());
if (this.getField(AnalysisLog.RECORD_OWNER).isNull())
this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner()));
this.set();
}
else
{
// Ignore for now System.exit(1);
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
|
[
"public",
"void",
"logRemoveRecord",
"(",
"Rec",
"record",
",",
"int",
"iSystemID",
")",
"{",
"try",
"{",
"this",
".",
"getTable",
"(",
")",
".",
"setProperty",
"(",
"DBParams",
".",
"SUPRESSREMOTEDBMESSAGES",
",",
"DBConstants",
".",
"TRUE",
")",
";",
"this",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
".",
"setProperty",
"(",
"DBParams",
".",
"MESSAGES_TO_REMOTE",
",",
"DBConstants",
".",
"FALSE",
")",
";",
"this",
".",
"addNew",
"(",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"SYSTEM_ID",
")",
".",
"setValue",
"(",
"iSystemID",
")",
";",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"OBJECT_ID",
")",
".",
"setValue",
"(",
"Debug",
".",
"getObjectID",
"(",
"record",
",",
"true",
")",
")",
";",
"this",
".",
"setKeyArea",
"(",
"AnalysisLog",
".",
"OBJECT_ID_KEY",
")",
";",
"if",
"(",
"this",
".",
"seek",
"(",
"null",
")",
")",
"{",
"this",
".",
"edit",
"(",
")",
";",
"(",
"(",
"DateTimeField",
")",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"FREE_TIME",
")",
")",
".",
"setValue",
"(",
"DateTimeField",
".",
"currentTime",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"RECORD_OWNER",
")",
".",
"isNull",
"(",
")",
")",
"this",
".",
"getField",
"(",
"AnalysisLog",
".",
"RECORD_OWNER",
")",
".",
"setString",
"(",
"Debug",
".",
"getClassName",
"(",
"(",
"(",
"Record",
")",
"record",
")",
".",
"getRecordOwner",
"(",
")",
")",
")",
";",
"this",
".",
"set",
"(",
")",
";",
"}",
"else",
"{",
"// Ignore for now System.exit(1);",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Log that this record has been freed.
Call this from the end of record.free
@param record the record that is being added.
|
[
"Log",
"that",
"this",
"record",
"has",
"been",
"freed",
".",
"Call",
"this",
"from",
"the",
"end",
"of",
"record",
".",
"free"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java#L167-L192
|
153,122
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.doSubScriptCommands
|
public int doSubScriptCommands(Script recScript, Map<String,Object> properties)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
Script recSubScript = recScript.getSubScript();
try {
recSubScript.close();
while (recSubScript.hasNext())
{
recSubScript.next();
iErrorCode = this.doCommand(recSubScript, properties);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
}
} catch (DBException ex) {
ex.printStackTrace();
}
return iErrorCode;
}
|
java
|
public int doSubScriptCommands(Script recScript, Map<String,Object> properties)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
Script recSubScript = recScript.getSubScript();
try {
recSubScript.close();
while (recSubScript.hasNext())
{
recSubScript.next();
iErrorCode = this.doCommand(recSubScript, properties);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
}
} catch (DBException ex) {
ex.printStackTrace();
}
return iErrorCode;
}
|
[
"public",
"int",
"doSubScriptCommands",
"(",
"Script",
"recScript",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"int",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"Script",
"recSubScript",
"=",
"recScript",
".",
"getSubScript",
"(",
")",
";",
"try",
"{",
"recSubScript",
".",
"close",
"(",
")",
";",
"while",
"(",
"recSubScript",
".",
"hasNext",
"(",
")",
")",
"{",
"recSubScript",
".",
"next",
"(",
")",
";",
"iErrorCode",
"=",
"this",
".",
"doCommand",
"(",
"recSubScript",
",",
"properties",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"return",
"iErrorCode",
";",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"iErrorCode",
";",
"}"
] |
DoSubScriptCommands Method.
|
[
"DoSubScriptCommands",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L193-L210
|
153,123
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.doRunCommand
|
public int doRunCommand(Script recScript, Map<String,Object> properties)
{
ProcessRunnerTask processRunner = new ProcessRunnerTask(this.getTask().getApplication(), null, null);
processRunner.setProperties(properties);
processRunner.run(); // Run and free when you are done
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int doRunCommand(Script recScript, Map<String,Object> properties)
{
ProcessRunnerTask processRunner = new ProcessRunnerTask(this.getTask().getApplication(), null, null);
processRunner.setProperties(properties);
processRunner.run(); // Run and free when you are done
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"doRunCommand",
"(",
"Script",
"recScript",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"ProcessRunnerTask",
"processRunner",
"=",
"new",
"ProcessRunnerTask",
"(",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
",",
"null",
",",
"null",
")",
";",
"processRunner",
".",
"setProperties",
"(",
"properties",
")",
";",
"processRunner",
".",
"run",
"(",
")",
";",
"// Run and free when you are done",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
DoRunCommand Method.
|
[
"DoRunCommand",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L214-L220
|
153,124
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.doSeekCommand
|
public int doSeekCommand(Script recScript, Map<String,Object> properties)
{
Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
if (record == null)
return DBConstants.ERROR_RETURN;
for (int iKeySeq = 0; iKeySeq < record.getKeyAreaCount(); iKeySeq++)
{
String strKeyFieldName = record.getKeyArea(iKeySeq).getKeyField(0).getField(DBConstants.FILE_KEY_AREA).getFieldName(false, false);
if (recScript.getProperty(strKeyFieldName) != null)
{
record.setKeyArea(iKeySeq);
record.getField(strKeyFieldName).setString(recScript.getProperty(strKeyFieldName));
try {
if (record.seek(null))
return DBConstants.NORMAL_RETURN;
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
return DBConstants.ERROR_RETURN;
}
|
java
|
public int doSeekCommand(Script recScript, Map<String,Object> properties)
{
Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
if (record == null)
return DBConstants.ERROR_RETURN;
for (int iKeySeq = 0; iKeySeq < record.getKeyAreaCount(); iKeySeq++)
{
String strKeyFieldName = record.getKeyArea(iKeySeq).getKeyField(0).getField(DBConstants.FILE_KEY_AREA).getFieldName(false, false);
if (recScript.getProperty(strKeyFieldName) != null)
{
record.setKeyArea(iKeySeq);
record.getField(strKeyFieldName).setString(recScript.getProperty(strKeyFieldName));
try {
if (record.seek(null))
return DBConstants.NORMAL_RETURN;
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
return DBConstants.ERROR_RETURN;
}
|
[
"public",
"int",
"doSeekCommand",
"(",
"Script",
"recScript",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"Record",
"record",
"=",
"recScript",
".",
"getTargetRecord",
"(",
"properties",
",",
"DBParams",
".",
"RECORD",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"for",
"(",
"int",
"iKeySeq",
"=",
"0",
";",
"iKeySeq",
"<",
"record",
".",
"getKeyAreaCount",
"(",
")",
";",
"iKeySeq",
"++",
")",
"{",
"String",
"strKeyFieldName",
"=",
"record",
".",
"getKeyArea",
"(",
"iKeySeq",
")",
".",
"getKeyField",
"(",
"0",
")",
".",
"getField",
"(",
"DBConstants",
".",
"FILE_KEY_AREA",
")",
".",
"getFieldName",
"(",
"false",
",",
"false",
")",
";",
"if",
"(",
"recScript",
".",
"getProperty",
"(",
"strKeyFieldName",
")",
"!=",
"null",
")",
"{",
"record",
".",
"setKeyArea",
"(",
"iKeySeq",
")",
";",
"record",
".",
"getField",
"(",
"strKeyFieldName",
")",
".",
"setString",
"(",
"recScript",
".",
"getProperty",
"(",
"strKeyFieldName",
")",
")",
";",
"try",
"{",
"if",
"(",
"record",
".",
"seek",
"(",
"null",
")",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"}"
] |
DoSeekCommand Method.
|
[
"DoSeekCommand",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L224-L245
|
153,125
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.doCopyRecordsCommand
|
public int doCopyRecordsCommand(Script recScript, Map<String,Object> properties)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
if (record == null)
return DBConstants.ERROR_RETURN;
if (properties.get(PARENT_RECORD) != null)
{
Record recParent = recScript.getTargetRecord(properties, PARENT_RECORD);
if (recParent != null)
record.addListener(new SubFileFilter(recParent));
}
Record recDestination = recScript.getTargetRecord(properties, Script.DESTINATION_RECORD);
try {
record.close();
while (record.hasNext())
{
record.next();
recDestination.addNew();
recDestination.setAutoSequence(false);
iErrorCode = this.doSubScriptCommands(recScript, properties);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
if (recDestination.getCounterField().isNull())
recDestination.setAutoSequence(true);
try {
recDestination.add();
} catch (DBException ex) {
// Ignore duplicate records
}
}
} catch (DBException ex) {
ex.printStackTrace();
}
return DONT_READ_SUB_SCRIPT;
}
|
java
|
public int doCopyRecordsCommand(Script recScript, Map<String,Object> properties)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
if (record == null)
return DBConstants.ERROR_RETURN;
if (properties.get(PARENT_RECORD) != null)
{
Record recParent = recScript.getTargetRecord(properties, PARENT_RECORD);
if (recParent != null)
record.addListener(new SubFileFilter(recParent));
}
Record recDestination = recScript.getTargetRecord(properties, Script.DESTINATION_RECORD);
try {
record.close();
while (record.hasNext())
{
record.next();
recDestination.addNew();
recDestination.setAutoSequence(false);
iErrorCode = this.doSubScriptCommands(recScript, properties);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
if (recDestination.getCounterField().isNull())
recDestination.setAutoSequence(true);
try {
recDestination.add();
} catch (DBException ex) {
// Ignore duplicate records
}
}
} catch (DBException ex) {
ex.printStackTrace();
}
return DONT_READ_SUB_SCRIPT;
}
|
[
"public",
"int",
"doCopyRecordsCommand",
"(",
"Script",
"recScript",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"int",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"Record",
"record",
"=",
"recScript",
".",
"getTargetRecord",
"(",
"properties",
",",
"DBParams",
".",
"RECORD",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"if",
"(",
"properties",
".",
"get",
"(",
"PARENT_RECORD",
")",
"!=",
"null",
")",
"{",
"Record",
"recParent",
"=",
"recScript",
".",
"getTargetRecord",
"(",
"properties",
",",
"PARENT_RECORD",
")",
";",
"if",
"(",
"recParent",
"!=",
"null",
")",
"record",
".",
"addListener",
"(",
"new",
"SubFileFilter",
"(",
"recParent",
")",
")",
";",
"}",
"Record",
"recDestination",
"=",
"recScript",
".",
"getTargetRecord",
"(",
"properties",
",",
"Script",
".",
"DESTINATION_RECORD",
")",
";",
"try",
"{",
"record",
".",
"close",
"(",
")",
";",
"while",
"(",
"record",
".",
"hasNext",
"(",
")",
")",
"{",
"record",
".",
"next",
"(",
")",
";",
"recDestination",
".",
"addNew",
"(",
")",
";",
"recDestination",
".",
"setAutoSequence",
"(",
"false",
")",
";",
"iErrorCode",
"=",
"this",
".",
"doSubScriptCommands",
"(",
"recScript",
",",
"properties",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"return",
"iErrorCode",
";",
"if",
"(",
"recDestination",
".",
"getCounterField",
"(",
")",
".",
"isNull",
"(",
")",
")",
"recDestination",
".",
"setAutoSequence",
"(",
"true",
")",
";",
"try",
"{",
"recDestination",
".",
"add",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"// Ignore duplicate records",
"}",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"DONT_READ_SUB_SCRIPT",
";",
"}"
] |
DoCopyRecordsCommand Method.
|
[
"DoCopyRecordsCommand",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L249-L284
|
153,126
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.doCopyFieldsCommand
|
public int doCopyFieldsCommand(Script recScript, Map<String,Object> properties)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
Record recSource = recScript.getTargetRecord(properties, DBParams.RECORD);
if (recSource == null)
return DBConstants.ERROR_RETURN;
Record recDestination = recScript.getTargetRecord(properties, Script.DESTINATION_RECORD);
if (recDestination == null)
return DBConstants.ERROR_RETURN;
String strSourceField = (String)properties.get(Script.SOURCE_PARAM);
String strDestField = (String)properties.get(Script.DESTINATION_PARAM);
if (strDestField == null)
strDestField = strSourceField;
if (strSourceField == null)
return DBConstants.ERROR_RETURN;
BaseField fldSource = recSource.getField(strSourceField);
BaseField fldDest = recDestination.getField(strDestField);
if ((fldSource == null) || (fldDest == null))
return DBConstants.ERROR_RETURN;
iErrorCode = fldDest.moveFieldToThis(fldSource);
return iErrorCode;
}
|
java
|
public int doCopyFieldsCommand(Script recScript, Map<String,Object> properties)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
Record recSource = recScript.getTargetRecord(properties, DBParams.RECORD);
if (recSource == null)
return DBConstants.ERROR_RETURN;
Record recDestination = recScript.getTargetRecord(properties, Script.DESTINATION_RECORD);
if (recDestination == null)
return DBConstants.ERROR_RETURN;
String strSourceField = (String)properties.get(Script.SOURCE_PARAM);
String strDestField = (String)properties.get(Script.DESTINATION_PARAM);
if (strDestField == null)
strDestField = strSourceField;
if (strSourceField == null)
return DBConstants.ERROR_RETURN;
BaseField fldSource = recSource.getField(strSourceField);
BaseField fldDest = recDestination.getField(strDestField);
if ((fldSource == null) || (fldDest == null))
return DBConstants.ERROR_RETURN;
iErrorCode = fldDest.moveFieldToThis(fldSource);
return iErrorCode;
}
|
[
"public",
"int",
"doCopyFieldsCommand",
"(",
"Script",
"recScript",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"int",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"Record",
"recSource",
"=",
"recScript",
".",
"getTargetRecord",
"(",
"properties",
",",
"DBParams",
".",
"RECORD",
")",
";",
"if",
"(",
"recSource",
"==",
"null",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"Record",
"recDestination",
"=",
"recScript",
".",
"getTargetRecord",
"(",
"properties",
",",
"Script",
".",
"DESTINATION_RECORD",
")",
";",
"if",
"(",
"recDestination",
"==",
"null",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"String",
"strSourceField",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"Script",
".",
"SOURCE_PARAM",
")",
";",
"String",
"strDestField",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"Script",
".",
"DESTINATION_PARAM",
")",
";",
"if",
"(",
"strDestField",
"==",
"null",
")",
"strDestField",
"=",
"strSourceField",
";",
"if",
"(",
"strSourceField",
"==",
"null",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"BaseField",
"fldSource",
"=",
"recSource",
".",
"getField",
"(",
"strSourceField",
")",
";",
"BaseField",
"fldDest",
"=",
"recDestination",
".",
"getField",
"(",
"strDestField",
")",
";",
"if",
"(",
"(",
"fldSource",
"==",
"null",
")",
"||",
"(",
"fldDest",
"==",
"null",
")",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"iErrorCode",
"=",
"fldDest",
".",
"moveFieldToThis",
"(",
"fldSource",
")",
";",
"return",
"iErrorCode",
";",
"}"
] |
DoCopyFieldsCommand Method.
|
[
"DoCopyFieldsCommand",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L288-L309
|
153,127
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.doCopyDataCommand
|
public int doCopyDataCommand(Script recScript, Map<String,Object> properties)
{
String strURL = (String)properties.get(Script.SOURCE_PARAM);
String strDest = (String)properties.get(Script.DESTINATION_PARAM);
if ((strURL != null) && (strDest != null))
Utility.transferURLStream(strURL, strDest);
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int doCopyDataCommand(Script recScript, Map<String,Object> properties)
{
String strURL = (String)properties.get(Script.SOURCE_PARAM);
String strDest = (String)properties.get(Script.DESTINATION_PARAM);
if ((strURL != null) && (strDest != null))
Utility.transferURLStream(strURL, strDest);
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"doCopyDataCommand",
"(",
"Script",
"recScript",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strURL",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"Script",
".",
"SOURCE_PARAM",
")",
";",
"String",
"strDest",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"Script",
".",
"DESTINATION_PARAM",
")",
";",
"if",
"(",
"(",
"strURL",
"!=",
"null",
")",
"&&",
"(",
"strDest",
"!=",
"null",
")",
")",
"Utility",
".",
"transferURLStream",
"(",
"strURL",
",",
"strDest",
")",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
DoCopyDataCommand Method.
|
[
"DoCopyDataCommand",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L320-L327
|
153,128
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.runDetail
|
public void runDetail()
{
Record recReplication = this.getMainRecord();
if ((recReplication.getEditMode() == DBConstants.EDIT_NONE)
|| (recReplication.getEditMode() == DBConstants.EDIT_ADD))
recReplication.getField(Script.ID).setValue(0);
String strSourcePath = "";
String strDestPath = "";
this.processDetail(recReplication, strSourcePath, strDestPath);
}
|
java
|
public void runDetail()
{
Record recReplication = this.getMainRecord();
if ((recReplication.getEditMode() == DBConstants.EDIT_NONE)
|| (recReplication.getEditMode() == DBConstants.EDIT_ADD))
recReplication.getField(Script.ID).setValue(0);
String strSourcePath = "";
String strDestPath = "";
this.processDetail(recReplication, strSourcePath, strDestPath);
}
|
[
"public",
"void",
"runDetail",
"(",
")",
"{",
"Record",
"recReplication",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"(",
"recReplication",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_NONE",
")",
"||",
"(",
"recReplication",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_ADD",
")",
")",
"recReplication",
".",
"getField",
"(",
"Script",
".",
"ID",
")",
".",
"setValue",
"(",
"0",
")",
";",
"String",
"strSourcePath",
"=",
"\"\"",
";",
"String",
"strDestPath",
"=",
"\"\"",
";",
"this",
".",
"processDetail",
"(",
"recReplication",
",",
"strSourcePath",
",",
"strDestPath",
")",
";",
"}"
] |
RunDetail Method.
|
[
"RunDetail",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L331-L340
|
153,129
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java
|
RunScriptProcess.processDetail
|
public boolean processDetail(Record parent, String strSourcePath, String strDestPath)
{
boolean bSubsExist = false;
String strName;
Script recReplication = new Script(this);
recReplication.setKeyArea(Script.PARENT_FOLDER_ID_KEY);
recReplication.addListener(new SubFileFilter(parent));
try {
strName = parent.getField(Script.NAME).toString();
while (recReplication.hasNext())
{ // Read through the pictures and create an index
recReplication.next();
bSubsExist = true;
strName = recReplication.getField(Script.NAME).toString();
String strSource = recReplication.getField(Script.SOURCE_PARAM).toString();
String strDestination = recReplication.getField(Script.DESTINATION_PARAM).toString();
strSource = strSourcePath + strSource;
strDestination = strDestPath + strDestination;
this.processDetail(recReplication, strSource, strDestination);
}
recReplication.close();
} catch (DBException ex) {
ex.printStackTrace();
}
if (strSourcePath.length() > 0)
if (Character.isLetterOrDigit(strSourcePath.charAt(strSourcePath.length() - 1)))
{
System.out.println("From: " + strSourcePath + " To: " + strDestPath);
File fileSource = new File(strSourcePath);
File fileDest = new File(strDestPath);
if (fileSource.exists())
{
if (fileDest.exists())
fileDest.delete();
else
System.out.println("Target doesn't exist: " + strSourcePath);
try {
FileInputStream inStream = new FileInputStream(fileSource);
FileOutputStream outStream = new FileOutputStream(fileDest);
org.jbundle.jbackup.util.Util.copyStream(inStream, outStream);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
return bSubsExist;
}
|
java
|
public boolean processDetail(Record parent, String strSourcePath, String strDestPath)
{
boolean bSubsExist = false;
String strName;
Script recReplication = new Script(this);
recReplication.setKeyArea(Script.PARENT_FOLDER_ID_KEY);
recReplication.addListener(new SubFileFilter(parent));
try {
strName = parent.getField(Script.NAME).toString();
while (recReplication.hasNext())
{ // Read through the pictures and create an index
recReplication.next();
bSubsExist = true;
strName = recReplication.getField(Script.NAME).toString();
String strSource = recReplication.getField(Script.SOURCE_PARAM).toString();
String strDestination = recReplication.getField(Script.DESTINATION_PARAM).toString();
strSource = strSourcePath + strSource;
strDestination = strDestPath + strDestination;
this.processDetail(recReplication, strSource, strDestination);
}
recReplication.close();
} catch (DBException ex) {
ex.printStackTrace();
}
if (strSourcePath.length() > 0)
if (Character.isLetterOrDigit(strSourcePath.charAt(strSourcePath.length() - 1)))
{
System.out.println("From: " + strSourcePath + " To: " + strDestPath);
File fileSource = new File(strSourcePath);
File fileDest = new File(strDestPath);
if (fileSource.exists())
{
if (fileDest.exists())
fileDest.delete();
else
System.out.println("Target doesn't exist: " + strSourcePath);
try {
FileInputStream inStream = new FileInputStream(fileSource);
FileOutputStream outStream = new FileOutputStream(fileDest);
org.jbundle.jbackup.util.Util.copyStream(inStream, outStream);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
return bSubsExist;
}
|
[
"public",
"boolean",
"processDetail",
"(",
"Record",
"parent",
",",
"String",
"strSourcePath",
",",
"String",
"strDestPath",
")",
"{",
"boolean",
"bSubsExist",
"=",
"false",
";",
"String",
"strName",
";",
"Script",
"recReplication",
"=",
"new",
"Script",
"(",
"this",
")",
";",
"recReplication",
".",
"setKeyArea",
"(",
"Script",
".",
"PARENT_FOLDER_ID_KEY",
")",
";",
"recReplication",
".",
"addListener",
"(",
"new",
"SubFileFilter",
"(",
"parent",
")",
")",
";",
"try",
"{",
"strName",
"=",
"parent",
".",
"getField",
"(",
"Script",
".",
"NAME",
")",
".",
"toString",
"(",
")",
";",
"while",
"(",
"recReplication",
".",
"hasNext",
"(",
")",
")",
"{",
"// Read through the pictures and create an index",
"recReplication",
".",
"next",
"(",
")",
";",
"bSubsExist",
"=",
"true",
";",
"strName",
"=",
"recReplication",
".",
"getField",
"(",
"Script",
".",
"NAME",
")",
".",
"toString",
"(",
")",
";",
"String",
"strSource",
"=",
"recReplication",
".",
"getField",
"(",
"Script",
".",
"SOURCE_PARAM",
")",
".",
"toString",
"(",
")",
";",
"String",
"strDestination",
"=",
"recReplication",
".",
"getField",
"(",
"Script",
".",
"DESTINATION_PARAM",
")",
".",
"toString",
"(",
")",
";",
"strSource",
"=",
"strSourcePath",
"+",
"strSource",
";",
"strDestination",
"=",
"strDestPath",
"+",
"strDestination",
";",
"this",
".",
"processDetail",
"(",
"recReplication",
",",
"strSource",
",",
"strDestination",
")",
";",
"}",
"recReplication",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"if",
"(",
"strSourcePath",
".",
"length",
"(",
")",
">",
"0",
")",
"if",
"(",
"Character",
".",
"isLetterOrDigit",
"(",
"strSourcePath",
".",
"charAt",
"(",
"strSourcePath",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"From: \"",
"+",
"strSourcePath",
"+",
"\" To: \"",
"+",
"strDestPath",
")",
";",
"File",
"fileSource",
"=",
"new",
"File",
"(",
"strSourcePath",
")",
";",
"File",
"fileDest",
"=",
"new",
"File",
"(",
"strDestPath",
")",
";",
"if",
"(",
"fileSource",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"fileDest",
".",
"exists",
"(",
")",
")",
"fileDest",
".",
"delete",
"(",
")",
";",
"else",
"System",
".",
"out",
".",
"println",
"(",
"\"Target doesn't exist: \"",
"+",
"strSourcePath",
")",
";",
"try",
"{",
"FileInputStream",
"inStream",
"=",
"new",
"FileInputStream",
"(",
"fileSource",
")",
";",
"FileOutputStream",
"outStream",
"=",
"new",
"FileOutputStream",
"(",
"fileDest",
")",
";",
"org",
".",
"jbundle",
".",
"jbackup",
".",
"util",
".",
"Util",
".",
"copyStream",
"(",
"inStream",
",",
"outStream",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"return",
"bSubsExist",
";",
"}"
] |
ProcessDetail Method.
|
[
"ProcessDetail",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/RunScriptProcess.java#L344-L392
|
153,130
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/message/record/RecordMessage.java
|
RecordMessage.convertToThinMessage
|
public BaseMessage convertToThinMessage()
{
int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType();
// See if this record is currently displayed or buffered, if so, refresh and display.
Object data = this.getData();
BaseMessage messageTableUpdate = null;
// NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession
// if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)
{
BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this);
messageTableUpdate = new MapMessage(messageHeader, data);
messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType));
}
return messageTableUpdate;
}
|
java
|
public BaseMessage convertToThinMessage()
{
int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType();
// See if this record is currently displayed or buffered, if so, refresh and display.
Object data = this.getData();
BaseMessage messageTableUpdate = null;
// NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession
// if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)
{
BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this);
messageTableUpdate = new MapMessage(messageHeader, data);
messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType));
}
return messageTableUpdate;
}
|
[
"public",
"BaseMessage",
"convertToThinMessage",
"(",
")",
"{",
"int",
"iChangeType",
"=",
"(",
"(",
"RecordMessageHeader",
")",
"this",
".",
"getMessageHeader",
"(",
")",
")",
".",
"getRecordMessageType",
"(",
")",
";",
"// See if this record is currently displayed or buffered, if so, refresh and display.",
"Object",
"data",
"=",
"this",
".",
"getData",
"(",
")",
";",
"BaseMessage",
"messageTableUpdate",
"=",
"null",
";",
"// NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession",
"// if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)",
"{",
"BaseMessageHeader",
"messageHeader",
"=",
"new",
"SessionMessageHeader",
"(",
"this",
".",
"getMessageHeader",
"(",
")",
".",
"getQueueName",
"(",
")",
",",
"this",
".",
"getMessageHeader",
"(",
")",
".",
"getQueueType",
"(",
")",
",",
"null",
",",
"this",
")",
";",
"messageTableUpdate",
"=",
"new",
"MapMessage",
"(",
"messageHeader",
",",
"data",
")",
";",
"messageTableUpdate",
".",
"put",
"(",
"MessageConstants",
".",
"MESSAGE_TYPE_PARAM",
",",
"Integer",
".",
"toString",
"(",
"iChangeType",
")",
")",
";",
"}",
"return",
"messageTableUpdate",
";",
"}"
] |
If you are sending a thick message to a thin client, convert it first.
Since BaseMessage is already, so conversion is necessary... return this message.
@return this message.
|
[
"If",
"you",
"are",
"sending",
"a",
"thick",
"message",
"to",
"a",
"thin",
"client",
"convert",
"it",
"first",
".",
"Since",
"BaseMessage",
"is",
"already",
"so",
"conversion",
"is",
"necessary",
"...",
"return",
"this",
"message",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/RecordMessage.java#L80-L95
|
153,131
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/opt/SBlinkImageView.java
|
SBlinkImageView.getImageIcon
|
public Object getImageIcon(Object value)
{
int index = 0;
if (value instanceof Integer)
index = ((Integer)value).intValue();
else if (value != null)
{
try {
index = Integer.parseInt(value.toString());
} catch (NumberFormatException ex) {
}
}
return this.getIcon(index);
}
|
java
|
public Object getImageIcon(Object value)
{
int index = 0;
if (value instanceof Integer)
index = ((Integer)value).intValue();
else if (value != null)
{
try {
index = Integer.parseInt(value.toString());
} catch (NumberFormatException ex) {
}
}
return this.getIcon(index);
}
|
[
"public",
"Object",
"getImageIcon",
"(",
"Object",
"value",
")",
"{",
"int",
"index",
"=",
"0",
";",
"if",
"(",
"value",
"instanceof",
"Integer",
")",
"index",
"=",
"(",
"(",
"Integer",
")",
"value",
")",
".",
"intValue",
"(",
")",
";",
"else",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"index",
"=",
"Integer",
".",
"parseInt",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"}",
"}",
"return",
"this",
".",
"getIcon",
"(",
"index",
")",
";",
"}"
] |
Get the icon at this location.
@param value
@return
|
[
"Get",
"the",
"icon",
"at",
"this",
"location",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/opt/SBlinkImageView.java#L98-L111
|
153,132
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/opt/SBlinkImageView.java
|
SBlinkImageView.addIcon
|
public void addIcon(Object icon, int iIndex)
{
m_rgIcons[iIndex] = icon;
if (this.getScreenFieldView().getControl() instanceof ExtendedComponent) // Always
((ExtendedComponent)this.getScreenFieldView().getControl()).addIcon(icon, iIndex);
}
|
java
|
public void addIcon(Object icon, int iIndex)
{
m_rgIcons[iIndex] = icon;
if (this.getScreenFieldView().getControl() instanceof ExtendedComponent) // Always
((ExtendedComponent)this.getScreenFieldView().getControl()).addIcon(icon, iIndex);
}
|
[
"public",
"void",
"addIcon",
"(",
"Object",
"icon",
",",
"int",
"iIndex",
")",
"{",
"m_rgIcons",
"[",
"iIndex",
"]",
"=",
"icon",
";",
"if",
"(",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"getControl",
"(",
")",
"instanceof",
"ExtendedComponent",
")",
"// Always",
"(",
"(",
"ExtendedComponent",
")",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"getControl",
"(",
")",
")",
".",
"addIcon",
"(",
"icon",
",",
"iIndex",
")",
";",
"}"
] |
Add an Icon to the Icon list.
@param iIndex The icon's index.
@param icon The icon at this index.
|
[
"Add",
"an",
"Icon",
"to",
"the",
"Icon",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/opt/SBlinkImageView.java#L117-L122
|
153,133
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/logic/Expression.java
|
Expression.copy
|
private void copy(Expression expression) {
this.operator = expression.operator;
this.elementsArray = expression.elementsArray;
this.elements = expression.elements;
}
|
java
|
private void copy(Expression expression) {
this.operator = expression.operator;
this.elementsArray = expression.elementsArray;
this.elements = expression.elements;
}
|
[
"private",
"void",
"copy",
"(",
"Expression",
"expression",
")",
"{",
"this",
".",
"operator",
"=",
"expression",
".",
"operator",
";",
"this",
".",
"elementsArray",
"=",
"expression",
".",
"elementsArray",
";",
"this",
".",
"elements",
"=",
"expression",
".",
"elements",
";",
"}"
] |
Copies contents of given expression into this one.
@param expression
|
[
"Copies",
"contents",
"of",
"given",
"expression",
"into",
"this",
"one",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/logic/Expression.java#L44-L48
|
153,134
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/logic/Expression.java
|
Expression.addStatement
|
private boolean addStatement(StringBuffer statementBuffer) {
if (statementBuffer.length() > 0) {
elements.add(new Predicate(statementBuffer.toString()));
elementsArray = elements.toArray();
statementBuffer.delete(0, statementBuffer.length());
return true;
}
return false;
}
|
java
|
private boolean addStatement(StringBuffer statementBuffer) {
if (statementBuffer.length() > 0) {
elements.add(new Predicate(statementBuffer.toString()));
elementsArray = elements.toArray();
statementBuffer.delete(0, statementBuffer.length());
return true;
}
return false;
}
|
[
"private",
"boolean",
"addStatement",
"(",
"StringBuffer",
"statementBuffer",
")",
"{",
"if",
"(",
"statementBuffer",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"elements",
".",
"add",
"(",
"new",
"Predicate",
"(",
"statementBuffer",
".",
"toString",
"(",
")",
")",
")",
";",
"elementsArray",
"=",
"elements",
".",
"toArray",
"(",
")",
";",
"statementBuffer",
".",
"delete",
"(",
"0",
",",
"statementBuffer",
".",
"length",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Adds a new statement to this Expression's elements.
Clears the statementBuffer.
@param statementBuffer
@return
|
[
"Adds",
"a",
"new",
"statement",
"to",
"this",
"Expression",
"s",
"elements",
".",
"Clears",
"the",
"statementBuffer",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/logic/Expression.java#L272-L280
|
153,135
|
jbundle/jbundle
|
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java
|
HScreenField.printHtmlControlDesc
|
public void printHtmlControlDesc(PrintWriter out, String strFieldDesc, int iHtmlAttributes)
{
if ((iHtmlAttributes & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0)
out.println("<td align=\"right\">" + strFieldDesc + "</td>");
}
|
java
|
public void printHtmlControlDesc(PrintWriter out, String strFieldDesc, int iHtmlAttributes)
{
if ((iHtmlAttributes & HtmlConstants.HTML_ADD_DESC_COLUMN) != 0)
out.println("<td align=\"right\">" + strFieldDesc + "</td>");
}
|
[
"public",
"void",
"printHtmlControlDesc",
"(",
"PrintWriter",
"out",
",",
"String",
"strFieldDesc",
",",
"int",
"iHtmlAttributes",
")",
"{",
"if",
"(",
"(",
"iHtmlAttributes",
"&",
"HtmlConstants",
".",
"HTML_ADD_DESC_COLUMN",
")",
"!=",
"0",
")",
"out",
".",
"println",
"(",
"\"<td align=\\\"right\\\">\"",
"+",
"strFieldDesc",
"+",
"\"</td>\"",
")",
";",
"}"
] |
display this field's description in html format.
@param out The html out stream.
@param strFieldDesc The field description.
@param iHtmlAttribures The attributes.
|
[
"display",
"this",
"field",
"s",
"description",
"in",
"html",
"format",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java#L76-L80
|
153,136
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java
|
ReadSecondaryHandler.init
|
public void init(BaseField field, Record record, String keyAreaName, boolean bCloseOnFree, boolean bUpdateRecord, boolean bAllowNull)
{
super.init(field);
m_record = record;
this.keyAreaName = keyAreaName;
m_keyField = null;
m_bCloseOnFree = bCloseOnFree;
m_bUpdateRecord = bUpdateRecord;
m_bAllowNull = bAllowNull;
m_bMoveBehavior = false;
m_record.addListener(new FileRemoveBOnCloseHandler(this)); // Remove this if you close the file first
if (m_bUpdateRecord)
{
if ((m_record.getOpenMode() & DBConstants.LOCK_TYPE_MASK) == 0) // If there is no lock strategy or type, set one.
if (m_record.getTask() != null)
m_record.setOpenMode(m_record.getOpenMode() | m_record.getTask().getDefaultLockType(m_record.getDatabaseType()));
}
else
m_record.setOpenMode(DBConstants.OPEN_READ_ONLY); // Dont Lock the record if any changes (Also caches records).
}
|
java
|
public void init(BaseField field, Record record, String keyAreaName, boolean bCloseOnFree, boolean bUpdateRecord, boolean bAllowNull)
{
super.init(field);
m_record = record;
this.keyAreaName = keyAreaName;
m_keyField = null;
m_bCloseOnFree = bCloseOnFree;
m_bUpdateRecord = bUpdateRecord;
m_bAllowNull = bAllowNull;
m_bMoveBehavior = false;
m_record.addListener(new FileRemoveBOnCloseHandler(this)); // Remove this if you close the file first
if (m_bUpdateRecord)
{
if ((m_record.getOpenMode() & DBConstants.LOCK_TYPE_MASK) == 0) // If there is no lock strategy or type, set one.
if (m_record.getTask() != null)
m_record.setOpenMode(m_record.getOpenMode() | m_record.getTask().getDefaultLockType(m_record.getDatabaseType()));
}
else
m_record.setOpenMode(DBConstants.OPEN_READ_ONLY); // Dont Lock the record if any changes (Also caches records).
}
|
[
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"Record",
"record",
",",
"String",
"keyAreaName",
",",
"boolean",
"bCloseOnFree",
",",
"boolean",
"bUpdateRecord",
",",
"boolean",
"bAllowNull",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"m_record",
"=",
"record",
";",
"this",
".",
"keyAreaName",
"=",
"keyAreaName",
";",
"m_keyField",
"=",
"null",
";",
"m_bCloseOnFree",
"=",
"bCloseOnFree",
";",
"m_bUpdateRecord",
"=",
"bUpdateRecord",
";",
"m_bAllowNull",
"=",
"bAllowNull",
";",
"m_bMoveBehavior",
"=",
"false",
";",
"m_record",
".",
"addListener",
"(",
"new",
"FileRemoveBOnCloseHandler",
"(",
"this",
")",
")",
";",
"// Remove this if you close the file first",
"if",
"(",
"m_bUpdateRecord",
")",
"{",
"if",
"(",
"(",
"m_record",
".",
"getOpenMode",
"(",
")",
"&",
"DBConstants",
".",
"LOCK_TYPE_MASK",
")",
"==",
"0",
")",
"// If there is no lock strategy or type, set one.",
"if",
"(",
"m_record",
".",
"getTask",
"(",
")",
"!=",
"null",
")",
"m_record",
".",
"setOpenMode",
"(",
"m_record",
".",
"getOpenMode",
"(",
")",
"|",
"m_record",
".",
"getTask",
"(",
")",
".",
"getDefaultLockType",
"(",
"m_record",
".",
"getDatabaseType",
"(",
")",
")",
")",
";",
"}",
"else",
"m_record",
".",
"setOpenMode",
"(",
"DBConstants",
".",
"OPEN_READ_ONLY",
")",
";",
"// Dont Lock the record if any changes (Also caches records).",
"}"
] |
Initialize this listener.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param record The secondary record that this field triggers a read to.
@param iQueryKeyArea The key area in the secondary record to read from.
@param bCloseOnFree Close the record when this behavior is removed?
@param bUpdateRecord Update the secondary record before reading (if it has changed)?
@param bAllowNull If true, a null field value will trigger a new record; if false a key not found error.
|
[
"Initialize",
"this",
"listener",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L112-L132
|
153,137
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java
|
ReadSecondaryHandler.setOwner
|
public void setOwner(ListenerOwner owner)
{
super.setOwner(owner);
if (owner != null)
{
MoveOnValidHandler moveBehavior = null;
m_record.setOpenMode(m_record.getOpenMode() | DBConstants.OPEN_CACHE_RECORDS); // Cache recently used records.
m_bMoveBehavior = false; // This flag is set automatically if the Valid record listener has to be used
ReadSecondaryHandler listenerDup = (ReadSecondaryHandler)this.getOwner().getListener(this.getClass());
while ((listenerDup != this) && (listenerDup != null))
{
if (listenerDup.getRecord() == this.getRecord())
if (listenerDup.getActualKeyArea() == this.getActualKeyArea())
{
listenerDup.setRecord(null);
this.getOwner().removeListener(listenerDup, true); // Make sure there is only one
break;
}
listenerDup = (ReadSecondaryHandler)listenerDup.getListener(this.getClass());
}
this.fieldChanged(DBConstants.DISPLAY, DBConstants.READ_MOVE); // SCREEN_MOVE says this is coming from here
if (owner instanceof ReferenceField)
{
m_keyField = m_record.getKeyArea(keyAreaName).getField(DBConstants.MAIN_KEY_FIELD); // Handle field (note - null keyAreaName -> counter field)
moveBehavior = new MoveOnValidHandler(((BaseField)owner), m_keyField, null, true, true); // Its okay to sync the key with references
m_keyField = null;
}
else
{
MainReadOnlyHandler listener = new MainReadOnlyHandler(keyAreaName);
m_keyField = m_record.getKeyArea(keyAreaName).getField(DBConstants.MAIN_KEY_FIELD);
m_keyField.addListener(listener); // Make sure this field has the BaseListener to read it's file
// Make sure you move the key field to this field!!
moveBehavior = new MoveOnValidHandler(((BaseField)owner), m_keyField, null, false, true);
}
m_record.addListener(moveBehavior);
}
else
{
if (m_bCloseOnFree) if (this.getDependentListener() != null) // If close and file is still open
{
this.setDependentListener(null); // If case you want to delete me!
if (m_record != null)
m_record.free(); // File is still open, and my listener is still there, close it!
}
m_record = null;
m_keyField = null;
}
}
|
java
|
public void setOwner(ListenerOwner owner)
{
super.setOwner(owner);
if (owner != null)
{
MoveOnValidHandler moveBehavior = null;
m_record.setOpenMode(m_record.getOpenMode() | DBConstants.OPEN_CACHE_RECORDS); // Cache recently used records.
m_bMoveBehavior = false; // This flag is set automatically if the Valid record listener has to be used
ReadSecondaryHandler listenerDup = (ReadSecondaryHandler)this.getOwner().getListener(this.getClass());
while ((listenerDup != this) && (listenerDup != null))
{
if (listenerDup.getRecord() == this.getRecord())
if (listenerDup.getActualKeyArea() == this.getActualKeyArea())
{
listenerDup.setRecord(null);
this.getOwner().removeListener(listenerDup, true); // Make sure there is only one
break;
}
listenerDup = (ReadSecondaryHandler)listenerDup.getListener(this.getClass());
}
this.fieldChanged(DBConstants.DISPLAY, DBConstants.READ_MOVE); // SCREEN_MOVE says this is coming from here
if (owner instanceof ReferenceField)
{
m_keyField = m_record.getKeyArea(keyAreaName).getField(DBConstants.MAIN_KEY_FIELD); // Handle field (note - null keyAreaName -> counter field)
moveBehavior = new MoveOnValidHandler(((BaseField)owner), m_keyField, null, true, true); // Its okay to sync the key with references
m_keyField = null;
}
else
{
MainReadOnlyHandler listener = new MainReadOnlyHandler(keyAreaName);
m_keyField = m_record.getKeyArea(keyAreaName).getField(DBConstants.MAIN_KEY_FIELD);
m_keyField.addListener(listener); // Make sure this field has the BaseListener to read it's file
// Make sure you move the key field to this field!!
moveBehavior = new MoveOnValidHandler(((BaseField)owner), m_keyField, null, false, true);
}
m_record.addListener(moveBehavior);
}
else
{
if (m_bCloseOnFree) if (this.getDependentListener() != null) // If close and file is still open
{
this.setDependentListener(null); // If case you want to delete me!
if (m_record != null)
m_record.free(); // File is still open, and my listener is still there, close it!
}
m_record = null;
m_keyField = null;
}
}
|
[
"public",
"void",
"setOwner",
"(",
"ListenerOwner",
"owner",
")",
"{",
"super",
".",
"setOwner",
"(",
"owner",
")",
";",
"if",
"(",
"owner",
"!=",
"null",
")",
"{",
"MoveOnValidHandler",
"moveBehavior",
"=",
"null",
";",
"m_record",
".",
"setOpenMode",
"(",
"m_record",
".",
"getOpenMode",
"(",
")",
"|",
"DBConstants",
".",
"OPEN_CACHE_RECORDS",
")",
";",
"// Cache recently used records.",
"m_bMoveBehavior",
"=",
"false",
";",
"// This flag is set automatically if the Valid record listener has to be used",
"ReadSecondaryHandler",
"listenerDup",
"=",
"(",
"ReadSecondaryHandler",
")",
"this",
".",
"getOwner",
"(",
")",
".",
"getListener",
"(",
"this",
".",
"getClass",
"(",
")",
")",
";",
"while",
"(",
"(",
"listenerDup",
"!=",
"this",
")",
"&&",
"(",
"listenerDup",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"listenerDup",
".",
"getRecord",
"(",
")",
"==",
"this",
".",
"getRecord",
"(",
")",
")",
"if",
"(",
"listenerDup",
".",
"getActualKeyArea",
"(",
")",
"==",
"this",
".",
"getActualKeyArea",
"(",
")",
")",
"{",
"listenerDup",
".",
"setRecord",
"(",
"null",
")",
";",
"this",
".",
"getOwner",
"(",
")",
".",
"removeListener",
"(",
"listenerDup",
",",
"true",
")",
";",
"// Make sure there is only one",
"break",
";",
"}",
"listenerDup",
"=",
"(",
"ReadSecondaryHandler",
")",
"listenerDup",
".",
"getListener",
"(",
"this",
".",
"getClass",
"(",
")",
")",
";",
"}",
"this",
".",
"fieldChanged",
"(",
"DBConstants",
".",
"DISPLAY",
",",
"DBConstants",
".",
"READ_MOVE",
")",
";",
"// SCREEN_MOVE says this is coming from here",
"if",
"(",
"owner",
"instanceof",
"ReferenceField",
")",
"{",
"m_keyField",
"=",
"m_record",
".",
"getKeyArea",
"(",
"keyAreaName",
")",
".",
"getField",
"(",
"DBConstants",
".",
"MAIN_KEY_FIELD",
")",
";",
"// Handle field (note - null keyAreaName -> counter field)",
"moveBehavior",
"=",
"new",
"MoveOnValidHandler",
"(",
"(",
"(",
"BaseField",
")",
"owner",
")",
",",
"m_keyField",
",",
"null",
",",
"true",
",",
"true",
")",
";",
"// Its okay to sync the key with references",
"m_keyField",
"=",
"null",
";",
"}",
"else",
"{",
"MainReadOnlyHandler",
"listener",
"=",
"new",
"MainReadOnlyHandler",
"(",
"keyAreaName",
")",
";",
"m_keyField",
"=",
"m_record",
".",
"getKeyArea",
"(",
"keyAreaName",
")",
".",
"getField",
"(",
"DBConstants",
".",
"MAIN_KEY_FIELD",
")",
";",
"m_keyField",
".",
"addListener",
"(",
"listener",
")",
";",
"// Make sure this field has the BaseListener to read it's file",
"// Make sure you move the key field to this field!!",
"moveBehavior",
"=",
"new",
"MoveOnValidHandler",
"(",
"(",
"(",
"BaseField",
")",
"owner",
")",
",",
"m_keyField",
",",
"null",
",",
"false",
",",
"true",
")",
";",
"}",
"m_record",
".",
"addListener",
"(",
"moveBehavior",
")",
";",
"}",
"else",
"{",
"if",
"(",
"m_bCloseOnFree",
")",
"if",
"(",
"this",
".",
"getDependentListener",
"(",
")",
"!=",
"null",
")",
"// If close and file is still open",
"{",
"this",
".",
"setDependentListener",
"(",
"null",
")",
";",
"// If case you want to delete me!",
"if",
"(",
"m_record",
"!=",
"null",
")",
"m_record",
".",
"free",
"(",
")",
";",
"// File is still open, and my listener is still there, close it!",
"}",
"m_record",
"=",
"null",
";",
"m_keyField",
"=",
"null",
";",
"}",
"}"
] |
Set the field that owns this listener.
This method adds the methods that allow a record to read itself if the main key field is changed.
@owner The field that this listener is being added to (if null, this listener is being removed).
|
[
"Set",
"the",
"field",
"that",
"owns",
"this",
"listener",
".",
"This",
"method",
"adds",
"the",
"methods",
"that",
"allow",
"a",
"record",
"to",
"read",
"itself",
"if",
"the",
"main",
"key",
"field",
"is",
"changed",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L149-L201
|
153,138
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java
|
ReadSecondaryHandler.addFieldPair
|
public MoveOnValidHandler addFieldPair(BaseField fldDest, BaseField fldSource, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
MoveOnValidHandler moveBehavior = null;
if (convCheckMark != null) if (convCheckMark.getField() != null)
{
CheckMoveHandler listener = new CheckMoveHandler(fldDest, fldSource);
((BaseField)convCheckMark.getField()).addListener(listener); // Whenever changed, this.FieldChanged is called
}
if (bMoveToDependent)
{
m_bMoveBehavior = true;
moveBehavior = new MoveOnValidHandler(fldDest, fldSource, convCheckMark, true, true);
m_record.addListener(moveBehavior);
}
if (bMoveBackOnChange)
{
CopyFieldHandler listener = new CopyFieldHandler(fldSource, convBackconvCheckMark);
fldDest.addListener(listener); // Add this listener to the field
}
return moveBehavior;
}
|
java
|
public MoveOnValidHandler addFieldPair(BaseField fldDest, BaseField fldSource, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
MoveOnValidHandler moveBehavior = null;
if (convCheckMark != null) if (convCheckMark.getField() != null)
{
CheckMoveHandler listener = new CheckMoveHandler(fldDest, fldSource);
((BaseField)convCheckMark.getField()).addListener(listener); // Whenever changed, this.FieldChanged is called
}
if (bMoveToDependent)
{
m_bMoveBehavior = true;
moveBehavior = new MoveOnValidHandler(fldDest, fldSource, convCheckMark, true, true);
m_record.addListener(moveBehavior);
}
if (bMoveBackOnChange)
{
CopyFieldHandler listener = new CopyFieldHandler(fldSource, convBackconvCheckMark);
fldDest.addListener(listener); // Add this listener to the field
}
return moveBehavior;
}
|
[
"public",
"MoveOnValidHandler",
"addFieldPair",
"(",
"BaseField",
"fldDest",
",",
"BaseField",
"fldSource",
",",
"boolean",
"bMoveToDependent",
",",
"boolean",
"bMoveBackOnChange",
",",
"Converter",
"convCheckMark",
",",
"Converter",
"convBackconvCheckMark",
")",
"{",
"// BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es",
"MoveOnValidHandler",
"moveBehavior",
"=",
"null",
";",
"if",
"(",
"convCheckMark",
"!=",
"null",
")",
"if",
"(",
"convCheckMark",
".",
"getField",
"(",
")",
"!=",
"null",
")",
"{",
"CheckMoveHandler",
"listener",
"=",
"new",
"CheckMoveHandler",
"(",
"fldDest",
",",
"fldSource",
")",
";",
"(",
"(",
"BaseField",
")",
"convCheckMark",
".",
"getField",
"(",
")",
")",
".",
"addListener",
"(",
"listener",
")",
";",
"// Whenever changed, this.FieldChanged is called",
"}",
"if",
"(",
"bMoveToDependent",
")",
"{",
"m_bMoveBehavior",
"=",
"true",
";",
"moveBehavior",
"=",
"new",
"MoveOnValidHandler",
"(",
"fldDest",
",",
"fldSource",
",",
"convCheckMark",
",",
"true",
",",
"true",
")",
";",
"m_record",
".",
"addListener",
"(",
"moveBehavior",
")",
";",
"}",
"if",
"(",
"bMoveBackOnChange",
")",
"{",
"CopyFieldHandler",
"listener",
"=",
"new",
"CopyFieldHandler",
"(",
"fldSource",
",",
"convBackconvCheckMark",
")",
";",
"fldDest",
".",
"addListener",
"(",
"listener",
")",
";",
"// Add this listener to the field",
"}",
"return",
"moveBehavior",
";",
"}"
] |
Add a field source and dest.
@param fldDest The destination field.
@param fldSource The source field.
@param bMoveToDependent If true adds a MoveOnValidHandler to the secondary record.
@param bMoveBackOnChange If true, adds a CopyFieldHandler to the destination field (moves to the source).
@param convCheckMark Check mark to check before moving.
@param convBackconvCheckMark Check mark to check before moving back.
|
[
"Add",
"a",
"field",
"source",
"and",
"dest",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L211-L231
|
153,139
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java
|
ReadSecondaryHandler.addFieldSeqPair
|
public MoveOnValidHandler addFieldSeqPair(int iFieldSeq)
{
m_bMoveBehavior = true;
MoveOnValidHandler moveBehavior = new MoveOnValidHandler(this.getOwner().getRecord().getField(iFieldSeq));
m_record.addListener(moveBehavior);
return moveBehavior;
}
|
java
|
public MoveOnValidHandler addFieldSeqPair(int iFieldSeq)
{
m_bMoveBehavior = true;
MoveOnValidHandler moveBehavior = new MoveOnValidHandler(this.getOwner().getRecord().getField(iFieldSeq));
m_record.addListener(moveBehavior);
return moveBehavior;
}
|
[
"public",
"MoveOnValidHandler",
"addFieldSeqPair",
"(",
"int",
"iFieldSeq",
")",
"{",
"m_bMoveBehavior",
"=",
"true",
";",
"MoveOnValidHandler",
"moveBehavior",
"=",
"new",
"MoveOnValidHandler",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"iFieldSeq",
")",
")",
";",
"m_record",
".",
"addListener",
"(",
"moveBehavior",
")",
";",
"return",
"moveBehavior",
";",
"}"
] |
This method is specifically for making sure a handle is moved to this field on valid.
The field must be a ReferenceField.
@param iFieldSeq int On valid, move to this field.
|
[
"This",
"method",
"is",
"specifically",
"for",
"making",
"sure",
"a",
"handle",
"is",
"moved",
"to",
"this",
"field",
"on",
"valid",
".",
"The",
"field",
"must",
"be",
"a",
"ReferenceField",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L237-L243
|
153,140
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java
|
ReadSecondaryHandler.addFieldSeqPair
|
public MoveOnValidHandler addFieldSeqPair(int iDestFieldSeq, int iSourceFieldSeq, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
return this.addFieldPair(this.getOwner().getRecord().getField(iDestFieldSeq), m_record.getField(iSourceFieldSeq),
bMoveToDependent, bMoveBackOnChange, convCheckMark, convBackconvCheckMark);
}
|
java
|
public MoveOnValidHandler addFieldSeqPair(int iDestFieldSeq, int iSourceFieldSeq, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
return this.addFieldPair(this.getOwner().getRecord().getField(iDestFieldSeq), m_record.getField(iSourceFieldSeq),
bMoveToDependent, bMoveBackOnChange, convCheckMark, convBackconvCheckMark);
}
|
[
"public",
"MoveOnValidHandler",
"addFieldSeqPair",
"(",
"int",
"iDestFieldSeq",
",",
"int",
"iSourceFieldSeq",
",",
"boolean",
"bMoveToDependent",
",",
"boolean",
"bMoveBackOnChange",
",",
"Converter",
"convCheckMark",
",",
"Converter",
"convBackconvCheckMark",
")",
"{",
"// BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es",
"return",
"this",
".",
"addFieldPair",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"iDestFieldSeq",
")",
",",
"m_record",
".",
"getField",
"(",
"iSourceFieldSeq",
")",
",",
"bMoveToDependent",
",",
"bMoveBackOnChange",
",",
"convCheckMark",
",",
"convBackconvCheckMark",
")",
";",
"}"
] |
Add the set of fields that will move on a valid record.
@param iDestFieldSeq The destination field.
@param iSourceFieldSeq The source field.
@param bMoveToDependent If true adds a MoveOnValidHandler to the secondary record.
@param bMoveBackOnChange If true, adds a CopyFieldHandler to the destination field (moves to the source).
@param convCheckMark Check mark to check before moving.
@param convBackconvCheckMark Check mark to check before moving back.
|
[
"Add",
"the",
"set",
"of",
"fields",
"that",
"will",
"move",
"on",
"a",
"valid",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L264-L268
|
153,141
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java
|
ReadSecondaryHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
if (m_bUpdateRecord)
if (m_record.isModified())
{
try
{
if (m_record.getEditMode() == Constants.EDIT_IN_PROGRESS)
m_record.set();
else if (m_record.getEditMode() == Constants.EDIT_ADD)
m_record.add();
}
catch( DBException ex )
{
return ex.getErrorCode();
}
}
if (m_bMoveBehavior) if (m_keyField != null)
if ((iMoveMode == DBConstants.INIT_MOVE) || (iMoveMode == DBConstants.READ_MOVE))
m_keyField.setModified(true); // Force re-read and GetValid/GetNew listener to run
if (m_keyField == null)
{
int iHandleType = DBConstants.BOOKMARK_HANDLE;
iErrorCode = DBConstants.NORMAL_RETURN;
try
{
Object handle = this.getOwner().getData();
if ((handle == null)
|| ((this.getOwner() instanceof ReferenceField) && (((Integer)handle).intValue() == 0)))
{
if ((m_bAllowNull) || (iMoveMode != DBConstants.SCREEN_MOVE))
m_record.handleNewRecord(DBConstants.DISPLAY); //? Display Fields (Should leave record in an indeterminate state!)
else
iErrorCode = DBConstants.KEY_NOT_FOUND; // Can't have a null value
}
else
{
if (m_record.setHandle(handle, iHandleType) == null) // SCREEN_MOVE says this is coming from here
iErrorCode = DBConstants.KEY_NOT_FOUND;
else // Do all the field behaviors for the secondary record //x if (iMoveMode != DBConstants.READ_MOVE)
{
for (int i = 0; i < m_record.getFieldCount(); i++)
{
m_record.getField(i).handleFieldChanged(bDisplayOption, DBConstants.READ_MOVE); // Make sure all fields of the secondary record get this change notification
}
}
}
} catch (DBException ex) {
iErrorCode = ex.getErrorCode();
}
}
else
iErrorCode = m_keyField.moveFieldToThis(this.getOwner(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // SCREEN_MOVE says this is coming from here
return iErrorCode;
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
if (m_bUpdateRecord)
if (m_record.isModified())
{
try
{
if (m_record.getEditMode() == Constants.EDIT_IN_PROGRESS)
m_record.set();
else if (m_record.getEditMode() == Constants.EDIT_ADD)
m_record.add();
}
catch( DBException ex )
{
return ex.getErrorCode();
}
}
if (m_bMoveBehavior) if (m_keyField != null)
if ((iMoveMode == DBConstants.INIT_MOVE) || (iMoveMode == DBConstants.READ_MOVE))
m_keyField.setModified(true); // Force re-read and GetValid/GetNew listener to run
if (m_keyField == null)
{
int iHandleType = DBConstants.BOOKMARK_HANDLE;
iErrorCode = DBConstants.NORMAL_RETURN;
try
{
Object handle = this.getOwner().getData();
if ((handle == null)
|| ((this.getOwner() instanceof ReferenceField) && (((Integer)handle).intValue() == 0)))
{
if ((m_bAllowNull) || (iMoveMode != DBConstants.SCREEN_MOVE))
m_record.handleNewRecord(DBConstants.DISPLAY); //? Display Fields (Should leave record in an indeterminate state!)
else
iErrorCode = DBConstants.KEY_NOT_FOUND; // Can't have a null value
}
else
{
if (m_record.setHandle(handle, iHandleType) == null) // SCREEN_MOVE says this is coming from here
iErrorCode = DBConstants.KEY_NOT_FOUND;
else // Do all the field behaviors for the secondary record //x if (iMoveMode != DBConstants.READ_MOVE)
{
for (int i = 0; i < m_record.getFieldCount(); i++)
{
m_record.getField(i).handleFieldChanged(bDisplayOption, DBConstants.READ_MOVE); // Make sure all fields of the secondary record get this change notification
}
}
}
} catch (DBException ex) {
iErrorCode = ex.getErrorCode();
}
}
else
iErrorCode = m_keyField.moveFieldToThis(this.getOwner(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // SCREEN_MOVE says this is coming from here
return iErrorCode;
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"if",
"(",
"m_bUpdateRecord",
")",
"if",
"(",
"m_record",
".",
"isModified",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"m_record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"m_record",
".",
"set",
"(",
")",
";",
"else",
"if",
"(",
"m_record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_ADD",
")",
"m_record",
".",
"add",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"return",
"ex",
".",
"getErrorCode",
"(",
")",
";",
"}",
"}",
"if",
"(",
"m_bMoveBehavior",
")",
"if",
"(",
"m_keyField",
"!=",
"null",
")",
"if",
"(",
"(",
"iMoveMode",
"==",
"DBConstants",
".",
"INIT_MOVE",
")",
"||",
"(",
"iMoveMode",
"==",
"DBConstants",
".",
"READ_MOVE",
")",
")",
"m_keyField",
".",
"setModified",
"(",
"true",
")",
";",
"// Force re-read and GetValid/GetNew listener to run",
"if",
"(",
"m_keyField",
"==",
"null",
")",
"{",
"int",
"iHandleType",
"=",
"DBConstants",
".",
"BOOKMARK_HANDLE",
";",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"try",
"{",
"Object",
"handle",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"getData",
"(",
")",
";",
"if",
"(",
"(",
"handle",
"==",
"null",
")",
"||",
"(",
"(",
"this",
".",
"getOwner",
"(",
")",
"instanceof",
"ReferenceField",
")",
"&&",
"(",
"(",
"(",
"Integer",
")",
"handle",
")",
".",
"intValue",
"(",
")",
"==",
"0",
")",
")",
")",
"{",
"if",
"(",
"(",
"m_bAllowNull",
")",
"||",
"(",
"iMoveMode",
"!=",
"DBConstants",
".",
"SCREEN_MOVE",
")",
")",
"m_record",
".",
"handleNewRecord",
"(",
"DBConstants",
".",
"DISPLAY",
")",
";",
"//? Display Fields (Should leave record in an indeterminate state!)",
"else",
"iErrorCode",
"=",
"DBConstants",
".",
"KEY_NOT_FOUND",
";",
"// Can't have a null value",
"}",
"else",
"{",
"if",
"(",
"m_record",
".",
"setHandle",
"(",
"handle",
",",
"iHandleType",
")",
"==",
"null",
")",
"// SCREEN_MOVE says this is coming from here",
"iErrorCode",
"=",
"DBConstants",
".",
"KEY_NOT_FOUND",
";",
"else",
"// Do all the field behaviors for the secondary record //x if (iMoveMode != DBConstants.READ_MOVE)",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_record",
".",
"getFieldCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"m_record",
".",
"getField",
"(",
"i",
")",
".",
"handleFieldChanged",
"(",
"bDisplayOption",
",",
"DBConstants",
".",
"READ_MOVE",
")",
";",
"// Make sure all fields of the secondary record get this change notification",
"}",
"}",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"iErrorCode",
"=",
"ex",
".",
"getErrorCode",
"(",
")",
";",
"}",
"}",
"else",
"iErrorCode",
"=",
"m_keyField",
".",
"moveFieldToThis",
"(",
"this",
".",
"getOwner",
"(",
")",
",",
"DBConstants",
".",
"DISPLAY",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"// SCREEN_MOVE says this is coming from here",
"return",
"iErrorCode",
";",
"}"
] |
The Field has Changed.
Read the secondary file.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
Key field changed, read the new secondary record.
|
[
"The",
"Field",
"has",
"Changed",
".",
"Read",
"the",
"secondary",
"file",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L314-L369
|
153,142
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.pack
|
private void pack(String data) {
byte[] bytes = data.getBytes(Constants.UTF8);
buffer.put(getLengthDescriptor(bytes.length));
buffer.put(bytes);
}
|
java
|
private void pack(String data) {
byte[] bytes = data.getBytes(Constants.UTF8);
buffer.put(getLengthDescriptor(bytes.length));
buffer.put(bytes);
}
|
[
"private",
"void",
"pack",
"(",
"String",
"data",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"data",
".",
"getBytes",
"(",
"Constants",
".",
"UTF8",
")",
";",
"buffer",
".",
"put",
"(",
"getLengthDescriptor",
"(",
"bytes",
".",
"length",
")",
")",
";",
"buffer",
".",
"put",
"(",
"bytes",
")",
";",
"}"
] |
Pack an argument and place in buffer.
@param data Argument to pack.
|
[
"Pack",
"an",
"argument",
"and",
"place",
"in",
"buffer",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L81-L85
|
153,143
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.addParameters
|
public void addParameters(RPCParameters parameters) {
for (int i = 0; i < parameters.getCount(); i++) {
RPCParameter parameter = parameters.get(i);
if (parameter.hasData() != HasData.NONE) {
addParameter(Integer.toString(i + 1), parameter);
}
}
}
|
java
|
public void addParameters(RPCParameters parameters) {
for (int i = 0; i < parameters.getCount(); i++) {
RPCParameter parameter = parameters.get(i);
if (parameter.hasData() != HasData.NONE) {
addParameter(Integer.toString(i + 1), parameter);
}
}
}
|
[
"public",
"void",
"addParameters",
"(",
"RPCParameters",
"parameters",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameters",
".",
"getCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"RPCParameter",
"parameter",
"=",
"parameters",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"parameter",
".",
"hasData",
"(",
")",
"!=",
"HasData",
".",
"NONE",
")",
"{",
"addParameter",
"(",
"Integer",
".",
"toString",
"(",
"i",
"+",
"1",
")",
",",
"parameter",
")",
";",
"}",
"}",
"}"
] |
Adds RPC parameters to the request.
@param parameters RPC parameters.
|
[
"Adds",
"RPC",
"parameters",
"to",
"the",
"request",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L120-L128
|
153,144
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.addParameters
|
public void addParameters(Map<String, Object> parameters, boolean suppressNull) {
for (String name : parameters.keySet()) {
Object value = parameters.get(name);
if (!suppressNull || value != null) {
addParameter(name, value);
}
}
}
|
java
|
public void addParameters(Map<String, Object> parameters, boolean suppressNull) {
for (String name : parameters.keySet()) {
Object value = parameters.get(name);
if (!suppressNull || value != null) {
addParameter(name, value);
}
}
}
|
[
"public",
"void",
"addParameters",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
",",
"boolean",
"suppressNull",
")",
"{",
"for",
"(",
"String",
"name",
":",
"parameters",
".",
"keySet",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"parameters",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"suppressNull",
"||",
"value",
"!=",
"null",
")",
"{",
"addParameter",
"(",
"name",
",",
"value",
")",
";",
"}",
"}",
"}"
] |
Adds map-based parameters to the request.
@param parameters Map of parameters.
@param suppressNull If true, ignore null parameters.
|
[
"Adds",
"map",
"-",
"based",
"parameters",
"to",
"the",
"request",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L136-L145
|
153,145
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.addParameter
|
public void addParameter(String name, String sub, Object data) {
pack(name);
pack(sub);
pack(BrokerUtil.toString(data));
}
|
java
|
public void addParameter(String name, String sub, Object data) {
pack(name);
pack(sub);
pack(BrokerUtil.toString(data));
}
|
[
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"String",
"sub",
",",
"Object",
"data",
")",
"{",
"pack",
"(",
"name",
")",
";",
"pack",
"(",
"sub",
")",
";",
"pack",
"(",
"BrokerUtil",
".",
"toString",
"(",
"data",
")",
")",
";",
"}"
] |
Adds a subscripted parameter to the request.
@param name Parameter name.
@param sub Subscript(s).
@param data Parameter value.
|
[
"Adds",
"a",
"subscripted",
"parameter",
"to",
"the",
"request",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L154-L158
|
153,146
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.addParameter
|
public void addParameter(String name, RPCParameter parameter) {
for (String subscript : parameter) {
addParameter(name, subscript, parameter.get(subscript));
}
}
|
java
|
public void addParameter(String name, RPCParameter parameter) {
for (String subscript : parameter) {
addParameter(name, subscript, parameter.get(subscript));
}
}
|
[
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"RPCParameter",
"parameter",
")",
"{",
"for",
"(",
"String",
"subscript",
":",
"parameter",
")",
"{",
"addParameter",
"(",
"name",
",",
"subscript",
",",
"parameter",
".",
"get",
"(",
"subscript",
")",
")",
";",
"}",
"}"
] |
Adds an RPC parameter to the request.
@param name Parameter name.
@param parameter RPC parameter.
|
[
"Adds",
"an",
"RPC",
"parameter",
"to",
"the",
"request",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L166-L170
|
153,147
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.addParameter
|
public void addParameter(String name, Object value) {
String subscript = "";
if (name.contains("(")) {
String[] pcs = name.split("\\(", 2);
name = pcs[0];
subscript = pcs[1];
if (subscript.endsWith(")")) {
subscript = subscript.substring(0, subscript.length() - 1);
}
}
addParameter(name, subscript, value);
}
|
java
|
public void addParameter(String name, Object value) {
String subscript = "";
if (name.contains("(")) {
String[] pcs = name.split("\\(", 2);
name = pcs[0];
subscript = pcs[1];
if (subscript.endsWith(")")) {
subscript = subscript.substring(0, subscript.length() - 1);
}
}
addParameter(name, subscript, value);
}
|
[
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"String",
"subscript",
"=",
"\"\"",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"(\"",
")",
")",
"{",
"String",
"[",
"]",
"pcs",
"=",
"name",
".",
"split",
"(",
"\"\\\\(\"",
",",
"2",
")",
";",
"name",
"=",
"pcs",
"[",
"0",
"]",
";",
"subscript",
"=",
"pcs",
"[",
"1",
"]",
";",
"if",
"(",
"subscript",
".",
"endsWith",
"(",
"\")\"",
")",
")",
"{",
"subscript",
"=",
"subscript",
".",
"substring",
"(",
"0",
",",
"subscript",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"addParameter",
"(",
"name",
",",
"subscript",
",",
"value",
")",
";",
"}"
] |
Adds a parameter to the request.
@param name Parameter name (optionally with subscripts).
@param value Parameter value.
|
[
"Adds",
"a",
"parameter",
"to",
"the",
"request",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L178-L192
|
153,148
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java
|
Request.write
|
public void write(DataOutputStream stream, byte sequenceId) throws IOException {
this.sequenceId = sequenceId;
stream.write(PREAMBLE);
stream.write(sequenceId);
stream.write(action.getCode());
stream.write(buffer.toArray());
stream.write(Constants.EOD);
}
|
java
|
public void write(DataOutputStream stream, byte sequenceId) throws IOException {
this.sequenceId = sequenceId;
stream.write(PREAMBLE);
stream.write(sequenceId);
stream.write(action.getCode());
stream.write(buffer.toArray());
stream.write(Constants.EOD);
}
|
[
"public",
"void",
"write",
"(",
"DataOutputStream",
"stream",
",",
"byte",
"sequenceId",
")",
"throws",
"IOException",
"{",
"this",
".",
"sequenceId",
"=",
"sequenceId",
";",
"stream",
".",
"write",
"(",
"PREAMBLE",
")",
";",
"stream",
".",
"write",
"(",
"sequenceId",
")",
";",
"stream",
".",
"write",
"(",
"action",
".",
"getCode",
"(",
")",
")",
";",
"stream",
".",
"write",
"(",
"buffer",
".",
"toArray",
"(",
")",
")",
";",
"stream",
".",
"write",
"(",
"Constants",
".",
"EOD",
")",
";",
"}"
] |
Write request components to output stream.
@param stream Output stream.
@param sequenceId Sequence identifier for packet.
@throws IOException An IO exception.
|
[
"Write",
"request",
"components",
"to",
"output",
"stream",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Request.java#L219-L226
|
153,149
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/Recycler.java
|
Recycler.get
|
public static final <T extends Recyclable> T get(Class<T> cls)
{
return get(cls, null);
}
|
java
|
public static final <T extends Recyclable> T get(Class<T> cls)
{
return get(cls, null);
}
|
[
"public",
"static",
"final",
"<",
"T",
"extends",
"Recyclable",
">",
"T",
"get",
"(",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"return",
"get",
"(",
"cls",
",",
"null",
")",
";",
"}"
] |
Returns new or recycled uninitialized object.
@param <T>
@param cls
@return
|
[
"Returns",
"new",
"or",
"recycled",
"uninitialized",
"object",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/Recycler.java#L59-L62
|
153,150
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/Recycler.java
|
Recycler.get
|
public static final <T extends Recyclable> T get(Class<T> cls, Consumer<T> initializer)
{
T recyclable = null;
lock.lock();
try
{
List<Recyclable> list = mapList.get(cls);
if (list != null && !list.isEmpty())
{
recyclable = (T) list.remove(list.size()-1);
log.debug("get recycled %s", recyclable);
}
}
finally
{
lock.unlock();
}
if (recyclable == null)
{
try
{
recyclable = cls.newInstance();
log.debug("create new recycled %s", recyclable);
}
catch (InstantiationException | IllegalAccessException ex)
{
throw new IllegalArgumentException(ex);
}
}
if (initializer != null)
{
initializer.accept(recyclable);
}
return (T) recyclable;
}
|
java
|
public static final <T extends Recyclable> T get(Class<T> cls, Consumer<T> initializer)
{
T recyclable = null;
lock.lock();
try
{
List<Recyclable> list = mapList.get(cls);
if (list != null && !list.isEmpty())
{
recyclable = (T) list.remove(list.size()-1);
log.debug("get recycled %s", recyclable);
}
}
finally
{
lock.unlock();
}
if (recyclable == null)
{
try
{
recyclable = cls.newInstance();
log.debug("create new recycled %s", recyclable);
}
catch (InstantiationException | IllegalAccessException ex)
{
throw new IllegalArgumentException(ex);
}
}
if (initializer != null)
{
initializer.accept(recyclable);
}
return (T) recyclable;
}
|
[
"public",
"static",
"final",
"<",
"T",
"extends",
"Recyclable",
">",
"T",
"get",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"Consumer",
"<",
"T",
">",
"initializer",
")",
"{",
"T",
"recyclable",
"=",
"null",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"List",
"<",
"Recyclable",
">",
"list",
"=",
"mapList",
".",
"get",
"(",
"cls",
")",
";",
"if",
"(",
"list",
"!=",
"null",
"&&",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"recyclable",
"=",
"(",
"T",
")",
"list",
".",
"remove",
"(",
"list",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"log",
".",
"debug",
"(",
"\"get recycled %s\"",
",",
"recyclable",
")",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"recyclable",
"==",
"null",
")",
"{",
"try",
"{",
"recyclable",
"=",
"cls",
".",
"newInstance",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"create new recycled %s\"",
",",
"recyclable",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"ex",
")",
";",
"}",
"}",
"if",
"(",
"initializer",
"!=",
"null",
")",
"{",
"initializer",
".",
"accept",
"(",
"recyclable",
")",
";",
"}",
"return",
"(",
"T",
")",
"recyclable",
";",
"}"
] |
Returns new or recycled initialized object.
@param <T>
@param cls
@param initializer
@return
|
[
"Returns",
"new",
"or",
"recycled",
"initialized",
"object",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/Recycler.java#L70-L104
|
153,151
|
fuwjax/ev-oss
|
gild/src/main/java/org/fuwjax/oss/gild/Gild.java
|
Gild.with
|
public Gild with(final String serviceName, final ServiceProxy proxy) {
proxies.put(serviceName, proxy);
return this;
}
|
java
|
public Gild with(final String serviceName, final ServiceProxy proxy) {
proxies.put(serviceName, proxy);
return this;
}
|
[
"public",
"Gild",
"with",
"(",
"final",
"String",
"serviceName",
",",
"final",
"ServiceProxy",
"proxy",
")",
"{",
"proxies",
".",
"put",
"(",
"serviceName",
",",
"proxy",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a service proxy to this harness. @param serviceName the name of the
service @param proxy the service proxy @return this harness
|
[
"Adds",
"a",
"service",
"proxy",
"to",
"this",
"harness",
"."
] |
cbd88592e9b2fa9547c3bdd41e52e790061a2253
|
https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/gild/src/main/java/org/fuwjax/oss/gild/Gild.java#L162-L165
|
153,152
|
fuwjax/ev-oss
|
gild/src/main/java/org/fuwjax/oss/gild/Gild.java
|
Gild.nextStage
|
public void nextStage(final String stageName) {
assertNotNull("Cannot move to a null stage", stageName);
execs.forEach(consumer(StageExec::preserve));
stage = stage.nextStage(stageName);
prepare();
}
|
java
|
public void nextStage(final String stageName) {
assertNotNull("Cannot move to a null stage", stageName);
execs.forEach(consumer(StageExec::preserve));
stage = stage.nextStage(stageName);
prepare();
}
|
[
"public",
"void",
"nextStage",
"(",
"final",
"String",
"stageName",
")",
"{",
"assertNotNull",
"(",
"\"Cannot move to a null stage\"",
",",
"stageName",
")",
";",
"execs",
".",
"forEach",
"(",
"consumer",
"(",
"StageExec",
"::",
"preserve",
")",
")",
";",
"stage",
"=",
"stage",
".",
"nextStage",
"(",
"stageName",
")",
";",
"prepare",
"(",
")",
";",
"}"
] |
Moves to the next stage in the staged test run. @param stageName the next
stage name
|
[
"Moves",
"to",
"the",
"next",
"stage",
"in",
"the",
"staged",
"test",
"run",
"."
] |
cbd88592e9b2fa9547c3bdd41e52e790061a2253
|
https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/gild/src/main/java/org/fuwjax/oss/gild/Gild.java#L234-L239
|
153,153
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/Sets.java
|
Sets.difference
|
public static final <T> Set<T> difference(Set<T> u, Set<T> a)
{
Set<T> set = new HashSet<>(u);
set.removeAll(a);
return set;
}
|
java
|
public static final <T> Set<T> difference(Set<T> u, Set<T> a)
{
Set<T> set = new HashSet<>(u);
set.removeAll(a);
return set;
}
|
[
"public",
"static",
"final",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"difference",
"(",
"Set",
"<",
"T",
">",
"u",
",",
"Set",
"<",
"T",
">",
"a",
")",
"{",
"Set",
"<",
"T",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
"u",
")",
";",
"set",
".",
"removeAll",
"(",
"a",
")",
";",
"return",
"set",
";",
"}"
] |
Set difference of U and A, denoted U \ A, is the set of all members of U
that are not members of A
@param <T>
@param u
@param a
@return
|
[
"Set",
"difference",
"of",
"U",
"and",
"A",
"denoted",
"U",
"\\",
"A",
"is",
"the",
"set",
"of",
"all",
"members",
"of",
"U",
"that",
"are",
"not",
"members",
"of",
"A"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Sets.java#L85-L90
|
153,154
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/Sets.java
|
Sets.intersect
|
public static final <T> boolean intersect(Collection<Set<T>> sets)
{
Set<T> set = intersection(sets);
return !set.isEmpty();
}
|
java
|
public static final <T> boolean intersect(Collection<Set<T>> sets)
{
Set<T> set = intersection(sets);
return !set.isEmpty();
}
|
[
"public",
"static",
"final",
"<",
"T",
">",
"boolean",
"intersect",
"(",
"Collection",
"<",
"Set",
"<",
"T",
">",
">",
"sets",
")",
"{",
"Set",
"<",
"T",
">",
"set",
"=",
"intersection",
"(",
"sets",
")",
";",
"return",
"!",
"set",
".",
"isEmpty",
"(",
")",
";",
"}"
] |
return true if intersection is not empty
@param <T>
@param sets
@return
|
[
"return",
"true",
"if",
"intersection",
"is",
"not",
"empty"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Sets.java#L165-L169
|
153,155
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/Sets.java
|
Sets.powerSet
|
public static final <T> Set<Set<T>> powerSet(Set<T> set)
{
Set<Set<T>> powerSet = new HashSet<>();
powerSet.add(Collections.EMPTY_SET);
powerSet(powerSet, set);
return powerSet;
}
|
java
|
public static final <T> Set<Set<T>> powerSet(Set<T> set)
{
Set<Set<T>> powerSet = new HashSet<>();
powerSet.add(Collections.EMPTY_SET);
powerSet(powerSet, set);
return powerSet;
}
|
[
"public",
"static",
"final",
"<",
"T",
">",
"Set",
"<",
"Set",
"<",
"T",
">",
">",
"powerSet",
"(",
"Set",
"<",
"T",
">",
"set",
")",
"{",
"Set",
"<",
"Set",
"<",
"T",
">>",
"powerSet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"powerSet",
".",
"add",
"(",
"Collections",
".",
"EMPTY_SET",
")",
";",
"powerSet",
"(",
"powerSet",
",",
"set",
")",
";",
"return",
"powerSet",
";",
"}"
] |
Power set of a set A is the set whose members are all possible subsets of A.
@param <T>
@param set
@return
|
[
"Power",
"set",
"of",
"a",
"set",
"A",
"is",
"the",
"set",
"whose",
"members",
"are",
"all",
"possible",
"subsets",
"of",
"A",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Sets.java#L198-L204
|
153,156
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/Sets.java
|
Sets.assign
|
public static final <T> void assign(Set<T> source, Set<T> target)
{
target.retainAll(source);
target.addAll(source);
}
|
java
|
public static final <T> void assign(Set<T> source, Set<T> target)
{
target.retainAll(source);
target.addAll(source);
}
|
[
"public",
"static",
"final",
"<",
"T",
">",
"void",
"assign",
"(",
"Set",
"<",
"T",
">",
"source",
",",
"Set",
"<",
"T",
">",
"target",
")",
"{",
"target",
".",
"retainAll",
"(",
"source",
")",
";",
"target",
".",
"addAll",
"(",
"source",
")",
";",
"}"
] |
Sets target content to be the same as source without clearing the target.
@param <T>
@param source
@param target
|
[
"Sets",
"target",
"content",
"to",
"be",
"the",
"same",
"as",
"source",
"without",
"clearing",
"the",
"target",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Sets.java#L224-L228
|
153,157
|
krotscheck/data-file-reader
|
data-file-reader-base/src/main/java/net/krotscheck/dfr/AbstractFilteredDataStream.java
|
AbstractFilteredDataStream.addFilters
|
public final void addFilters(final List<IDataFilter> newFilters) {
assertFilterListExists();
for (IDataFilter filter : newFilters) {
addFilter(filter);
}
}
|
java
|
public final void addFilters(final List<IDataFilter> newFilters) {
assertFilterListExists();
for (IDataFilter filter : newFilters) {
addFilter(filter);
}
}
|
[
"public",
"final",
"void",
"addFilters",
"(",
"final",
"List",
"<",
"IDataFilter",
">",
"newFilters",
")",
"{",
"assertFilterListExists",
"(",
")",
";",
"for",
"(",
"IDataFilter",
"filter",
":",
"newFilters",
")",
"{",
"addFilter",
"(",
"filter",
")",
";",
"}",
"}"
] |
Add many filters.
@param newFilters The filters to add.
|
[
"Add",
"many",
"filters",
"."
] |
b9a85bd07dc9f9b8291ffbfb6945443d96371811
|
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-base/src/main/java/net/krotscheck/dfr/AbstractFilteredDataStream.java#L66-L71
|
153,158
|
krotscheck/data-file-reader
|
data-file-reader-base/src/main/java/net/krotscheck/dfr/AbstractFilteredDataStream.java
|
AbstractFilteredDataStream.applyFilters
|
public final Map<String, Object> applyFilters(
final Map<String, Object> row) {
Map<String, Object> filteringRow = new LinkedHashMap<>(row);
assertFilterListExists();
for (IDataFilter filter : getFilters()) {
filteringRow = filter.apply(filteringRow);
}
return filteringRow;
}
|
java
|
public final Map<String, Object> applyFilters(
final Map<String, Object> row) {
Map<String, Object> filteringRow = new LinkedHashMap<>(row);
assertFilterListExists();
for (IDataFilter filter : getFilters()) {
filteringRow = filter.apply(filteringRow);
}
return filteringRow;
}
|
[
"public",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"applyFilters",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"filteringRow",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"row",
")",
";",
"assertFilterListExists",
"(",
")",
";",
"for",
"(",
"IDataFilter",
"filter",
":",
"getFilters",
"(",
")",
")",
"{",
"filteringRow",
"=",
"filter",
".",
"apply",
"(",
"filteringRow",
")",
";",
"}",
"return",
"filteringRow",
";",
"}"
] |
Apply the filters.
@param row The row to filter.
@return The filtered row.
|
[
"Apply",
"the",
"filters",
"."
] |
b9a85bd07dc9f9b8291ffbfb6945443d96371811
|
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-base/src/main/java/net/krotscheck/dfr/AbstractFilteredDataStream.java#L120-L129
|
153,159
|
BeholderTAF/beholder-selenium
|
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java
|
SeleniumComponent.setElement
|
public final void setElement(final WebElement element) {
if (element == null) {
throw new IllegalArgumentException(String.format(ErrorMessages.ERROR_TEMPLATE_VARIABLE_NULL,"element"));
}
this.element = element;
validateElementTag();
validateAttributes();
}
|
java
|
public final void setElement(final WebElement element) {
if (element == null) {
throw new IllegalArgumentException(String.format(ErrorMessages.ERROR_TEMPLATE_VARIABLE_NULL,"element"));
}
this.element = element;
validateElementTag();
validateAttributes();
}
|
[
"public",
"final",
"void",
"setElement",
"(",
"final",
"WebElement",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"ErrorMessages",
".",
"ERROR_TEMPLATE_VARIABLE_NULL",
",",
"\"element\"",
")",
")",
";",
"}",
"this",
".",
"element",
"=",
"element",
";",
"validateElementTag",
"(",
")",
";",
"validateAttributes",
"(",
")",
";",
"}"
] |
The Selenium-Webdriver element that represents the component HTML of the
simulated page.
@param element WebElement object
|
[
"The",
"Selenium",
"-",
"Webdriver",
"element",
"that",
"represents",
"the",
"component",
"HTML",
"of",
"the",
"simulated",
"page",
"."
] |
8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee
|
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java#L107-L117
|
153,160
|
BeholderTAF/beholder-selenium
|
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java
|
SeleniumComponent.validateElementTag
|
public void validateElementTag() {
String errorMsg = String.format(
ErrorMessages.ERROR_INVALID_TAG_TO_CLASS, getElement()
.getTagName());
if (!isValidElementTag()) {
throw new IllegalArgumentException(errorMsg);
}
}
|
java
|
public void validateElementTag() {
String errorMsg = String.format(
ErrorMessages.ERROR_INVALID_TAG_TO_CLASS, getElement()
.getTagName());
if (!isValidElementTag()) {
throw new IllegalArgumentException(errorMsg);
}
}
|
[
"public",
"void",
"validateElementTag",
"(",
")",
"{",
"String",
"errorMsg",
"=",
"String",
".",
"format",
"(",
"ErrorMessages",
".",
"ERROR_INVALID_TAG_TO_CLASS",
",",
"getElement",
"(",
")",
".",
"getTagName",
"(",
")",
")",
";",
"if",
"(",
"!",
"isValidElementTag",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"errorMsg",
")",
";",
"}",
"}"
] |
Verify if the element loaded is a valid element for the class that is
representing it.
|
[
"Verify",
"if",
"the",
"element",
"loaded",
"is",
"a",
"valid",
"element",
"for",
"the",
"class",
"that",
"is",
"representing",
"it",
"."
] |
8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee
|
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java#L322-L331
|
153,161
|
BeholderTAF/beholder-selenium
|
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java
|
SeleniumComponent.getLocator
|
public String getLocator(Integer index) {
String relLocator = ".//";
if (getBasicLocator().contains("[")) {
relLocator += getBasicLocator().replace("]", " and position()=%d ]");
} else {
relLocator += "%s[%d]";
}
return String.format(relLocator, index);
}
|
java
|
public String getLocator(Integer index) {
String relLocator = ".//";
if (getBasicLocator().contains("[")) {
relLocator += getBasicLocator().replace("]", " and position()=%d ]");
} else {
relLocator += "%s[%d]";
}
return String.format(relLocator, index);
}
|
[
"public",
"String",
"getLocator",
"(",
"Integer",
"index",
")",
"{",
"String",
"relLocator",
"=",
"\".//\"",
";",
"if",
"(",
"getBasicLocator",
"(",
")",
".",
"contains",
"(",
"\"[\"",
")",
")",
"{",
"relLocator",
"+=",
"getBasicLocator",
"(",
")",
".",
"replace",
"(",
"\"]\"",
",",
"\" and position()=%d ]\"",
")",
";",
"}",
"else",
"{",
"relLocator",
"+=",
"\"%s[%d]\"",
";",
"}",
"return",
"String",
".",
"format",
"(",
"relLocator",
",",
"index",
")",
";",
"}"
] |
Returns the relative locator to find the html object on HTML page using
the index of the HTML object to recover it.
@param index
HTML index of the object. Starts with 1.
@return Returns a relative xpath representation of the html object on the
browser's page.
|
[
"Returns",
"the",
"relative",
"locator",
"to",
"find",
"the",
"html",
"object",
"on",
"HTML",
"page",
"using",
"the",
"index",
"of",
"the",
"HTML",
"object",
"to",
"recover",
"it",
"."
] |
8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee
|
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java#L375-L386
|
153,162
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/mbroker/AbstractBrokerQueryService.java
|
AbstractBrokerQueryService.getArguments
|
protected Object[] getArguments(IQueryContext context) {
List<Object> args = new ArrayList<>();
createArgumentList(args, context);
return args.toArray();
}
|
java
|
protected Object[] getArguments(IQueryContext context) {
List<Object> args = new ArrayList<>();
createArgumentList(args, context);
return args.toArray();
}
|
[
"protected",
"Object",
"[",
"]",
"getArguments",
"(",
"IQueryContext",
"context",
")",
"{",
"List",
"<",
"Object",
">",
"args",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"createArgumentList",
"(",
"args",
",",
"context",
")",
";",
"return",
"args",
".",
"toArray",
"(",
")",
";",
"}"
] |
Prepares an argument list from the query context.
@param context The query context.
@return An argument list.
|
[
"Prepares",
"an",
"argument",
"list",
"from",
"the",
"query",
"context",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/mbroker/AbstractBrokerQueryService.java#L75-L79
|
153,163
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/mbroker/AbstractBrokerQueryService.java
|
AbstractBrokerQueryService.fetch
|
@Override
public IQueryResult<T> fetch(IQueryContext context) {
try {
return QueryUtil.packageResult(processData(context, service.callRPC(rpcName, getArguments(context))));
} catch (Exception e) {
return QueryUtil.errorResult(e);
}
}
|
java
|
@Override
public IQueryResult<T> fetch(IQueryContext context) {
try {
return QueryUtil.packageResult(processData(context, service.callRPC(rpcName, getArguments(context))));
} catch (Exception e) {
return QueryUtil.errorResult(e);
}
}
|
[
"@",
"Override",
"public",
"IQueryResult",
"<",
"T",
">",
"fetch",
"(",
"IQueryContext",
"context",
")",
"{",
"try",
"{",
"return",
"QueryUtil",
".",
"packageResult",
"(",
"processData",
"(",
"context",
",",
"service",
".",
"callRPC",
"(",
"rpcName",
",",
"getArguments",
"(",
"context",
")",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"QueryUtil",
".",
"errorResult",
"(",
"e",
")",
";",
"}",
"}"
] |
Fetches data in a foreground thread.
|
[
"Fetches",
"data",
"in",
"a",
"foreground",
"thread",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/mbroker/AbstractBrokerQueryService.java#L92-L99
|
153,164
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/shared/MultiTable.java
|
MultiTable.getInfoFromHandle
|
public Object getInfoFromHandle(Object bookmark, boolean bGetTable, int iHandleType) throws DBException
{
if (iHandleType == DBConstants.OBJECT_ID_HANDLE)
{
if (!(bookmark instanceof String))
return null;
int iLastColon = ((String)bookmark).lastIndexOf(BaseTable.HANDLE_SEPARATOR);
if (iLastColon == -1)
return null;
if (bGetTable)
return ((String)bookmark).substring(0, iLastColon);
else
return ((String)bookmark).substring(iLastColon+1);
}
return bookmark;
}
|
java
|
public Object getInfoFromHandle(Object bookmark, boolean bGetTable, int iHandleType) throws DBException
{
if (iHandleType == DBConstants.OBJECT_ID_HANDLE)
{
if (!(bookmark instanceof String))
return null;
int iLastColon = ((String)bookmark).lastIndexOf(BaseTable.HANDLE_SEPARATOR);
if (iLastColon == -1)
return null;
if (bGetTable)
return ((String)bookmark).substring(0, iLastColon);
else
return ((String)bookmark).substring(iLastColon+1);
}
return bookmark;
}
|
[
"public",
"Object",
"getInfoFromHandle",
"(",
"Object",
"bookmark",
",",
"boolean",
"bGetTable",
",",
"int",
"iHandleType",
")",
"throws",
"DBException",
"{",
"if",
"(",
"iHandleType",
"==",
"DBConstants",
".",
"OBJECT_ID_HANDLE",
")",
"{",
"if",
"(",
"!",
"(",
"bookmark",
"instanceof",
"String",
")",
")",
"return",
"null",
";",
"int",
"iLastColon",
"=",
"(",
"(",
"String",
")",
"bookmark",
")",
".",
"lastIndexOf",
"(",
"BaseTable",
".",
"HANDLE_SEPARATOR",
")",
";",
"if",
"(",
"iLastColon",
"==",
"-",
"1",
")",
"return",
"null",
";",
"if",
"(",
"bGetTable",
")",
"return",
"(",
"(",
"String",
")",
"bookmark",
")",
".",
"substring",
"(",
"0",
",",
"iLastColon",
")",
";",
"else",
"return",
"(",
"(",
"String",
")",
"bookmark",
")",
".",
"substring",
"(",
"iLastColon",
"+",
"1",
")",
";",
"}",
"return",
"bookmark",
";",
"}"
] |
Get the table or object ID portion of the bookmark.
@exception DBException File exception.
|
[
"Get",
"the",
"table",
"or",
"object",
"ID",
"portion",
"of",
"the",
"bookmark",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/MultiTable.java#L190-L205
|
153,165
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.set
|
public void set(int index, int count, boolean value)
{
for (int ii=0;ii<count;ii++)
{
set(ii+index, value);
}
}
|
java
|
public void set(int index, int count, boolean value)
{
for (int ii=0;ii<count;ii++)
{
set(ii+index, value);
}
}
|
[
"public",
"void",
"set",
"(",
"int",
"index",
",",
"int",
"count",
",",
"boolean",
"value",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"count",
";",
"ii",
"++",
")",
"{",
"set",
"(",
"ii",
"+",
"index",
",",
"value",
")",
";",
"}",
"}"
] |
Set count of bits starting from index to value
@param index
@param count
@param value
|
[
"Set",
"count",
"of",
"bits",
"starting",
"from",
"index",
"to",
"value"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L59-L65
|
153,166
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.set
|
public void set(int index, boolean value)
{
check(index);
if (value)
{
array[index / 8] |= (1 << (index % 8));
}
else
{
array[index / 8] &= ~(1 << (index % 8));
}
}
|
java
|
public void set(int index, boolean value)
{
check(index);
if (value)
{
array[index / 8] |= (1 << (index % 8));
}
else
{
array[index / 8] &= ~(1 << (index % 8));
}
}
|
[
"public",
"void",
"set",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"{",
"check",
"(",
"index",
")",
";",
"if",
"(",
"value",
")",
"{",
"array",
"[",
"index",
"/",
"8",
"]",
"|=",
"(",
"1",
"<<",
"(",
"index",
"%",
"8",
")",
")",
";",
"}",
"else",
"{",
"array",
"[",
"index",
"/",
"8",
"]",
"&=",
"~",
"(",
"1",
"<<",
"(",
"index",
"%",
"8",
")",
")",
";",
"}",
"}"
] |
Set bit at index to value
@param index
@param value
|
[
"Set",
"bit",
"at",
"index",
"to",
"value"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L71-L82
|
153,167
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.any
|
public boolean any()
{
int l = bits/8;
for (int ii=0;ii<l;ii++)
{
if (array[ii] != 0)
{
return true;
}
}
for (int ii=l*8;ii<bits;ii++)
{
if (isSet(ii))
{
return true;
}
}
return false;
}
|
java
|
public boolean any()
{
int l = bits/8;
for (int ii=0;ii<l;ii++)
{
if (array[ii] != 0)
{
return true;
}
}
for (int ii=l*8;ii<bits;ii++)
{
if (isSet(ii))
{
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"any",
"(",
")",
"{",
"int",
"l",
"=",
"bits",
"/",
"8",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"l",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"ii",
"]",
"!=",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"for",
"(",
"int",
"ii",
"=",
"l",
"*",
"8",
";",
"ii",
"<",
"bits",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"isSet",
"(",
"ii",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if any bit is set
@return
|
[
"Returns",
"true",
"if",
"any",
"bit",
"is",
"set"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L112-L130
|
153,168
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.first
|
public int first()
{
for (int ii=0;ii<array.length;ii++)
{
if (array[ii] != 0)
{
for (int jj=ii*8;jj<bits;jj++)
{
if (isSet(jj))
{
return jj;
}
}
}
}
return -1;
}
|
java
|
public int first()
{
for (int ii=0;ii<array.length;ii++)
{
if (array[ii] != 0)
{
for (int jj=ii*8;jj<bits;jj++)
{
if (isSet(jj))
{
return jj;
}
}
}
}
return -1;
}
|
[
"public",
"int",
"first",
"(",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"array",
".",
"length",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"ii",
"]",
"!=",
"0",
")",
"{",
"for",
"(",
"int",
"jj",
"=",
"ii",
"*",
"8",
";",
"jj",
"<",
"bits",
";",
"jj",
"++",
")",
"{",
"if",
"(",
"isSet",
"(",
"jj",
")",
")",
"{",
"return",
"jj",
";",
"}",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
returns the first set bits index
@return
|
[
"returns",
"the",
"first",
"set",
"bits",
"index"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L135-L151
|
153,169
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.last
|
public int last()
{
for (int ii=array.length-1;ii>=0;ii--)
{
if (array[ii] != 0)
{
for (int jj=Math.min(bits,(ii+1)*8)-1;jj>=0;jj--)
{
if (isSet(jj))
{
return jj;
}
}
}
}
return -1;
}
|
java
|
public int last()
{
for (int ii=array.length-1;ii>=0;ii--)
{
if (array[ii] != 0)
{
for (int jj=Math.min(bits,(ii+1)*8)-1;jj>=0;jj--)
{
if (isSet(jj))
{
return jj;
}
}
}
}
return -1;
}
|
[
"public",
"int",
"last",
"(",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"array",
".",
"length",
"-",
"1",
";",
"ii",
">=",
"0",
";",
"ii",
"--",
")",
"{",
"if",
"(",
"array",
"[",
"ii",
"]",
"!=",
"0",
")",
"{",
"for",
"(",
"int",
"jj",
"=",
"Math",
".",
"min",
"(",
"bits",
",",
"(",
"ii",
"+",
"1",
")",
"*",
"8",
")",
"-",
"1",
";",
"jj",
">=",
"0",
";",
"jj",
"--",
")",
"{",
"if",
"(",
"isSet",
"(",
"jj",
")",
")",
"{",
"return",
"jj",
";",
"}",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
returns the last set bits index
@return
|
[
"returns",
"the",
"last",
"set",
"bits",
"index"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L156-L172
|
153,170
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.forEach
|
public void forEach(IntConsumer consumer)
{
for (int ii=0;ii<array.length;ii++)
{
if (array[ii] != 0)
{
int lim = Math.min(bits, (ii+1)*8);
for (int jj=ii*8;jj<lim;jj++)
{
if (isSet(jj))
{
consumer.accept(jj);
}
}
}
}
}
|
java
|
public void forEach(IntConsumer consumer)
{
for (int ii=0;ii<array.length;ii++)
{
if (array[ii] != 0)
{
int lim = Math.min(bits, (ii+1)*8);
for (int jj=ii*8;jj<lim;jj++)
{
if (isSet(jj))
{
consumer.accept(jj);
}
}
}
}
}
|
[
"public",
"void",
"forEach",
"(",
"IntConsumer",
"consumer",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"array",
".",
"length",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"ii",
"]",
"!=",
"0",
")",
"{",
"int",
"lim",
"=",
"Math",
".",
"min",
"(",
"bits",
",",
"(",
"ii",
"+",
"1",
")",
"*",
"8",
")",
";",
"for",
"(",
"int",
"jj",
"=",
"ii",
"*",
"8",
";",
"jj",
"<",
"lim",
";",
"jj",
"++",
")",
"{",
"if",
"(",
"isSet",
"(",
"jj",
")",
")",
"{",
"consumer",
".",
"accept",
"(",
"jj",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
For each set bet index.
@param consumer
|
[
"For",
"each",
"set",
"bet",
"index",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L177-L193
|
153,171
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.stream
|
public IntStream stream()
{
IntStream.Builder builder = IntStream.builder();
forEach(builder);
return builder.build();
}
|
java
|
public IntStream stream()
{
IntStream.Builder builder = IntStream.builder();
forEach(builder);
return builder.build();
}
|
[
"public",
"IntStream",
"stream",
"(",
")",
"{",
"IntStream",
".",
"Builder",
"builder",
"=",
"IntStream",
".",
"builder",
"(",
")",
";",
"forEach",
"(",
"builder",
")",
";",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}"
] |
Returns set bit indexes as stream
@return
|
[
"Returns",
"set",
"bit",
"indexes",
"as",
"stream"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L198-L203
|
153,172
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.count
|
public int count()
{
int count = 0;
for (int ii=bits-1;ii>=0;ii--)
{
if (isSet(ii))
{
count++;
}
}
return count;
}
|
java
|
public int count()
{
int count = 0;
for (int ii=bits-1;ii>=0;ii--)
{
if (isSet(ii))
{
count++;
}
}
return count;
}
|
[
"public",
"int",
"count",
"(",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"ii",
"=",
"bits",
"-",
"1",
";",
"ii",
">=",
"0",
";",
"ii",
"--",
")",
"{",
"if",
"(",
"isSet",
"(",
"ii",
")",
")",
"{",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] |
Returns number of set bits
@return
|
[
"Returns",
"number",
"of",
"set",
"bits"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L208-L219
|
153,173
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BitArray.java
|
BitArray.and
|
public boolean and(BitArray other)
{
if (bits != other.bits)
{
throw new IllegalArgumentException("number of bits differ");
}
int l = bits/8;
for (int ii=0;ii<l;ii++)
{
if ((array[ii] & other.array[ii]) != 0)
{
return true;
}
}
for (int ii=l*8;ii<bits;ii++)
{
if (isSet(ii) && other.isSet(ii))
{
return true;
}
}
return false;
}
|
java
|
public boolean and(BitArray other)
{
if (bits != other.bits)
{
throw new IllegalArgumentException("number of bits differ");
}
int l = bits/8;
for (int ii=0;ii<l;ii++)
{
if ((array[ii] & other.array[ii]) != 0)
{
return true;
}
}
for (int ii=l*8;ii<bits;ii++)
{
if (isSet(ii) && other.isSet(ii))
{
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"and",
"(",
"BitArray",
"other",
")",
"{",
"if",
"(",
"bits",
"!=",
"other",
".",
"bits",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"number of bits differ\"",
")",
";",
"}",
"int",
"l",
"=",
"bits",
"/",
"8",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"l",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"(",
"array",
"[",
"ii",
"]",
"&",
"other",
".",
"array",
"[",
"ii",
"]",
")",
"!=",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"for",
"(",
"int",
"ii",
"=",
"l",
"*",
"8",
";",
"ii",
"<",
"bits",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"isSet",
"(",
"ii",
")",
"&&",
"other",
".",
"isSet",
"(",
"ii",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns true if bit in this and other is set in any same index.
@param other
@return
|
[
"Returns",
"true",
"if",
"bit",
"in",
"this",
"and",
"other",
"is",
"set",
"in",
"any",
"same",
"index",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BitArray.java#L225-L247
|
153,174
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/ui/LineDrawer.java
|
LineDrawer.fillWidth
|
public static void fillWidth(Point point, Point derivate, double width, PlotOperator plot)
{
fillWidth(point.x, point.y, derivate.x, derivate.y, width, plot);
}
|
java
|
public static void fillWidth(Point point, Point derivate, double width, PlotOperator plot)
{
fillWidth(point.x, point.y, derivate.x, derivate.y, width, plot);
}
|
[
"public",
"static",
"void",
"fillWidth",
"(",
"Point",
"point",
",",
"Point",
"derivate",
",",
"double",
"width",
",",
"PlotOperator",
"plot",
")",
"{",
"fillWidth",
"(",
"point",
".",
"x",
",",
"point",
".",
"y",
",",
"derivate",
".",
"x",
",",
"derivate",
".",
"y",
",",
"width",
",",
"plot",
")",
";",
"}"
] |
Draws orthogonal to derivate width length line having center at point.
@param point
@param derivate
@param width
@param plot
|
[
"Draws",
"orthogonal",
"to",
"derivate",
"width",
"length",
"line",
"having",
"center",
"at",
"point",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/LineDrawer.java#L35-L38
|
153,175
|
nofacepress/csv4180
|
src/main/java/com/nofacepress/csv4180/CSVReader.java
|
CSVReader.readFields
|
public void readFields(ArrayList<String> fields) throws IOException {
fields.clear();
if (this.eof) {
throw new EOFException();
}
do {
fields.add(readField());
} while (this.moreFieldsOnLine);
}
|
java
|
public void readFields(ArrayList<String> fields) throws IOException {
fields.clear();
if (this.eof) {
throw new EOFException();
}
do {
fields.add(readField());
} while (this.moreFieldsOnLine);
}
|
[
"public",
"void",
"readFields",
"(",
"ArrayList",
"<",
"String",
">",
"fields",
")",
"throws",
"IOException",
"{",
"fields",
".",
"clear",
"(",
")",
";",
"if",
"(",
"this",
".",
"eof",
")",
"{",
"throw",
"new",
"EOFException",
"(",
")",
";",
"}",
"do",
"{",
"fields",
".",
"add",
"(",
"readField",
"(",
")",
")",
";",
"}",
"while",
"(",
"this",
".",
"moreFieldsOnLine",
")",
";",
"}"
] |
Reads the current line's fields into an ArrayList. This is a convenience
method.
@param fields container for the fields in the current row. It will be
cleared.
@throws IOException on general I/O error
@throws EOFException on end of file
|
[
"Reads",
"the",
"current",
"line",
"s",
"fields",
"into",
"an",
"ArrayList",
".",
"This",
"is",
"a",
"convenience",
"method",
"."
] |
c107ff66b0dcbd7fb56773dcc9eebb1756f172e8
|
https://github.com/nofacepress/csv4180/blob/c107ff66b0dcbd7fb56773dcc9eebb1756f172e8/src/main/java/com/nofacepress/csv4180/CSVReader.java#L81-L89
|
153,176
|
nofacepress/csv4180
|
src/main/java/com/nofacepress/csv4180/CSVReader.java
|
CSVReader.readField
|
public String readField() throws IOException {
int c;
final int UNQUOTED = 0;
final int QUOTED = 1;
final int QUOTEDPLUS = 2;
int state = UNQUOTED;
if (this.eof) {
throw new EOFException();
}
this.buffer.setLength(0);
while ((c = this.read()) >= 0) {
if (state == QUOTEDPLUS) {
switch (c) {
case '"':
this.buffer.append('"');
state = QUOTED;
continue;
default:
state = UNQUOTED;
break;
}
}
if (state == QUOTED) {
switch (c) {
default:
this.buffer.append((char) c);
continue;
case '"':
state = QUOTEDPLUS;
continue;
}
}
// (state == UNQUOTED)
switch (c) {
case '"':
state = QUOTED;
continue;
case '\r':
continue;
case '\n':
case ',':
this.moreFieldsOnLine = (c != '\n');
return this.buffer.toString();
default:
this.buffer.append((char) c);
continue;
}
}
this.eof = true;
this.moreFieldsOnLine = false;
return this.buffer.toString();
}
|
java
|
public String readField() throws IOException {
int c;
final int UNQUOTED = 0;
final int QUOTED = 1;
final int QUOTEDPLUS = 2;
int state = UNQUOTED;
if (this.eof) {
throw new EOFException();
}
this.buffer.setLength(0);
while ((c = this.read()) >= 0) {
if (state == QUOTEDPLUS) {
switch (c) {
case '"':
this.buffer.append('"');
state = QUOTED;
continue;
default:
state = UNQUOTED;
break;
}
}
if (state == QUOTED) {
switch (c) {
default:
this.buffer.append((char) c);
continue;
case '"':
state = QUOTEDPLUS;
continue;
}
}
// (state == UNQUOTED)
switch (c) {
case '"':
state = QUOTED;
continue;
case '\r':
continue;
case '\n':
case ',':
this.moreFieldsOnLine = (c != '\n');
return this.buffer.toString();
default:
this.buffer.append((char) c);
continue;
}
}
this.eof = true;
this.moreFieldsOnLine = false;
return this.buffer.toString();
}
|
[
"public",
"String",
"readField",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
";",
"final",
"int",
"UNQUOTED",
"=",
"0",
";",
"final",
"int",
"QUOTED",
"=",
"1",
";",
"final",
"int",
"QUOTEDPLUS",
"=",
"2",
";",
"int",
"state",
"=",
"UNQUOTED",
";",
"if",
"(",
"this",
".",
"eof",
")",
"{",
"throw",
"new",
"EOFException",
"(",
")",
";",
"}",
"this",
".",
"buffer",
".",
"setLength",
"(",
"0",
")",
";",
"while",
"(",
"(",
"c",
"=",
"this",
".",
"read",
"(",
")",
")",
">=",
"0",
")",
"{",
"if",
"(",
"state",
"==",
"QUOTEDPLUS",
")",
"{",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"this",
".",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"state",
"=",
"QUOTED",
";",
"continue",
";",
"default",
":",
"state",
"=",
"UNQUOTED",
";",
"break",
";",
"}",
"}",
"if",
"(",
"state",
"==",
"QUOTED",
")",
"{",
"switch",
"(",
"c",
")",
"{",
"default",
":",
"this",
".",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"continue",
";",
"case",
"'",
"'",
":",
"state",
"=",
"QUOTEDPLUS",
";",
"continue",
";",
"}",
"}",
"// (state == UNQUOTED)",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"state",
"=",
"QUOTED",
";",
"continue",
";",
"case",
"'",
"'",
":",
"continue",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"this",
".",
"moreFieldsOnLine",
"=",
"(",
"c",
"!=",
"'",
"'",
")",
";",
"return",
"this",
".",
"buffer",
".",
"toString",
"(",
")",
";",
"default",
":",
"this",
".",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"continue",
";",
"}",
"}",
"this",
".",
"eof",
"=",
"true",
";",
"this",
".",
"moreFieldsOnLine",
"=",
"false",
";",
"return",
"this",
".",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] |
Reads the next field from the input removing quotes as necessary.
@return next field
@throws IOException If an I/O error occurs, may be an EOFException on end of
input.
|
[
"Reads",
"the",
"next",
"field",
"from",
"the",
"input",
"removing",
"quotes",
"as",
"necessary",
"."
] |
c107ff66b0dcbd7fb56773dcc9eebb1756f172e8
|
https://github.com/nofacepress/csv4180/blob/c107ff66b0dcbd7fb56773dcc9eebb1756f172e8/src/main/java/com/nofacepress/csv4180/CSVReader.java#L98-L153
|
153,177
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.addLevelsToDatabase
|
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) {
// Add the level to the database
buildDatabase.add(level);
// Add the child levels to the database
for (final Level childLevel : level.getChildLevels()) {
addLevelsToDatabase(buildDatabase, childLevel);
}
}
|
java
|
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) {
// Add the level to the database
buildDatabase.add(level);
// Add the child levels to the database
for (final Level childLevel : level.getChildLevels()) {
addLevelsToDatabase(buildDatabase, childLevel);
}
}
|
[
"public",
"static",
"void",
"addLevelsToDatabase",
"(",
"final",
"BuildDatabase",
"buildDatabase",
",",
"final",
"Level",
"level",
")",
"{",
"// Add the level to the database",
"buildDatabase",
".",
"add",
"(",
"level",
")",
";",
"// Add the child levels to the database",
"for",
"(",
"final",
"Level",
"childLevel",
":",
"level",
".",
"getChildLevels",
"(",
")",
")",
"{",
"addLevelsToDatabase",
"(",
"buildDatabase",
",",
"childLevel",
")",
";",
"}",
"}"
] |
Adds the levels in the provided Level object to the content spec database.
@param buildDatabase
@param level The content spec level to be added to the database.
|
[
"Adds",
"the",
"levels",
"in",
"the",
"provided",
"Level",
"object",
"to",
"the",
"content",
"spec",
"database",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L76-L84
|
153,178
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.setUniqueIds
|
public static void setUniqueIds(final BuildData buildData, final ITopicNode topicNode, final Node node, final Document doc,
final Map<SpecTopic, Set<String>> usedIdAttributes) {
// The root node needs to be handled slightly differently
boolean isRootNode = doc.getDocumentElement() == node;
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
final Node idAttribute;
if (buildData.getDocBookVersion() == DocBookVersion.DOCBOOK_50) {
idAttribute = attributes.getNamedItem("xml:id");
} else {
idAttribute = attributes.getNamedItem("id");
}
if (idAttribute != null) {
final String idAttributeValue = idAttribute.getNodeValue();
String fixedIdAttributeValue = idAttributeValue;
if (!isRootNode) {
// Set the duplicate id incase the topic has been included twice
if (topicNode.getDuplicateId() != null) {
fixedIdAttributeValue += "-" + topicNode.getDuplicateId();
}
// The same id may be used across multiple topics, so add the step/line number to make it unique
if (!DocBookBuildUtilities.isUniqueAttributeId(buildData, fixedIdAttributeValue, topicNode, usedIdAttributes)) {
fixedIdAttributeValue += "-" + topicNode.getStep();
}
}
setUniqueIdReferences(doc.getDocumentElement(), idAttributeValue, fixedIdAttributeValue);
idAttribute.setNodeValue(fixedIdAttributeValue);
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
setUniqueIds(buildData, topicNode, elements.item(i), doc, usedIdAttributes);
}
}
|
java
|
public static void setUniqueIds(final BuildData buildData, final ITopicNode topicNode, final Node node, final Document doc,
final Map<SpecTopic, Set<String>> usedIdAttributes) {
// The root node needs to be handled slightly differently
boolean isRootNode = doc.getDocumentElement() == node;
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
final Node idAttribute;
if (buildData.getDocBookVersion() == DocBookVersion.DOCBOOK_50) {
idAttribute = attributes.getNamedItem("xml:id");
} else {
idAttribute = attributes.getNamedItem("id");
}
if (idAttribute != null) {
final String idAttributeValue = idAttribute.getNodeValue();
String fixedIdAttributeValue = idAttributeValue;
if (!isRootNode) {
// Set the duplicate id incase the topic has been included twice
if (topicNode.getDuplicateId() != null) {
fixedIdAttributeValue += "-" + topicNode.getDuplicateId();
}
// The same id may be used across multiple topics, so add the step/line number to make it unique
if (!DocBookBuildUtilities.isUniqueAttributeId(buildData, fixedIdAttributeValue, topicNode, usedIdAttributes)) {
fixedIdAttributeValue += "-" + topicNode.getStep();
}
}
setUniqueIdReferences(doc.getDocumentElement(), idAttributeValue, fixedIdAttributeValue);
idAttribute.setNodeValue(fixedIdAttributeValue);
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
setUniqueIds(buildData, topicNode, elements.item(i), doc, usedIdAttributes);
}
}
|
[
"public",
"static",
"void",
"setUniqueIds",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"Node",
"node",
",",
"final",
"Document",
"doc",
",",
"final",
"Map",
"<",
"SpecTopic",
",",
"Set",
"<",
"String",
">",
">",
"usedIdAttributes",
")",
"{",
"// The root node needs to be handled slightly differently",
"boolean",
"isRootNode",
"=",
"doc",
".",
"getDocumentElement",
"(",
")",
"==",
"node",
";",
"final",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"final",
"Node",
"idAttribute",
";",
"if",
"(",
"buildData",
".",
"getDocBookVersion",
"(",
")",
"==",
"DocBookVersion",
".",
"DOCBOOK_50",
")",
"{",
"idAttribute",
"=",
"attributes",
".",
"getNamedItem",
"(",
"\"xml:id\"",
")",
";",
"}",
"else",
"{",
"idAttribute",
"=",
"attributes",
".",
"getNamedItem",
"(",
"\"id\"",
")",
";",
"}",
"if",
"(",
"idAttribute",
"!=",
"null",
")",
"{",
"final",
"String",
"idAttributeValue",
"=",
"idAttribute",
".",
"getNodeValue",
"(",
")",
";",
"String",
"fixedIdAttributeValue",
"=",
"idAttributeValue",
";",
"if",
"(",
"!",
"isRootNode",
")",
"{",
"// Set the duplicate id incase the topic has been included twice",
"if",
"(",
"topicNode",
".",
"getDuplicateId",
"(",
")",
"!=",
"null",
")",
"{",
"fixedIdAttributeValue",
"+=",
"\"-\"",
"+",
"topicNode",
".",
"getDuplicateId",
"(",
")",
";",
"}",
"// The same id may be used across multiple topics, so add the step/line number to make it unique",
"if",
"(",
"!",
"DocBookBuildUtilities",
".",
"isUniqueAttributeId",
"(",
"buildData",
",",
"fixedIdAttributeValue",
",",
"topicNode",
",",
"usedIdAttributes",
")",
")",
"{",
"fixedIdAttributeValue",
"+=",
"\"-\"",
"+",
"topicNode",
".",
"getStep",
"(",
")",
";",
"}",
"}",
"setUniqueIdReferences",
"(",
"doc",
".",
"getDocumentElement",
"(",
")",
",",
"idAttributeValue",
",",
"fixedIdAttributeValue",
")",
";",
"idAttribute",
".",
"setNodeValue",
"(",
"fixedIdAttributeValue",
")",
";",
"}",
"}",
"final",
"NodeList",
"elements",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"getLength",
"(",
")",
";",
"++",
"i",
")",
"{",
"setUniqueIds",
"(",
"buildData",
",",
"topicNode",
",",
"elements",
".",
"item",
"(",
"i",
")",
",",
"doc",
",",
"usedIdAttributes",
")",
";",
"}",
"}"
] |
Sets the "id" attributes in the supplied XML node so that they will be
unique within the book.
@param buildData
@param topicNode The topic the node belongs to.
@param node The node to process for id attributes.
@param usedIdAttributes The list of usedIdAttributes.
|
[
"Sets",
"the",
"id",
"attributes",
"in",
"the",
"supplied",
"XML",
"node",
"so",
"that",
"they",
"will",
"be",
"unique",
"within",
"the",
"book",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L109-L148
|
153,179
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.isUniqueAttributeId
|
public static boolean isUniqueAttributeId(final BuildData buildData, final String id, final ITopicNode topicNode,
final Map<SpecTopic, Set<String>> usedIdAttributes) {
// Make sure the id doesn't match the spec topic's unique link
if (topicNode instanceof SpecTopic && id.equals(
((SpecTopic) topicNode).getUniqueLinkId(buildData.isUseFixedUrls()))) {
return false;
}
// Make sure the id isn't used else where in another topic
for (final Entry<SpecTopic, Set<String>> entry : usedIdAttributes.entrySet()) {
final SpecTopic topic2 = entry.getKey();
final Integer topicId2 = topic2.getDBId();
if (topicId2.equals(topicNode.getDBId())) {
continue;
}
final Set<String> ids2 = entry.getValue();
if (ids2.contains(id)) {
return false;
}
}
return true;
}
|
java
|
public static boolean isUniqueAttributeId(final BuildData buildData, final String id, final ITopicNode topicNode,
final Map<SpecTopic, Set<String>> usedIdAttributes) {
// Make sure the id doesn't match the spec topic's unique link
if (topicNode instanceof SpecTopic && id.equals(
((SpecTopic) topicNode).getUniqueLinkId(buildData.isUseFixedUrls()))) {
return false;
}
// Make sure the id isn't used else where in another topic
for (final Entry<SpecTopic, Set<String>> entry : usedIdAttributes.entrySet()) {
final SpecTopic topic2 = entry.getKey();
final Integer topicId2 = topic2.getDBId();
if (topicId2.equals(topicNode.getDBId())) {
continue;
}
final Set<String> ids2 = entry.getValue();
if (ids2.contains(id)) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isUniqueAttributeId",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"String",
"id",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"Map",
"<",
"SpecTopic",
",",
"Set",
"<",
"String",
">",
">",
"usedIdAttributes",
")",
"{",
"// Make sure the id doesn't match the spec topic's unique link",
"if",
"(",
"topicNode",
"instanceof",
"SpecTopic",
"&&",
"id",
".",
"equals",
"(",
"(",
"(",
"SpecTopic",
")",
"topicNode",
")",
".",
"getUniqueLinkId",
"(",
"buildData",
".",
"isUseFixedUrls",
"(",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Make sure the id isn't used else where in another topic",
"for",
"(",
"final",
"Entry",
"<",
"SpecTopic",
",",
"Set",
"<",
"String",
">",
">",
"entry",
":",
"usedIdAttributes",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"SpecTopic",
"topic2",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"final",
"Integer",
"topicId2",
"=",
"topic2",
".",
"getDBId",
"(",
")",
";",
"if",
"(",
"topicId2",
".",
"equals",
"(",
"topicNode",
".",
"getDBId",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"final",
"Set",
"<",
"String",
">",
"ids2",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"ids2",
".",
"contains",
"(",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks to see if a supplied attribute id is unique within this book, based
upon the used id attributes that were calculated earlier.
@param buildData
@param id The Attribute id to be checked
@param topicNode The id of the topic the attribute id was found in
@param usedIdAttributes The set of used ids calculated earlier @return True if the id is unique otherwise false.
|
[
"Checks",
"to",
"see",
"if",
"a",
"supplied",
"attribute",
"id",
"is",
"unique",
"within",
"this",
"book",
"based",
"upon",
"the",
"used",
"id",
"attributes",
"that",
"were",
"calculated",
"earlier",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L189-L212
|
153,180
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.getTopicLinkIds
|
public static void getTopicLinkIds(final Node node, final Set<String> linkIds) {
// If the node is null then there isn't anything to find, so just return.
if (node == null) {
return;
}
if (node.getNodeName().equals("xref") || node.getNodeName().equals("link")) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
final Node idAttribute = attributes.getNamedItem("linkend");
if (idAttribute != null) {
final String idAttributeValue = idAttribute.getNodeValue();
linkIds.add(idAttributeValue);
}
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
getTopicLinkIds(elements.item(i), linkIds);
}
}
|
java
|
public static void getTopicLinkIds(final Node node, final Set<String> linkIds) {
// If the node is null then there isn't anything to find, so just return.
if (node == null) {
return;
}
if (node.getNodeName().equals("xref") || node.getNodeName().equals("link")) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
final Node idAttribute = attributes.getNamedItem("linkend");
if (idAttribute != null) {
final String idAttributeValue = idAttribute.getNodeValue();
linkIds.add(idAttributeValue);
}
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
getTopicLinkIds(elements.item(i), linkIds);
}
}
|
[
"public",
"static",
"void",
"getTopicLinkIds",
"(",
"final",
"Node",
"node",
",",
"final",
"Set",
"<",
"String",
">",
"linkIds",
")",
"{",
"// If the node is null then there isn't anything to find, so just return.",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"node",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"\"xref\"",
")",
"||",
"node",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"\"link\"",
")",
")",
"{",
"final",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"final",
"Node",
"idAttribute",
"=",
"attributes",
".",
"getNamedItem",
"(",
"\"linkend\"",
")",
";",
"if",
"(",
"idAttribute",
"!=",
"null",
")",
"{",
"final",
"String",
"idAttributeValue",
"=",
"idAttribute",
".",
"getNodeValue",
"(",
")",
";",
"linkIds",
".",
"add",
"(",
"idAttributeValue",
")",
";",
"}",
"}",
"}",
"final",
"NodeList",
"elements",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"getLength",
"(",
")",
";",
"++",
"i",
")",
"{",
"getTopicLinkIds",
"(",
"elements",
".",
"item",
"(",
"i",
")",
",",
"linkIds",
")",
";",
"}",
"}"
] |
Get any ids that are referenced by a "link" or "xref"
XML attribute within the node. Any ids that are found
are added to the passes linkIds set.
@param node The DOM XML node to check for links.
@param linkIds The set of current found link ids.
|
[
"Get",
"any",
"ids",
"that",
"are",
"referenced",
"by",
"a",
"link",
"or",
"xref",
"XML",
"attribute",
"within",
"the",
"node",
".",
"Any",
"ids",
"that",
"are",
"found",
"are",
"added",
"to",
"the",
"passes",
"linkIds",
"set",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L222-L243
|
153,181
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.generateRevisionNumber
|
public static String generateRevisionNumber(final ContentSpec contentSpec) {
final StringBuilder rev = new StringBuilder();
rev.append(generateRevision(contentSpec));
// Add the separator
rev.append("-");
// Build the pubsnumber part of the revision number.
final Integer pubsnum = contentSpec.getPubsNumber();
if (pubsnum == null) {
rev.append(BuilderConstants.DEFAULT_PUBSNUMBER);
} else {
rev.append(pubsnum);
}
return rev.toString();
}
|
java
|
public static String generateRevisionNumber(final ContentSpec contentSpec) {
final StringBuilder rev = new StringBuilder();
rev.append(generateRevision(contentSpec));
// Add the separator
rev.append("-");
// Build the pubsnumber part of the revision number.
final Integer pubsnum = contentSpec.getPubsNumber();
if (pubsnum == null) {
rev.append(BuilderConstants.DEFAULT_PUBSNUMBER);
} else {
rev.append(pubsnum);
}
return rev.toString();
}
|
[
"public",
"static",
"String",
"generateRevisionNumber",
"(",
"final",
"ContentSpec",
"contentSpec",
")",
"{",
"final",
"StringBuilder",
"rev",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"rev",
".",
"append",
"(",
"generateRevision",
"(",
"contentSpec",
")",
")",
";",
"// Add the separator",
"rev",
".",
"append",
"(",
"\"-\"",
")",
";",
"// Build the pubsnumber part of the revision number.",
"final",
"Integer",
"pubsnum",
"=",
"contentSpec",
".",
"getPubsNumber",
"(",
")",
";",
"if",
"(",
"pubsnum",
"==",
"null",
")",
"{",
"rev",
".",
"append",
"(",
"BuilderConstants",
".",
"DEFAULT_PUBSNUMBER",
")",
";",
"}",
"else",
"{",
"rev",
".",
"append",
"(",
"pubsnum",
")",
";",
"}",
"return",
"rev",
".",
"toString",
"(",
")",
";",
"}"
] |
Generates the Revision Number to be used in a Revision_History.xml
file using the Book Version, Edition and Pubsnumber values from a content
specification.
@param contentSpec the content specification to generate the revision number for.
@return The generated revnumber value.
|
[
"Generates",
"the",
"Revision",
"Number",
"to",
"be",
"used",
"in",
"a",
"Revision_History",
".",
"xml",
"file",
"using",
"the",
"Book",
"Version",
"Edition",
"and",
"Pubsnumber",
"values",
"from",
"a",
"content",
"specification",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L322-L339
|
153,182
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.generateRevision
|
public static String generateRevision(final ContentSpec contentSpec) {
final StringBuilder rev = new StringBuilder();
// Build the BookVersion/Edition part of the revision number.
final String bookVersion;
if (contentSpec.getBookVersion() == null) {
bookVersion = contentSpec.getEdition();
} else {
bookVersion = contentSpec.getBookVersion();
}
if (bookVersion == null) {
rev.append(BuilderConstants.DEFAULT_EDITION).append(".0.0");
} else {
// Remove any beta/alpha declarations
final String removeContent = bookVersion.replaceAll("^(([0-9]+)|([0-9]+.[0-9]+)|([0-9]+.[0-9]+.[0-9]+))", "");
final String fixedBookVersion = bookVersion.replace(removeContent, "");
if (fixedBookVersion.matches("^[0-9]+\\.[0-9]+\\.[0-9]+$")) {
rev.append(fixedBookVersion);
} else if (fixedBookVersion.matches("^[0-9]+\\.[0-9]+$")) {
rev.append(fixedBookVersion).append(".0");
} else {
rev.append(fixedBookVersion).append(".0.0");
}
}
return rev.toString();
}
|
java
|
public static String generateRevision(final ContentSpec contentSpec) {
final StringBuilder rev = new StringBuilder();
// Build the BookVersion/Edition part of the revision number.
final String bookVersion;
if (contentSpec.getBookVersion() == null) {
bookVersion = contentSpec.getEdition();
} else {
bookVersion = contentSpec.getBookVersion();
}
if (bookVersion == null) {
rev.append(BuilderConstants.DEFAULT_EDITION).append(".0.0");
} else {
// Remove any beta/alpha declarations
final String removeContent = bookVersion.replaceAll("^(([0-9]+)|([0-9]+.[0-9]+)|([0-9]+.[0-9]+.[0-9]+))", "");
final String fixedBookVersion = bookVersion.replace(removeContent, "");
if (fixedBookVersion.matches("^[0-9]+\\.[0-9]+\\.[0-9]+$")) {
rev.append(fixedBookVersion);
} else if (fixedBookVersion.matches("^[0-9]+\\.[0-9]+$")) {
rev.append(fixedBookVersion).append(".0");
} else {
rev.append(fixedBookVersion).append(".0.0");
}
}
return rev.toString();
}
|
[
"public",
"static",
"String",
"generateRevision",
"(",
"final",
"ContentSpec",
"contentSpec",
")",
"{",
"final",
"StringBuilder",
"rev",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// Build the BookVersion/Edition part of the revision number.",
"final",
"String",
"bookVersion",
";",
"if",
"(",
"contentSpec",
".",
"getBookVersion",
"(",
")",
"==",
"null",
")",
"{",
"bookVersion",
"=",
"contentSpec",
".",
"getEdition",
"(",
")",
";",
"}",
"else",
"{",
"bookVersion",
"=",
"contentSpec",
".",
"getBookVersion",
"(",
")",
";",
"}",
"if",
"(",
"bookVersion",
"==",
"null",
")",
"{",
"rev",
".",
"append",
"(",
"BuilderConstants",
".",
"DEFAULT_EDITION",
")",
".",
"append",
"(",
"\".0.0\"",
")",
";",
"}",
"else",
"{",
"// Remove any beta/alpha declarations",
"final",
"String",
"removeContent",
"=",
"bookVersion",
".",
"replaceAll",
"(",
"\"^(([0-9]+)|([0-9]+.[0-9]+)|([0-9]+.[0-9]+.[0-9]+))\"",
",",
"\"\"",
")",
";",
"final",
"String",
"fixedBookVersion",
"=",
"bookVersion",
".",
"replace",
"(",
"removeContent",
",",
"\"\"",
")",
";",
"if",
"(",
"fixedBookVersion",
".",
"matches",
"(",
"\"^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$\"",
")",
")",
"{",
"rev",
".",
"append",
"(",
"fixedBookVersion",
")",
";",
"}",
"else",
"if",
"(",
"fixedBookVersion",
".",
"matches",
"(",
"\"^[0-9]+\\\\.[0-9]+$\"",
")",
")",
"{",
"rev",
".",
"append",
"(",
"fixedBookVersion",
")",
".",
"append",
"(",
"\".0\"",
")",
";",
"}",
"else",
"{",
"rev",
".",
"append",
"(",
"fixedBookVersion",
")",
".",
"append",
"(",
"\".0.0\"",
")",
";",
"}",
"}",
"return",
"rev",
".",
"toString",
"(",
")",
";",
"}"
] |
Generates the Revision component of a revnumber to be used in a Revision_History.xml
file using the Book Version, Edition and Pubsnumber values from a content
specification.
@param contentSpec the content specification to generate the revision number for.
@return The generated revision number.
|
[
"Generates",
"the",
"Revision",
"component",
"of",
"a",
"revnumber",
"to",
"be",
"used",
"in",
"a",
"Revision_History",
".",
"xml",
"file",
"using",
"the",
"Book",
"Version",
"Edition",
"and",
"Pubsnumber",
"values",
"from",
"a",
"content",
"specification",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L349-L377
|
153,183
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.cleanUserPublicanCfg
|
public static String cleanUserPublicanCfg(final String userPublicanCfg) {
// Remove any xml_lang statements
String retValue = userPublicanCfg.replaceAll("(#( |\\t)*)?xml_lang\\s*:\\s*.*?($|\\r\\n|\\n)", "");
// Remove any type statements
retValue = retValue.replaceAll("(#( |\\t)*)?type\\s*:\\s*.*($|\\r\\n|\\n)" + "", "");
// Remove any brand statements
retValue = retValue.replaceAll("(#( |\\t)*)?brand\\s*:\\s*.*($|\\r\\n|\\n)" + "", "");
// Remove any dtdver statements
retValue = retValue.replaceAll("(^|\\n)( |\\t)*dtdver\\s*:\\s*.*($|\\r\\n|\\n)", "");
// BZ#1091776 Remove mainfile
retValue = retValue.replaceAll("(^|\\n)( |\\t)*mainfile\\s*:\\s*.*($|\\r\\n|\\n)", "");
// Remove any whitespace before the text
retValue = retValue.replaceAll("(^|\\n)\\s*", "$1");
if (!retValue.endsWith("\n")) {
retValue += "\n";
}
return retValue;
}
|
java
|
public static String cleanUserPublicanCfg(final String userPublicanCfg) {
// Remove any xml_lang statements
String retValue = userPublicanCfg.replaceAll("(#( |\\t)*)?xml_lang\\s*:\\s*.*?($|\\r\\n|\\n)", "");
// Remove any type statements
retValue = retValue.replaceAll("(#( |\\t)*)?type\\s*:\\s*.*($|\\r\\n|\\n)" + "", "");
// Remove any brand statements
retValue = retValue.replaceAll("(#( |\\t)*)?brand\\s*:\\s*.*($|\\r\\n|\\n)" + "", "");
// Remove any dtdver statements
retValue = retValue.replaceAll("(^|\\n)( |\\t)*dtdver\\s*:\\s*.*($|\\r\\n|\\n)", "");
// BZ#1091776 Remove mainfile
retValue = retValue.replaceAll("(^|\\n)( |\\t)*mainfile\\s*:\\s*.*($|\\r\\n|\\n)", "");
// Remove any whitespace before the text
retValue = retValue.replaceAll("(^|\\n)\\s*", "$1");
if (!retValue.endsWith("\n")) {
retValue += "\n";
}
return retValue;
}
|
[
"public",
"static",
"String",
"cleanUserPublicanCfg",
"(",
"final",
"String",
"userPublicanCfg",
")",
"{",
"// Remove any xml_lang statements",
"String",
"retValue",
"=",
"userPublicanCfg",
".",
"replaceAll",
"(",
"\"(#( |\\\\t)*)?xml_lang\\\\s*:\\\\s*.*?($|\\\\r\\\\n|\\\\n)\"",
",",
"\"\"",
")",
";",
"// Remove any type statements",
"retValue",
"=",
"retValue",
".",
"replaceAll",
"(",
"\"(#( |\\\\t)*)?type\\\\s*:\\\\s*.*($|\\\\r\\\\n|\\\\n)\"",
"+",
"\"\"",
",",
"\"\"",
")",
";",
"// Remove any brand statements",
"retValue",
"=",
"retValue",
".",
"replaceAll",
"(",
"\"(#( |\\\\t)*)?brand\\\\s*:\\\\s*.*($|\\\\r\\\\n|\\\\n)\"",
"+",
"\"\"",
",",
"\"\"",
")",
";",
"// Remove any dtdver statements",
"retValue",
"=",
"retValue",
".",
"replaceAll",
"(",
"\"(^|\\\\n)( |\\\\t)*dtdver\\\\s*:\\\\s*.*($|\\\\r\\\\n|\\\\n)\"",
",",
"\"\"",
")",
";",
"// BZ#1091776 Remove mainfile",
"retValue",
"=",
"retValue",
".",
"replaceAll",
"(",
"\"(^|\\\\n)( |\\\\t)*mainfile\\\\s*:\\\\s*.*($|\\\\r\\\\n|\\\\n)\"",
",",
"\"\"",
")",
";",
"// Remove any whitespace before the text",
"retValue",
"=",
"retValue",
".",
"replaceAll",
"(",
"\"(^|\\\\n)\\\\s*\"",
",",
"\"$1\"",
")",
";",
"if",
"(",
"!",
"retValue",
".",
"endsWith",
"(",
"\"\\n\"",
")",
")",
"{",
"retValue",
"+=",
"\"\\n\"",
";",
"}",
"return",
"retValue",
";",
"}"
] |
Clean a user specified publican.cfg to remove content that should be set for a build.
@param userPublicanCfg The User publican.cfg file to be cleaned.
@return The cleaned publican.cfg file.
|
[
"Clean",
"a",
"user",
"specified",
"publican",
".",
"cfg",
"to",
"remove",
"content",
"that",
"should",
"be",
"set",
"for",
"a",
"build",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L391-L411
|
153,184
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.getTopicIdsFromContentSpec
|
public static Set<Pair<Integer, Integer>> getTopicIdsFromContentSpec(final ContentSpec contentSpec) {
// Add the topics at this level to the database
final Set<Pair<Integer, Integer>> topicIds = new HashSet<Pair<Integer, Integer>>();
final List<SpecTopic> specTopics = contentSpec.getSpecTopics();
for (final SpecTopic specTopic : specTopics) {
if (specTopic.getDBId() != 0) {
topicIds.add(new Pair<Integer, Integer>(specTopic.getDBId(), specTopic.getRevision()));
}
}
return topicIds;
}
|
java
|
public static Set<Pair<Integer, Integer>> getTopicIdsFromContentSpec(final ContentSpec contentSpec) {
// Add the topics at this level to the database
final Set<Pair<Integer, Integer>> topicIds = new HashSet<Pair<Integer, Integer>>();
final List<SpecTopic> specTopics = contentSpec.getSpecTopics();
for (final SpecTopic specTopic : specTopics) {
if (specTopic.getDBId() != 0) {
topicIds.add(new Pair<Integer, Integer>(specTopic.getDBId(), specTopic.getRevision()));
}
}
return topicIds;
}
|
[
"public",
"static",
"Set",
"<",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
">",
"getTopicIdsFromContentSpec",
"(",
"final",
"ContentSpec",
"contentSpec",
")",
"{",
"// Add the topics at this level to the database",
"final",
"Set",
"<",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
">",
"topicIds",
"=",
"new",
"HashSet",
"<",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
">",
"(",
")",
";",
"final",
"List",
"<",
"SpecTopic",
">",
"specTopics",
"=",
"contentSpec",
".",
"getSpecTopics",
"(",
")",
";",
"for",
"(",
"final",
"SpecTopic",
"specTopic",
":",
"specTopics",
")",
"{",
"if",
"(",
"specTopic",
".",
"getDBId",
"(",
")",
"!=",
"0",
")",
"{",
"topicIds",
".",
"add",
"(",
"new",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
"(",
"specTopic",
".",
"getDBId",
"(",
")",
",",
"specTopic",
".",
"getRevision",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"topicIds",
";",
"}"
] |
Gets a Set of Topic ID's to Revisions from the content specification for each Spec Topic.
@param contentSpec The content spec to scan for topics.
@return A Set of Topic ID/Revision Pairs that represent the topics in the content spec.
|
[
"Gets",
"a",
"Set",
"of",
"Topic",
"ID",
"s",
"to",
"Revisions",
"from",
"the",
"content",
"specification",
"for",
"each",
"Spec",
"Topic",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L419-L430
|
153,185
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.addDocBookPreamble
|
public static String addDocBookPreamble(final DocBookVersion docBookVersion, final String xml, final String elementName,
final String entityName) {
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
final String xmlWithNamespace = DocBookUtilities.addDocBook50Namespace(xml, elementName);
return XMLUtilities.addDoctype(xmlWithNamespace, elementName, entityName);
} else {
return DocBookUtilities.addDocBook45Doctype(xml, entityName, elementName);
}
}
|
java
|
public static String addDocBookPreamble(final DocBookVersion docBookVersion, final String xml, final String elementName,
final String entityName) {
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
final String xmlWithNamespace = DocBookUtilities.addDocBook50Namespace(xml, elementName);
return XMLUtilities.addDoctype(xmlWithNamespace, elementName, entityName);
} else {
return DocBookUtilities.addDocBook45Doctype(xml, entityName, elementName);
}
}
|
[
"public",
"static",
"String",
"addDocBookPreamble",
"(",
"final",
"DocBookVersion",
"docBookVersion",
",",
"final",
"String",
"xml",
",",
"final",
"String",
"elementName",
",",
"final",
"String",
"entityName",
")",
"{",
"if",
"(",
"docBookVersion",
"==",
"DocBookVersion",
".",
"DOCBOOK_50",
")",
"{",
"final",
"String",
"xmlWithNamespace",
"=",
"DocBookUtilities",
".",
"addDocBook50Namespace",
"(",
"xml",
",",
"elementName",
")",
";",
"return",
"XMLUtilities",
".",
"addDoctype",
"(",
"xmlWithNamespace",
",",
"elementName",
",",
"entityName",
")",
";",
"}",
"else",
"{",
"return",
"DocBookUtilities",
".",
"addDocBook45Doctype",
"(",
"xml",
",",
"entityName",
",",
"elementName",
")",
";",
"}",
"}"
] |
Adds any content to the xml that is required for the specified DocBook version.
@param docBookVersion The DocBook version to add the preamble content for.
@param xml The XML to add the preamble content to.
@param elementName The name that the root element should be.
@param entityName The name of the local entity file, if one exists.
@return
|
[
"Adds",
"any",
"content",
"to",
"the",
"xml",
"that",
"is",
"required",
"for",
"the",
"specified",
"DocBook",
"version",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L457-L465
|
153,186
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.convertDocumentToCDATAFormattedString
|
public static String convertDocumentToCDATAFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) {
return XMLUtilities.wrapStringInCDATA(convertDocumentToFormattedString(doc, xmlFormatProperties));
}
|
java
|
public static String convertDocumentToCDATAFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) {
return XMLUtilities.wrapStringInCDATA(convertDocumentToFormattedString(doc, xmlFormatProperties));
}
|
[
"public",
"static",
"String",
"convertDocumentToCDATAFormattedString",
"(",
"final",
"Document",
"doc",
",",
"final",
"XMLFormatProperties",
"xmlFormatProperties",
")",
"{",
"return",
"XMLUtilities",
".",
"wrapStringInCDATA",
"(",
"convertDocumentToFormattedString",
"(",
"doc",
",",
"xmlFormatProperties",
")",
")",
";",
"}"
] |
Convert a DOM Document to a Formatted String representation and wrap it in a CDATA element.
@param doc The DOM Document to be converted and formatted.
@param xmlFormatProperties The XML Formatting Properties.
@return The converted XML String representation.
|
[
"Convert",
"a",
"DOM",
"Document",
"to",
"a",
"Formatted",
"String",
"representation",
"and",
"wrap",
"it",
"in",
"a",
"CDATA",
"element",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L474-L476
|
153,187
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.getTranslatedTopicBuildKey
|
public static String getTranslatedTopicBuildKey(final TranslatedTopicWrapper translatedTopic,
final TranslatedCSNodeWrapper translatedCSNode) {
String topicKey = getBaseTopicBuildKey(translatedTopic);
return translatedCSNode == null ? topicKey : (topicKey + "-" + translatedCSNode.getId());
}
|
java
|
public static String getTranslatedTopicBuildKey(final TranslatedTopicWrapper translatedTopic,
final TranslatedCSNodeWrapper translatedCSNode) {
String topicKey = getBaseTopicBuildKey(translatedTopic);
return translatedCSNode == null ? topicKey : (topicKey + "-" + translatedCSNode.getId());
}
|
[
"public",
"static",
"String",
"getTranslatedTopicBuildKey",
"(",
"final",
"TranslatedTopicWrapper",
"translatedTopic",
",",
"final",
"TranslatedCSNodeWrapper",
"translatedCSNode",
")",
"{",
"String",
"topicKey",
"=",
"getBaseTopicBuildKey",
"(",
"translatedTopic",
")",
";",
"return",
"translatedCSNode",
"==",
"null",
"?",
"topicKey",
":",
"(",
"topicKey",
"+",
"\"-\"",
"+",
"translatedCSNode",
".",
"getId",
"(",
")",
")",
";",
"}"
] |
Create a Key that can be used to store a translated topic in a build database.
@param translatedTopic The translated topic to create the key for.
@return The Key for the translated topic.
|
[
"Create",
"a",
"Key",
"that",
"can",
"be",
"used",
"to",
"store",
"a",
"translated",
"topic",
"in",
"a",
"build",
"database",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L518-L522
|
153,188
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.processTopicID
|
public static void processTopicID(final BuildData buildData, final ITopicNode topicNode, final Document doc) {
final BaseTopicWrapper<?> topic = topicNode.getTopic();
// Ignore info topics
if (!topic.hasTag(buildData.getServerEntities().getInfoTagId())) {
// Get the id value
final String errorXRefID = ((SpecNode) topicNode).getUniqueLinkId(buildData.isUseFixedUrls());
// Set the id
setDOMElementId(buildData.getDocBookVersion(), doc.getDocumentElement(), errorXRefID);
}
// Add the remap parameter
final Integer topicId = topicNode.getDBId();
doc.getDocumentElement().setAttribute("remap", "TID_" + topicId);
}
|
java
|
public static void processTopicID(final BuildData buildData, final ITopicNode topicNode, final Document doc) {
final BaseTopicWrapper<?> topic = topicNode.getTopic();
// Ignore info topics
if (!topic.hasTag(buildData.getServerEntities().getInfoTagId())) {
// Get the id value
final String errorXRefID = ((SpecNode) topicNode).getUniqueLinkId(buildData.isUseFixedUrls());
// Set the id
setDOMElementId(buildData.getDocBookVersion(), doc.getDocumentElement(), errorXRefID);
}
// Add the remap parameter
final Integer topicId = topicNode.getDBId();
doc.getDocumentElement().setAttribute("remap", "TID_" + topicId);
}
|
[
"public",
"static",
"void",
"processTopicID",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"Document",
"doc",
")",
"{",
"final",
"BaseTopicWrapper",
"<",
"?",
">",
"topic",
"=",
"topicNode",
".",
"getTopic",
"(",
")",
";",
"// Ignore info topics",
"if",
"(",
"!",
"topic",
".",
"hasTag",
"(",
"buildData",
".",
"getServerEntities",
"(",
")",
".",
"getInfoTagId",
"(",
")",
")",
")",
"{",
"// Get the id value",
"final",
"String",
"errorXRefID",
"=",
"(",
"(",
"SpecNode",
")",
"topicNode",
")",
".",
"getUniqueLinkId",
"(",
"buildData",
".",
"isUseFixedUrls",
"(",
")",
")",
";",
"// Set the id",
"setDOMElementId",
"(",
"buildData",
".",
"getDocBookVersion",
"(",
")",
",",
"doc",
".",
"getDocumentElement",
"(",
")",
",",
"errorXRefID",
")",
";",
"}",
"// Add the remap parameter",
"final",
"Integer",
"topicId",
"=",
"topicNode",
".",
"getDBId",
"(",
")",
";",
"doc",
".",
"getDocumentElement",
"(",
")",
".",
"setAttribute",
"(",
"\"remap\"",
",",
"\"TID_\"",
"+",
"topicId",
")",
";",
"}"
] |
Sets the topic xref id to the topic database id.
@param buildData Information and data structures for the build.
@param topicNode The topic to be used to set the id attribute.
@param doc The document object for the topics XML.
|
[
"Sets",
"the",
"topic",
"xref",
"id",
"to",
"the",
"topic",
"database",
"id",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L541-L556
|
153,189
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.setTopicXMLForError
|
public static Document setTopicXMLForError(final BuildData buildData, final BaseTopicWrapper<?> topic,
final String template) throws BuildProcessingException {
final String errorContent = buildTopicErrorTemplate(buildData, topic, template);
Document doc = null;
try {
doc = XMLUtilities.convertStringToDocument(errorContent);
} catch (Exception ex) {
// Exit since we shouldn't fail at converting a basic template
log.debug("Topic Error Template is not valid XML", ex);
throw new BuildProcessingException("Failed to convert the Topic Error template into a DOM document");
}
if (DocBookUtilities.TOPIC_ROOT_NODE_NAME.equals(doc.getDocumentElement().getNodeName())) {
DocBookUtilities.setSectionTitle(buildData.getDocBookVersion(), topic.getTitle(), doc);
}
return doc;
}
|
java
|
public static Document setTopicXMLForError(final BuildData buildData, final BaseTopicWrapper<?> topic,
final String template) throws BuildProcessingException {
final String errorContent = buildTopicErrorTemplate(buildData, topic, template);
Document doc = null;
try {
doc = XMLUtilities.convertStringToDocument(errorContent);
} catch (Exception ex) {
// Exit since we shouldn't fail at converting a basic template
log.debug("Topic Error Template is not valid XML", ex);
throw new BuildProcessingException("Failed to convert the Topic Error template into a DOM document");
}
if (DocBookUtilities.TOPIC_ROOT_NODE_NAME.equals(doc.getDocumentElement().getNodeName())) {
DocBookUtilities.setSectionTitle(buildData.getDocBookVersion(), topic.getTitle(), doc);
}
return doc;
}
|
[
"public",
"static",
"Document",
"setTopicXMLForError",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"BaseTopicWrapper",
"<",
"?",
">",
"topic",
",",
"final",
"String",
"template",
")",
"throws",
"BuildProcessingException",
"{",
"final",
"String",
"errorContent",
"=",
"buildTopicErrorTemplate",
"(",
"buildData",
",",
"topic",
",",
"template",
")",
";",
"Document",
"doc",
"=",
"null",
";",
"try",
"{",
"doc",
"=",
"XMLUtilities",
".",
"convertStringToDocument",
"(",
"errorContent",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// Exit since we shouldn't fail at converting a basic template",
"log",
".",
"debug",
"(",
"\"Topic Error Template is not valid XML\"",
",",
"ex",
")",
";",
"throw",
"new",
"BuildProcessingException",
"(",
"\"Failed to convert the Topic Error template into a DOM document\"",
")",
";",
"}",
"if",
"(",
"DocBookUtilities",
".",
"TOPIC_ROOT_NODE_NAME",
".",
"equals",
"(",
"doc",
".",
"getDocumentElement",
"(",
")",
".",
"getNodeName",
"(",
")",
")",
")",
"{",
"DocBookUtilities",
".",
"setSectionTitle",
"(",
"buildData",
".",
"getDocBookVersion",
"(",
")",
",",
"topic",
".",
"getTitle",
"(",
")",
",",
"doc",
")",
";",
"}",
"return",
"doc",
";",
"}"
] |
Sets the XML of the topic to the specified error template.
@param buildData Information and data structures for the build.
@param topic The topic to be updated as having an error.
@param template The template for the Error Message.
@return The Document Object that is initialised using the topic and error template.
@throws BuildProcessingException Thrown if an unexpected error occurs during building.
|
[
"Sets",
"the",
"XML",
"of",
"the",
"topic",
"to",
"the",
"specified",
"error",
"template",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L580-L597
|
153,190
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.setTopicNodeXMLForError
|
public static void setTopicNodeXMLForError(final BuildData buildData, final ITopicNode topicNode,
final String template) throws BuildProcessingException {
final BaseTopicWrapper<?> topic = topicNode.getTopic();
final Document doc = setTopicXMLForError(buildData, topic, template);
processTopicID(buildData, topicNode, doc);
topicNode.setXMLDocument(doc);
}
|
java
|
public static void setTopicNodeXMLForError(final BuildData buildData, final ITopicNode topicNode,
final String template) throws BuildProcessingException {
final BaseTopicWrapper<?> topic = topicNode.getTopic();
final Document doc = setTopicXMLForError(buildData, topic, template);
processTopicID(buildData, topicNode, doc);
topicNode.setXMLDocument(doc);
}
|
[
"public",
"static",
"void",
"setTopicNodeXMLForError",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"String",
"template",
")",
"throws",
"BuildProcessingException",
"{",
"final",
"BaseTopicWrapper",
"<",
"?",
">",
"topic",
"=",
"topicNode",
".",
"getTopic",
"(",
")",
";",
"final",
"Document",
"doc",
"=",
"setTopicXMLForError",
"(",
"buildData",
",",
"topic",
",",
"template",
")",
";",
"processTopicID",
"(",
"buildData",
",",
"topicNode",
",",
"doc",
")",
";",
"topicNode",
".",
"setXMLDocument",
"(",
"doc",
")",
";",
"}"
] |
Sets the XML of the topic in the content spec to the error template provided.
@param buildData Information and data structures for the build.
@param topicNode The topic node to be updated as having an error.
@param template The template for the Error Message.
@throws BuildProcessingException Thrown if an unexpected error occurs during building.
|
[
"Sets",
"the",
"XML",
"of",
"the",
"topic",
"in",
"the",
"content",
"spec",
"to",
"the",
"error",
"template",
"provided",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L607-L613
|
153,191
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
|
DocBookBuildUtilities.collectIdAttributes
|
public static void collectIdAttributes(final DocBookVersion docBookVersion, final SpecTopic topic, final Node node,
final Map<SpecTopic, Set<String>> usedIdAttributes) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
final Node idAttribute;
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
idAttribute = attributes.getNamedItem("xml:id");
} else {
idAttribute = attributes.getNamedItem("id");
}
if (idAttribute != null) {
final String idAttributeValue = idAttribute.getNodeValue();
if (!usedIdAttributes.containsKey(topic)) {
usedIdAttributes.put(topic, new HashSet<String>());
}
usedIdAttributes.get(topic).add(idAttributeValue);
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
collectIdAttributes(docBookVersion, topic, elements.item(i), usedIdAttributes);
}
}
|
java
|
public static void collectIdAttributes(final DocBookVersion docBookVersion, final SpecTopic topic, final Node node,
final Map<SpecTopic, Set<String>> usedIdAttributes) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
final Node idAttribute;
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
idAttribute = attributes.getNamedItem("xml:id");
} else {
idAttribute = attributes.getNamedItem("id");
}
if (idAttribute != null) {
final String idAttributeValue = idAttribute.getNodeValue();
if (!usedIdAttributes.containsKey(topic)) {
usedIdAttributes.put(topic, new HashSet<String>());
}
usedIdAttributes.get(topic).add(idAttributeValue);
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
collectIdAttributes(docBookVersion, topic, elements.item(i), usedIdAttributes);
}
}
|
[
"public",
"static",
"void",
"collectIdAttributes",
"(",
"final",
"DocBookVersion",
"docBookVersion",
",",
"final",
"SpecTopic",
"topic",
",",
"final",
"Node",
"node",
",",
"final",
"Map",
"<",
"SpecTopic",
",",
"Set",
"<",
"String",
">",
">",
"usedIdAttributes",
")",
"{",
"final",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"final",
"Node",
"idAttribute",
";",
"if",
"(",
"docBookVersion",
"==",
"DocBookVersion",
".",
"DOCBOOK_50",
")",
"{",
"idAttribute",
"=",
"attributes",
".",
"getNamedItem",
"(",
"\"xml:id\"",
")",
";",
"}",
"else",
"{",
"idAttribute",
"=",
"attributes",
".",
"getNamedItem",
"(",
"\"id\"",
")",
";",
"}",
"if",
"(",
"idAttribute",
"!=",
"null",
")",
"{",
"final",
"String",
"idAttributeValue",
"=",
"idAttribute",
".",
"getNodeValue",
"(",
")",
";",
"if",
"(",
"!",
"usedIdAttributes",
".",
"containsKey",
"(",
"topic",
")",
")",
"{",
"usedIdAttributes",
".",
"put",
"(",
"topic",
",",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
")",
";",
"}",
"usedIdAttributes",
".",
"get",
"(",
"topic",
")",
".",
"add",
"(",
"idAttributeValue",
")",
";",
"}",
"}",
"final",
"NodeList",
"elements",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"getLength",
"(",
")",
";",
"++",
"i",
")",
"{",
"collectIdAttributes",
"(",
"docBookVersion",
",",
"topic",
",",
"elements",
".",
"item",
"(",
"i",
")",
",",
"usedIdAttributes",
")",
";",
"}",
"}"
] |
This function scans the supplied XML node and it's children for id attributes, collecting them in the usedIdAttributes
parameter.
@param docBookVersion
@param topic The topic that we are collecting attribute ID's for.
@param node The current node being processed (will be the document root to start with, and then all the children as this
function is recursively called)
@param usedIdAttributes The set of Used ID Attributes that should be added to.
|
[
"This",
"function",
"scans",
"the",
"supplied",
"XML",
"node",
"and",
"it",
"s",
"children",
"for",
"id",
"attributes",
"collecting",
"them",
"in",
"the",
"usedIdAttributes",
"parameter",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L625-L648
|
153,192
|
jbundle/jbundle
|
app/program/screen/src/main/java/org/jbundle/app/program/screen/ExportRecordsScreen.java
|
ExportRecordsScreen.copyProcessParams
|
public String copyProcessParams()
{
String strProcess = null;
strProcess = Utility.addURLParam(strProcess, DBParams.LOCAL, this.getProperty(DBParams.LOCAL));
strProcess = Utility.addURLParam(strProcess, DBParams.REMOTE, this.getProperty(DBParams.REMOTE));
strProcess = Utility.addURLParam(strProcess, DBParams.TABLE, this.getProperty(DBParams.TABLE));
strProcess = Utility.addURLParam(strProcess, DBParams.MESSAGE_SERVER, this.getProperty(DBParams.MESSAGE_SERVER));
strProcess = Utility.addURLParam(strProcess, DBParams.CONNECTION_TYPE, this.getProperty(DBParams.CONNECTION_TYPE));
strProcess = Utility.addURLParam(strProcess, DBParams.REMOTE_HOST, this.getProperty(DBParams.REMOTE_HOST));
strProcess = Utility.addURLParam(strProcess, DBParams.CODEBASE, this.getProperty(DBParams.CODEBASE));
strProcess = Utility.addURLParam(strProcess, SQLParams.DATABASE_PRODUCT_PARAM, this.getProperty(SQLParams.DATABASE_PRODUCT_PARAM));
strProcess = Utility.addURLParam(strProcess, DBConstants.SYSTEM_NAME, this.getProperty(DBConstants.SYSTEM_NAME), false);
return strProcess;
}
|
java
|
public String copyProcessParams()
{
String strProcess = null;
strProcess = Utility.addURLParam(strProcess, DBParams.LOCAL, this.getProperty(DBParams.LOCAL));
strProcess = Utility.addURLParam(strProcess, DBParams.REMOTE, this.getProperty(DBParams.REMOTE));
strProcess = Utility.addURLParam(strProcess, DBParams.TABLE, this.getProperty(DBParams.TABLE));
strProcess = Utility.addURLParam(strProcess, DBParams.MESSAGE_SERVER, this.getProperty(DBParams.MESSAGE_SERVER));
strProcess = Utility.addURLParam(strProcess, DBParams.CONNECTION_TYPE, this.getProperty(DBParams.CONNECTION_TYPE));
strProcess = Utility.addURLParam(strProcess, DBParams.REMOTE_HOST, this.getProperty(DBParams.REMOTE_HOST));
strProcess = Utility.addURLParam(strProcess, DBParams.CODEBASE, this.getProperty(DBParams.CODEBASE));
strProcess = Utility.addURLParam(strProcess, SQLParams.DATABASE_PRODUCT_PARAM, this.getProperty(SQLParams.DATABASE_PRODUCT_PARAM));
strProcess = Utility.addURLParam(strProcess, DBConstants.SYSTEM_NAME, this.getProperty(DBConstants.SYSTEM_NAME), false);
return strProcess;
}
|
[
"public",
"String",
"copyProcessParams",
"(",
")",
"{",
"String",
"strProcess",
"=",
"null",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"LOCAL",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"LOCAL",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"REMOTE",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"REMOTE",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"TABLE",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"TABLE",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"MESSAGE_SERVER",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"MESSAGE_SERVER",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"CONNECTION_TYPE",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"CONNECTION_TYPE",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"REMOTE_HOST",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"REMOTE_HOST",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBParams",
".",
"CODEBASE",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"CODEBASE",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"SQLParams",
".",
"DATABASE_PRODUCT_PARAM",
",",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"DATABASE_PRODUCT_PARAM",
")",
")",
";",
"strProcess",
"=",
"Utility",
".",
"addURLParam",
"(",
"strProcess",
",",
"DBConstants",
".",
"SYSTEM_NAME",
",",
"this",
".",
"getProperty",
"(",
"DBConstants",
".",
"SYSTEM_NAME",
")",
",",
"false",
")",
";",
"return",
"strProcess",
";",
"}"
] |
CopyProcessParams Method.
|
[
"CopyProcessParams",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/ExportRecordsScreen.java#L112-L125
|
153,193
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.doValidationPass
|
protected boolean doValidationPass(final ProcessorData processorData) {
// Validate the content specification before doing any rest calls
if (!doFirstValidationPass(processorData)) {
return false;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
shutdown.set(true);
return false;
}
// Validate the content specification bug links before doing the post validation as it is a costly operation
if (!doBugLinkValidationPass(processorData)) {
log.error(ProcessorConstants.ERROR_INVALID_CS_MSG);
return false;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
shutdown.set(true);
return false;
}
// Validate the content specification now that we have most of the data from the REST API
if (!doSecondValidationPass(processorData)) {
log.error(ProcessorConstants.ERROR_INVALID_CS_MSG);
return false;
}
// Log that the spec is valid
log.info(ProcessorConstants.INFO_VALID_CS_MSG);
return true;
}
|
java
|
protected boolean doValidationPass(final ProcessorData processorData) {
// Validate the content specification before doing any rest calls
if (!doFirstValidationPass(processorData)) {
return false;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
shutdown.set(true);
return false;
}
// Validate the content specification bug links before doing the post validation as it is a costly operation
if (!doBugLinkValidationPass(processorData)) {
log.error(ProcessorConstants.ERROR_INVALID_CS_MSG);
return false;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
shutdown.set(true);
return false;
}
// Validate the content specification now that we have most of the data from the REST API
if (!doSecondValidationPass(processorData)) {
log.error(ProcessorConstants.ERROR_INVALID_CS_MSG);
return false;
}
// Log that the spec is valid
log.info(ProcessorConstants.INFO_VALID_CS_MSG);
return true;
}
|
[
"protected",
"boolean",
"doValidationPass",
"(",
"final",
"ProcessorData",
"processorData",
")",
"{",
"// Validate the content specification before doing any rest calls",
"if",
"(",
"!",
"doFirstValidationPass",
"(",
"processorData",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"shutdown",
".",
"set",
"(",
"true",
")",
";",
"return",
"false",
";",
"}",
"// Validate the content specification bug links before doing the post validation as it is a costly operation",
"if",
"(",
"!",
"doBugLinkValidationPass",
"(",
"processorData",
")",
")",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_INVALID_CS_MSG",
")",
";",
"return",
"false",
";",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"shutdown",
".",
"set",
"(",
"true",
")",
";",
"return",
"false",
";",
"}",
"// Validate the content specification now that we have most of the data from the REST API",
"if",
"(",
"!",
"doSecondValidationPass",
"(",
"processorData",
")",
")",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_INVALID_CS_MSG",
")",
";",
"return",
"false",
";",
"}",
"// Log that the spec is valid",
"log",
".",
"info",
"(",
"ProcessorConstants",
".",
"INFO_VALID_CS_MSG",
")",
";",
"return",
"true",
";",
"}"
] |
Does a validation pass before processing any data.
@param processorData The data to be used during processing.
@return True if the content spec is valid, otherwise false.
|
[
"Does",
"a",
"validation",
"pass",
"before",
"processing",
"any",
"data",
"."
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L218-L252
|
153,194
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.doFirstValidationPass
|
protected boolean doFirstValidationPass(final ProcessorData processorData) {
final ContentSpec contentSpec = processorData.getContentSpec();
LOG.info("Starting first validation pass...");
// Validate the content spec syntax
if (!validator.preValidateContentSpec(contentSpec)) {
log.error(ProcessorConstants.ERROR_INVALID_CS_MSG);
return false;
}
return true;
}
|
java
|
protected boolean doFirstValidationPass(final ProcessorData processorData) {
final ContentSpec contentSpec = processorData.getContentSpec();
LOG.info("Starting first validation pass...");
// Validate the content spec syntax
if (!validator.preValidateContentSpec(contentSpec)) {
log.error(ProcessorConstants.ERROR_INVALID_CS_MSG);
return false;
}
return true;
}
|
[
"protected",
"boolean",
"doFirstValidationPass",
"(",
"final",
"ProcessorData",
"processorData",
")",
"{",
"final",
"ContentSpec",
"contentSpec",
"=",
"processorData",
".",
"getContentSpec",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Starting first validation pass...\"",
")",
";",
"// Validate the content spec syntax",
"if",
"(",
"!",
"validator",
".",
"preValidateContentSpec",
"(",
"contentSpec",
")",
")",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_INVALID_CS_MSG",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Does the first validation pass on the content spec, which does the core validation without doing any rest calls.
@param processorData The data to be used during processing.
@return True if the content spec is valid without doing any rest calls, otherwise false.
|
[
"Does",
"the",
"first",
"validation",
"pass",
"on",
"the",
"content",
"spec",
"which",
"does",
"the",
"core",
"validation",
"without",
"doing",
"any",
"rest",
"calls",
"."
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L260-L272
|
153,195
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.doBugLinkValidationPass
|
protected boolean doBugLinkValidationPass(final ProcessorData processorData) {
final ContentSpec contentSpec = processorData.getContentSpec();
boolean valid = true;
if (processingOptions.isValidateBugLinks() && contentSpec.isInjectBugLinks()) {
// Find out if we should re-validate bug links
boolean reValidateBugLinks = true;
if (contentSpec.getId() != null) {
ContentSpecWrapper contentSpecEntity = null;
try {
contentSpecEntity = providerFactory.getProvider(ContentSpecProvider.class).getContentSpec(contentSpec.getId(),
contentSpec.getRevision());
} catch (ProviderException e) {
}
// This shouldn't happen but if it does, then it'll be picked up in the postValidationContentSpec method
if (contentSpecEntity != null) {
boolean weekPassed = false;
if (processingOptions.isDoBugLinkLastValidateCheck()) {
final PropertyTagInContentSpecWrapper lastValidated = contentSpecEntity.getProperty(
serverEntities.getBugLinksLastValidatedPropertyTagId());
final Date now = new Date();
final long then;
if (lastValidated != null && lastValidated.getValue() != null && lastValidated.getValue().matches("^[0-9]+$")) {
then = Long.parseLong(lastValidated.getValue());
} else {
then = 0L;
}
// Check that a week has passed
weekPassed = (then + WEEK_MILLI_SECS) <= now.getTime();
} else {
weekPassed = true;
}
if (!weekPassed) {
// A week hasn't passed so check to see if anything has changed
boolean changed = false;
final String bugLinksValue = contentSpec.getBugLinksActualValue() == null ? null : contentSpec
.getBugLinksActualValue().toString();
if (EntityUtilities.hasContentSpecMetaDataChanged(CommonConstants.CS_BUG_LINKS_TITLE, bugLinksValue,
contentSpecEntity)) {
changed = true;
} else {
BugLinkType bugLinkType = null;
BugLinkOptions bugOptions = null;
if (contentSpec.getBugLinks() == BugLinkType.JIRA) {
bugLinkType = BugLinkType.JIRA;
bugOptions = contentSpec.getJIRABugLinkOptions();
} else {
bugLinkType = BugLinkType.BUGZILLA;
bugOptions = contentSpec.getBugzillaBugLinkOptions();
}
final BaseBugLinkStrategy bugLinkStrategy = BugLinkStrategyFactory.getInstance().create(bugLinkType,
bugOptions.getBaseUrl());
if (bugLinkType != null && bugLinkStrategy.hasValuesChanged(contentSpecEntity, bugOptions)) {
changed = true;
}
}
// If the content hasn't changed then don't re-validate the bug links
if (!changed) {
reValidateBugLinks = false;
}
}
}
}
// Validate the bug links
if (reValidateBugLinks) {
processorData.setBugLinksReValidated(reValidateBugLinks);
LOG.info("Starting bug link validation pass...");
if (!validator.postValidateBugLinks(contentSpec, processingOptions.isStrictBugLinks())) {
valid = false;
}
}
}
return valid;
}
|
java
|
protected boolean doBugLinkValidationPass(final ProcessorData processorData) {
final ContentSpec contentSpec = processorData.getContentSpec();
boolean valid = true;
if (processingOptions.isValidateBugLinks() && contentSpec.isInjectBugLinks()) {
// Find out if we should re-validate bug links
boolean reValidateBugLinks = true;
if (contentSpec.getId() != null) {
ContentSpecWrapper contentSpecEntity = null;
try {
contentSpecEntity = providerFactory.getProvider(ContentSpecProvider.class).getContentSpec(contentSpec.getId(),
contentSpec.getRevision());
} catch (ProviderException e) {
}
// This shouldn't happen but if it does, then it'll be picked up in the postValidationContentSpec method
if (contentSpecEntity != null) {
boolean weekPassed = false;
if (processingOptions.isDoBugLinkLastValidateCheck()) {
final PropertyTagInContentSpecWrapper lastValidated = contentSpecEntity.getProperty(
serverEntities.getBugLinksLastValidatedPropertyTagId());
final Date now = new Date();
final long then;
if (lastValidated != null && lastValidated.getValue() != null && lastValidated.getValue().matches("^[0-9]+$")) {
then = Long.parseLong(lastValidated.getValue());
} else {
then = 0L;
}
// Check that a week has passed
weekPassed = (then + WEEK_MILLI_SECS) <= now.getTime();
} else {
weekPassed = true;
}
if (!weekPassed) {
// A week hasn't passed so check to see if anything has changed
boolean changed = false;
final String bugLinksValue = contentSpec.getBugLinksActualValue() == null ? null : contentSpec
.getBugLinksActualValue().toString();
if (EntityUtilities.hasContentSpecMetaDataChanged(CommonConstants.CS_BUG_LINKS_TITLE, bugLinksValue,
contentSpecEntity)) {
changed = true;
} else {
BugLinkType bugLinkType = null;
BugLinkOptions bugOptions = null;
if (contentSpec.getBugLinks() == BugLinkType.JIRA) {
bugLinkType = BugLinkType.JIRA;
bugOptions = contentSpec.getJIRABugLinkOptions();
} else {
bugLinkType = BugLinkType.BUGZILLA;
bugOptions = contentSpec.getBugzillaBugLinkOptions();
}
final BaseBugLinkStrategy bugLinkStrategy = BugLinkStrategyFactory.getInstance().create(bugLinkType,
bugOptions.getBaseUrl());
if (bugLinkType != null && bugLinkStrategy.hasValuesChanged(contentSpecEntity, bugOptions)) {
changed = true;
}
}
// If the content hasn't changed then don't re-validate the bug links
if (!changed) {
reValidateBugLinks = false;
}
}
}
}
// Validate the bug links
if (reValidateBugLinks) {
processorData.setBugLinksReValidated(reValidateBugLinks);
LOG.info("Starting bug link validation pass...");
if (!validator.postValidateBugLinks(contentSpec, processingOptions.isStrictBugLinks())) {
valid = false;
}
}
}
return valid;
}
|
[
"protected",
"boolean",
"doBugLinkValidationPass",
"(",
"final",
"ProcessorData",
"processorData",
")",
"{",
"final",
"ContentSpec",
"contentSpec",
"=",
"processorData",
".",
"getContentSpec",
"(",
")",
";",
"boolean",
"valid",
"=",
"true",
";",
"if",
"(",
"processingOptions",
".",
"isValidateBugLinks",
"(",
")",
"&&",
"contentSpec",
".",
"isInjectBugLinks",
"(",
")",
")",
"{",
"// Find out if we should re-validate bug links",
"boolean",
"reValidateBugLinks",
"=",
"true",
";",
"if",
"(",
"contentSpec",
".",
"getId",
"(",
")",
"!=",
"null",
")",
"{",
"ContentSpecWrapper",
"contentSpecEntity",
"=",
"null",
";",
"try",
"{",
"contentSpecEntity",
"=",
"providerFactory",
".",
"getProvider",
"(",
"ContentSpecProvider",
".",
"class",
")",
".",
"getContentSpec",
"(",
"contentSpec",
".",
"getId",
"(",
")",
",",
"contentSpec",
".",
"getRevision",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ProviderException",
"e",
")",
"{",
"}",
"// This shouldn't happen but if it does, then it'll be picked up in the postValidationContentSpec method",
"if",
"(",
"contentSpecEntity",
"!=",
"null",
")",
"{",
"boolean",
"weekPassed",
"=",
"false",
";",
"if",
"(",
"processingOptions",
".",
"isDoBugLinkLastValidateCheck",
"(",
")",
")",
"{",
"final",
"PropertyTagInContentSpecWrapper",
"lastValidated",
"=",
"contentSpecEntity",
".",
"getProperty",
"(",
"serverEntities",
".",
"getBugLinksLastValidatedPropertyTagId",
"(",
")",
")",
";",
"final",
"Date",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"final",
"long",
"then",
";",
"if",
"(",
"lastValidated",
"!=",
"null",
"&&",
"lastValidated",
".",
"getValue",
"(",
")",
"!=",
"null",
"&&",
"lastValidated",
".",
"getValue",
"(",
")",
".",
"matches",
"(",
"\"^[0-9]+$\"",
")",
")",
"{",
"then",
"=",
"Long",
".",
"parseLong",
"(",
"lastValidated",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"then",
"=",
"0L",
";",
"}",
"// Check that a week has passed",
"weekPassed",
"=",
"(",
"then",
"+",
"WEEK_MILLI_SECS",
")",
"<=",
"now",
".",
"getTime",
"(",
")",
";",
"}",
"else",
"{",
"weekPassed",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"weekPassed",
")",
"{",
"// A week hasn't passed so check to see if anything has changed",
"boolean",
"changed",
"=",
"false",
";",
"final",
"String",
"bugLinksValue",
"=",
"contentSpec",
".",
"getBugLinksActualValue",
"(",
")",
"==",
"null",
"?",
"null",
":",
"contentSpec",
".",
"getBugLinksActualValue",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"EntityUtilities",
".",
"hasContentSpecMetaDataChanged",
"(",
"CommonConstants",
".",
"CS_BUG_LINKS_TITLE",
",",
"bugLinksValue",
",",
"contentSpecEntity",
")",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"else",
"{",
"BugLinkType",
"bugLinkType",
"=",
"null",
";",
"BugLinkOptions",
"bugOptions",
"=",
"null",
";",
"if",
"(",
"contentSpec",
".",
"getBugLinks",
"(",
")",
"==",
"BugLinkType",
".",
"JIRA",
")",
"{",
"bugLinkType",
"=",
"BugLinkType",
".",
"JIRA",
";",
"bugOptions",
"=",
"contentSpec",
".",
"getJIRABugLinkOptions",
"(",
")",
";",
"}",
"else",
"{",
"bugLinkType",
"=",
"BugLinkType",
".",
"BUGZILLA",
";",
"bugOptions",
"=",
"contentSpec",
".",
"getBugzillaBugLinkOptions",
"(",
")",
";",
"}",
"final",
"BaseBugLinkStrategy",
"bugLinkStrategy",
"=",
"BugLinkStrategyFactory",
".",
"getInstance",
"(",
")",
".",
"create",
"(",
"bugLinkType",
",",
"bugOptions",
".",
"getBaseUrl",
"(",
")",
")",
";",
"if",
"(",
"bugLinkType",
"!=",
"null",
"&&",
"bugLinkStrategy",
".",
"hasValuesChanged",
"(",
"contentSpecEntity",
",",
"bugOptions",
")",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"}",
"// If the content hasn't changed then don't re-validate the bug links",
"if",
"(",
"!",
"changed",
")",
"{",
"reValidateBugLinks",
"=",
"false",
";",
"}",
"}",
"}",
"}",
"// Validate the bug links",
"if",
"(",
"reValidateBugLinks",
")",
"{",
"processorData",
".",
"setBugLinksReValidated",
"(",
"reValidateBugLinks",
")",
";",
"LOG",
".",
"info",
"(",
"\"Starting bug link validation pass...\"",
")",
";",
"if",
"(",
"!",
"validator",
".",
"postValidateBugLinks",
"(",
"contentSpec",
",",
"processingOptions",
".",
"isStrictBugLinks",
"(",
")",
")",
")",
"{",
"valid",
"=",
"false",
";",
"}",
"}",
"}",
"return",
"valid",
";",
"}"
] |
Checks if bug links should be validated and performs the validation if required.
@param processorData The data to be used during processing.
@return True if the content spec bug links are valid, otherwise false.
|
[
"Checks",
"if",
"bug",
"links",
"should",
"be",
"validated",
"and",
"performs",
"the",
"validation",
"if",
"required",
"."
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L280-L360
|
153,196
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.doSecondValidationPass
|
protected boolean doSecondValidationPass(final ProcessorData processorData) {
// Validate the content specification now that we have most of the data from the REST API
LOG.info("Starting second validation pass...");
final ContentSpec contentSpec = processorData.getContentSpec();
return validator.postValidateContentSpec(contentSpec, processorData.getUsername());
}
|
java
|
protected boolean doSecondValidationPass(final ProcessorData processorData) {
// Validate the content specification now that we have most of the data from the REST API
LOG.info("Starting second validation pass...");
final ContentSpec contentSpec = processorData.getContentSpec();
return validator.postValidateContentSpec(contentSpec, processorData.getUsername());
}
|
[
"protected",
"boolean",
"doSecondValidationPass",
"(",
"final",
"ProcessorData",
"processorData",
")",
"{",
"// Validate the content specification now that we have most of the data from the REST API",
"LOG",
".",
"info",
"(",
"\"Starting second validation pass...\"",
")",
";",
"final",
"ContentSpec",
"contentSpec",
"=",
"processorData",
".",
"getContentSpec",
"(",
")",
";",
"return",
"validator",
".",
"postValidateContentSpec",
"(",
"contentSpec",
",",
"processorData",
".",
"getUsername",
"(",
")",
")",
";",
"}"
] |
Does the post Validation step on a Content Spec.
@param processorData The data to be used during processing.
@return True if the content spec is valid.
|
[
"Does",
"the",
"post",
"Validation",
"step",
"on",
"a",
"Content",
"Spec",
"."
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L368-L374
|
153,197
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.saveContentSpec
|
protected boolean saveContentSpec(final DataProviderFactory providerFactory, final ProcessorData processorData, final boolean edit) {
final ContentSpecProvider contentSpecProvider = providerFactory.getProvider(ContentSpecProvider.class);
try {
final ContentSpec contentSpec = processorData.contentSpec;
final LocaleWrapper locale = contentSpec.getLocale() != null ?
EntityUtilities.findLocaleFromString(serverSettings.getLocales(), contentSpec.getLocale())
: serverSettings.getDefaultLocale();
final List<ITopicNode> topicNodes = contentSpec.getAllTopicNodes();
// Create the duplicate topic map
final Map<ITopicNode, ITopicNode> duplicatedTopicMap = createDuplicatedTopicMap(topicNodes);
// Create the new topic entities
createOrUpdateTopics(topicNodes, topics, processorData, locale);
// Check if the app should be shutdown
if (isShuttingDown.get()) {
shutdown.set(true);
throw new ProcessingException("Shutdown Requested");
}
// From here on the main saving happens so this shouldn't be interrupted
// Save the new topic entities
if (!topics.savePool()) {
log.error(ProcessorConstants.ERROR_DATABASE_ERROR_MSG);
throw new ProcessingException("Failed to save the pool of topics.");
}
// Initialise the new and cloned topics using the populated topic pool
for (final ITopicNode topicNode : topicNodes) {
topics.initialiseFromPool(topicNode);
cleanSpecTopicWhenCreatedOrUpdated(topicNode);
}
// Sync the Duplicated Topics (ID = X<Number>)
syncDuplicatedTopics(duplicatedTopicMap);
// Save the content spec
mergeAndSaveContentSpec(providerFactory, processorData, !edit);
} catch (ProcessingException e) {
LOG.debug("", e);
if (providerFactory.isTransactionsSupported()) {
providerFactory.rollback();
} else {
// Clean up the data that was created
if (processorData.getContentSpec().getId() != null && !edit) {
try {
contentSpecProvider.deleteContentSpec(processorData.getContentSpec().getId());
} catch (Exception e1) {
log.error("Unable to clean up the Content Specification from the database.", e);
}
}
if (topics.isInitialised()) topics.rollbackPool();
}
return false;
} catch (Exception e) {
LOG.error("", e);
if (providerFactory.isTransactionsSupported()) {
providerFactory.rollback();
} else {
// Clean up the data that was created
if (processorData.getContentSpec().getId() != null && !edit) {
try {
contentSpecProvider.deleteContentSpec(processorData.getContentSpec().getId());
} catch (Exception e1) {
log.error("Unable to clean up the Content Specification from the database.", e);
}
}
if (topics.isInitialised()) topics.rollbackPool();
}
log.debug("", e);
return false;
}
return true;
}
|
java
|
protected boolean saveContentSpec(final DataProviderFactory providerFactory, final ProcessorData processorData, final boolean edit) {
final ContentSpecProvider contentSpecProvider = providerFactory.getProvider(ContentSpecProvider.class);
try {
final ContentSpec contentSpec = processorData.contentSpec;
final LocaleWrapper locale = contentSpec.getLocale() != null ?
EntityUtilities.findLocaleFromString(serverSettings.getLocales(), contentSpec.getLocale())
: serverSettings.getDefaultLocale();
final List<ITopicNode> topicNodes = contentSpec.getAllTopicNodes();
// Create the duplicate topic map
final Map<ITopicNode, ITopicNode> duplicatedTopicMap = createDuplicatedTopicMap(topicNodes);
// Create the new topic entities
createOrUpdateTopics(topicNodes, topics, processorData, locale);
// Check if the app should be shutdown
if (isShuttingDown.get()) {
shutdown.set(true);
throw new ProcessingException("Shutdown Requested");
}
// From here on the main saving happens so this shouldn't be interrupted
// Save the new topic entities
if (!topics.savePool()) {
log.error(ProcessorConstants.ERROR_DATABASE_ERROR_MSG);
throw new ProcessingException("Failed to save the pool of topics.");
}
// Initialise the new and cloned topics using the populated topic pool
for (final ITopicNode topicNode : topicNodes) {
topics.initialiseFromPool(topicNode);
cleanSpecTopicWhenCreatedOrUpdated(topicNode);
}
// Sync the Duplicated Topics (ID = X<Number>)
syncDuplicatedTopics(duplicatedTopicMap);
// Save the content spec
mergeAndSaveContentSpec(providerFactory, processorData, !edit);
} catch (ProcessingException e) {
LOG.debug("", e);
if (providerFactory.isTransactionsSupported()) {
providerFactory.rollback();
} else {
// Clean up the data that was created
if (processorData.getContentSpec().getId() != null && !edit) {
try {
contentSpecProvider.deleteContentSpec(processorData.getContentSpec().getId());
} catch (Exception e1) {
log.error("Unable to clean up the Content Specification from the database.", e);
}
}
if (topics.isInitialised()) topics.rollbackPool();
}
return false;
} catch (Exception e) {
LOG.error("", e);
if (providerFactory.isTransactionsSupported()) {
providerFactory.rollback();
} else {
// Clean up the data that was created
if (processorData.getContentSpec().getId() != null && !edit) {
try {
contentSpecProvider.deleteContentSpec(processorData.getContentSpec().getId());
} catch (Exception e1) {
log.error("Unable to clean up the Content Specification from the database.", e);
}
}
if (topics.isInitialised()) topics.rollbackPool();
}
log.debug("", e);
return false;
}
return true;
}
|
[
"protected",
"boolean",
"saveContentSpec",
"(",
"final",
"DataProviderFactory",
"providerFactory",
",",
"final",
"ProcessorData",
"processorData",
",",
"final",
"boolean",
"edit",
")",
"{",
"final",
"ContentSpecProvider",
"contentSpecProvider",
"=",
"providerFactory",
".",
"getProvider",
"(",
"ContentSpecProvider",
".",
"class",
")",
";",
"try",
"{",
"final",
"ContentSpec",
"contentSpec",
"=",
"processorData",
".",
"contentSpec",
";",
"final",
"LocaleWrapper",
"locale",
"=",
"contentSpec",
".",
"getLocale",
"(",
")",
"!=",
"null",
"?",
"EntityUtilities",
".",
"findLocaleFromString",
"(",
"serverSettings",
".",
"getLocales",
"(",
")",
",",
"contentSpec",
".",
"getLocale",
"(",
")",
")",
":",
"serverSettings",
".",
"getDefaultLocale",
"(",
")",
";",
"final",
"List",
"<",
"ITopicNode",
">",
"topicNodes",
"=",
"contentSpec",
".",
"getAllTopicNodes",
"(",
")",
";",
"// Create the duplicate topic map",
"final",
"Map",
"<",
"ITopicNode",
",",
"ITopicNode",
">",
"duplicatedTopicMap",
"=",
"createDuplicatedTopicMap",
"(",
"topicNodes",
")",
";",
"// Create the new topic entities",
"createOrUpdateTopics",
"(",
"topicNodes",
",",
"topics",
",",
"processorData",
",",
"locale",
")",
";",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"shutdown",
".",
"set",
"(",
"true",
")",
";",
"throw",
"new",
"ProcessingException",
"(",
"\"Shutdown Requested\"",
")",
";",
"}",
"// From here on the main saving happens so this shouldn't be interrupted",
"// Save the new topic entities",
"if",
"(",
"!",
"topics",
".",
"savePool",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_DATABASE_ERROR_MSG",
")",
";",
"throw",
"new",
"ProcessingException",
"(",
"\"Failed to save the pool of topics.\"",
")",
";",
"}",
"// Initialise the new and cloned topics using the populated topic pool",
"for",
"(",
"final",
"ITopicNode",
"topicNode",
":",
"topicNodes",
")",
"{",
"topics",
".",
"initialiseFromPool",
"(",
"topicNode",
")",
";",
"cleanSpecTopicWhenCreatedOrUpdated",
"(",
"topicNode",
")",
";",
"}",
"// Sync the Duplicated Topics (ID = X<Number>)",
"syncDuplicatedTopics",
"(",
"duplicatedTopicMap",
")",
";",
"// Save the content spec",
"mergeAndSaveContentSpec",
"(",
"providerFactory",
",",
"processorData",
",",
"!",
"edit",
")",
";",
"}",
"catch",
"(",
"ProcessingException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"\"",
",",
"e",
")",
";",
"if",
"(",
"providerFactory",
".",
"isTransactionsSupported",
"(",
")",
")",
"{",
"providerFactory",
".",
"rollback",
"(",
")",
";",
"}",
"else",
"{",
"// Clean up the data that was created",
"if",
"(",
"processorData",
".",
"getContentSpec",
"(",
")",
".",
"getId",
"(",
")",
"!=",
"null",
"&&",
"!",
"edit",
")",
"{",
"try",
"{",
"contentSpecProvider",
".",
"deleteContentSpec",
"(",
"processorData",
".",
"getContentSpec",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e1",
")",
"{",
"log",
".",
"error",
"(",
"\"Unable to clean up the Content Specification from the database.\"",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"topics",
".",
"isInitialised",
"(",
")",
")",
"topics",
".",
"rollbackPool",
"(",
")",
";",
"}",
"return",
"false",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"if",
"(",
"providerFactory",
".",
"isTransactionsSupported",
"(",
")",
")",
"{",
"providerFactory",
".",
"rollback",
"(",
")",
";",
"}",
"else",
"{",
"// Clean up the data that was created",
"if",
"(",
"processorData",
".",
"getContentSpec",
"(",
")",
".",
"getId",
"(",
")",
"!=",
"null",
"&&",
"!",
"edit",
")",
"{",
"try",
"{",
"contentSpecProvider",
".",
"deleteContentSpec",
"(",
"processorData",
".",
"getContentSpec",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e1",
")",
"{",
"log",
".",
"error",
"(",
"\"Unable to clean up the Content Specification from the database.\"",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"topics",
".",
"isInitialised",
"(",
")",
")",
"topics",
".",
"rollbackPool",
"(",
")",
";",
"}",
"log",
".",
"debug",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Saves the Content Specification and all of the topics in the content specification
@param providerFactory
@param processorData The data to be processed.
@param edit Whether the content specification is being edited or created.
@return True if the topic saved successfully otherwise false.
|
[
"Saves",
"the",
"Content",
"Specification",
"and",
"all",
"of",
"the",
"topics",
"in",
"the",
"content",
"specification"
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L384-L460
|
153,198
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.cleanSpecTopicWhenCreatedOrUpdated
|
protected void cleanSpecTopicWhenCreatedOrUpdated(final ITopicNode topicNode) {
topicNode.setDescription(null);
topicNode.setTags(new ArrayList<String>());
topicNode.setRemoveTags(new ArrayList<String>());
topicNode.setAssignedWriter(null);
if (topicNode instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topicNode;
specTopic.setSourceUrls(new ArrayList<String>());
specTopic.setType(null);
}
}
|
java
|
protected void cleanSpecTopicWhenCreatedOrUpdated(final ITopicNode topicNode) {
topicNode.setDescription(null);
topicNode.setTags(new ArrayList<String>());
topicNode.setRemoveTags(new ArrayList<String>());
topicNode.setAssignedWriter(null);
if (topicNode instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topicNode;
specTopic.setSourceUrls(new ArrayList<String>());
specTopic.setType(null);
}
}
|
[
"protected",
"void",
"cleanSpecTopicWhenCreatedOrUpdated",
"(",
"final",
"ITopicNode",
"topicNode",
")",
"{",
"topicNode",
".",
"setDescription",
"(",
"null",
")",
";",
"topicNode",
".",
"setTags",
"(",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
"topicNode",
".",
"setRemoveTags",
"(",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
"topicNode",
".",
"setAssignedWriter",
"(",
"null",
")",
";",
"if",
"(",
"topicNode",
"instanceof",
"SpecTopic",
")",
"{",
"final",
"SpecTopic",
"specTopic",
"=",
"(",
"SpecTopic",
")",
"topicNode",
";",
"specTopic",
".",
"setSourceUrls",
"(",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
"specTopic",
".",
"setType",
"(",
"null",
")",
";",
"}",
"}"
] |
Cleans a SpecTopic to reset any content that should be removed in a post processed content spec.
@param topicNode
|
[
"Cleans",
"a",
"SpecTopic",
"to",
"reset",
"any",
"content",
"that",
"should",
"be",
"removed",
"in",
"a",
"post",
"processed",
"content",
"spec",
"."
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L503-L513
|
153,199
|
pressgang-ccms/PressGangCCMSContentSpecProcessor
|
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
|
ContentSpecProcessor.createTopicEntity
|
protected TopicWrapper createTopicEntity(final DataProviderFactory providerFactory, final ITopicNode topicNode,
final String docBookVersion, final LocaleWrapper locale) throws ProcessingException {
LOG.debug("Processing topic: {}", topicNode.getText());
// Duplicates reference another new or cloned topic and should not have a different new/updated underlying topic
if (topicNode.isTopicAClonedDuplicateTopic() || topicNode.isTopicADuplicateTopic()) return null;
final TagProvider tagProvider = providerFactory.getProvider(TagProvider.class);
final TopicSourceURLProvider topicSourceURLProvider = providerFactory.getProvider(TopicSourceURLProvider.class);
if (isShuttingDown.get()) {
return null;
}
// If the spec topic is a clone or new topic then it will have changed no mater what else is done, since it's a new topic
boolean changed = topicNode.isTopicAClonedTopic() || topicNode.isTopicANewTopic();
final TopicWrapper topic = getTopicForTopicNode(providerFactory, topicNode);
// Check if the topic is null, if so throw an exception as it shouldn't be at this stage
if (topic == null) {
throw new ProcessingException("Creating a topic failed.");
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Process the topic and add or remove any tags
if (processTopicTags(tagProvider, topicNode, topic)) {
changed = true;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Process and set the assigned writer for new and cloned topics
if (!topicNode.isTopicAnExistingTopic() && !isNullOrEmpty(topicNode.getAssignedWriter(true))) {
processAssignedWriter(tagProvider, topicNode, topic);
changed = true;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Process and set the source urls for new and cloned topics
if (topicNode instanceof SpecTopic && !topicNode.isTopicAnExistingTopic()) {
if (processTopicSourceUrls(topicSourceURLProvider, (SpecTopic) topicNode, topic)) changed = true;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
if (!topicNode.isTopicAnExistingTopic()) {
// Process and set the docbook version
if (docBookVersion.equals(
CommonConstants.DOCBOOK_45_TITLE) && (topic.getXmlFormat() == null || topic.getXmlFormat() != CommonConstants
.DOCBOOK_45)) {
topic.setXmlFormat(CommonConstants.DOCBOOK_45);
changed = true;
} else if (docBookVersion.equals(
CommonConstants.DOCBOOK_50_TITLE) && (topic.getXmlFormat() == null || topic.getXmlFormat() != CommonConstants
.DOCBOOK_50)) {
topic.setXmlFormat(CommonConstants.DOCBOOK_50);
changed = true;
}
// Process and set the locale
if (locale != null && !locale.equals(topic.getLocale())) {
topic.setLocale(locale);
changed = true;
}
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
if (changed) {
// Set the CSP Property Tag ID for new/updated so that we can track the newly created topic
if (topicNode.isTopicAClonedTopic() || topicNode.isTopicANewTopic()) {
setCSPPropertyForTopic(topic, topicNode, providerFactory.getProvider(PropertyTagProvider.class));
}
return topic;
} else {
return null;
}
}
|
java
|
protected TopicWrapper createTopicEntity(final DataProviderFactory providerFactory, final ITopicNode topicNode,
final String docBookVersion, final LocaleWrapper locale) throws ProcessingException {
LOG.debug("Processing topic: {}", topicNode.getText());
// Duplicates reference another new or cloned topic and should not have a different new/updated underlying topic
if (topicNode.isTopicAClonedDuplicateTopic() || topicNode.isTopicADuplicateTopic()) return null;
final TagProvider tagProvider = providerFactory.getProvider(TagProvider.class);
final TopicSourceURLProvider topicSourceURLProvider = providerFactory.getProvider(TopicSourceURLProvider.class);
if (isShuttingDown.get()) {
return null;
}
// If the spec topic is a clone or new topic then it will have changed no mater what else is done, since it's a new topic
boolean changed = topicNode.isTopicAClonedTopic() || topicNode.isTopicANewTopic();
final TopicWrapper topic = getTopicForTopicNode(providerFactory, topicNode);
// Check if the topic is null, if so throw an exception as it shouldn't be at this stage
if (topic == null) {
throw new ProcessingException("Creating a topic failed.");
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Process the topic and add or remove any tags
if (processTopicTags(tagProvider, topicNode, topic)) {
changed = true;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Process and set the assigned writer for new and cloned topics
if (!topicNode.isTopicAnExistingTopic() && !isNullOrEmpty(topicNode.getAssignedWriter(true))) {
processAssignedWriter(tagProvider, topicNode, topic);
changed = true;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Process and set the source urls for new and cloned topics
if (topicNode instanceof SpecTopic && !topicNode.isTopicAnExistingTopic()) {
if (processTopicSourceUrls(topicSourceURLProvider, (SpecTopic) topicNode, topic)) changed = true;
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
if (!topicNode.isTopicAnExistingTopic()) {
// Process and set the docbook version
if (docBookVersion.equals(
CommonConstants.DOCBOOK_45_TITLE) && (topic.getXmlFormat() == null || topic.getXmlFormat() != CommonConstants
.DOCBOOK_45)) {
topic.setXmlFormat(CommonConstants.DOCBOOK_45);
changed = true;
} else if (docBookVersion.equals(
CommonConstants.DOCBOOK_50_TITLE) && (topic.getXmlFormat() == null || topic.getXmlFormat() != CommonConstants
.DOCBOOK_50)) {
topic.setXmlFormat(CommonConstants.DOCBOOK_50);
changed = true;
}
// Process and set the locale
if (locale != null && !locale.equals(topic.getLocale())) {
topic.setLocale(locale);
changed = true;
}
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
if (changed) {
// Set the CSP Property Tag ID for new/updated so that we can track the newly created topic
if (topicNode.isTopicAClonedTopic() || topicNode.isTopicANewTopic()) {
setCSPPropertyForTopic(topic, topicNode, providerFactory.getProvider(PropertyTagProvider.class));
}
return topic;
} else {
return null;
}
}
|
[
"protected",
"TopicWrapper",
"createTopicEntity",
"(",
"final",
"DataProviderFactory",
"providerFactory",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"String",
"docBookVersion",
",",
"final",
"LocaleWrapper",
"locale",
")",
"throws",
"ProcessingException",
"{",
"LOG",
".",
"debug",
"(",
"\"Processing topic: {}\"",
",",
"topicNode",
".",
"getText",
"(",
")",
")",
";",
"// Duplicates reference another new or cloned topic and should not have a different new/updated underlying topic",
"if",
"(",
"topicNode",
".",
"isTopicAClonedDuplicateTopic",
"(",
")",
"||",
"topicNode",
".",
"isTopicADuplicateTopic",
"(",
")",
")",
"return",
"null",
";",
"final",
"TagProvider",
"tagProvider",
"=",
"providerFactory",
".",
"getProvider",
"(",
"TagProvider",
".",
"class",
")",
";",
"final",
"TopicSourceURLProvider",
"topicSourceURLProvider",
"=",
"providerFactory",
".",
"getProvider",
"(",
"TopicSourceURLProvider",
".",
"class",
")",
";",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// If the spec topic is a clone or new topic then it will have changed no mater what else is done, since it's a new topic",
"boolean",
"changed",
"=",
"topicNode",
".",
"isTopicAClonedTopic",
"(",
")",
"||",
"topicNode",
".",
"isTopicANewTopic",
"(",
")",
";",
"final",
"TopicWrapper",
"topic",
"=",
"getTopicForTopicNode",
"(",
"providerFactory",
",",
"topicNode",
")",
";",
"// Check if the topic is null, if so throw an exception as it shouldn't be at this stage",
"if",
"(",
"topic",
"==",
"null",
")",
"{",
"throw",
"new",
"ProcessingException",
"(",
"\"Creating a topic failed.\"",
")",
";",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Process the topic and add or remove any tags",
"if",
"(",
"processTopicTags",
"(",
"tagProvider",
",",
"topicNode",
",",
"topic",
")",
")",
"{",
"changed",
"=",
"true",
";",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Process and set the assigned writer for new and cloned topics",
"if",
"(",
"!",
"topicNode",
".",
"isTopicAnExistingTopic",
"(",
")",
"&&",
"!",
"isNullOrEmpty",
"(",
"topicNode",
".",
"getAssignedWriter",
"(",
"true",
")",
")",
")",
"{",
"processAssignedWriter",
"(",
"tagProvider",
",",
"topicNode",
",",
"topic",
")",
";",
"changed",
"=",
"true",
";",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Process and set the source urls for new and cloned topics",
"if",
"(",
"topicNode",
"instanceof",
"SpecTopic",
"&&",
"!",
"topicNode",
".",
"isTopicAnExistingTopic",
"(",
")",
")",
"{",
"if",
"(",
"processTopicSourceUrls",
"(",
"topicSourceURLProvider",
",",
"(",
"SpecTopic",
")",
"topicNode",
",",
"topic",
")",
")",
"changed",
"=",
"true",
";",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"topicNode",
".",
"isTopicAnExistingTopic",
"(",
")",
")",
"{",
"// Process and set the docbook version",
"if",
"(",
"docBookVersion",
".",
"equals",
"(",
"CommonConstants",
".",
"DOCBOOK_45_TITLE",
")",
"&&",
"(",
"topic",
".",
"getXmlFormat",
"(",
")",
"==",
"null",
"||",
"topic",
".",
"getXmlFormat",
"(",
")",
"!=",
"CommonConstants",
".",
"DOCBOOK_45",
")",
")",
"{",
"topic",
".",
"setXmlFormat",
"(",
"CommonConstants",
".",
"DOCBOOK_45",
")",
";",
"changed",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"docBookVersion",
".",
"equals",
"(",
"CommonConstants",
".",
"DOCBOOK_50_TITLE",
")",
"&&",
"(",
"topic",
".",
"getXmlFormat",
"(",
")",
"==",
"null",
"||",
"topic",
".",
"getXmlFormat",
"(",
")",
"!=",
"CommonConstants",
".",
"DOCBOOK_50",
")",
")",
"{",
"topic",
".",
"setXmlFormat",
"(",
"CommonConstants",
".",
"DOCBOOK_50",
")",
";",
"changed",
"=",
"true",
";",
"}",
"// Process and set the locale",
"if",
"(",
"locale",
"!=",
"null",
"&&",
"!",
"locale",
".",
"equals",
"(",
"topic",
".",
"getLocale",
"(",
")",
")",
")",
"{",
"topic",
".",
"setLocale",
"(",
"locale",
")",
";",
"changed",
"=",
"true",
";",
"}",
"}",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"changed",
")",
"{",
"// Set the CSP Property Tag ID for new/updated so that we can track the newly created topic",
"if",
"(",
"topicNode",
".",
"isTopicAClonedTopic",
"(",
")",
"||",
"topicNode",
".",
"isTopicANewTopic",
"(",
")",
")",
"{",
"setCSPPropertyForTopic",
"(",
"topic",
",",
"topicNode",
",",
"providerFactory",
".",
"getProvider",
"(",
"PropertyTagProvider",
".",
"class",
")",
")",
";",
"}",
"return",
"topic",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Creates an entity to be sent through the REST interface to create or update a DB entry.
@param providerFactory
@param topicNode The Content Specification Topic to create the topic entity from.
@param locale
@return The new topic object if any changes where made otherwise null.
@throws ProcessingException
|
[
"Creates",
"an",
"entity",
"to",
"be",
"sent",
"through",
"the",
"REST",
"interface",
"to",
"create",
"or",
"update",
"a",
"DB",
"entry",
"."
] |
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L524-L619
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.