id
int32
0
12.9k
code
sequence
12,900
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ";", "import", "java", ".", "util", ".", "Observable", ";", "public", "class", "NfeStatusChangedObserver", "extends", "Observable", "{", "public", "void", "fireStatusChanged", "(", "NFeFile", "nfe", ")", "{", "setChanged", "(", ")", ";", "notifyObservers", "(", "nfe", ")", ";", "}", "}", "</s>" ]
12,901
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilder", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilderFactory", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "ParserConfigurationException", ";", "import", "javax", ".", "xml", ".", "transform", ".", "OutputKeys", ";", "import", "javax", ".", "xml", ".", "transform", ".", "Transformer", ";", "import", "javax", ".", "xml", ".", "transform", ".", "TransformerException", ";", "import", "javax", ".", "xml", ".", "transform", ".", "TransformerFactory", ";", "import", "javax", ".", "xml", ".", "transform", ".", "stream", ".", "StreamResult", ";", "import", "javax", ".", "xml", ".", "transform", ".", "stream", ".", "StreamSource", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Document", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Element", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NamedNodeMap", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Node", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "org", ".", "xml", ".", "sax", ".", "SAXException", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFE", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResourceFactory", ";", "public", "class", "NFeFile", "extends", "File", "{", "public", "enum", "Status", "{", "SYNCHRONIZED", ",", "SYNCHRONIZING", ",", "NOT_SYNCHRONIZED", ";", "}", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "private", "TransformerFactory", "factory", ";", "private", "Transformer", "transformer", ";", "private", "Status", "status", "=", "Status", ".", "SYNCHRONIZING", ";", "private", "NfeStatusChangedObserver", "nfeStatusChangedObserver", "=", "new", "NfeStatusChangedObserver", "(", ")", ";", "private", "static", "DocumentBuilderFactory", "documentBuilderFactory", ";", "static", "{", "documentBuilderFactory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "documentBuilderFactory", ".", "setNamespaceAware", "(", "true", ")", ";", "}", "public", "NFeFile", "(", "URI", "uri", ")", "{", "super", "(", "uri", ")", ";", "initTransformers", "(", ")", ";", "}", "public", "NFeFile", "(", "File", "parent", ",", "String", "child", ")", "{", "super", "(", "parent", ",", "child", ")", ";", "initTransformers", "(", ")", ";", "}", "public", "NFeFile", "(", "String", "parent", ",", "String", "child", ")", "{", "super", "(", "parent", ",", "child", ")", ";", "initTransformers", "(", ")", ";", "}", "public", "NFeFile", "(", "String", "pathname", ")", "{", "super", "(", "pathname", ")", ";", "initTransformers", "(", ")", ";", "}", "public", "Status", "getStatus", "(", ")", "{", "return", "status", ";", "}", "public", "void", "setStatus", "(", "Status", "status", ")", "{", "this", ".", "status", "=", "status", ";", "nfeStatusChangedObserver", ".", "fireStatusChanged", "(", "this", ")", ";", "}", "private", "void", "initTransformers", "(", ")", "{", "factory", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "}", "public", "String", "getXMLAsString", "(", "boolean", "formatted", ")", "throws", "TransformerException", "{", "transformer", "=", "factory", ".", "newTransformer", "(", ")", ";", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "formatted", "?", "\"yes\"", ":", "\"no\"", ")", ";", "Writer", "writer", "=", "new", "StringWriter", "(", ")", ";", "transformer", ".", "transform", "(", "new", "StreamSource", "(", "this", ")", ",", "new", "StreamResult", "(", "writer", ")", ")", ";", "return", "writer", ".", "toString", "(", ")", ";", "}", "public", "String", "getID", "(", ")", "throws", "IOException", "{", "try", "{", "DocumentBuilder", "documentBuilder", "=", "documentBuilderFactory", ".", "newDocumentBuilder", "(", ")", ";", "Document", "document", "=", "documentBuilder", ".", "parse", "(", "this", ")", ";", "NodeList", "infNfe", "=", "document", ".", "getDocumentElement", "(", ")", ".", "getElementsByTagName", "(", "\"infNFe\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "infNfe", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "String", "id", "=", "(", "(", "Node", ")", "infNfe", ".", "item", "(", "i", ")", ")", ".", "getAttributes", "(", ")", ".", "getNamedItem", "(", "\"Id\"", ")", ".", "getTextContent", "(", ")", ";", "if", "(", "id", "!=", "null", ")", "return", "id", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ",", "e", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "getName", "(", ")", ";", "}", "}", "</s>" ]
12,902
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "SystemConfiguration", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "ErrorDialog", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "MainFrame", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "javax", ".", "swing", ".", "JFrame", ";", "import", "javax", ".", "swing", ".", "UIManager", ";", "public", "class", "Main", "{", "public", "static", "final", "MainFrame", "FRAME", ";", "public", "static", "final", "SystemConfiguration", "CONFIGURATION", ";", "static", "{", "SystemConfiguration", "configuration", "=", "null", ";", "try", "{", "configuration", "=", "new", "SystemConfiguration", "(", ")", ";", "UIManager", ".", "setLookAndFeel", "(", "configuration", ".", "getVisual", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "ErrorDialog", ".", "showError", "(", "null", ",", "\"ERRO\"", ",", "\"\"", ",", "e", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ErrorDialog", ".", "showError", "(", "null", ",", "\"ERRO\"", ",", "\"\"", ",", "ex", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "CONFIGURATION", "=", "configuration", ";", "FRAME", "=", "new", "MainFrame", "(", ")", ";", "FRAME", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "EXIT_ON_CLOSE", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "java", ".", "awt", ".", "EventQueue", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "FRAME", ".", "setVisible", "(", "true", ")", ";", "}", "}", ")", ";", "}", "public", "static", "boolean", "isConfigurationValid", "(", ")", "{", "return", "CONFIGURATION", ".", "validate", "(", ")", "==", "SystemConfiguration", ".", "VALID", ";", "}", "}", "</s>" ]
12,903
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "swing", ".", "JOptionPane", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "NFEPanel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFE", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResource", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResourceFactory", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResourceType", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "response", ".", "NFEGuardianResponse", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "public", "class", "NFEFindWSWorker", "extends", "NFEBaseWSWorker", "{", "private", "String", "nfeID", ";", "private", "boolean", "hasChange", ";", "public", "NFEFindWSWorker", "(", "String", "nfeID", ",", "NFEPanel", "parent", ")", "{", "super", "(", "nfeID", ",", "parent", ")", ";", "this", ".", "nfeID", "=", "nfeID", ";", "hasChange", "=", "false", ";", "}", "@", "Override", "protected", "NFEGuardianResource", "doInBackground", "(", ")", "throws", "Exception", "{", "super", ".", "doInBackground", "(", ")", ";", "parent", ".", "getJxBusyLabel", "(", ")", ".", "setVisible", "(", "true", ")", ";", "client", ".", "path", "(", "wsBaseURL", "+", "\"/\"", "+", "nfeID", ")", ";", "client", ".", "accept", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "NFEGuardianResponse", "<", "NFE", ">", "nfe", "=", "new", "NFEGuardianResponse", "<", "NFE", ">", "(", "NFEGuardianResourceType", ".", "NFe", ")", ";", "try", "{", "String", "nfes", "=", "client", ".", "get", "(", "String", ".", "class", ")", ";", "nfe", "=", "NFEGuardianResourceFactory", ".", "newInstance", "(", "NFEGuardianResponse", ".", "class", ",", "nfes", ")", ";", "}", "catch", "(", "UniformInterfaceException", "e", ")", "{", "handleWSError", "(", "e", ",", "null", ")", ";", "}", "for", "(", "NFE", "nf", ":", "nfe", ")", "{", "String", "fileName", "=", "Main", ".", "CONFIGURATION", ".", "getNfePath", "(", ")", "+", "\"/\"", "+", "nf", ".", "getId", "(", ")", "+", "\".xml\"", ";", "if", "(", "new", "File", "(", "fileName", ")", ".", "exists", "(", ")", ")", "{", "int", "result", "=", "JOptionPane", ".", "showOptionDialog", "(", "parent", ",", "\"O", "arquivo", "\"", "+", "fileName", "+", "\"\"", ",", "\"Aten-UNK-o\"", ",", "JOptionPane", ".", "YES_NO_OPTION", ",", "JOptionPane", ".", "WARNING_MESSAGE", ",", "null", ",", "new", "Object", "[", "]", "{", "\"Sim\"", ",", "\"N-UNK-o\"", "}", ",", "0", ")", ";", "if", "(", "result", "==", "1", ")", "{", "continue", ";", "}", "}", "FileWriter", "writer", "=", "new", "FileWriter", "(", "fileName", ")", ";", "nf", ".", "toXML", "(", "writer", ")", ";", "writer", ".", "flush", "(", ")", ";", "writer", ".", "close", "(", ")", ";", "hasChange", "=", "true", ";", "}", "return", "nfe", ";", "}", "@", "Override", "protected", "void", "done", "(", ")", "{", "super", ".", "done", "(", ")", ";", "if", "(", "hasChange", ")", "parent", ".", "loadXMLList", "(", ")", ";", "}", "@", "Override", "protected", "void", "process", "(", "List", "<", "Object", ">", "chunks", ")", "{", "super", ".", "process", "(", "chunks", ")", ";", "}", "}", "</s>" ]
12,904
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "NFEPanel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResource", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "public", "class", "NFERemoveWSWorker", "extends", "NFEBaseWSWorker", "{", "public", "NFERemoveWSWorker", "(", "ArrayList", "<", "NFeFile", ">", "files", ",", "NFEPanel", "parent", ")", "{", "super", "(", "files", ",", "parent", ")", ";", "}", "@", "Override", "protected", "NFEGuardianResource", "doInBackground", "(", ")", "throws", "Exception", "{", "super", ".", "doInBackground", "(", ")", ";", "int", "count", "=", "0", ";", "for", "(", "NFeFile", "file", ":", "files", ")", "{", "NFeFile", ".", "Status", "oldStatus", "=", "file", ".", "getStatus", "(", ")", ";", "setStatus", "(", "file", ",", "NFeFile", ".", "Status", ".", "SYNCHRONIZING", ")", ";", "publish", "(", "\"\"", "+", "++", "count", "+", "\"", "de", "\"", "+", "totalNFes", "+", "\"...", "\"", ",", "count", ")", ";", "String", "nfeID", "=", "getNFeID", "(", "file", ")", ";", "if", "(", "nfeID", "==", "null", ")", "{", "setStatus", "(", "file", ",", "oldStatus", ")", ";", "continue", ";", "}", "client", ".", "path", "(", "wsBaseURL", "+", "\"/\"", "+", "file", ".", "getID", "(", ")", ")", ";", "client", ".", "type", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "try", "{", "client", ".", "delete", "(", ")", ";", "setStatus", "(", "file", ",", "NFeFile", ".", "Status", ".", "NOT_SYNCHRONIZED", ")", ";", "}", "catch", "(", "UniformInterfaceException", "ex", ")", "{", "handleWSError", "(", "ex", ",", "file", ")", ";", "setStatus", "(", "file", ",", "oldStatus", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "setStatus", "(", "file", ",", "oldStatus", ")", ";", "throw", "e", ";", "}", "}", "return", "null", ";", "}", "@", "Override", "protected", "void", "process", "(", "List", "<", "Object", ">", "chunks", ")", "{", "parent", ".", "getPbNFEProgress", "(", ")", ".", "setValue", "(", "(", "Integer", ")", "chunks", ".", "get", "(", "1", ")", ")", ";", "parent", ".", "getPbNFEProgress", "(", ")", ".", "setString", "(", "(", "String", ")", "chunks", ".", "get", "(", "0", ")", ")", ";", "}", "}", "</s>" ]
12,905
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "NFEPanel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResource", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "public", "class", "NFESendWSWorker", "extends", "NFEBaseWSWorker", "{", "public", "NFESendWSWorker", "(", "ArrayList", "<", "NFeFile", ">", "files", ",", "NFEPanel", "parent", ")", "{", "super", "(", "files", ",", "parent", ")", ";", "}", "@", "Override", "protected", "NFEGuardianResource", "doInBackground", "(", ")", "throws", "Exception", "{", "super", ".", "doInBackground", "(", ")", ";", "client", ".", "path", "(", "wsBaseURL", ")", ";", "int", "count", "=", "0", ";", "for", "(", "NFeFile", "file", ":", "files", ")", "{", "NFeFile", ".", "Status", "oldStatus", "=", "file", ".", "getStatus", "(", ")", ";", "setStatus", "(", "file", ",", "NFeFile", ".", "Status", ".", "SYNCHRONIZING", ")", ";", "publish", "(", "\"Nota", "\"", "+", "++", "count", "+", "\"", "de", "\"", "+", "totalNFes", ",", "count", ")", ";", "client", ".", "accept", "(", "MediaType", ".", "APPLICATION_XML", ")", ".", "type", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "try", "{", "client", ".", "post", "(", "String", ".", "class", ",", "file", ".", "getXMLAsString", "(", "false", ")", ")", ";", "setStatus", "(", "file", ",", "NFeFile", ".", "Status", ".", "SYNCHRONIZED", ")", ";", "}", "catch", "(", "UniformInterfaceException", "ex", ")", "{", "setStatus", "(", "file", ",", "oldStatus", ")", ";", "handleWSError", "(", "ex", ",", "file", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "setStatus", "(", "file", ",", "oldStatus", ")", ";", "throw", "e", ";", "}", "refreshUI", "(", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "protected", "void", "process", "(", "List", "<", "Object", ">", "chunks", ")", "{", "parent", ".", "getPbNFEProgress", "(", ")", ".", "setValue", "(", "(", "Integer", ")", "chunks", ".", "get", "(", "1", ")", ")", ";", "parent", ".", "getPbNFEProgress", "(", ")", ".", "setString", "(", "(", "String", ")", "chunks", ".", "get", "(", "0", ")", ")", ";", "}", "}", "</s>" ]
12,906
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ".", "WSClient", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeErrorWrapper", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "ErrorDialog", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "NFEPanel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianError", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResource", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResourceFactory", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "response", ".", "NFEGuardianResponse", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "filter", ".", "HTTPBasicAuthFilter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "swing", ".", "SwingWorker", ";", "public", "abstract", "class", "NFEBaseWSWorker", "extends", "SwingWorker", "<", "NFEGuardianResource", ",", "Object", ">", "{", "protected", "final", "List", "<", "NFeFile", ">", "files", ";", "protected", "final", "NFEPanel", "parent", ";", "protected", "final", "WSClient", "client", ";", "protected", "final", "String", "wsBaseURL", ";", "protected", "final", "int", "totalNFes", ";", "public", "NFEBaseWSWorker", "(", "List", "<", "NFeFile", ">", "files", ",", "NFEPanel", "parent", ")", "{", "this", ".", "files", "=", "files", ";", "this", ".", "parent", "=", "parent", ";", "client", "=", "WSClient", ".", "getInstance", "(", ")", ";", "totalNFes", "=", "files", ".", "size", "(", ")", ";", "parent", ".", "getPbNFEProgress", "(", ")", ".", "setMaximum", "(", "totalNFes", ")", ";", "wsBaseURL", "=", "Main", ".", "CONFIGURATION", ".", "getWsURL", "(", ")", "+", "\"/api/nfe\"", ";", "addUserFilter", "(", ")", ";", "}", "public", "NFEBaseWSWorker", "(", "String", "nfeID", ",", "NFEPanel", "parent", ")", "{", "this", ".", "files", "=", "null", ";", "this", ".", "parent", "=", "parent", ";", "client", "=", "WSClient", ".", "getInstance", "(", ")", ";", "totalNFes", "=", "0", ";", "wsBaseURL", "=", "Main", ".", "CONFIGURATION", ".", "getWsURL", "(", ")", "+", "\"/api/nfe\"", ";", "addUserFilter", "(", ")", ";", "}", "protected", "void", "addUserFilter", "(", ")", "{", "client", ".", "addFilter", "(", "new", "HTTPBasicAuthFilter", "(", "Main", ".", "CONFIGURATION", ".", "getUsername", "(", ")", ",", "Main", ".", "CONFIGURATION", ".", "getPassword", "(", ")", ")", ")", ";", "}", "protected", "void", "refreshUI", "(", ")", "{", "parent", ".", "updateUI", "(", ")", ";", "}", "protected", "void", "setStatus", "(", "NFeFile", "file", ",", "NFeFile", ".", "Status", "status", ")", "{", "file", ".", "setStatus", "(", "status", ")", ";", "refreshUI", "(", ")", ";", "}", "@", "Override", "protected", "NFEGuardianResource", "doInBackground", "(", ")", "throws", "Exception", "{", "if", "(", "totalNFes", ">", "0", ")", "parent", ".", "setProgressComponentsVisible", "(", "true", ")", ";", "parent", ".", "getJxBusyLabel", "(", ")", ".", "setBusy", "(", "true", ")", ";", "parent", ".", "enableToolbarButtons", "(", "false", ")", ";", "return", "null", ";", "}", "@", "Override", "protected", "void", "done", "(", ")", "{", "try", "{", "get", "(", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "ErrorDialog", ".", "showError", "(", "Main", ".", "FRAME", ",", "\"ERRO\"", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "parent", ".", "getJxBusyLabel", "(", ")", ".", "setBusy", "(", "false", ")", ";", "parent", ".", "setProgressComponentsVisible", "(", "false", ")", ";", "parent", ".", "enableToolbarButtons", "(", "true", ")", ";", "}", "@", "Override", "protected", "void", "process", "(", "List", "<", "Object", ">", "chunks", ")", "{", "}", "protected", "void", "handleWSError", "(", "UniformInterfaceException", "ex", ",", "NFeFile", "file", ")", "throws", "Exception", "{", "if", "(", "ex", ".", "getResponse", "(", ")", ".", "getStatus", "(", ")", "==", "500", "||", "ex", ".", "getResponse", "(", ")", ".", "getStatus", "(", ")", "==", "501", ")", "{", "String", "responseAsString", "=", "ex", ".", "getResponse", "(", ")", ".", "getEntity", "(", "String", ".", "class", ")", ";", "NFEGuardianResponse", "<", "NFEGuardianError", ">", "response", "=", "NFEGuardianResourceFactory", ".", "newInstance", "(", "NFEGuardianResponse", ".", "class", ",", "responseAsString", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "Iterator", "<", "NFEGuardianError", ">", "iterator", "=", "response", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "NFEGuardianError", "erro", "=", "(", "NFEGuardianError", ")", "iterator", ".", "next", "(", ")", ";", "NFeErrorWrapper", "wrapper", "=", "new", "NFeErrorWrapper", "(", "file", "!=", "null", "?", "file", ".", "getName", "(", ")", ":", "\"\"", ",", "erro", ")", ";", "if", "(", "erro", ".", "getHttpErrorCode", "(", ")", "==", "500", ")", "parent", ".", "addError", "(", "wrapper", ")", ";", "else", "throw", "new", "RuntimeException", "(", "erro", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "else", "throw", "ex", ";", "}", "protected", "void", "addError", "(", "String", "message", ",", "String", "fileName", ")", "{", "NFeErrorWrapper", "erro", "=", "new", "NFeErrorWrapper", "(", "fileName", ",", "new", "NFEGuardianError", "(", "message", ")", ")", ";", "parent", ".", "addError", "(", "erro", ")", ";", "}", "protected", "String", "getNFeID", "(", "NFeFile", "file", ")", "{", "try", "{", "return", "file", ".", "getID", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "addError", "(", "\"\"", "+", "file", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ",", "file", ".", "getName", "(", ")", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
12,907
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ".", "WSClient", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeErrorWrapper", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "NFEPanel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianError", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianResource", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "public", "class", "NFEStatusWSWorker", "extends", "NFEBaseWSWorker", "{", "public", "NFEStatusWSWorker", "(", "ArrayList", "<", "NFeFile", ">", "files", ",", "NFEPanel", "parent", ")", "{", "super", "(", "files", ",", "parent", ")", ";", "}", "@", "Override", "protected", "NFEGuardianResource", "doInBackground", "(", ")", "throws", "Exception", "{", "WSClient", "client", "=", "WSClient", ".", "getInstance", "(", ")", ";", "for", "(", "NFeFile", "file", ":", "files", ")", "{", "String", "nfeID", "=", "getNFeID", "(", "file", ")", ";", "if", "(", "nfeID", "==", "null", ")", "{", "file", ".", "setStatus", "(", "NFeFile", ".", "Status", ".", "NOT_SYNCHRONIZED", ")", ";", "continue", ";", "}", "client", ".", "path", "(", "Main", ".", "CONFIGURATION", ".", "getWsURL", "(", ")", "+", "\"\"", "+", "nfeID", ")", ";", "client", ".", "accept", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "try", "{", "client", ".", "get", "(", "String", ".", "class", ")", ";", "file", ".", "setStatus", "(", "NFeFile", ".", "Status", ".", "SYNCHRONIZED", ")", ";", "}", "catch", "(", "UniformInterfaceException", "e", ")", "{", "file", ".", "setStatus", "(", "NFeFile", ".", "Status", ".", "NOT_SYNCHRONIZED", ")", ";", "if", "(", "e", ".", "getResponse", "(", ")", ".", "getStatus", "(", ")", "!=", "404", ")", "{", "handleWSError", "(", "e", ",", "file", ")", ";", "}", "}", "refreshUI", "(", ")", ";", "}", "return", "null", ";", "}", "@", "Override", "protected", "void", "done", "(", ")", "{", "try", "{", "get", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "addError", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ",", "null", ")", ";", "}", "}", "@", "Override", "protected", "void", "process", "(", "List", "<", "Object", ">", "chunks", ")", "{", "super", ".", "process", "(", "chunks", ")", ";", "}", "}", "</s>" ]
12,908
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "SystemConfiguration", ";", "import", "javax", ".", "swing", ".", "JFileChooser", ";", "import", "javax", ".", "swing", ".", "SwingUtilities", ";", "import", "javax", ".", "swing", ".", "UIManager", ";", "public", "class", "ConfigurationPanel", "extends", "javax", ".", "swing", ".", "JPanel", "implements", "ITitledPane", "{", "public", "static", "final", "String", "DESCRIPTION", "=", "\"\"", ";", "private", "UIManager", ".", "LookAndFeelInfo", "[", "]", "lfInfo", ";", "private", "MainFrame", "parent", ";", "public", "ConfigurationPanel", "(", "MainFrame", "parent", ")", "{", "initComponents", "(", ")", ";", "this", ".", "parent", "=", "parent", ";", "setFields", "(", ")", ";", "}", "private", "void", "setFields", "(", ")", "{", "SystemConfiguration", "cfg", "=", "Main", ".", "CONFIGURATION", ";", "tfDiretorioNfe", ".", "setText", "(", "cfg", ".", "getNfePath", "(", ")", ")", ";", "tfNomeUsuario", ".", "setText", "(", "cfg", ".", "getUsername", "(", ")", ")", ";", "pfSenha", ".", "setText", "(", "cfg", ".", "getPassword", "(", ")", ")", ";", "cbLookAndFeel", ".", "setSelectedItem", "(", "getVisualNameByClass", "(", "cfg", ".", "getVisual", "(", ")", ")", ")", ";", "tfURL", ".", "setText", "(", "cfg", ".", "getWsURL", "(", ")", ")", ";", "}", "private", "String", "getVisualNameByClass", "(", "String", "className", ")", "{", "for", "(", "UIManager", ".", "LookAndFeelInfo", "info", ":", "lfInfo", ")", "{", "if", "(", "info", ".", "getClassName", "(", ")", ".", "equals", "(", "className", ")", ")", "return", "info", ".", "getName", "(", ")", ";", "}", "return", "\"\"", ";", "}", "private", "void", "updateUI", "(", "java", ".", "awt", ".", "event", ".", "ItemEvent", "evt", ")", "{", "try", "{", "UIManager", ".", "setLookAndFeel", "(", "lfInfo", "[", "cbLookAndFeel", ".", "getSelectedIndex", "(", ")", "]", ".", "getClassName", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ErrorDialog", ".", "showError", "(", "parent", ",", "\"Erro\"", ",", "\"\"", ",", "e", ")", ";", "}", "SwingUtilities", ".", "updateComponentTreeUI", "(", "parent", ".", "getNFEPanel", "(", ")", ")", ";", "SwingUtilities", ".", "updateComponentTreeUI", "(", "parent", ")", ";", "parent", ".", "pack", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "initComponents", "(", ")", "{", "jScrollPane1", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "jTextArea1", "=", "new", "javax", ".", "swing", ".", "JTextArea", "(", ")", ";", "fileChooser", "=", "new", "javax", ".", "swing", ".", "JFileChooser", "(", ")", ";", "pnCenter", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "jPanel1", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "lbNomeUsuario", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "lbSenha", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "tfNomeUsuario", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "pfSenha", "=", "new", "javax", ".", "swing", ".", "JPasswordField", "(", ")", ";", "btSalvar", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jPanel2", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "lbDiretorioNfe", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "tfDiretorioNfe", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "btDiretorioNfe", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jLabel1", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "lfInfo", "=", "UIManager", ".", "getInstalledLookAndFeels", "(", ")", ";", "String", "[", "]", "lfNames", "=", "new", "String", "[", "lfInfo", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lfInfo", ".", "length", ";", "i", "++", ")", "lfNames", "[", "i", "]", "=", "lfInfo", "[", "i", "]", ".", "getName", "(", ")", ";", "cbLookAndFeel", "=", "new", "javax", ".", "swing", ".", "JComboBox", "(", "lfNames", ")", ";", "tfURL", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "lbUrl", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "jTextArea1", ".", "setColumns", "(", "20", ")", ";", "jTextArea1", ".", "setRows", "(", "5", ")", ";", "jScrollPane1", ".", "setViewportView", "(", "jTextArea1", ")", ";", "fileChooser", ".", "setFileSelectionMode", "(", "javax", ".", "swing", ".", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "jPanel1", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createTitledBorder", "(", "\"\"", ")", ")", ";", "lbNomeUsuario", ".", "setText", "(", "\"\"", ")", ";", "lbSenha", ".", "setText", "(", "\"Senha:\"", ")", ";", "tfNomeUsuario", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "tfNomeUsuarioActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "jPanel1Layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "jPanel1", ")", ";", "jPanel1", ".", "setLayout", "(", "jPanel1Layout", ")", ";", "jPanel1Layout", ".", "setHorizontalGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "14", ",", "14", ",", "14", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "lbNomeUsuario", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "100", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "lbSenha", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "80", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGap", "(", "20", ",", "20", ",", "20", ")", ")", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "false", ")", ".", "addComponent", "(", "pfSenha", ")", ".", "addComponent", "(", "tfNomeUsuario", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "357", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addGap", "(", "68", ",", "68", ",", "68", ")", ")", ")", ";", "jPanel1Layout", ".", "setVerticalGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "10", ",", "10", ",", "10", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "lbNomeUsuario", ")", ".", "addComponent", "(", "tfNomeUsuario", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addGap", "(", "10", ",", "10", ",", "10", ")", ".", "addGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "lbSenha", ")", ".", "addComponent", "(", "pfSenha", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "btSalvar", ".", "setText", "(", "\"Salvar\"", ")", ";", "btSalvar", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btSalvarActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jPanel2", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createTitledBorder", "(", "\"\"", ")", ")", ";", "lbDiretorioNfe", ".", "setText", "(", "\"\"", ")", ";", "tfDiretorioNfe", ".", "setEditable", "(", "false", ")", ";", "btDiretorioNfe", ".", "setText", "(", "\"...\"", ")", ";", "btDiretorioNfe", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btDiretorioNfeActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "jPanel2Layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "jPanel2", ")", ";", "jPanel2", ".", "setLayout", "(", "jPanel2Layout", ")", ";", "jPanel2Layout", ".", "setHorizontalGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jPanel2Layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "10", ",", "10", ",", "10", ")", ".", "addComponent", "(", "lbDiretorioNfe", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "100", ",", "Short", ".", "MAX_VALUE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ")", ".", "addComponent", "(", "tfDiretorioNfe", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "360", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGap", "(", "20", ",", "20", ",", "20", ")", ".", "addComponent", "(", "btDiretorioNfe", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "36", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGap", "(", "13", ",", "13", ",", "13", ")", ")", ")", ";", "jPanel2Layout", ".", "setVerticalGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jPanel2Layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "30", ",", "30", ",", "30", ")", ".", "addGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "BASELINE", ")", ".", "addComponent", "(", "lbDiretorioNfe", ")", ".", "addComponent", "(", "tfDiretorioNfe", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addComponent", "(", "btDiretorioNfe", ")", ")", ".", "addContainerGap", "(", "15", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "jLabel1", ".", "setText", "(", "\"Visual:\"", ")", ";", "cbLookAndFeel", ".", "addItemListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ItemListener", "(", ")", "{", "public", "void", "itemStateChanged", "(", "java", ".", "awt", ".", "event", ".", "ItemEvent", "evt", ")", "{", "cbLookAndFeelItemStateChanged", "(", "evt", ")", ";", "}", "}", ")", ";", "cbLookAndFeel", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "cbLookAndFeelActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "lbUrl", ".", "setText", "(", "\"\"", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "pnCenterLayout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "pnCenter", ")", ";", "pnCenter", ".", "setLayout", "(", "pnCenterLayout", ")", ";", "pnCenterLayout", ".", "setHorizontalGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "jPanel2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addComponent", "(", "jPanel1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addComponent", "(", "btSalvar", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "72", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "pnCenterLayout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "33", ",", "33", ",", "33", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ")", ".", "addComponent", "(", "jLabel1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "81", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "lbUrl", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "UNRELATED", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ",", "false", ")", ".", "addComponent", "(", "cbLookAndFeel", ",", "0", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "tfURL", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "396", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addGap", "(", "35", ",", "35", ",", "35", ")", ")", ")", ".", "addContainerGap", "(", "21", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "pnCenterLayout", ".", "setVerticalGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "22", ",", "22", ",", "22", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "BASELINE", ")", ".", "addComponent", "(", "jLabel1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "22", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addComponent", "(", "cbLookAndFeel", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ")", ".", "addGroup", "(", "pnCenterLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "BASELINE", ")", ".", "addComponent", "(", "tfURL", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addComponent", "(", "lbUrl", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "22", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addGap", "(", "18", ",", "18", ",", "18", ")", ".", "addComponent", "(", "jPanel1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "96", ",", "Short", ".", "MAX_VALUE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ")", ".", "addComponent", "(", "jPanel2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "UNRELATED", ")", ".", "addComponent", "(", "btSalvar", ")", ".", "addGap", "(", "31", ",", "31", ",", "31", ")", ")", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "this", ")", ";", "this", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", "72", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "pnCenter", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addContainerGap", "(", "82", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", "50", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "pnCenter", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addContainerGap", "(", "109", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "}", "private", "void", "tfNomeUsuarioActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "}", "private", "void", "cbLookAndFeelActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "}", "private", "void", "cbLookAndFeelItemStateChanged", "(", "java", ".", "awt", ".", "event", ".", "ItemEvent", "evt", ")", "{", "updateUI", "(", "evt", ")", ";", "}", "private", "void", "btSalvarActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "boolean", "nfePathChanged", "=", "false", ";", "Main", ".", "CONFIGURATION", ".", "setVisual", "(", "lfInfo", "[", "cbLookAndFeel", ".", "getSelectedIndex", "(", ")", "]", ".", "getClassName", "(", ")", ")", ";", "Main", ".", "CONFIGURATION", ".", "setUsername", "(", "tfNomeUsuario", ".", "getText", "(", ")", ")", ";", "Main", ".", "CONFIGURATION", ".", "setPassword", "(", "new", "String", "(", "pfSenha", ".", "getPassword", "(", ")", ")", ")", ";", "if", "(", "!", "tfDiretorioNfe", ".", "getText", "(", ")", ".", "equals", "(", "Main", ".", "CONFIGURATION", ".", "getNfePath", "(", ")", ")", ")", "{", "nfePathChanged", "=", "true", ";", "}", "Main", ".", "CONFIGURATION", ".", "setNfePath", "(", "tfDiretorioNfe", ".", "getText", "(", ")", ")", ";", "Main", ".", "CONFIGURATION", ".", "setWsURL", "(", "tfURL", ".", "getText", "(", ")", ")", ";", "if", "(", "nfePathChanged", ")", "parent", ".", "getNFEPanel", "(", ")", ".", "loadXMLList", "(", ")", ";", "}", "private", "void", "btDiretorioNfeActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "int", "returnVal", "=", "fileChooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "returnVal", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "tfDiretorioNfe", ".", "setText", "(", "fileChooser", ".", "getSelectedFile", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "private", "javax", ".", "swing", ".", "JButton", "btDiretorioNfe", ";", "private", "javax", ".", "swing", ".", "JButton", "btSalvar", ";", "private", "javax", ".", "swing", ".", "JComboBox", "cbLookAndFeel", ";", "private", "javax", ".", "swing", ".", "JFileChooser", "fileChooser", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel1", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel1", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel2", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "jScrollPane1", ";", "private", "javax", ".", "swing", ".", "JTextArea", "jTextArea1", ";", "private", "javax", ".", "swing", ".", "JLabel", "lbDiretorioNfe", ";", "private", "javax", ".", "swing", ".", "JLabel", "lbNomeUsuario", ";", "private", "javax", ".", "swing", ".", "JLabel", "lbSenha", ";", "private", "javax", ".", "swing", ".", "JLabel", "lbUrl", ";", "private", "javax", ".", "swing", ".", "JPasswordField", "pfSenha", ";", "private", "javax", ".", "swing", ".", "JPanel", "pnCenter", ";", "private", "javax", ".", "swing", ".", "JTextField", "tfDiretorioNfe", ";", "private", "javax", ".", "swing", ".", "JTextField", "tfNomeUsuario", ";", "private", "javax", ".", "swing", ".", "JTextField", "tfURL", ";", "@", "Override", "public", "String", "getTitle", "(", ")", "{", "return", "DESCRIPTION", ";", "}", "}", "</s>" ]
12,909
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ";", "import", "static", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ".", "isConfigurationValid", ";", "import", "java", ".", "awt", ".", "BorderLayout", ";", "import", "java", ".", "awt", ".", "Component", ";", "import", "java", ".", "awt", ".", "event", ".", "ActionEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "ActionListener", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileFilter", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Constructor", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JOptionPane", ";", "import", "javax", ".", "swing", ".", "JProgressBar", ";", "import", "org", ".", "fife", ".", "ui", ".", "rsyntaxtextarea", ".", "RSyntaxTextArea", ";", "import", "org", ".", "fife", ".", "ui", ".", "rsyntaxtextarea", ".", "SyntaxConstants", ";", "import", "org", ".", "fife", ".", "ui", ".", "rtextarea", ".", "RTextScrollPane", ";", "import", "org", ".", "jdesktop", ".", "swingx", ".", "JXBusyLabel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeErrorWrapper", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "components", ".", "NfeFileJlistModel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "components", ".", "NfeJlistRender", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ".", "NFEBaseWSWorker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ".", "NFEFindWSWorker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ".", "NFERemoveWSWorker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ".", "NFESendWSWorker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "worker", ".", "NFEStatusWSWorker", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianError", ";", "import", "com", ".", "tiago", ".", "tablemodel", ".", "table", ".", "ObjectTableModel", ";", "public", "class", "NFEPanel", "extends", "javax", ".", "swing", ".", "JPanel", "implements", "ITitledPane", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "public", "static", "final", "String", "DESCRIPTION", "=", "\"\"", ";", "private", "final", "NfeFileJlistModel", "listXMLModel", ";", "private", "RSyntaxTextArea", "xmlTextArea", ";", "private", "RTextScrollPane", "xmlSrollPane", ";", "private", "ObjectTableModel", "errorTableModel", ";", "public", "NFEPanel", "(", ")", "{", "initComponents", "(", ")", ";", "listXMLModel", "=", "new", "NfeFileJlistModel", "(", ")", ";", "listXML", ".", "setModel", "(", "listXMLModel", ")", ";", "listXML", ".", "setCellRenderer", "(", "new", "NfeJlistRender", "(", ")", ")", ";", "loadXMLPanel", "(", ")", ";", "loadXMLList", "(", ")", ";", "pbNFEProgress", ".", "setStringPainted", "(", "true", ")", ";", "setProgressComponentsVisible", "(", "false", ")", ";", "createErrorTable", "(", ")", ";", "btLimparErros", ".", "addActionListener", "(", "new", "ActionListener", "(", ")", "{", "@", "Override", "public", "void", "actionPerformed", "(", "ActionEvent", "e", ")", "{", "if", "(", "errorTableModel", ".", "getData", "(", ")", "!=", "null", ")", "{", "errorTableModel", ".", "getData", "(", ")", ".", "clear", "(", ")", ";", "errorTableModel", ".", "fireTableDataChanged", "(", ")", ";", "updateUI", "(", ")", ";", "}", "}", "}", ")", ";", "}", "private", "void", "createErrorTable", "(", ")", "{", "errorTableModel", "=", "new", "ObjectTableModel", "(", "NFeErrorWrapper", ".", "class", ")", ";", "tbErros", ".", "setModel", "(", "errorTableModel", ")", ";", "tbErros", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "0", ")", ".", "setPreferredWidth", "(", "70", ")", ";", "tbErros", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "0", ")", ".", "setMaxWidth", "(", "70", ")", ";", "tbErros", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "0", ")", ".", "setResizable", "(", "false", ")", ";", "tbErros", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "1", ")", ".", "setPreferredWidth", "(", "340", ")", ";", "tbErros", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "1", ")", ".", "setMaxWidth", "(", "340", ")", ";", "tbErros", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "1", ")", ".", "setResizable", "(", "false", ")", ";", "}", "public", "final", "void", "setProgressComponentsVisible", "(", "boolean", "visible", ")", "{", "pbNFEProgress", ".", "setVisible", "(", "visible", ")", ";", "jxBusyLabel", ".", "setVisible", "(", "visible", ")", ";", "}", "public", "void", "enableToolbarButtons", "(", "boolean", "enabled", ")", "{", "tbNfeButtons", ".", "setEnabled", "(", "enabled", ")", ";", "for", "(", "Component", "button", ":", "tbNfeButtons", ".", "getComponents", "(", ")", ")", "{", "button", ".", "setEnabled", "(", "enabled", ")", ";", "}", "}", "public", "void", "addError", "(", "NFeErrorWrapper", "erro", ")", "{", "if", "(", "errorTableModel", ".", "getData", "(", ")", "==", "null", ")", "{", "errorTableModel", ".", "setData", "(", "new", "ArrayList", "<", "NFEGuardianError", ">", "(", ")", ")", ";", "}", "errorTableModel", ".", "getData", "(", ")", ".", "add", "(", "erro", ")", ";", "errorTableModel", ".", "fireTableDataChanged", "(", ")", ";", "this", ".", "updateUI", "(", ")", ";", "}", "public", "void", "loadXMLList", "(", ")", "{", "if", "(", "listXMLModel", ".", "getData", "(", ")", "!=", "null", ")", "listXMLModel", ".", "getData", "(", ")", ".", "clear", "(", ")", ";", "String", "xmlPath", "=", "Main", ".", "CONFIGURATION", ".", "getNfePath", "(", ")", ";", "if", "(", "xmlPath", "!=", "null", "&&", "xmlPath", ".", "length", "(", ")", ">", "0", ")", "{", "File", "[", "]", "files", "=", "new", "File", "(", "xmlPath", ")", ".", "listFiles", "(", "new", "FileFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "pathname", ")", "{", "if", "(", "pathname", ".", "isDirectory", "(", ")", ")", "return", "false", ";", "return", "pathname", ".", "getName", "(", ")", ".", "endsWith", "(", "\".xml\"", ")", ";", "}", "}", ")", ";", "for", "(", "File", "file", ":", "files", ")", "{", "listXMLModel", ".", "addElement", "(", "new", "NFeFile", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ")", ";", "}", "executeWSWorker", "(", "NFEStatusWSWorker", ".", "class", ",", "listXMLModel", ".", "getData", "(", ")", ",", "this", ")", ";", "}", "}", "private", "void", "loadXMLPanel", "(", ")", "{", "xmlTextArea", "=", "new", "RSyntaxTextArea", "(", "20", ",", "60", ")", ";", "xmlTextArea", ".", "setSyntaxEditingStyle", "(", "SyntaxConstants", ".", "SYNTAX_STYLE_XML", ")", ";", "xmlTextArea", ".", "setCodeFoldingEnabled", "(", "true", ")", ";", "xmlTextArea", ".", "setAntiAliasingEnabled", "(", "true", ")", ";", "xmlTextArea", ".", "setEditable", "(", "false", ")", ";", "xmlSrollPane", "=", "new", "RTextScrollPane", "(", "xmlTextArea", ")", ";", "xmlSrollPane", ".", "setFoldIndicatorEnabled", "(", "true", ")", ";", "pnXMLPreview", ".", "add", "(", "xmlSrollPane", ",", "BorderLayout", ".", "CENTER", ")", ";", "}", "public", "JXBusyLabel", "getJxBusyLabel", "(", ")", "{", "return", "jxBusyLabel", ";", "}", "public", "JProgressBar", "getPbNFEProgress", "(", ")", "{", "return", "pbNFEProgress", ";", "}", "private", "List", "<", "NFeFile", ">", "getSelectedNFEs", "(", ")", "{", "Object", "[", "]", "files", "=", "listXML", ".", "getSelectedValues", "(", ")", ";", "List", "<", "NFeFile", ">", "nfes", "=", "new", "ArrayList", "<", "NFeFile", ">", "(", ")", ";", "for", "(", "Object", "file", ":", "files", ")", "{", "nfes", ".", "add", "(", "(", "NFeFile", ")", "file", ")", ";", "}", "return", "nfes", ";", "}", "private", "boolean", "changePanels", "(", ")", "{", "int", "result", "=", "JOptionPane", ".", "showOptionDialog", "(", "this", ",", "\"\"", ",", "\"Aten-UNK-o\"", ",", "JOptionPane", ".", "YES_NO_OPTION", ",", "JOptionPane", ".", "WARNING_MESSAGE", ",", "null", ",", "new", "Object", "[", "]", "{", "\"Sim\"", ",", "\"N-UNK-o\"", "}", ",", "0", ")", ";", "if", "(", "result", "==", "0", ")", "{", "Main", ".", "FRAME", ".", "changeCurrentPanelTo", "(", "ConfigurationPanel", ".", "class", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "private", "void", "executeWSWorker", "(", "Class", "<", "?", "extends", "NFEBaseWSWorker", ">", "workerClass", ",", "Object", "...", "args", ")", "{", "if", "(", "workerClass", "==", "NFEBaseWSWorker", ".", "class", ")", "throw", "new", "RuntimeException", "(", "\"Can't", "run", "\"", "+", "workerClass", "+", "\".", "\"", "+", "\"\"", "+", "workerClass", ")", ";", "if", "(", "!", "isConfigurationValid", "(", ")", ")", "{", "if", "(", "changePanels", "(", ")", ")", "return", ";", "}", "Class", "<", "?", ">", "types", "[", "]", "=", "new", "Class", "<", "?", ">", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "types", "[", "i", "]", "=", "args", "[", "i", "]", ".", "getClass", "(", ")", ";", "}", "try", "{", "Constructor", "<", "?", "extends", "NFEBaseWSWorker", ">", "constructor", "=", "workerClass", ".", "getConstructor", "(", "types", ")", ";", "NFEBaseWSWorker", "worker", "=", "constructor", ".", "newInstance", "(", "args", ")", ";", "worker", ".", "execute", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}", "private", "void", "initComponents", "(", ")", "{", "tbNfeButtons", "=", "new", "javax", ".", "swing", ".", "JToolBar", "(", ")", ";", "btEnviar", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "btRemove", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "btFind", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jLabel1", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "tfNFEId", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "pbNFEProgress", "=", "new", "javax", ".", "swing", ".", "JProgressBar", "(", ")", ";", "jxBusyLabel", "=", "new", "org", ".", "jdesktop", ".", "swingx", ".", "JXBusyLabel", "(", ")", ";", "painelCentral", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "spCentral", "=", "new", "javax", ".", "swing", ".", "JSplitPane", "(", ")", ";", "pnXMLFiles", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "spListaXML", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "listXML", "=", "new", "javax", ".", "swing", ".", "JList", "(", ")", ";", "jSplitPane1", "=", "new", "javax", ".", "swing", ".", "JSplitPane", "(", ")", ";", "pnXMLPreview", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "pnError", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "spError", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "tbErros", "=", "new", "javax", ".", "swing", ".", "JTable", "(", ")", ";", "btLimparErros", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "tbNfeButtons", ".", "setBorder", "(", "null", ")", ";", "tbNfeButtons", ".", "setFloatable", "(", "false", ")", ";", "tbNfeButtons", ".", "setRollover", "(", "true", ")", ";", "tbNfeButtons", ".", "setBorderPainted", "(", "false", ")", ";", "btEnviar", ".", "setIcon", "(", "new", "javax", ".", "swing", ".", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "btEnviar", ".", "setToolTipText", "(", "\"enviar\"", ")", ";", "btEnviar", ".", "setFocusable", "(", "false", ")", ";", "btEnviar", ".", "setHorizontalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "CENTER", ")", ";", "btEnviar", ".", "setVerticalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "BOTTOM", ")", ";", "btEnviar", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btEnviarActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "tbNfeButtons", ".", "add", "(", "btEnviar", ")", ";", "btRemove", ".", "setIcon", "(", "new", "javax", ".", "swing", ".", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "btRemove", ".", "setToolTipText", "(", "\"remover\"", ")", ";", "btRemove", ".", "setFocusable", "(", "false", ")", ";", "btRemove", ".", "setHorizontalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "CENTER", ")", ";", "btRemove", ".", "setVerticalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "BOTTOM", ")", ";", "btRemove", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btRemoveActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "tbNfeButtons", ".", "add", "(", "btRemove", ")", ";", "btFind", ".", "setIcon", "(", "new", "javax", ".", "swing", ".", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "btFind", ".", "setToolTipText", "(", "\"recuperar\"", ")", ";", "btFind", ".", "setFocusable", "(", "false", ")", ";", "btFind", ".", "setHorizontalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "CENTER", ")", ";", "btFind", ".", "setVerticalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "BOTTOM", ")", ";", "btFind", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btFindActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "tbNfeButtons", ".", "add", "(", "btFind", ")", ";", "jLabel1", ".", "setFont", "(", "new", "java", ".", "awt", ".", "Font", "(", "\"Tahoma\"", ",", "1", ",", "12", ")", ")", ";", "jLabel1", ".", "setText", "(", "\"\"", ")", ";", "tfNFEId", ".", "setFont", "(", "new", "java", ".", "awt", ".", "Font", "(", "\"Tahoma\"", ",", "1", ",", "14", ")", ")", ";", "pnXMLFiles", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createEtchedBorder", "(", ")", ")", ";", "pnXMLFiles", ".", "setMinimumSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "10", ",", "0", ")", ")", ";", "listXML", ".", "addMouseListener", "(", "new", "java", ".", "awt", ".", "event", ".", "MouseAdapter", "(", ")", "{", "public", "void", "mouseClicked", "(", "java", ".", "awt", ".", "event", ".", "MouseEvent", "evt", ")", "{", "listXMLMouseClicked", "(", "evt", ")", ";", "}", "}", ")", ";", "spListaXML", ".", "setViewportView", "(", "listXML", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "pnXMLFilesLayout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "pnXMLFiles", ")", ";", "pnXMLFiles", ".", "setLayout", "(", "pnXMLFilesLayout", ")", ";", "pnXMLFilesLayout", ".", "setHorizontalGroup", "(", "pnXMLFilesLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "spListaXML", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "334", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "pnXMLFilesLayout", ".", "setVerticalGroup", "(", "pnXMLFilesLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "spListaXML", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "482", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "spCentral", ".", "setLeftComponent", "(", "pnXMLFiles", ")", ";", "jSplitPane1", ".", "setOrientation", "(", "javax", ".", "swing", ".", "JSplitPane", ".", "VERTICAL_SPLIT", ")", ";", "jSplitPane1", ".", "setMinimumSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "10", ",", "207", ")", ")", ";", "jSplitPane1", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "400", ",", "407", ")", ")", ";", "pnXMLPreview", ".", "setMinimumSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "10", ",", "200", ")", ")", ";", "pnXMLPreview", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "744", ",", "300", ")", ")", ";", "pnXMLPreview", ".", "setLayout", "(", "new", "java", ".", "awt", ".", "BorderLayout", "(", ")", ")", ";", "jSplitPane1", ".", "setLeftComponent", "(", "pnXMLPreview", ")", ";", "pnError", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "776", ",", "100", ")", ")", ";", "spError", ".", "setMinimumSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "10", ",", "23", ")", ")", ";", "spError", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "452", ",", "80", ")", ")", ";", "tbErros", ".", "setModel", "(", "new", "javax", ".", "swing", ".", "table", ".", "DefaultTableModel", "(", "new", "Object", "[", "]", "[", "]", "{", "}", ",", "new", "String", "[", "]", "{", "}", ")", ")", ";", "spError", ".", "setViewportView", "(", "tbErros", ")", ";", "btLimparErros", ".", "setText", "(", "\"Limpar\"", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "pnErrorLayout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "pnError", ")", ";", "pnError", ".", "setLayout", "(", "pnErrorLayout", ")", ";", "pnErrorLayout", ".", "setHorizontalGroup", "(", "pnErrorLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "pnErrorLayout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", "588", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "btLimparErros", ")", ")", ".", "addGroup", "(", "pnErrorLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "spError", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "651", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "pnErrorLayout", ".", "setVerticalGroup", "(", "pnErrorLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "pnErrorLayout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", "156", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "btLimparErros", ")", ")", ".", "addGroup", "(", "pnErrorLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnErrorLayout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "spError", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "153", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGap", "(", "26", ",", "26", ",", "26", ")", ")", ")", ")", ";", "jSplitPane1", ".", "setRightComponent", "(", "pnError", ")", ";", "spCentral", ".", "setRightComponent", "(", "jSplitPane1", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "painelCentralLayout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "painelCentral", ")", ";", "painelCentral", ".", "setLayout", "(", "painelCentralLayout", ")", ";", "painelCentralLayout", ".", "setHorizontalGroup", "(", "painelCentralLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "painelCentralLayout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "addComponent", "(", "spCentral", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "998", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "painelCentralLayout", ".", "setVerticalGroup", "(", "painelCentralLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "spCentral", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "488", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "this", ")", ";", "this", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "addComponent", "(", "tbNfeButtons", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addGap", "(", "145", ",", "145", ",", "145", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "tfNFEId", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "512", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "jLabel1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "592", ",", "Short", ".", "MAX_VALUE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ",", "106", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "362", ",", "362", ",", "362", ")", ".", "addComponent", "(", "pbNFEProgress", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "300", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "UNRELATED", ")", ".", "addComponent", "(", "jxBusyLabel", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ")", ".", "addContainerGap", "(", ")", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "painelCentral", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "addContainerGap", "(", ")", ")", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "jLabel1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "25", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ")", ".", "addComponent", "(", "tfNFEId", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "31", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addComponent", "(", "tbNfeButtons", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "62", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ",", "496", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ")", ".", "addComponent", "(", "jxBusyLabel", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addComponent", "(", "pbNFEProgress", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "24", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addGap", "(", "3", ",", "3", ",", "3", ")", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "76", ",", "76", ",", "76", ")", ".", "addComponent", "(", "painelCentral", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGap", "(", "34", ",", "34", ",", "34", ")", ")", ")", ")", ";", "}", "private", "void", "btEnviarActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "executeWSWorker", "(", "NFESendWSWorker", ".", "class", ",", "(", "List", "<", "NFeFile", ">", ")", "getSelectedNFEs", "(", ")", ",", "this", ")", ";", "}", "private", "void", "listXMLMouseClicked", "(", "java", ".", "awt", ".", "event", ".", "MouseEvent", "evt", ")", "{", "if", "(", "listXML", ".", "getSelectedIndex", "(", ")", "!=", "-", "1", ")", "{", "NFeFile", "xml", "=", "(", "NFeFile", ")", "listXMLModel", ".", "getElementAt", "(", "listXML", ".", "getSelectedIndex", "(", ")", ")", ";", "String", "xmlContent", "=", "null", ";", "try", "{", "xmlContent", "=", "xml", ".", "getXMLAsString", "(", "true", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Logger", ".", "getLogger", "(", "NFEPanel", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "xmlTextArea", ".", "setText", "(", "xmlContent", ")", ";", "}", "}", "private", "void", "btRemoveActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "executeWSWorker", "(", "NFERemoveWSWorker", ".", "class", ",", "(", "List", "<", "NFeFile", ">", ")", "getSelectedNFEs", "(", ")", ",", "this", ")", ";", "}", "private", "void", "btFindActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "executeWSWorker", "(", "NFEFindWSWorker", ".", "class", ",", "tfNFEId", ".", "getText", "(", ")", "==", "null", "?", "\"\"", ":", "tfNFEId", ".", "getText", "(", ")", ",", "this", ")", ";", "}", "private", "javax", ".", "swing", ".", "JButton", "btEnviar", ";", "private", "javax", ".", "swing", ".", "JButton", "btFind", ";", "private", "javax", ".", "swing", ".", "JButton", "btLimparErros", ";", "private", "javax", ".", "swing", ".", "JButton", "btRemove", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel1", ";", "private", "javax", ".", "swing", ".", "JSplitPane", "jSplitPane1", ";", "private", "org", ".", "jdesktop", ".", "swingx", ".", "JXBusyLabel", "jxBusyLabel", ";", "private", "javax", ".", "swing", ".", "JList", "listXML", ";", "private", "javax", ".", "swing", ".", "JPanel", "painelCentral", ";", "private", "javax", ".", "swing", ".", "JProgressBar", "pbNFEProgress", ";", "private", "javax", ".", "swing", ".", "JPanel", "pnError", ";", "private", "javax", ".", "swing", ".", "JPanel", "pnXMLFiles", ";", "private", "javax", ".", "swing", ".", "JPanel", "pnXMLPreview", ";", "private", "javax", ".", "swing", ".", "JSplitPane", "spCentral", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "spError", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "spListaXML", ";", "private", "javax", ".", "swing", ".", "JTable", "tbErros", ";", "private", "javax", ".", "swing", ".", "JToolBar", "tbNfeButtons", ";", "private", "javax", ".", "swing", ".", "JTextField", "tfNFEId", ";", "@", "Override", "public", "String", "getTitle", "(", ")", "{", "return", "DESCRIPTION", ";", "}", "}", "</s>" ]
12,910
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ".", "StackWriter", ";", "import", "java", ".", "awt", ".", "Desktop", ";", "import", "java", ".", "awt", ".", "Dimension", ";", "import", "java", ".", "awt", ".", "Font", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "Icon", ";", "import", "javax", ".", "swing", ".", "ImageIcon", ";", "import", "javax", ".", "swing", ".", "JDialog", ";", "import", "javax", ".", "swing", ".", "JFrame", ";", "import", "javax", ".", "swing", ".", "event", ".", "HyperlinkEvent", ";", "import", "javax", ".", "swing", ".", "event", ".", "HyperlinkListener", ";", "public", "class", "ErrorDialog", "extends", "javax", ".", "swing", ".", "JDialog", "{", "private", "ErrorDialog", "(", "JFrame", "parent", ",", "boolean", "modal", ",", "String", "title", ",", "String", "message", ",", "Exception", "ex", ")", "{", "super", "(", "parent", ",", "modal", ")", ";", "Icon", "icon", "=", "new", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ";", "this", ".", "message", "=", "\"<HTML>\"", "+", "message", "+", "\"</HTML>\"", ";", "initComponents", "(", ")", ";", "setDefaultCloseOperation", "(", "JDialog", ".", "DISPOSE_ON_CLOSE", ")", ";", "setTitle", "(", "title", ")", ";", "lbIcon", ".", "setIcon", "(", "icon", ")", ";", "jpDetalhe", ".", "setVisible", "(", "false", ")", ";", "epDetalhe", ".", "setVisible", "(", "false", ")", ";", "epDetalhe", ".", "setEditable", "(", "false", ")", ";", "pack", "(", ")", ";", "epDetalhe", ".", "addHyperlinkListener", "(", "new", "OpenHyperlinkListener", "(", ")", ")", ";", "detailMaxWidth", "=", "epDetalhe", ".", "getPreferredSize", "(", ")", ".", "getWidth", "(", ")", ";", "setDetail", "(", "ex", ")", ";", "setLocationRelativeTo", "(", "null", ")", ";", "final", "JDialog", "dialog", "=", "this", ";", "Thread", "t", "=", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "while", "(", "dialog", "!=", "null", "&&", "dialog", ".", "isVisible", "(", ")", ")", "{", "}", "}", "}", ")", ";", "t", ".", "start", "(", ")", ";", "}", "public", "static", "void", "showError", "(", "JFrame", "parent", ",", "String", "title", ",", "String", "message", ",", "Exception", "ex", ")", "{", "new", "ErrorDialog", "(", "parent", ",", "true", ",", "title", ",", "message", ",", "ex", ")", ".", "setVisible", "(", "true", ")", ";", "}", "private", "void", "setDetail", "(", "Exception", "ex", ")", "{", "StackWriter", "exWriter", "=", "new", "StackWriter", "(", "System", ".", "out", ",", "epDetalhe", ".", "getFontMetrics", "(", "new", "Font", "(", "\"Tahoma\"", ",", "Font", ".", "BOLD", ",", "11", ")", ")", ")", ";", "ex", ".", "printStackTrace", "(", "exWriter", ")", ";", "String", "detail", "=", "\"<html>\"", ";", "for", "(", "String", "line", ":", "exWriter", ".", "getStackLines", "(", ")", ")", "{", "if", "(", "line", "!=", "null", ")", "{", "detail", "+=", "line", ";", "}", "}", "epDetalhe", ".", "setContentType", "(", "\"text/html\"", ")", ";", "epDetalhe", ".", "setText", "(", "detail", "+", "\"</html>\"", ")", ";", "detailMaxWidth", "=", "exWriter", ".", "getMaxStringWidth", "(", ")", ";", "if", "(", "detailMaxWidth", ">", "800", ")", "detailMaxWidth", "=", "800", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "initComponents", "(", ")", "{", "lbIcon", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "jLabel2", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", "message", ")", ";", "btDetalhe", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jButton2", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jpDetalhe", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "jScrollPane1", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "epDetalhe", "=", "new", "javax", ".", "swing", ".", "JEditorPane", "(", ")", ";", "setDefaultCloseOperation", "(", "javax", ".", "swing", ".", "WindowConstants", ".", "DISPOSE_ON_CLOSE", ")", ";", "lbIcon", ".", "setName", "(", "\"lbIcon\"", ")", ";", "jLabel2", ".", "setName", "(", "\"jLabel2\"", ")", ";", "btDetalhe", ".", "setText", "(", "\"Detalhe", ">>\"", ")", ";", "btDetalhe", ".", "setName", "(", "\"btDetalhe\"", ")", ";", "btDetalhe", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btDetalheActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jButton2", ".", "setText", "(", "\"Ok\"", ")", ";", "jButton2", ".", "setName", "(", "\"jButton2\"", ")", ";", "jButton2", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "jButton2ActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jpDetalhe", ".", "setName", "(", "\"jpDetalhe\"", ")", ";", "jScrollPane1", ".", "setName", "(", "\"jScrollPane1\"", ")", ";", "epDetalhe", ".", "setName", "(", "\"epDetalhe\"", ")", ";", "jScrollPane1", ".", "setViewportView", "(", "epDetalhe", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "jpDetalheLayout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "jpDetalhe", ")", ";", "jpDetalhe", ".", "setLayout", "(", "jpDetalheLayout", ")", ";", "jpDetalheLayout", ".", "setHorizontalGroup", "(", "jpDetalheLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jpDetalheLayout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "jScrollPane1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "332", ",", "Short", ".", "MAX_VALUE", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "jpDetalheLayout", ".", "setVerticalGroup", "(", "jpDetalheLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "jpDetalheLayout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "jScrollPane1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "210", ",", "Short", ".", "MAX_VALUE", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "getContentPane", "(", ")", ")", ";", "getContentPane", "(", ")", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "10", ",", "10", ",", "10", ")", ".", "addComponent", "(", "lbIcon", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "54", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addGap", "(", "6", ",", "6", ",", "6", ")", ".", "addComponent", "(", "jLabel2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "266", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", "190", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "btDetalhe", ")", ".", "addGap", "(", "11", ",", "11", ",", "11", ")", ".", "addComponent", "(", "jButton2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "52", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addContainerGap", "(", ")", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "10", ",", "10", ",", "10", ")", ".", "addComponent", "(", "jpDetalhe", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "lbIcon", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "58", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addComponent", "(", "jLabel2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "58", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addGap", "(", "11", ",", "11", ",", "11", ")", ".", "addGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "btDetalhe", ")", ".", "addComponent", "(", "jButton2", ")", ")", ".", "addGap", "(", "10", ",", "10", ",", "10", ")", ".", "addComponent", "(", "jpDetalhe", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "pack", "(", ")", ";", "}", "private", "void", "jButton2ActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "dispose", "(", ")", ";", "}", "private", "void", "btDetalheActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "if", "(", "jpDetalhe", ".", "isVisible", "(", ")", ")", "{", "detailMaxWidth", "=", "getSize", "(", ")", ".", "getWidth", "(", ")", ";", "jpDetalhe", ".", "setVisible", "(", "false", ")", ";", "epDetalhe", ".", "setVisible", "(", "false", ")", ";", "setSize", "(", "new", "Dimension", "(", "(", "int", ")", "getPreferredSize", "(", ")", ".", "getWidth", "(", ")", ",", "(", "int", ")", "getPreferredSize", "(", ")", ".", "getHeight", "(", ")", ")", ")", ";", "btDetalhe", ".", "setText", "(", "\"Detalhe", ">>\"", ")", ";", "}", "else", "{", "jpDetalhe", ".", "setVisible", "(", "true", ")", ";", "epDetalhe", ".", "setVisible", "(", "true", ")", ";", "if", "(", "detailMaxWidth", ">", "epDetalhe", ".", "getSize", "(", ")", ".", "getWidth", "(", ")", ")", "{", "setSize", "(", "new", "Dimension", "(", "(", "int", ")", "detailMaxWidth", ",", "getSize", "(", ")", ".", "height", ")", ")", ";", "jpDetalhe", ".", "setSize", "(", "new", "Dimension", "(", "(", "int", ")", "detailMaxWidth", ",", "getSize", "(", ")", ".", "height", ")", ")", ";", "epDetalhe", ".", "setSize", "(", "new", "Dimension", "(", "(", "int", ")", "detailMaxWidth", ",", "getSize", "(", ")", ".", "height", ")", ")", ";", "}", "setSize", "(", "new", "Dimension", "(", "(", "int", ")", "getSize", "(", ")", ".", "getWidth", "(", ")", ",", "(", "int", ")", "(", "getPreferredSize", "(", ")", ".", "getHeight", "(", ")", ")", ")", ")", ";", "btDetalhe", ".", "setText", "(", "\"<<", "Detalhe\"", ")", ";", "}", "}", "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "{", "java", ".", "awt", ".", "EventQueue", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "}", "}", ")", ";", "}", "private", "javax", ".", "swing", ".", "JButton", "btDetalhe", ";", "private", "javax", ".", "swing", ".", "JEditorPane", "epDetalhe", ";", "private", "javax", ".", "swing", ".", "JButton", "jButton2", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel2", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "jScrollPane1", ";", "private", "javax", ".", "swing", ".", "JPanel", "jpDetalhe", ";", "private", "javax", ".", "swing", ".", "JLabel", "lbIcon", ";", "private", "String", "message", ";", "private", "double", "detailMaxWidth", ";", "public", "static", "final", "int", "ERROR_MESSAGE", "=", "1", ";", "public", "static", "final", "int", "WARNING_MESSAGE", "=", "2", ";", "}", "class", "OpenHyperlinkListener", "implements", "HyperlinkListener", "{", "public", "void", "hyperlinkUpdate", "(", "HyperlinkEvent", "evt", ")", "{", "if", "(", "evt", ".", "getEventType", "(", ")", "==", "HyperlinkEvent", ".", "EventType", ".", "ACTIVATED", ")", "{", "if", "(", "Desktop", ".", "isDesktopSupported", "(", ")", ")", "{", "try", "{", "Desktop", ".", "getDesktop", "(", ")", ".", "browse", "(", "evt", ".", "getURL", "(", ")", ".", "toURI", "(", ")", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Logger", ".", "getLogger", "(", "OpenHyperlinkListener", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "}", "}", "}", "}", "</s>" ]
12,911
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ";", "public", "interface", "ITitledPane", "{", "String", "getTitle", "(", ")", ";", "}", "</s>" ]
12,912
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "components", ";", "import", "java", ".", "awt", ".", "Component", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "swing", ".", "DefaultListCellRenderer", ";", "import", "javax", ".", "swing", ".", "ImageIcon", ";", "import", "javax", ".", "swing", ".", "JLabel", ";", "import", "javax", ".", "swing", ".", "JList", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "public", "class", "NfeJlistRender", "extends", "DefaultListCellRenderer", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "private", "Map", "<", "NFeFile", ".", "Status", ",", "ImageIcon", ">", "iconMap", ";", "public", "NfeJlistRender", "(", ")", "{", "iconMap", "=", "new", "HashMap", "<", "NFeFile", ".", "Status", ",", "ImageIcon", ">", "(", ")", ";", "iconMap", ".", "put", "(", "NFeFile", ".", "Status", ".", "SYNCHRONIZED", ",", "new", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "iconMap", ".", "put", "(", "NFeFile", ".", "Status", ".", "NOT_SYNCHRONIZED", ",", "new", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "iconMap", ".", "put", "(", "NFeFile", ".", "Status", ".", "SYNCHRONIZING", ",", "new", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Override", "public", "Component", "getListCellRendererComponent", "(", "JList", "list", ",", "Object", "value", ",", "int", "index", ",", "boolean", "isSelected", ",", "boolean", "cellHasFocus", ")", "{", "Component", "component", "=", "super", ".", "getListCellRendererComponent", "(", "list", ",", "value", ",", "index", ",", "isSelected", ",", "cellHasFocus", ")", ";", "if", "(", "!", "(", "component", "instanceof", "JLabel", ")", ")", "return", "component", ";", "JLabel", "label", "=", "(", "JLabel", ")", "component", ";", "if", "(", "value", "instanceof", "NFeFile", ")", "{", "label", ".", "setIcon", "(", "iconMap", ".", "get", "(", "(", "(", "NFeFile", ")", "value", ")", ".", "getStatus", "(", ")", ")", ")", ";", "}", "return", "label", ";", "}", "}", "</s>" ]
12,913
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ".", "components", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Observable", ";", "import", "java", ".", "util", ".", "Observer", ";", "import", "java", ".", "util", ".", "Vector", ";", "import", "javax", ".", "swing", ".", "AbstractListModel", ";", "import", "javax", ".", "swing", ".", "DefaultListModel", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ".", "NFeFile", ";", "public", "class", "NfeFileJlistModel", "extends", "AbstractListModel", "implements", "Observer", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "private", "List", "<", "NFeFile", ">", "data", ";", "public", "NfeFileJlistModel", "(", ")", "{", "data", "=", "new", "ArrayList", "<", "NFeFile", ">", "(", ")", ";", "}", "public", "NfeFileJlistModel", "(", "List", "<", "NFeFile", ">", "data", ")", "{", "this", ".", "data", "=", "data", ";", "}", "@", "Override", "public", "int", "getSize", "(", ")", "{", "return", "data", "!=", "null", "?", "data", ".", "size", "(", ")", ":", "0", ";", "}", "@", "Override", "public", "Object", "getElementAt", "(", "int", "index", ")", "{", "return", "data", "!=", "null", "?", "data", ".", "get", "(", "index", ")", ":", "null", ";", "}", "public", "List", "<", "NFeFile", ">", "getData", "(", ")", "{", "return", "data", ";", "}", "public", "void", "setData", "(", "List", "<", "NFeFile", ">", "data", ")", "{", "this", ".", "data", "=", "data", ";", "fireIntervalAdded", "(", "data", ",", "0", ",", "data", ".", "size", "(", ")", ")", ";", "}", "public", "void", "addElement", "(", "NFeFile", "file", ")", "{", "int", "index", "=", "data", ".", "size", "(", ")", ";", "data", ".", "add", "(", "file", ")", ";", "fireIntervalAdded", "(", "this", ",", "index", ",", "index", ")", ";", "}", "public", "boolean", "removeElement", "(", "NFeFile", "obj", ")", "{", "int", "index", "=", "data", ".", "indexOf", "(", "obj", ")", ";", "boolean", "rv", "=", "data", ".", "remove", "(", "obj", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "fireIntervalRemoved", "(", "this", ",", "index", ",", "index", ")", ";", "}", "return", "rv", ";", "}", "@", "Override", "public", "void", "update", "(", "Observable", "o", ",", "Object", "arg", ")", "{", "NFeFile", "f", "=", "(", "NFeFile", ")", "arg", ";", "int", "index", "=", "data", ".", "indexOf", "(", "f", ")", ";", "fireContentsChanged", "(", "f", ",", "index", ",", "index", ")", ";", "}", "}", "</s>" ]
12,914
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "ui", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ";", "import", "java", ".", "awt", ".", "BorderLayout", ";", "import", "java", ".", "awt", ".", "Component", ";", "import", "java", ".", "awt", ".", "event", ".", "WindowAdapter", ";", "import", "java", ".", "awt", ".", "event", ".", "WindowEvent", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "swing", ".", "JPanel", ";", "import", "static", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "Main", ".", "*", ";", "public", "class", "MainFrame", "extends", "javax", ".", "swing", ".", "JFrame", "{", "private", "ConfigurationPanel", "configurationPanel", ";", "private", "NFEPanel", "nFEPanel", ";", "private", "Map", "<", "Class", "<", "?", "extends", "JPanel", ">", ",", "JPanel", ">", "availablePanels", ";", "public", "MainFrame", "(", ")", "{", "initComponents", "(", ")", ";", "setTitle", "(", "\"\"", ")", ";", "nFEPanel", "=", "new", "NFEPanel", "(", ")", ";", "configurationPanel", "=", "new", "ConfigurationPanel", "(", "this", ")", ";", "availablePanels", "=", "new", "HashMap", "<", "Class", "<", "?", "extends", "JPanel", ">", ",", "JPanel", ">", "(", ")", ";", "availablePanels", ".", "put", "(", "ConfigurationPanel", ".", "class", ",", "configurationPanel", ")", ";", "availablePanels", ".", "put", "(", "NFEPanel", ".", "class", ",", "nFEPanel", ")", ";", "setLocationRelativeTo", "(", "null", ")", ";", "if", "(", "isConfigurationValid", "(", ")", ")", "swapCurrentPanel", "(", "nFEPanel", ",", "NFEPanel", ".", "DESCRIPTION", ")", ";", "else", "swapCurrentPanel", "(", "configurationPanel", ",", "ConfigurationPanel", ".", "DESCRIPTION", ")", ";", "this", ".", "addWindowListener", "(", "new", "WindowAdapter", "(", ")", "{", "@", "Override", "public", "void", "windowClosing", "(", "WindowEvent", "e", ")", "{", "try", "{", "Main", ".", "CONFIGURATION", ".", "store", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "ErrorDialog", ".", "showError", "(", "null", ",", "\"ERRO\"", ",", "\"\"", ",", "ex", ")", ";", "}", "}", "}", ")", ";", "}", "public", "JPanel", "getConfigurationPanel", "(", ")", "{", "return", "configurationPanel", ";", "}", "public", "NFEPanel", "getNFEPanel", "(", ")", "{", "return", "nFEPanel", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "initComponents", "(", ")", "{", "jPanel2", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "jSeparator1", "=", "new", "javax", ".", "swing", ".", "JSeparator", "(", ")", ";", "pnTop", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "jToolBar1", "=", "new", "javax", ".", "swing", ".", "JToolBar", "(", ")", ";", "btNFE", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "btConfiguration", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "tfDescriptionMesage", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "jSeparator2", "=", "new", "javax", ".", "swing", ".", "JSeparator", "(", ")", ";", "pnCurrent", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "jPanel2Layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "jPanel2", ")", ";", "jPanel2", ".", "setLayout", "(", "jPanel2Layout", ")", ";", "jPanel2Layout", ".", "setHorizontalGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGap", "(", "0", ",", "100", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "jPanel2Layout", ".", "setVerticalGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGap", "(", "0", ",", "100", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "setDefaultCloseOperation", "(", "javax", ".", "swing", ".", "WindowConstants", ".", "EXIT_ON_CLOSE", ")", ";", "pnTop", ".", "setBackground", "(", "new", "java", ".", "awt", ".", "Color", "(", "255", ",", "255", ",", "255", ")", ")", ";", "jToolBar1", ".", "setBackground", "(", "new", "java", ".", "awt", ".", "Color", "(", "255", ",", "255", ",", "255", ")", ")", ";", "jToolBar1", ".", "setBorder", "(", "null", ")", ";", "jToolBar1", ".", "setFloatable", "(", "false", ")", ";", "jToolBar1", ".", "setBorderPainted", "(", "false", ")", ";", "btNFE", ".", "setBackground", "(", "new", "java", ".", "awt", ".", "Color", "(", "255", ",", "255", ",", "255", ")", ")", ";", "btNFE", ".", "setIcon", "(", "new", "javax", ".", "swing", ".", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "btNFE", ".", "setFocusable", "(", "false", ")", ";", "btNFE", ".", "setHorizontalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "CENTER", ")", ";", "btNFE", ".", "setVerticalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "BOTTOM", ")", ";", "btNFE", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btNFEActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jToolBar1", ".", "add", "(", "btNFE", ")", ";", "btConfiguration", ".", "setBackground", "(", "new", "java", ".", "awt", ".", "Color", "(", "255", ",", "255", ",", "255", ")", ")", ";", "btConfiguration", ".", "setIcon", "(", "new", "javax", ".", "swing", ".", "ImageIcon", "(", "getClass", "(", ")", ".", "getResource", "(", "\"\"", ")", ")", ")", ";", "btConfiguration", ".", "setFocusable", "(", "false", ")", ";", "btConfiguration", ".", "setHorizontalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "CENTER", ")", ";", "btConfiguration", ".", "setVerticalTextPosition", "(", "javax", ".", "swing", ".", "SwingConstants", ".", "BOTTOM", ")", ";", "btConfiguration", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "btConfigurationActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jToolBar1", ".", "add", "(", "btConfiguration", ")", ";", "tfDescriptionMesage", ".", "setFont", "(", "new", "java", ".", "awt", ".", "Font", "(", "\"Tahoma\"", ",", "3", ",", "18", ")", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "pnTopLayout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "pnTop", ")", ";", "pnTop", ".", "setLayout", "(", "pnTopLayout", ")", ";", "pnTopLayout", ".", "setHorizontalGroup", "(", "pnTopLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnTopLayout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "jToolBar1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "186", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "javax", ".", "swing", ".", "LayoutStyle", ".", "ComponentPlacement", ".", "RELATED", ",", "541", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "tfDescriptionMesage", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "372", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addComponent", "(", "jSeparator2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "TRAILING", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "1099", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "pnTopLayout", ".", "setVerticalGroup", "(", "pnTopLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnTopLayout", ".", "createSequentialGroup", "(", ")", ".", "addGroup", "(", "pnTopLayout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "pnTopLayout", ".", "createSequentialGroup", "(", ")", ".", "addGap", "(", "1", ",", "1", ",", "1", ")", ".", "addComponent", "(", "jToolBar1", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "75", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addComponent", "(", "tfDescriptionMesage", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "76", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addGap", "(", "0", ",", "0", ",", "0", ")", ".", "addComponent", "(", "jSeparator2", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ")", ";", "pnCurrent", ".", "setLayout", "(", "new", "java", ".", "awt", ".", "BorderLayout", "(", ")", ")", ";", "javax", ".", "swing", ".", "GroupLayout", "layout", "=", "new", "javax", ".", "swing", ".", "GroupLayout", "(", "getContentPane", "(", ")", ")", ";", "getContentPane", "(", ")", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addComponent", "(", "pnTop", ",", "0", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "addComponent", "(", "pnCurrent", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "1099", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "javax", ".", "swing", ".", "GroupLayout", ".", "Alignment", ".", "LEADING", ")", ".", "addGroup", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addComponent", "(", "pnTop", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addGap", "(", "1", ",", "1", ",", "1", ")", ".", "addComponent", "(", "pnCurrent", ",", "javax", ".", "swing", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "616", ",", "Short", ".", "MAX_VALUE", ")", ".", "addGap", "(", "6", ",", "6", ",", "6", ")", ")", ")", ";", "pack", "(", ")", ";", "}", "private", "void", "btNFEActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "swapCurrentPanel", "(", "nFEPanel", ",", "NFEPanel", ".", "DESCRIPTION", ")", ";", "}", "private", "void", "btConfigurationActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "swapCurrentPanel", "(", "configurationPanel", ",", "ConfigurationPanel", ".", "DESCRIPTION", ")", ";", "}", "public", "void", "changeCurrentPanelTo", "(", "Class", "<", "?", "extends", "JPanel", ">", "panelClass", ")", "{", "JPanel", "panel", "=", "availablePanels", ".", "get", "(", "panelClass", ")", ";", "if", "(", "panel", "!=", "null", ")", "{", "String", "desc", "=", "\"\"", ";", "if", "(", "panel", "instanceof", "ITitledPane", ")", "desc", "=", "(", "String", ")", "(", "(", "ITitledPane", ")", "panel", ")", ".", "getTitle", "(", ")", ";", "swapCurrentPanel", "(", "panel", ",", "desc", ")", ";", "}", "}", "private", "void", "swapCurrentPanel", "(", "Component", "comp", ",", "String", "desc", ")", "{", "tfDescriptionMesage", ".", "setText", "(", "desc", ")", ";", "pnCurrent", ".", "removeAll", "(", ")", ";", "pnCurrent", ".", "add", "(", "comp", ",", "BorderLayout", ".", "CENTER", ")", ";", "pnCurrent", ".", "updateUI", "(", ")", ";", "}", "private", "javax", ".", "swing", ".", "JButton", "btConfiguration", ";", "private", "javax", ".", "swing", ".", "JButton", "btNFE", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel2", ";", "private", "javax", ".", "swing", ".", "JSeparator", "jSeparator1", ";", "private", "javax", ".", "swing", ".", "JSeparator", "jSeparator2", ";", "private", "javax", ".", "swing", ".", "JToolBar", "jToolBar1", ";", "private", "javax", ".", "swing", ".", "JPanel", "pnCurrent", ";", "private", "javax", ".", "swing", ".", "JPanel", "pnTop", ";", "private", "javax", ".", "swing", ".", "JLabel", "tfDescriptionMesage", ";", "}", "</s>" ]
12,915
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "import", "org", ".", "springframework", ".", "security", ".", "core", ".", "GrantedAuthority", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ".", "WSClient", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "User", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "UserGroup", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "ClientHandlerException", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "filter", ".", "HTTPBasicAuthFilter", ";", "public", "class", "UserMain", "{", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", ",", "Exception", "{", "WSClient", "client", "=", "WSClient", ".", "getInstance", "(", ")", ";", "UserGroup", "grupo", "=", "new", "UserGroup", "(", "\"USER\"", ")", ";", "Collection", "<", "GrantedAuthority", ">", "grupos", "=", "new", "ArrayList", "<", "GrantedAuthority", ">", "(", ")", ";", "grupos", ".", "add", "(", "grupo", ")", ";", "User", "user", "=", "new", "User", "(", "\"Tiago1\"", ",", "\"q1w2e3r4\"", ",", "grupos", ")", ";", "client", ".", "addFilter", "(", "new", "HTTPBasicAuthFilter", "(", "\"ROOT\"", ",", "\"12qwas\"", ")", ")", ";", "client", ".", "path", "(", "\"\"", ")", ";", "client", ".", "type", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "client", ".", "post", "(", "String", ".", "class", ",", "user", ".", "toXML", "(", ")", ")", ";", "}", "}", "</s>" ]
12,916
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "Client", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "ClientHandlerException", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "ClientResponse", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "GenericType", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "WebResource", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "filter", ".", "ClientFilter", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "filter", ".", "HTTPBasicAuthFilter", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "Cookie", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MultivaluedMap", ";", "public", "class", "WSClient", "{", "private", "static", "WSClient", "instance", "=", "new", "WSClient", "(", ")", ";", "private", "Client", "realClient", ";", "private", "ThreadLocal", "<", "WebResource", ">", "currentResource", ";", "private", "ThreadLocal", "<", "WebResource", ".", "Builder", ">", "currentResourceBuilder", ";", "private", "WSClient", "(", ")", "{", "realClient", "=", "new", "Client", "(", ")", ";", "currentResource", "=", "new", "ThreadLocal", "<", "WebResource", ">", "(", ")", "{", "@", "Override", "protected", "WebResource", "initialValue", "(", ")", "{", "return", "realClient", ".", "resource", "(", "\"\"", ")", ";", "}", "}", ";", "currentResourceBuilder", "=", "new", "ThreadLocal", "<", "WebResource", ".", "Builder", ">", "(", ")", "{", "@", "Override", "protected", "WebResource", ".", "Builder", "initialValue", "(", ")", "{", "return", "currentResource", ".", "get", "(", ")", ".", "getRequestBuilder", "(", ")", ";", "}", "}", ";", "}", "private", "void", "newResource", "(", "String", "path", ")", "{", "currentResource", ".", "set", "(", "realClient", ".", "resource", "(", "path", ")", ")", ";", "currentResourceBuilder", ".", "set", "(", "currentResource", ".", "get", "(", ")", ".", "getRequestBuilder", "(", ")", ")", ";", "}", "private", "WebResource", ".", "Builder", "getBuilder", "(", ")", "{", "return", "currentResourceBuilder", ".", "get", "(", ")", ";", "}", "public", "static", "WSClient", "getInstance", "(", ")", "{", "return", "instance", ";", "}", "public", "void", "addFilter", "(", "ClientFilter", "filter", ")", "{", "realClient", ".", "addFilter", "(", "filter", ")", ";", "}", "public", "WSClient", "accept", "(", "MediaType", "...", "types", ")", "{", "getBuilder", "(", ")", ".", "accept", "(", "types", ")", ";", "return", "this", ";", "}", "public", "WSClient", "accept", "(", "String", "...", "types", ")", "{", "getBuilder", "(", ")", ".", "accept", "(", "types", ")", ";", "return", "this", ";", "}", "public", "WSClient", "acceptLanguage", "(", "Locale", "...", "locales", ")", "{", "getBuilder", "(", ")", ".", "acceptLanguage", "(", "locales", ")", ";", "return", "this", ";", "}", "public", "WSClient", "acceptLanguage", "(", "String", "...", "locales", ")", "{", "getBuilder", "(", ")", ".", "acceptLanguage", "(", "locales", ")", ";", "return", "this", ";", "}", "public", "WSClient", "cookie", "(", "Cookie", "cookie", ")", "{", "getBuilder", "(", ")", ".", "cookie", "(", "cookie", ")", ";", "return", "this", ";", "}", "public", "void", "delete", "(", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "delete", "(", ")", ";", "}", "public", "void", "delete", "(", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "delete", "(", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "delete", "(", "Class", "<", "T", ">", "c", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "delete", "(", "c", ")", ";", "}", "public", "<", "T", ">", "T", "delete", "(", "GenericType", "<", "T", ">", "gt", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "delete", "(", "gt", ")", ";", "}", "public", "<", "T", ">", "T", "delete", "(", "Class", "<", "T", ">", "c", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "delete", "(", "c", ",", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "delete", "(", "GenericType", "<", "T", ">", "gt", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "delete", "(", "gt", ",", "requestEntity", ")", ";", "}", "public", "WSClient", "entity", "(", "Object", "entity", ")", "{", "getBuilder", "(", ")", ".", "entity", "(", "entity", ")", ";", "return", "this", ";", "}", "public", "WSClient", "entity", "(", "Object", "entity", ",", "MediaType", "type", ")", "{", "getBuilder", "(", ")", ".", "entity", "(", "entity", ",", "type", ")", ";", "return", "this", ";", "}", "public", "WSClient", "entity", "(", "Object", "entity", ",", "String", "type", ")", "{", "getBuilder", "(", ")", ".", "entity", "(", "entity", ",", "type", ")", ";", "return", "this", ";", "}", "public", "<", "T", ">", "T", "get", "(", "Class", "<", "T", ">", "c", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "get", "(", "c", ")", ";", "}", "public", "<", "T", ">", "T", "get", "(", "GenericType", "<", "T", ">", "gt", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "get", "(", "gt", ")", ";", "}", "public", "Map", "<", "String", ",", "Object", ">", "getProperties", "(", ")", "{", "return", "currentResource", ".", "get", "(", ")", ".", "getProperties", "(", ")", ";", "}", "public", "URI", "getURI", "(", ")", "{", "return", "currentResource", ".", "get", "(", ")", ".", "getURI", "(", ")", ";", "}", "public", "ClientResponse", "head", "(", ")", "throws", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "head", "(", ")", ";", "}", "public", "WebResource", ".", "Builder", "header", "(", "String", "name", ",", "Object", "value", ")", "{", "return", "getBuilder", "(", ")", ".", "header", "(", "name", ",", "value", ")", ";", "}", "public", "void", "method", "(", "String", "method", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "method", "(", "method", ")", ";", "}", "public", "void", "method", "(", "String", "method", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "method", "(", "method", ",", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "method", "(", "String", "method", ",", "Class", "<", "T", ">", "c", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "method", "(", "method", ",", "c", ")", ";", "}", "public", "<", "T", ">", "T", "method", "(", "String", "method", ",", "GenericType", "<", "T", ">", "gt", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "method", "(", "method", ",", "gt", ")", ";", "}", "public", "<", "T", ">", "T", "method", "(", "String", "method", ",", "Class", "<", "T", ">", "c", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "method", "(", "method", ",", "c", ",", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "method", "(", "String", "method", ",", "GenericType", "<", "T", ">", "gt", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "method", "(", "method", ",", "gt", ",", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "options", "(", "Class", "<", "T", ">", "c", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "options", "(", "c", ")", ";", "}", "public", "<", "T", ">", "T", "options", "(", "GenericType", "<", "T", ">", "gt", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "options", "(", "gt", ")", ";", "}", "public", "WSClient", "path", "(", "String", "path", ")", "{", "newResource", "(", "path", ")", ";", "return", "this", ";", "}", "public", "void", "post", "(", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "post", "(", ")", ";", "}", "public", "void", "post", "(", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "post", "(", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "post", "(", "Class", "<", "T", ">", "c", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "post", "(", "c", ")", ";", "}", "public", "<", "T", ">", "T", "post", "(", "GenericType", "<", "T", ">", "gt", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "post", "(", "gt", ")", ";", "}", "public", "<", "T", ">", "T", "post", "(", "Class", "<", "T", ">", "c", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "post", "(", "c", ",", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "post", "(", "GenericType", "<", "T", ">", "gt", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "post", "(", "gt", ",", "requestEntity", ")", ";", "}", "public", "void", "put", "(", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "put", "(", ")", ";", "}", "public", "void", "put", "(", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "getBuilder", "(", ")", ".", "put", "(", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "put", "(", "Class", "<", "T", ">", "c", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "put", "(", "c", ")", ";", "}", "public", "<", "T", ">", "T", "put", "(", "GenericType", "<", "T", ">", "gt", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "put", "(", "gt", ")", ";", "}", "public", "<", "T", ">", "T", "put", "(", "Class", "<", "T", ">", "c", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "put", "(", "c", ",", "requestEntity", ")", ";", "}", "public", "<", "T", ">", "T", "put", "(", "GenericType", "<", "T", ">", "gt", ",", "Object", "requestEntity", ")", "throws", "UniformInterfaceException", ",", "ClientHandlerException", "{", "return", "getBuilder", "(", ")", ".", "put", "(", "gt", ",", "requestEntity", ")", ";", "}", "public", "WSClient", "queryParam", "(", "String", "key", ",", "String", "value", ")", "{", "currentResource", ".", "get", "(", ")", ".", "queryParam", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}", "public", "WSClient", "queryParams", "(", "MultivaluedMap", "<", "String", ",", "String", ">", "params", ")", "{", "currentResource", ".", "get", "(", ")", ".", "queryParams", "(", "params", ")", ";", "return", "this", ";", "}", "public", "void", "setProperty", "(", "String", "property", ",", "Object", "value", ")", "{", "currentResource", ".", "get", "(", ")", ".", "setProperty", "(", "property", ",", "value", ")", ";", "}", "public", "WSClient", "type", "(", "MediaType", "type", ")", "{", "getBuilder", "(", ")", ".", "type", "(", "type", ")", ";", "return", "this", ";", "}", "public", "WSClient", "type", "(", "String", "type", ")", "{", "getBuilder", "(", ")", ".", "type", "(", "type", ")", ";", "return", "this", ";", "}", "public", "WSClient", "uri", "(", "URI", "uri", ")", "{", "currentResource", ".", "get", "(", ")", ".", "uri", "(", "uri", ")", ";", "return", "this", ";", "}", "}", "</s>" ]
12,917
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ";", "import", "java", ".", "awt", ".", "FontMetrics", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "public", "class", "StackWriter", "extends", "PrintWriter", "{", "private", "int", "count", ";", "private", "String", "[", "]", "stackLines", ";", "private", "static", "String", "baseUrl", "=", "\"\"", ";", "private", "int", "maxStringWidth", ";", "private", "FontMetrics", "fm", ";", "public", "StackWriter", "(", "OutputStream", "stream", ")", "{", "super", "(", "stream", ")", ";", "stackLines", "=", "new", "String", "[", "10", "]", ";", "count", "=", "0", ";", "maxStringWidth", "=", "0", ";", "}", "public", "StackWriter", "(", "OutputStream", "stream", ",", "FontMetrics", "fm", ")", "{", "this", "(", "stream", ")", ";", "this", ".", "fm", "=", "fm", ";", "}", "@", "Override", "public", "void", "write", "(", "String", "string", ")", "{", "String", "exUrl", "=", "\"\"", ";", "String", "exName", "=", "\"\"", ";", "String", "exDesc", "=", "\"\"", ";", "if", "(", "maxStringWidth", "<", "(", "fm", ".", "stringWidth", "(", "string", ")", "+", "90", ")", ")", "maxStringWidth", "=", "(", "fm", ".", "stringWidth", "(", "string", ")", "+", "90", ")", ";", "if", "(", "count", "==", "0", ")", "{", "exName", "=", "(", "string", ".", "indexOf", "(", "\":\"", ")", "!=", "-", "1", ")", "?", "string", ".", "substring", "(", "0", ",", "string", ".", "indexOf", "(", "\":\"", ")", ")", ":", "string", ";", "exDesc", "=", "\"\"", "+", "(", "(", "string", ".", "indexOf", "(", "\":\"", ")", "!=", "-", "1", ")", "?", "string", ".", "substring", "(", "string", ".", "indexOf", "(", "\":\"", ")", ",", "string", ".", "length", "(", ")", ")", ":", "\"\"", ")", "+", "\"</FONT>\"", ";", "exUrl", "=", "getExceptionLink", "(", "exName", ")", ";", "add", "(", "\"<A", "HREF=\\\"\"", "+", "exUrl", "+", "\"\\\">\"", "+", "exName", "+", "\"</A>", "\"", "+", "exDesc", "+", "\"<BR>\"", ",", "count", "++", ")", ";", "}", "else", "if", "(", "string", ".", "indexOf", "(", "\"(\"", ")", "!=", "-", "1", "&&", "string", ".", "indexOf", "(", "\")\"", ")", "!=", "-", "1", ")", "{", "add", "(", "string", ".", "substring", "(", "0", ",", "string", ".", "indexOf", "(", "\"(\"", ")", ")", "+", "\"\"", "+", "string", ".", "substring", "(", "string", ".", "indexOf", "(", "\"(\"", ")", ",", "string", ".", "length", "(", ")", ")", "+", "\"</FONT><BR>\"", ",", "count", "++", ")", ";", "}", "else", "{", "add", "(", "string", "+", "\"<BR>\"", ",", "count", "++", ")", ";", "}", "}", "public", "String", "[", "]", "getStackLines", "(", ")", "{", "return", "stackLines", ";", "}", "public", "int", "getMaxStringWidth", "(", ")", "{", "return", "maxStringWidth", ";", "}", "private", "void", "add", "(", "String", "s", ",", "int", "index", ")", "{", "String", "[", "]", "temp", "=", "null", ";", "if", "(", "index", ">=", "stackLines", ".", "length", ")", "{", "temp", "=", "new", "String", "[", "stackLines", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "stackLines", ",", "0", ",", "temp", ",", "0", ",", "stackLines", ".", "length", ")", ";", "stackLines", "=", "new", "String", "[", "temp", ".", "length", "+", "10", "]", ";", "System", ".", "arraycopy", "(", "temp", ",", "0", ",", "stackLines", ",", "0", ",", "temp", ".", "length", ")", ";", "}", "stackLines", "[", "index", "]", "=", "s", ";", "}", "private", "String", "getExceptionLink", "(", "String", "ex", ")", "{", "ex", "=", "ex", ".", "replace", "(", "\".\"", ",", "\"/\"", ")", ";", "ex", "=", "ex", "+", "\".html\"", ";", "return", "baseUrl", "+", "ex", ";", "}", "}", "</s>" ]
12,918
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "test", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "helper", ".", "WSClient", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "javax", ".", "ws", ".", "rs", ".", "core", ".", "MediaType", ";", "import", "org", ".", "apache", ".", "commons", ".", "io", ".", "FileUtils", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "UniformInterfaceException", ";", "import", "com", ".", "sun", ".", "jersey", ".", "api", ".", "client", ".", "filter", ".", "HTTPBasicAuthFilter", ";", "public", "class", "NFETester", "{", "@", "Test", "public", "void", "sendNfe", "(", ")", "throws", "IOException", "{", "WSClient", "client", "=", "WSClient", ".", "getInstance", "(", ")", ";", "client", ".", "addFilter", "(", "new", "HTTPBasicAuthFilter", "(", "\"maria\"", ",", "\"q1w2e3r4\"", ")", ")", ";", "String", "nfe", "=", "FileUtils", ".", "readFileToString", "(", "new", "File", "(", "\"\"", ")", ")", ";", "String", "clientResponse", "=", "null", ";", "try", "{", "client", ".", "path", "(", "\"\"", ")", ";", "client", ".", "type", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "client", ".", "accept", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "clientResponse", "=", "client", ".", "post", "(", "String", ".", "class", ",", "nfe", ")", ";", "}", "catch", "(", "UniformInterfaceException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "e", ".", "getResponse", "(", ")", ".", "getEntity", "(", "String", ".", "class", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", "clientResponse", ")", ";", "try", "{", "client", ".", "path", "(", "\"\"", ")", ";", "client", ".", "type", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "client", ".", "accept", "(", "MediaType", ".", "APPLICATION_XML", ")", ";", "clientResponse", "=", "client", ".", "get", "(", "String", ".", "class", ")", ";", "}", "catch", "(", "UniformInterfaceException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "e", ".", "getResponse", "(", ")", ".", "getEntity", "(", "String", ".", "class", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", "clientResponse", ")", ";", "}", "}", "</s>" ]
12,919
[ "<s>", "package", "org", ".", "kde", ".", "necessitas", ".", "origo", ".", "example", ".", "redak", ";", "public", "final", "class", "R", "{", "public", "static", "final", "class", "array", "{", "public", "static", "final", "int", "bundled_libs", "=", "0x7f040001", ";", "public", "static", "final", "int", "qt_libs", "=", "0x7f040000", ";", "}", "public", "static", "final", "class", "attr", "{", "}", "public", "static", "final", "class", "drawable", "{", "public", "static", "final", "int", "icon", "=", "0x7f020000", ";", "public", "static", "final", "int", "logo", "=", "0x7f020001", ";", "}", "public", "static", "final", "class", "layout", "{", "public", "static", "final", "int", "splash", "=", "0x7f030000", ";", "}", "public", "static", "final", "class", "string", "{", "public", "static", "final", "int", "app_name", "=", "0x7f050000", ";", "public", "static", "final", "int", "fatal_error_msg", "=", "0x7f050003", ";", "public", "static", "final", "int", "ministro_needed_msg", "=", "0x7f050002", ";", "public", "static", "final", "int", "ministro_not_found_msg", "=", "0x7f050001", ";", "}", "}", "</s>" ]
12,920
[ "<s>", "package", "org", ".", "kde", ".", "necessitas", ".", "origo", ".", "example", ".", "redak", ";", "public", "final", "class", "BuildConfig", "{", "public", "final", "static", "boolean", "DEBUG", "=", "true", ";", "}", "</s>" ]
12,921
[ "<s>", "package", "org", ".", "kde", ".", "necessitas", ".", "ministro", ";", "public", "interface", "IMinistro", "extends", "android", ".", "os", ".", "IInterface", "{", "public", "static", "abstract", "class", "Stub", "extends", "android", ".", "os", ".", "Binder", "implements", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", "{", "private", "static", "final", "java", ".", "lang", ".", "String", "DESCRIPTOR", "=", "\"\"", ";", "public", "Stub", "(", ")", "{", "this", ".", "attachInterface", "(", "this", ",", "DESCRIPTOR", ")", ";", "}", "public", "static", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", "asInterface", "(", "android", ".", "os", ".", "IBinder", "obj", ")", "{", "if", "(", "(", "obj", "==", "null", ")", ")", "{", "return", "null", ";", "}", "android", ".", "os", ".", "IInterface", "iin", "=", "(", "android", ".", "os", ".", "IInterface", ")", "obj", ".", "queryLocalInterface", "(", "DESCRIPTOR", ")", ";", "if", "(", "(", "(", "iin", "!=", "null", ")", "&&", "(", "iin", "instanceof", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", ")", ")", ")", "{", "return", "(", "(", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", ")", "iin", ")", ";", "}", "return", "new", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", ".", "Stub", ".", "Proxy", "(", "obj", ")", ";", "}", "public", "android", ".", "os", ".", "IBinder", "asBinder", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "boolean", "onTransact", "(", "int", "code", ",", "android", ".", "os", ".", "Parcel", "data", ",", "android", ".", "os", ".", "Parcel", "reply", ",", "int", "flags", ")", "throws", "android", ".", "os", ".", "RemoteException", "{", "switch", "(", "code", ")", "{", "case", "INTERFACE_TRANSACTION", ":", "{", "reply", ".", "writeString", "(", "DESCRIPTOR", ")", ";", "return", "true", ";", "}", "case", "TRANSACTION_requestLoader", ":", "{", "data", ".", "enforceInterface", "(", "DESCRIPTOR", ")", ";", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", "_arg0", ";", "_arg0", "=", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", ".", "Stub", ".", "asInterface", "(", "data", ".", "readStrongBinder", "(", ")", ")", ";", "android", ".", "os", ".", "Bundle", "_arg1", ";", "if", "(", "(", "0", "!=", "data", ".", "readInt", "(", ")", ")", ")", "{", "_arg1", "=", "android", ".", "os", ".", "Bundle", ".", "CREATOR", ".", "createFromParcel", "(", "data", ")", ";", "}", "else", "{", "_arg1", "=", "null", ";", "}", "this", ".", "requestLoader", "(", "_arg0", ",", "_arg1", ")", ";", "reply", ".", "writeNoException", "(", ")", ";", "return", "true", ";", "}", "}", "return", "super", ".", "onTransact", "(", "code", ",", "data", ",", "reply", ",", "flags", ")", ";", "}", "private", "static", "class", "Proxy", "implements", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", "{", "private", "android", ".", "os", ".", "IBinder", "mRemote", ";", "Proxy", "(", "android", ".", "os", ".", "IBinder", "remote", ")", "{", "mRemote", "=", "remote", ";", "}", "public", "android", ".", "os", ".", "IBinder", "asBinder", "(", ")", "{", "return", "mRemote", ";", "}", "public", "java", ".", "lang", ".", "String", "getInterfaceDescriptor", "(", ")", "{", "return", "DESCRIPTOR", ";", "}", "public", "void", "requestLoader", "(", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", "callback", ",", "android", ".", "os", ".", "Bundle", "parameters", ")", "throws", "android", ".", "os", ".", "RemoteException", "{", "android", ".", "os", ".", "Parcel", "_data", "=", "android", ".", "os", ".", "Parcel", ".", "obtain", "(", ")", ";", "android", ".", "os", ".", "Parcel", "_reply", "=", "android", ".", "os", ".", "Parcel", ".", "obtain", "(", ")", ";", "try", "{", "_data", ".", "writeInterfaceToken", "(", "DESCRIPTOR", ")", ";", "_data", ".", "writeStrongBinder", "(", "(", "(", "(", "callback", "!=", "null", ")", ")", "?", "(", "callback", ".", "asBinder", "(", ")", ")", ":", "(", "null", ")", ")", ")", ";", "if", "(", "(", "parameters", "!=", "null", ")", ")", "{", "_data", ".", "writeInt", "(", "1", ")", ";", "parameters", ".", "writeToParcel", "(", "_data", ",", "0", ")", ";", "}", "else", "{", "_data", ".", "writeInt", "(", "0", ")", ";", "}", "mRemote", ".", "transact", "(", "Stub", ".", "TRANSACTION_requestLoader", ",", "_data", ",", "_reply", ",", "0", ")", ";", "_reply", ".", "readException", "(", ")", ";", "}", "finally", "{", "_reply", ".", "recycle", "(", ")", ";", "_data", ".", "recycle", "(", ")", ";", "}", "}", "}", "static", "final", "int", "TRANSACTION_requestLoader", "=", "(", "android", ".", "os", ".", "IBinder", ".", "FIRST_CALL_TRANSACTION", "+", "0", ")", ";", "}", "public", "void", "requestLoader", "(", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", "callback", ",", "android", ".", "os", ".", "Bundle", "parameters", ")", "throws", "android", ".", "os", ".", "RemoteException", ";", "}", "</s>" ]
12,922
[ "<s>", "package", "org", ".", "kde", ".", "necessitas", ".", "ministro", ";", "public", "interface", "IMinistroCallback", "extends", "android", ".", "os", ".", "IInterface", "{", "public", "static", "abstract", "class", "Stub", "extends", "android", ".", "os", ".", "Binder", "implements", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", "{", "private", "static", "final", "java", ".", "lang", ".", "String", "DESCRIPTOR", "=", "\"\"", ";", "public", "Stub", "(", ")", "{", "this", ".", "attachInterface", "(", "this", ",", "DESCRIPTOR", ")", ";", "}", "public", "static", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", "asInterface", "(", "android", ".", "os", ".", "IBinder", "obj", ")", "{", "if", "(", "(", "obj", "==", "null", ")", ")", "{", "return", "null", ";", "}", "android", ".", "os", ".", "IInterface", "iin", "=", "(", "android", ".", "os", ".", "IInterface", ")", "obj", ".", "queryLocalInterface", "(", "DESCRIPTOR", ")", ";", "if", "(", "(", "(", "iin", "!=", "null", ")", "&&", "(", "iin", "instanceof", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", ")", ")", ")", "{", "return", "(", "(", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", ")", "iin", ")", ";", "}", "return", "new", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", ".", "Stub", ".", "Proxy", "(", "obj", ")", ";", "}", "public", "android", ".", "os", ".", "IBinder", "asBinder", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "boolean", "onTransact", "(", "int", "code", ",", "android", ".", "os", ".", "Parcel", "data", ",", "android", ".", "os", ".", "Parcel", "reply", ",", "int", "flags", ")", "throws", "android", ".", "os", ".", "RemoteException", "{", "switch", "(", "code", ")", "{", "case", "INTERFACE_TRANSACTION", ":", "{", "reply", ".", "writeString", "(", "DESCRIPTOR", ")", ";", "return", "true", ";", "}", "case", "TRANSACTION_loaderReady", ":", "{", "data", ".", "enforceInterface", "(", "DESCRIPTOR", ")", ";", "android", ".", "os", ".", "Bundle", "_arg0", ";", "if", "(", "(", "0", "!=", "data", ".", "readInt", "(", ")", ")", ")", "{", "_arg0", "=", "android", ".", "os", ".", "Bundle", ".", "CREATOR", ".", "createFromParcel", "(", "data", ")", ";", "}", "else", "{", "_arg0", "=", "null", ";", "}", "this", ".", "loaderReady", "(", "_arg0", ")", ";", "return", "true", ";", "}", "}", "return", "super", ".", "onTransact", "(", "code", ",", "data", ",", "reply", ",", "flags", ")", ";", "}", "private", "static", "class", "Proxy", "implements", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", "{", "private", "android", ".", "os", ".", "IBinder", "mRemote", ";", "Proxy", "(", "android", ".", "os", ".", "IBinder", "remote", ")", "{", "mRemote", "=", "remote", ";", "}", "public", "android", ".", "os", ".", "IBinder", "asBinder", "(", ")", "{", "return", "mRemote", ";", "}", "public", "java", ".", "lang", ".", "String", "getInterfaceDescriptor", "(", ")", "{", "return", "DESCRIPTOR", ";", "}", "public", "void", "loaderReady", "(", "android", ".", "os", ".", "Bundle", "loaderParams", ")", "throws", "android", ".", "os", ".", "RemoteException", "{", "android", ".", "os", ".", "Parcel", "_data", "=", "android", ".", "os", ".", "Parcel", ".", "obtain", "(", ")", ";", "try", "{", "_data", ".", "writeInterfaceToken", "(", "DESCRIPTOR", ")", ";", "if", "(", "(", "loaderParams", "!=", "null", ")", ")", "{", "_data", ".", "writeInt", "(", "1", ")", ";", "loaderParams", ".", "writeToParcel", "(", "_data", ",", "0", ")", ";", "}", "else", "{", "_data", ".", "writeInt", "(", "0", ")", ";", "}", "mRemote", ".", "transact", "(", "Stub", ".", "TRANSACTION_loaderReady", ",", "_data", ",", "null", ",", "android", ".", "os", ".", "IBinder", ".", "FLAG_ONEWAY", ")", ";", "}", "finally", "{", "_data", ".", "recycle", "(", ")", ";", "}", "}", "}", "static", "final", "int", "TRANSACTION_loaderReady", "=", "(", "android", ".", "os", ".", "IBinder", ".", "FIRST_CALL_TRANSACTION", "+", "0", ")", ";", "}", "public", "void", "loaderReady", "(", "android", ".", "os", ".", "Bundle", "loaderParams", ")", "throws", "android", ".", "os", ".", "RemoteException", ";", "}", "</s>" ]
12,923
[ "<s>", "package", "org", ".", "kde", ".", "necessitas", ".", "origo", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Field", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "android", ".", "app", ".", "Application", ";", "public", "class", "QtApplication", "extends", "Application", "{", "public", "final", "static", "String", "QtTAG", "=", "\"Qt\"", ";", "public", "static", "Object", "m_delegateObject", "=", "null", ";", "public", "static", "HashMap", "<", "String", ",", "ArrayList", "<", "Method", ">", ">", "m_delegateMethods", "=", "new", "HashMap", "<", "String", ",", "ArrayList", "<", "Method", ">", ">", "(", ")", ";", "public", "static", "Method", "dispatchKeyEvent", "=", "null", ";", "public", "static", "Method", "dispatchPopulateAccessibilityEvent", "=", "null", ";", "public", "static", "Method", "dispatchTouchEvent", "=", "null", ";", "public", "static", "Method", "dispatchTrackballEvent", "=", "null", ";", "public", "static", "Method", "onKeyDown", "=", "null", ";", "public", "static", "Method", "onKeyMultiple", "=", "null", ";", "public", "static", "Method", "onKeyUp", "=", "null", ";", "public", "static", "Method", "onTouchEvent", "=", "null", ";", "public", "static", "Method", "onTrackballEvent", "=", "null", ";", "public", "static", "Method", "onActivityResult", "=", "null", ";", "public", "static", "Method", "onCreate", "=", "null", ";", "public", "static", "Method", "onKeyLongPress", "=", "null", ";", "public", "static", "Method", "dispatchKeyShortcutEvent", "=", "null", ";", "public", "static", "Method", "onKeyShortcut", "=", "null", ";", "public", "static", "Method", "dispatchGenericMotionEvent", "=", "null", ";", "public", "static", "Method", "onGenericMotionEvent", "=", "null", ";", "public", "static", "void", "setQtActivityDelegate", "(", "Object", "listener", ")", "{", "QtApplication", ".", "m_delegateObject", "=", "listener", ";", "ArrayList", "<", "Method", ">", "delegateMethods", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "for", "(", "Method", "m", ":", "listener", ".", "getClass", "(", ")", ".", "getMethods", "(", ")", ")", "if", "(", "m", ".", "getDeclaringClass", "(", ")", ".", "getName", "(", ")", ".", "startsWith", "(", "\"\"", ")", ")", "delegateMethods", ".", "add", "(", "m", ")", ";", "ArrayList", "<", "Field", ">", "applicationFields", "=", "new", "ArrayList", "<", "Field", ">", "(", ")", ";", "for", "(", "Field", "f", ":", "QtApplication", ".", "class", ".", "getFields", "(", ")", ")", "if", "(", "f", ".", "getDeclaringClass", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "QtApplication", ".", "class", ".", "getName", "(", ")", ")", ")", "applicationFields", ".", "add", "(", "f", ")", ";", "for", "(", "Method", "delegateMethod", ":", "delegateMethods", ")", "{", "try", "{", "QtActivity", ".", "class", ".", "getDeclaredMethod", "(", "delegateMethod", ".", "getName", "(", ")", ",", "delegateMethod", ".", "getParameterTypes", "(", ")", ")", ";", "if", "(", "QtApplication", ".", "m_delegateMethods", ".", "containsKey", "(", "delegateMethod", ".", "getName", "(", ")", ")", ")", "QtApplication", ".", "m_delegateMethods", ".", "get", "(", "delegateMethod", ".", "getName", "(", ")", ")", ".", "add", "(", "delegateMethod", ")", ";", "else", "{", "ArrayList", "<", "Method", ">", "delegateSet", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "delegateSet", ".", "add", "(", "delegateMethod", ")", ";", "QtApplication", ".", "m_delegateMethods", ".", "put", "(", "delegateMethod", ".", "getName", "(", ")", ",", "delegateSet", ")", ";", "}", "for", "(", "Field", "applicationField", ":", "applicationFields", ")", "{", "if", "(", "applicationField", ".", "getName", "(", ")", ".", "equals", "(", "delegateMethod", ".", "getName", "(", ")", ")", ")", "{", "try", "{", "applicationField", ".", "set", "(", "null", ",", "delegateMethod", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", "@", "Override", "public", "void", "onTerminate", "(", ")", "{", "if", "(", "m_delegateObject", "!=", "null", "&&", "m_delegateMethods", ".", "containsKey", "(", "\"onTerminate\"", ")", ")", "invokeDelegateMethod", "(", "m_delegateMethods", ".", "get", "(", "\"onTerminate\"", ")", ".", "get", "(", "0", ")", ")", ";", "super", ".", "onTerminate", "(", ")", ";", "}", "public", "static", "class", "InvokeResult", "{", "public", "boolean", "invoked", "=", "false", ";", "public", "Object", "methodReturns", "=", "null", ";", "}", "private", "static", "int", "stackDeep", "=", "-", "1", ";", "public", "static", "InvokeResult", "invokeDelegate", "(", "Object", "...", "args", ")", "{", "InvokeResult", "result", "=", "new", "InvokeResult", "(", ")", ";", "if", "(", "m_delegateObject", "==", "null", ")", "return", "result", ";", "StackTraceElement", "[", "]", "elements", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", ";", "if", "(", "-", "1", "==", "stackDeep", ")", "{", "String", "activityClassName", "=", "QtActivity", ".", "class", ".", "getCanonicalName", "(", ")", ";", "for", "(", "int", "it", "=", "0", ";", "it", "<", "elements", ".", "length", ";", "it", "++", ")", "if", "(", "elements", "[", "it", "]", ".", "getClassName", "(", ")", ".", "equals", "(", "activityClassName", ")", ")", "{", "stackDeep", "=", "it", ";", "break", ";", "}", "}", "final", "String", "methodName", "=", "elements", "[", "stackDeep", "]", ".", "getMethodName", "(", ")", ";", "if", "(", "-", "1", "==", "stackDeep", "||", "!", "m_delegateMethods", ".", "containsKey", "(", "methodName", ")", ")", "return", "result", ";", "for", "(", "Method", "m", ":", "m_delegateMethods", ".", "get", "(", "methodName", ")", ")", "if", "(", "m", ".", "getParameterTypes", "(", ")", ".", "length", "==", "args", ".", "length", ")", "{", "result", ".", "methodReturns", "=", "invokeDelegateMethod", "(", "m", ",", "args", ")", ";", "result", ".", "invoked", "=", "true", ";", "return", "result", ";", "}", "return", "result", ";", "}", "public", "static", "Object", "invokeDelegateMethod", "(", "Method", "m", ",", "Object", "...", "args", ")", "{", "try", "{", "return", "m", ".", "invoke", "(", "m_delegateObject", ",", "args", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
12,924
[ "<s>", "package", "org", ".", "kde", ".", "necessitas", ".", "origo", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", ";", "import", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistroCallback", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "app", ".", "AlertDialog", ";", "import", "android", ".", "app", ".", "Dialog", ";", "import", "android", ".", "content", ".", "ComponentName", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "DialogInterface", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "ServiceConnection", ";", "import", "android", ".", "content", ".", "pm", ".", "ActivityInfo", ";", "import", "android", ".", "content", ".", "pm", ".", "PackageManager", ";", "import", "android", ".", "content", ".", "pm", ".", "PackageManager", ".", "NameNotFoundException", ";", "import", "android", ".", "content", ".", "res", ".", "Configuration", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ".", "Theme", ";", "import", "android", ".", "graphics", ".", "Bitmap", ";", "import", "android", ".", "graphics", ".", "Canvas", ";", "import", "android", ".", "net", ".", "Uri", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "os", ".", "IBinder", ";", "import", "android", ".", "os", ".", "RemoteException", ";", "import", "android", ".", "util", ".", "AttributeSet", ";", "import", "android", ".", "util", ".", "Log", ";", "import", "android", ".", "view", ".", "ContextMenu", ";", "import", "android", ".", "view", ".", "ContextMenu", ".", "ContextMenuInfo", ";", "import", "android", ".", "view", ".", "KeyEvent", ";", "import", "android", ".", "view", ".", "Menu", ";", "import", "android", ".", "view", ".", "MenuItem", ";", "import", "android", ".", "view", ".", "MotionEvent", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "Window", ";", "import", "android", ".", "view", ".", "WindowManager", ".", "LayoutParams", ";", "import", "android", ".", "view", ".", "accessibility", ".", "AccessibilityEvent", ";", "import", "dalvik", ".", "system", ".", "DexClassLoader", ";", "public", "class", "QtActivity", "extends", "Activity", "{", "private", "final", "static", "int", "MINISTRO_INSTALL_REQUEST_CODE", "=", "0xf3ee", ";", "private", "static", "final", "int", "MINISTRO_API_LEVEL", "=", "1", ";", "private", "static", "final", "String", "QT_PROVIDER", "=", "\"necessitas\"", ";", "private", "static", "final", "int", "QT_VERSION", "=", "0x040800", ";", "private", "static", "final", "String", "ERROR_CODE_KEY", "=", "\"error.code\"", ";", "private", "static", "final", "String", "ERROR_MESSAGE_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "DEX_PATH_KEY", "=", "\"dex.path\"", ";", "private", "static", "final", "String", "LIB_PATH_KEY", "=", "\"lib.path\"", ";", "private", "static", "final", "String", "LOADER_CLASS_NAME_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "NATIVE_LIBRARIES_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "ENVIRONMENT_VARIABLES_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "APPLICATION_PARAMETERS_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "BUNDLED_LIBRARIES_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "REQUIRED_MODULES_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "APPLICATION_TITLE_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "QT_PROVIDER_KEY", "=", "\"qt.provider\"", ";", "private", "static", "final", "String", "MINIMUM_MINISTRO_API_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "MINIMUM_QT_VERSION_KEY", "=", "\"\"", ";", "private", "ActivityInfo", "m_activityInfo", "=", "null", ";", "private", "DexClassLoader", "m_classLoader", "=", "null", ";", "private", "String", "[", "]", "m_qtLibs", "=", "null", ";", "private", "void", "loadApplication", "(", "Bundle", "loaderParams", ")", "{", "try", "{", "if", "(", "loaderParams", ".", "getInt", "(", "ERROR_CODE_KEY", ")", "!=", "0", ")", "{", "AlertDialog", "errorDialog", "=", "new", "AlertDialog", ".", "Builder", "(", "QtActivity", ".", "this", ")", ".", "create", "(", ")", ";", "errorDialog", ".", "setMessage", "(", "loaderParams", ".", "getString", "(", "ERROR_MESSAGE_KEY", ")", ")", ";", "errorDialog", ".", "setButton", "(", "getResources", "(", ")", ".", "getString", "(", "android", ".", "R", ".", "string", ".", "ok", ")", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "finish", "(", ")", ";", "}", "}", ")", ";", "errorDialog", ".", "show", "(", ")", ";", "return", ";", "}", "ArrayList", "<", "String", ">", "libs", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "m_activityInfo", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "libs", ".", "addAll", "(", "Arrays", ".", "asList", "(", "getResources", "(", ")", ".", "getStringArray", "(", "m_activityInfo", ".", "metaData", ".", "getInt", "(", "\"\"", ")", ")", ")", ")", ";", "if", "(", "m_activityInfo", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "libs", ".", "add", "(", "m_activityInfo", ".", "metaData", ".", "getString", "(", "\"\"", ")", ")", ";", "loaderParams", ".", "putStringArrayList", "(", "BUNDLED_LIBRARIES_KEY", ",", "libs", ")", ";", "m_classLoader", "=", "new", "DexClassLoader", "(", "loaderParams", ".", "getString", "(", "DEX_PATH_KEY", ")", ",", "getDir", "(", "\"outdex\"", ",", "Context", ".", "MODE_PRIVATE", ")", ".", "getAbsolutePath", "(", ")", ",", "loaderParams", ".", "containsKey", "(", "LIB_PATH_KEY", ")", "?", "loaderParams", ".", "getString", "(", "LIB_PATH_KEY", ")", ":", "null", ",", "getClassLoader", "(", ")", ")", ";", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Class", "loaderClass", "=", "m_classLoader", ".", "loadClass", "(", "loaderParams", ".", "getString", "(", "LOADER_CLASS_NAME_KEY", ")", ")", ";", "Object", "qtLoader", "=", "loaderClass", ".", "newInstance", "(", ")", ";", "Method", "perpareAppMethod", "=", "qtLoader", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"\"", ",", "Activity", ".", "class", ",", "ClassLoader", ".", "class", ",", "Bundle", ".", "class", ")", ";", "if", "(", "!", "(", "Boolean", ")", "perpareAppMethod", ".", "invoke", "(", "qtLoader", ",", "this", ",", "m_classLoader", ",", "loaderParams", ")", ")", "throw", "new", "Exception", "(", "\"\"", ")", ";", "QtApplication", ".", "setQtActivityDelegate", "(", "qtLoader", ")", ";", "Method", "startAppMethod", "=", "qtLoader", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"\"", ")", ";", "if", "(", "!", "(", "Boolean", ")", "startAppMethod", ".", "invoke", "(", "qtLoader", ")", ")", "throw", "new", "Exception", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "AlertDialog", "errorDialog", "=", "new", "AlertDialog", ".", "Builder", "(", "QtActivity", ".", "this", ")", ".", "create", "(", ")", ";", "if", "(", "m_activityInfo", "!=", "null", "&&", "m_activityInfo", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "errorDialog", ".", "setMessage", "(", "m_activityInfo", ".", "metaData", ".", "getString", "(", "\"\"", ")", ")", ";", "else", "errorDialog", ".", "setMessage", "(", "\"\"", ")", ";", "errorDialog", ".", "setButton", "(", "getResources", "(", ")", ".", "getString", "(", "android", ".", "R", ".", "string", ".", "ok", ")", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "finish", "(", ")", ";", "}", "}", ")", ";", "errorDialog", ".", "show", "(", ")", ";", "}", "}", "private", "ServiceConnection", "m_ministroConnection", "=", "new", "ServiceConnection", "(", ")", "{", "private", "IMinistro", "m_service", "=", "null", ";", "@", "Override", "public", "void", "onServiceConnected", "(", "ComponentName", "name", ",", "IBinder", "service", ")", "{", "m_service", "=", "IMinistro", ".", "Stub", ".", "asInterface", "(", "service", ")", ";", "try", "{", "if", "(", "m_service", "!=", "null", ")", "{", "Bundle", "parameters", "=", "new", "Bundle", "(", ")", ";", "parameters", ".", "putStringArray", "(", "REQUIRED_MODULES_KEY", ",", "m_qtLibs", ")", ";", "parameters", ".", "putString", "(", "APPLICATION_TITLE_KEY", ",", "(", "String", ")", "QtActivity", ".", "this", ".", "getTitle", "(", ")", ")", ";", "parameters", ".", "putInt", "(", "MINIMUM_MINISTRO_API_KEY", ",", "MINISTRO_API_LEVEL", ")", ";", "parameters", ".", "putString", "(", "QT_PROVIDER_KEY", ",", "QT_PROVIDER", ")", ";", "parameters", ".", "putInt", "(", "MINIMUM_QT_VERSION_KEY", ",", "QT_VERSION", ")", ";", "m_service", ".", "requestLoader", "(", "m_ministroCallback", ",", "parameters", ")", ";", "}", "}", "catch", "(", "RemoteException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "private", "IMinistroCallback", "m_ministroCallback", "=", "new", "IMinistroCallback", ".", "Stub", "(", ")", "{", "@", "Override", "public", "void", "loaderReady", "(", "final", "Bundle", "loaderParams", ")", "throws", "RemoteException", "{", "runOnUiThread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "unbindService", "(", "m_ministroConnection", ")", ";", "loadApplication", "(", "loaderParams", ")", ";", "}", "}", ")", ";", "}", "}", ";", "@", "Override", "public", "void", "onServiceDisconnected", "(", "ComponentName", "name", ")", "{", "m_service", "=", "null", ";", "}", "}", ";", "private", "void", "ministroNotFound", "(", ")", "{", "AlertDialog", "errorDialog", "=", "new", "AlertDialog", ".", "Builder", "(", "QtActivity", ".", "this", ")", ".", "create", "(", ")", ";", "if", "(", "m_activityInfo", "!=", "null", "&&", "m_activityInfo", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "errorDialog", ".", "setMessage", "(", "m_activityInfo", ".", "metaData", ".", "getString", "(", "\"\"", ")", ")", ";", "else", "errorDialog", ".", "setMessage", "(", "\"\"", ")", ";", "errorDialog", ".", "setButton", "(", "getResources", "(", ")", ".", "getString", "(", "android", ".", "R", ".", "string", ".", "ok", ")", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "finish", "(", ")", ";", "}", "}", ")", ";", "errorDialog", ".", "show", "(", ")", ";", "}", "private", "void", "startApp", "(", "final", "boolean", "firstStart", ")", "{", "try", "{", "ActivityInfo", "ai", "=", "getPackageManager", "(", ")", ".", "getActivityInfo", "(", "getComponentName", "(", ")", ",", "PackageManager", ".", "GET_META_DATA", ")", ";", "if", "(", "ai", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "{", "int", "resourceId", "=", "ai", ".", "metaData", ".", "getInt", "(", "\"\"", ")", ";", "m_qtLibs", "=", "getResources", "(", ")", ".", "getStringArray", "(", "resourceId", ")", ";", "}", "if", "(", "getIntent", "(", ")", ".", "getExtras", "(", ")", "!=", "null", "&&", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "containsKey", "(", "\"\"", ")", "&&", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "getString", "(", "\"\"", ")", ".", "equals", "(", "\"true\"", ")", ")", "{", "ArrayList", "<", "String", ">", "libraryList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "localPrefix", "=", "\"\"", ";", "if", "(", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "containsKey", "(", "\"libs_prefix\"", ")", ")", "localPrefix", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "getString", "(", "\"libs_prefix\"", ")", ";", "if", "(", "m_qtLibs", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_qtLibs", ".", "length", ";", "i", "++", ")", "{", "libraryList", ".", "add", "(", "localPrefix", "+", "\"lib/lib\"", "+", "m_qtLibs", "[", "i", "]", "+", "\".so\"", ")", ";", "}", "if", "(", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "containsKey", "(", "\"\"", ")", ")", "{", "String", "[", "]", "extraLibs", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "getString", "(", "\"\"", ")", ".", "split", "(", "\":\"", ")", ";", "for", "(", "String", "lib", ":", "extraLibs", ")", "if", "(", "lib", ".", "length", "(", ")", ">", "0", ")", "libraryList", ".", "add", "(", "localPrefix", "+", "lib", ")", ";", "}", "String", "dexPaths", "=", "new", "String", "(", ")", ";", "String", "pathSeparator", "=", "System", ".", "getProperty", "(", "\"\"", ",", "\":\"", ")", ";", "if", "(", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "containsKey", "(", "\"\"", ")", ")", "{", "String", "[", "]", "jarFiles", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "getString", "(", "\"\"", ")", ".", "split", "(", "\":\"", ")", ";", "for", "(", "String", "jar", ":", "jarFiles", ")", "if", "(", "jar", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "dexPaths", ".", "length", "(", ")", ">", "0", ")", "dexPaths", "+=", "pathSeparator", ";", "dexPaths", "+=", "localPrefix", "+", "jar", ";", "}", "}", "Bundle", "loaderParams", "=", "new", "Bundle", "(", ")", ";", "loaderParams", ".", "putInt", "(", "ERROR_CODE_KEY", ",", "0", ")", ";", "loaderParams", ".", "putString", "(", "DEX_PATH_KEY", ",", "dexPaths", ")", ";", "loaderParams", ".", "putString", "(", "LOADER_CLASS_NAME_KEY", ",", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "containsKey", "(", "\"\"", ")", "?", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "getString", "(", "\"\"", ")", ":", "\"\"", ")", ";", "loaderParams", ".", "putStringArrayList", "(", "NATIVE_LIBRARIES_KEY", ",", "libraryList", ")", ";", "loaderParams", ".", "putString", "(", "ENVIRONMENT_VARIABLES_KEY", ",", "\"\"", ")", ";", "loaderParams", ".", "putString", "(", "APPLICATION_PARAMETERS_KEY", ",", "\"\"", ")", ";", "loadApplication", "(", "loaderParams", ")", ";", "return", ";", "}", "try", "{", "if", "(", "!", "bindService", "(", "new", "Intent", "(", "org", ".", "kde", ".", "necessitas", ".", "ministro", ".", "IMinistro", ".", "class", ".", "getCanonicalName", "(", ")", ")", ",", "m_ministroConnection", ",", "Context", ".", "BIND_AUTO_CREATE", ")", ")", "throw", "new", "SecurityException", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "firstStart", ")", "{", "AlertDialog", ".", "Builder", "downloadDialog", "=", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ";", "if", "(", "m_activityInfo", "!=", "null", "&&", "m_activityInfo", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "downloadDialog", ".", "setMessage", "(", "m_activityInfo", ".", "metaData", ".", "getString", "(", "\"\"", ")", ")", ";", "downloadDialog", ".", "setPositiveButton", "(", "android", ".", "R", ".", "string", ".", "yes", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialogInterface", ",", "int", "i", ")", "{", "try", "{", "Uri", "uri", "=", "Uri", ".", "parse", "(", "\"\"", ")", ";", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_VIEW", ",", "uri", ")", ";", "startActivityForResult", "(", "intent", ",", "MINISTRO_INSTALL_REQUEST_CODE", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "ministroNotFound", "(", ")", ";", "}", "}", "}", ")", ";", "downloadDialog", ".", "setNegativeButton", "(", "android", ".", "R", ".", "string", ".", "no", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialogInterface", ",", "int", "i", ")", "{", "QtActivity", ".", "this", ".", "finish", "(", ")", ";", "}", "}", ")", ";", "downloadDialog", ".", "show", "(", ")", ";", "}", "else", "{", "ministroNotFound", "(", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "e", "(", "QtApplication", ".", "QtTAG", ",", "\"\"", ",", "e", ")", ";", "}", "}", "@", "Override", "public", "boolean", "dispatchKeyEvent", "(", "KeyEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "dispatchKeyEvent", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "dispatchKeyEvent", ",", "event", ")", ";", "else", "return", "super", ".", "dispatchKeyEvent", "(", "event", ")", ";", "}", "public", "boolean", "super_dispatchKeyEvent", "(", "KeyEvent", "event", ")", "{", "return", "super", ".", "dispatchKeyEvent", "(", "event", ")", ";", "}", "@", "Override", "public", "boolean", "dispatchPopulateAccessibilityEvent", "(", "AccessibilityEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "dispatchPopulateAccessibilityEvent", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "dispatchPopulateAccessibilityEvent", ",", "event", ")", ";", "else", "return", "super", ".", "dispatchPopulateAccessibilityEvent", "(", "event", ")", ";", "}", "public", "boolean", "super_dispatchPopulateAccessibilityEvent", "(", "AccessibilityEvent", "event", ")", "{", "return", "super_dispatchPopulateAccessibilityEvent", "(", "event", ")", ";", "}", "@", "Override", "public", "boolean", "dispatchTouchEvent", "(", "MotionEvent", "ev", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "dispatchTouchEvent", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "dispatchTouchEvent", ",", "ev", ")", ";", "else", "return", "super", ".", "dispatchTouchEvent", "(", "ev", ")", ";", "}", "public", "boolean", "super_dispatchTouchEvent", "(", "MotionEvent", "event", ")", "{", "return", "super", ".", "dispatchTouchEvent", "(", "event", ")", ";", "}", "@", "Override", "public", "boolean", "dispatchTrackballEvent", "(", "MotionEvent", "ev", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "dispatchTrackballEvent", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "dispatchTrackballEvent", ",", "ev", ")", ";", "else", "return", "super", ".", "dispatchTrackballEvent", "(", "ev", ")", ";", "}", "public", "boolean", "super_dispatchTrackballEvent", "(", "MotionEvent", "event", ")", "{", "return", "super", ".", "dispatchTrackballEvent", "(", "event", ")", ";", "}", "@", "Override", "protected", "void", "onActivityResult", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "data", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onActivityResult", "!=", "null", ")", "{", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onActivityResult", ",", "requestCode", ",", "resultCode", ",", "data", ")", ";", "return", ";", "}", "if", "(", "requestCode", "==", "MINISTRO_INSTALL_REQUEST_CODE", ")", "startApp", "(", "false", ")", ";", "super", ".", "onActivityResult", "(", "requestCode", ",", "resultCode", ",", "data", ")", ";", "}", "public", "void", "super_onActivityResult", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "data", ")", "{", "super", ".", "onActivityResult", "(", "requestCode", ",", "resultCode", ",", "data", ")", ";", "}", "@", "Override", "protected", "void", "onApplyThemeResource", "(", "Theme", "theme", ",", "int", "resid", ",", "boolean", "first", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "theme", ",", "resid", ",", "first", ")", ".", "invoked", ")", "super", ".", "onApplyThemeResource", "(", "theme", ",", "resid", ",", "first", ")", ";", "}", "public", "void", "super_onApplyThemeResource", "(", "Theme", "theme", ",", "int", "resid", ",", "boolean", "first", ")", "{", "super", ".", "onApplyThemeResource", "(", "theme", ",", "resid", ",", "first", ")", ";", "}", "@", "Override", "protected", "void", "onChildTitleChanged", "(", "Activity", "childActivity", ",", "CharSequence", "title", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "childActivity", ",", "title", ")", ".", "invoked", ")", "super", ".", "onChildTitleChanged", "(", "childActivity", ",", "title", ")", ";", "}", "public", "void", "super_onChildTitleChanged", "(", "Activity", "childActivity", ",", "CharSequence", "title", ")", "{", "super", ".", "onChildTitleChanged", "(", "childActivity", ",", "title", ")", ";", "}", "@", "Override", "public", "void", "onConfigurationChanged", "(", "Configuration", "newConfig", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "newConfig", ")", ".", "invoked", ")", "super", ".", "onConfigurationChanged", "(", "newConfig", ")", ";", "}", "public", "void", "super_onConfigurationChanged", "(", "Configuration", "newConfig", ")", "{", "super", ".", "onConfigurationChanged", "(", "newConfig", ")", ";", "}", "@", "Override", "public", "void", "onContentChanged", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onContentChanged", "(", ")", ";", "}", "public", "void", "super_onContentChanged", "(", ")", "{", "super", ".", "onContentChanged", "(", ")", ";", "}", "@", "Override", "public", "boolean", "onContextItemSelected", "(", "MenuItem", "item", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "item", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onContextItemSelected", "(", "item", ")", ";", "}", "public", "boolean", "super_onContextItemSelected", "(", "MenuItem", "item", ")", "{", "return", "super", ".", "onContextItemSelected", "(", "item", ")", ";", "}", "@", "Override", "public", "void", "onContextMenuClosed", "(", "Menu", "menu", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "menu", ")", ".", "invoked", ")", "super", ".", "onContextMenuClosed", "(", "menu", ")", ";", "}", "public", "void", "super_onContextMenuClosed", "(", "Menu", "menu", ")", "{", "super", ".", "onContextMenuClosed", "(", "menu", ")", ";", "}", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onCreate", "!=", "null", ")", "{", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onCreate", ",", "savedInstanceState", ")", ";", "return", ";", "}", "requestWindowFeature", "(", "Window", ".", "FEATURE_NO_TITLE", ")", ";", "try", "{", "m_activityInfo", "=", "getPackageManager", "(", ")", ".", "getActivityInfo", "(", "getComponentName", "(", ")", ",", "PackageManager", ".", "GET_META_DATA", ")", ";", "}", "catch", "(", "NameNotFoundException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "finish", "(", ")", ";", "return", ";", "}", "if", "(", "null", "==", "getLastNonConfigurationInstance", "(", ")", ")", "{", "if", "(", "m_activityInfo", ".", "metaData", ".", "containsKey", "(", "\"\"", ")", ")", "setContentView", "(", "m_activityInfo", ".", "metaData", ".", "getInt", "(", "\"\"", ")", ")", ";", "startApp", "(", "true", ")", ";", "}", "}", "@", "Override", "public", "void", "onCreateContextMenu", "(", "ContextMenu", "menu", ",", "View", "v", ",", "ContextMenuInfo", "menuInfo", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "menu", ",", "v", ",", "menuInfo", ")", ".", "invoked", ")", "super", ".", "onCreateContextMenu", "(", "menu", ",", "v", ",", "menuInfo", ")", ";", "}", "public", "void", "super_onCreateContextMenu", "(", "ContextMenu", "menu", ",", "View", "v", ",", "ContextMenuInfo", "menuInfo", ")", "{", "super", ".", "onCreateContextMenu", "(", "menu", ",", "v", ",", "menuInfo", ")", ";", "}", "@", "Override", "public", "CharSequence", "onCreateDescription", "(", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "CharSequence", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreateDescription", "(", ")", ";", "}", "public", "CharSequence", "super_onCreateDescription", "(", ")", "{", "return", "super", ".", "onCreateDescription", "(", ")", ";", "}", "@", "Override", "protected", "Dialog", "onCreateDialog", "(", "int", "id", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "id", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Dialog", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreateDialog", "(", "id", ")", ";", "}", "public", "Dialog", "super_onCreateDialog", "(", "int", "id", ")", "{", "return", "super", ".", "onCreateDialog", "(", "id", ")", ";", "}", "@", "Override", "public", "boolean", "onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "menu", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreateOptionsMenu", "(", "menu", ")", ";", "}", "public", "boolean", "super_onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "return", "super", ".", "onCreateOptionsMenu", "(", "menu", ")", ";", "}", "@", "Override", "public", "boolean", "onCreatePanelMenu", "(", "int", "featureId", ",", "Menu", "menu", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "featureId", ",", "menu", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreatePanelMenu", "(", "featureId", ",", "menu", ")", ";", "}", "public", "boolean", "super_onCreatePanelMenu", "(", "int", "featureId", ",", "Menu", "menu", ")", "{", "return", "super", ".", "onCreatePanelMenu", "(", "featureId", ",", "menu", ")", ";", "}", "@", "Override", "public", "View", "onCreatePanelView", "(", "int", "featureId", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "featureId", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "View", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreatePanelView", "(", "featureId", ")", ";", "}", "public", "View", "super_onCreatePanelView", "(", "int", "featureId", ")", "{", "return", "super", ".", "onCreatePanelView", "(", "featureId", ")", ";", "}", "@", "Override", "public", "boolean", "onCreateThumbnail", "(", "Bitmap", "outBitmap", ",", "Canvas", "canvas", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "outBitmap", ",", "canvas", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreateThumbnail", "(", "outBitmap", ",", "canvas", ")", ";", "}", "public", "boolean", "super_onCreateThumbnail", "(", "Bitmap", "outBitmap", ",", "Canvas", "canvas", ")", "{", "return", "super", ".", "onCreateThumbnail", "(", "outBitmap", ",", "canvas", ")", ";", "}", "@", "Override", "public", "View", "onCreateView", "(", "String", "name", ",", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "name", ",", "context", ",", "attrs", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "View", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onCreateView", "(", "name", ",", "context", ",", "attrs", ")", ";", "}", "public", "View", "super_onCreateView", "(", "String", "name", ",", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "return", "super", ".", "onCreateView", "(", "name", ",", "context", ",", "attrs", ")", ";", "}", "@", "Override", "protected", "void", "onDestroy", "(", ")", "{", "super", ".", "onDestroy", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "public", "boolean", "onKeyDown", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onKeyDown", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onKeyDown", ",", "keyCode", ",", "event", ")", ";", "else", "return", "super", ".", "onKeyDown", "(", "keyCode", ",", "event", ")", ";", "}", "public", "boolean", "super_onKeyDown", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "return", "super", ".", "onKeyDown", "(", "keyCode", ",", "event", ")", ";", "}", "@", "Override", "public", "boolean", "onKeyMultiple", "(", "int", "keyCode", ",", "int", "repeatCount", ",", "KeyEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onKeyMultiple", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onKeyMultiple", ",", "keyCode", ",", "repeatCount", ",", "event", ")", ";", "else", "return", "super", ".", "onKeyMultiple", "(", "keyCode", ",", "repeatCount", ",", "event", ")", ";", "}", "public", "boolean", "super_onKeyMultiple", "(", "int", "keyCode", ",", "int", "repeatCount", ",", "KeyEvent", "event", ")", "{", "return", "super", ".", "onKeyMultiple", "(", "keyCode", ",", "repeatCount", ",", "event", ")", ";", "}", "@", "Override", "public", "boolean", "onKeyUp", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onKeyDown", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onKeyUp", ",", "keyCode", ",", "event", ")", ";", "else", "return", "super", ".", "onKeyUp", "(", "keyCode", ",", "event", ")", ";", "}", "public", "boolean", "super_onKeyUp", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "return", "super", ".", "onKeyUp", "(", "keyCode", ",", "event", ")", ";", "}", "@", "Override", "public", "void", "onLowMemory", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onLowMemory", "(", ")", ";", "}", "@", "Override", "public", "boolean", "onMenuItemSelected", "(", "int", "featureId", ",", "MenuItem", "item", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "featureId", ",", "item", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onMenuItemSelected", "(", "featureId", ",", "item", ")", ";", "}", "public", "boolean", "super_onMenuItemSelected", "(", "int", "featureId", ",", "MenuItem", "item", ")", "{", "return", "super", ".", "onMenuItemSelected", "(", "featureId", ",", "item", ")", ";", "}", "@", "Override", "public", "boolean", "onMenuOpened", "(", "int", "featureId", ",", "Menu", "menu", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "featureId", ",", "menu", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onMenuOpened", "(", "featureId", ",", "menu", ")", ";", "}", "public", "boolean", "super_onMenuOpened", "(", "int", "featureId", ",", "Menu", "menu", ")", "{", "return", "super", ".", "onMenuOpened", "(", "featureId", ",", "menu", ")", ";", "}", "@", "Override", "protected", "void", "onNewIntent", "(", "Intent", "intent", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "intent", ")", ".", "invoked", ")", "super", ".", "onNewIntent", "(", "intent", ")", ";", "}", "public", "void", "super_onNewIntent", "(", "Intent", "intent", ")", "{", "super", ".", "onNewIntent", "(", "intent", ")", ";", "}", "@", "Override", "public", "boolean", "onOptionsItemSelected", "(", "MenuItem", "item", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "item", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onOptionsItemSelected", "(", "item", ")", ";", "}", "public", "boolean", "super_onOptionsItemSelected", "(", "MenuItem", "item", ")", "{", "return", "super", ".", "onOptionsItemSelected", "(", "item", ")", ";", "}", "@", "Override", "public", "void", "onOptionsMenuClosed", "(", "Menu", "menu", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "menu", ")", ".", "invoked", ")", "super", ".", "onOptionsMenuClosed", "(", "menu", ")", ";", "}", "public", "void", "super_onOptionsMenuClosed", "(", "Menu", "menu", ")", "{", "super", ".", "onOptionsMenuClosed", "(", "menu", ")", ";", "}", "@", "Override", "public", "void", "onPanelClosed", "(", "int", "featureId", ",", "Menu", "menu", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "featureId", ",", "menu", ")", ".", "invoked", ")", "super", ".", "onPanelClosed", "(", "featureId", ",", "menu", ")", ";", "}", "public", "void", "super_onPanelClosed", "(", "int", "featureId", ",", "Menu", "menu", ")", "{", "super", ".", "onPanelClosed", "(", "featureId", ",", "menu", ")", ";", "}", "@", "Override", "protected", "void", "onPause", "(", ")", "{", "super", ".", "onPause", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "protected", "void", "onPostCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onPostCreate", "(", "savedInstanceState", ")", ";", "QtApplication", ".", "invokeDelegate", "(", "savedInstanceState", ")", ";", "}", "@", "Override", "protected", "void", "onPostResume", "(", ")", "{", "super", ".", "onPostResume", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "protected", "void", "onPrepareDialog", "(", "int", "id", ",", "Dialog", "dialog", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "id", ",", "dialog", ")", ".", "invoked", ")", "super", ".", "onPrepareDialog", "(", "id", ",", "dialog", ")", ";", "}", "public", "void", "super_onPrepareDialog", "(", "int", "id", ",", "Dialog", "dialog", ")", "{", "super", ".", "onPrepareDialog", "(", "id", ",", "dialog", ")", ";", "}", "@", "Override", "public", "boolean", "onPrepareOptionsMenu", "(", "Menu", "menu", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "menu", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onPrepareOptionsMenu", "(", "menu", ")", ";", "}", "public", "boolean", "super_onPrepareOptionsMenu", "(", "Menu", "menu", ")", "{", "return", "super", ".", "onPrepareOptionsMenu", "(", "menu", ")", ";", "}", "@", "Override", "public", "boolean", "onPreparePanel", "(", "int", "featureId", ",", "View", "view", ",", "Menu", "menu", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", "featureId", ",", "view", ",", "menu", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onPreparePanel", "(", "featureId", ",", "view", ",", "menu", ")", ";", "}", "public", "boolean", "super_onPreparePanel", "(", "int", "featureId", ",", "View", "view", ",", "Menu", "menu", ")", "{", "return", "super", ".", "onPreparePanel", "(", "featureId", ",", "view", ",", "menu", ")", ";", "}", "@", "Override", "protected", "void", "onRestart", "(", ")", "{", "super", ".", "onRestart", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "protected", "void", "onRestoreInstanceState", "(", "Bundle", "savedInstanceState", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "savedInstanceState", ")", ".", "invoked", ")", "super", ".", "onRestoreInstanceState", "(", "savedInstanceState", ")", ";", "}", "public", "void", "super_onRestoreInstanceState", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onRestoreInstanceState", "(", "savedInstanceState", ")", ";", "}", "@", "Override", "protected", "void", "onResume", "(", ")", "{", "super", ".", "onResume", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "public", "Object", "onRetainNonConfigurationInstance", "(", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onRetainNonConfigurationInstance", "(", ")", ";", "}", "public", "Object", "super_onRetainNonConfigurationInstance", "(", ")", "{", "return", "super", ".", "onRetainNonConfigurationInstance", "(", ")", ";", "}", "@", "Override", "protected", "void", "onSaveInstanceState", "(", "Bundle", "outState", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "outState", ")", ".", "invoked", ")", "super", ".", "onSaveInstanceState", "(", "outState", ")", ";", "}", "public", "void", "super_onSaveInstanceState", "(", "Bundle", "outState", ")", "{", "super", ".", "onSaveInstanceState", "(", "outState", ")", ";", "}", "@", "Override", "public", "boolean", "onSearchRequested", "(", ")", "{", "QtApplication", ".", "InvokeResult", "res", "=", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "if", "(", "res", ".", "invoked", ")", "return", "(", "Boolean", ")", "res", ".", "methodReturns", ";", "else", "return", "super", ".", "onSearchRequested", "(", ")", ";", "}", "public", "boolean", "super_onSearchRequested", "(", ")", "{", "return", "super", ".", "onSearchRequested", "(", ")", ";", "}", "@", "Override", "protected", "void", "onStart", "(", ")", "{", "super", ".", "onStart", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "protected", "void", "onStop", "(", ")", "{", "super", ".", "onStop", "(", ")", ";", "QtApplication", ".", "invokeDelegate", "(", ")", ";", "}", "@", "Override", "protected", "void", "onTitleChanged", "(", "CharSequence", "title", ",", "int", "color", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "title", ",", "color", ")", ".", "invoked", ")", "super", ".", "onTitleChanged", "(", "title", ",", "color", ")", ";", "}", "public", "void", "super_onTitleChanged", "(", "CharSequence", "title", ",", "int", "color", ")", "{", "super", ".", "onTitleChanged", "(", "title", ",", "color", ")", ";", "}", "@", "Override", "public", "boolean", "onTouchEvent", "(", "MotionEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onTouchEvent", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onTouchEvent", ",", "event", ")", ";", "else", "return", "super", ".", "onTouchEvent", "(", "event", ")", ";", "}", "public", "boolean", "super_onTouchEvent", "(", "MotionEvent", "event", ")", "{", "return", "super", ".", "onTouchEvent", "(", "event", ")", ";", "}", "@", "Override", "public", "boolean", "onTrackballEvent", "(", "MotionEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onTrackballEvent", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onTrackballEvent", ",", "event", ")", ";", "else", "return", "super", ".", "onTrackballEvent", "(", "event", ")", ";", "}", "public", "boolean", "super_onTrackballEvent", "(", "MotionEvent", "event", ")", "{", "return", "super", ".", "onTrackballEvent", "(", "event", ")", ";", "}", "@", "Override", "public", "void", "onUserInteraction", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onUserInteraction", "(", ")", ";", "}", "public", "void", "super_onUserInteraction", "(", ")", "{", "super", ".", "onUserInteraction", "(", ")", ";", "}", "@", "Override", "protected", "void", "onUserLeaveHint", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onUserLeaveHint", "(", ")", ";", "}", "public", "void", "super_onUserLeaveHint", "(", ")", "{", "super", ".", "onUserLeaveHint", "(", ")", ";", "}", "@", "Override", "public", "void", "onWindowAttributesChanged", "(", "LayoutParams", "params", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "params", ")", ".", "invoked", ")", "super", ".", "onWindowAttributesChanged", "(", "params", ")", ";", "}", "public", "void", "super_onWindowAttributesChanged", "(", "LayoutParams", "params", ")", "{", "super", ".", "onWindowAttributesChanged", "(", "params", ")", ";", "}", "@", "Override", "public", "void", "onWindowFocusChanged", "(", "boolean", "hasFocus", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", "hasFocus", ")", ".", "invoked", ")", "super", ".", "onWindowFocusChanged", "(", "hasFocus", ")", ";", "}", "public", "void", "super_onWindowFocusChanged", "(", "boolean", "hasFocus", ")", "{", "super", ".", "onWindowFocusChanged", "(", "hasFocus", ")", ";", "}", "@", "Override", "public", "void", "onAttachedToWindow", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onAttachedToWindow", "(", ")", ";", "}", "public", "void", "super_onAttachedToWindow", "(", ")", "{", "super", ".", "onAttachedToWindow", "(", ")", ";", "}", "@", "Override", "public", "void", "onBackPressed", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onBackPressed", "(", ")", ";", "}", "public", "void", "super_onBackPressed", "(", ")", "{", "super", ".", "onBackPressed", "(", ")", ";", "}", "@", "Override", "public", "void", "onDetachedFromWindow", "(", ")", "{", "if", "(", "!", "QtApplication", ".", "invokeDelegate", "(", ")", ".", "invoked", ")", "super", ".", "onDetachedFromWindow", "(", ")", ";", "}", "public", "void", "super_onDetachedFromWindow", "(", ")", "{", "super", ".", "onDetachedFromWindow", "(", ")", ";", "}", "@", "Override", "public", "boolean", "onKeyLongPress", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "if", "(", "QtApplication", ".", "m_delegateObject", "!=", "null", "&&", "QtApplication", ".", "onKeyLongPress", "!=", "null", ")", "return", "(", "Boolean", ")", "QtApplication", ".", "invokeDelegateMethod", "(", "QtApplication", ".", "onKeyLongPress", ",", "keyCode", ",", "event", ")", ";", "else", "return", "super", ".", "onKeyLongPress", "(", "keyCode", ",", "event", ")", ";", "}", "public", "boolean", "super_onKeyLongPress", "(", "int", "keyCode", ",", "KeyEvent", "event", ")", "{", "return", "super", ".", "onKeyLongPress", "(", "keyCode", ",", "event", ")", ";", "}", "}", "</s>" ]
12,925
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ".", "git", ";", "import", "org", ".", "eclipse", ".", "jgit", ".", "lib", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jgit", ".", "util", ".", "FS", ";", "import", "org", ".", "eclipse", ".", "jgit", ".", "util", ".", "SystemReader", ";", "import", "org", ".", "junit", ".", "*", ";", "import", "org", ".", "junit", ".", "rules", ".", "TemporaryFolder", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "UnknownHostException", ";", "import", "java", ".", "util", ".", "Random", ";", "import", "java", ".", "util", ".", "TimeZone", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "public", "class", "TestGit", "{", "static", "int", "counter", "=", "0", ";", "public", "static", "class", "MockSystemReader", "extends", "SystemReader", "{", "private", "volatile", "String", "hostname", ";", "public", "String", "getenv", "(", "String", "variable", ")", "{", "return", "System", ".", "getenv", "(", "variable", ")", ";", "}", "public", "String", "getProperty", "(", "String", "key", ")", "{", "return", "System", ".", "getProperty", "(", "key", ")", ";", "}", "public", "FileBasedConfig", "openUserConfig", "(", ")", "{", "final", "File", "home", "=", "FS", ".", "userHome", "(", ")", ";", "return", "new", "FileBasedConfig", "(", "new", "File", "(", "home", ",", "\".gitconfig\"", ")", ")", ";", "}", "public", "String", "getHostname", "(", ")", "{", "if", "(", "hostname", "==", "null", ")", "{", "try", "{", "InetAddress", "localMachine", "=", "InetAddress", ".", "getLocalHost", "(", ")", ";", "hostname", "=", "localMachine", ".", "getCanonicalHostName", "(", ")", ";", "}", "catch", "(", "UnknownHostException", "e", ")", "{", "hostname", "=", "\"localhost\"", ";", "}", "assert", "hostname", "!=", "null", ";", "}", "return", "hostname", ";", "}", "@", "Override", "public", "long", "getCurrentTime", "(", ")", "{", "counter", "+=", "1000", ";", "return", "System", ".", "currentTimeMillis", "(", ")", "+", "counter", ";", "}", "@", "Override", "public", "int", "getTimezone", "(", "long", "when", ")", "{", "return", "TimeZone", ".", "getDefault", "(", ")", ".", "getOffset", "(", "when", ")", "/", "(", "60", "*", "1000", ")", ";", "}", "}", "public", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "TestGit", ".", "class", ".", "getName", "(", ")", ")", ";", "@", "Rule", "public", "static", "TemporaryFolder", "gitRepoFolder", "=", "new", "TemporaryFolder", "(", ")", ";", "Commit", "c1", ";", "File", "work_folder", ";", "File", "git_repo", ";", "Repository", "repo", ";", "GitTools", "git", ";", "Random", "r", "=", "new", "Random", "(", ")", ";", "@", "BeforeClass", "public", "static", "void", "initMock", "(", ")", "{", "SystemReader", "mock", "=", "new", "MockSystemReader", "(", ")", ";", "SystemReader", ".", "setInstance", "(", "mock", ")", ";", "}", "@", "Before", "public", "void", "initGit", "(", ")", "throws", "IOException", "{", "work_folder", "=", "gitRepoFolder", ".", "newFolder", "(", "\"repository\"", ")", ";", "git_repo", "=", "new", "File", "(", "work_folder", ",", "\".git/\"", ")", ";", "repo", "=", "new", "Repository", "(", "git_repo", ")", ";", "repo", ".", "create", "(", ")", ";", "File", "file1", "=", "new", "File", "(", "work_folder", ",", "\"file1\"", ")", ";", "FileWriter", "writer", "=", "new", "FileWriter", "(", "file1", ")", ";", "writer", ".", "write", "(", "\"test_text\"", ")", ";", "ObjectId", "id", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "2", ";", "i", "++", ")", "{", "id", "=", "makeCommit", "(", "repo", ",", "\"commit1\"", ",", "id", ")", ".", "getCommitId", "(", ")", ";", "updateRef", "(", "repo", ",", "\"commit\"", "+", "i", ",", "id", ",", "\"HEAD\"", ")", ";", "}", "c1", "=", "addCommitToBranch", "(", "\"HEAD\"", ",", "id", ")", ";", "git", "=", "new", "GitTools", "(", ")", ";", "}", "@", "After", "public", "void", "destroy", "(", ")", "{", "c1", "=", "null", ";", "work_folder", "=", "null", ";", "git_repo", "=", "null", ";", "repo", "=", "null", ";", "}", "private", "Commit", "makeCommit", "(", "Repository", "repo", ",", "String", "msg", ",", "ObjectId", "parent", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "40", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "Integer", ".", "toHexString", "(", "r", ".", "nextInt", "(", "16", ")", ")", ")", ";", "}", "ObjectId", "t1Id", "=", "ObjectId", ".", "fromString", "(", "sb", ".", "toString", "(", ")", ")", ";", "Tree", "tree", "=", "new", "Tree", "(", "repo", ")", ";", "tree", ".", "setId", "(", "t1Id", ")", ";", "PersonIdent", "ident", "=", "new", "PersonIdent", "(", "repo", ")", ";", "Commit", "commit", "=", "new", "Commit", "(", "repo", ")", ";", "commit", ".", "setAuthor", "(", "ident", ")", ";", "commit", ".", "setCommitter", "(", "ident", ")", ";", "commit", ".", "setTree", "(", "tree", ")", ";", "commit", ".", "setMessage", "(", "msg", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "ObjectId", "parents", "[", "]", "=", "{", "parent", "}", ";", "commit", ".", "setParentIds", "(", "parents", ")", ";", "}", "commit", ".", "commit", "(", ")", ";", "return", "commit", ";", "}", "private", "void", "updateRef", "(", "Repository", "repo", ",", "String", "msg", ",", "ObjectId", "id", ",", "final", "String", "ref", ")", "throws", "IOException", "{", "RefUpdate", "refUp", "=", "repo", ".", "updateRef", "(", "ref", ")", ";", "refUp", ".", "setNewObjectId", "(", "id", ")", ";", "refUp", ".", "setRefLogMessage", "(", "\"id:", "\"", "+", "msg", ",", "false", ")", ";", "refUp", ".", "forceUpdate", "(", ")", ";", "}", "private", "Commit", "addCommitToBranch", "(", "String", "branch_name", ",", "ObjectId", "parent", ")", "throws", "IOException", "{", "return", "addCommitToBranch", "(", "branch_name", ",", "parent", ",", "\"\"", ")", ";", "}", "private", "Commit", "addCommitToBranch", "(", "String", "branch_name", ",", "ObjectId", "parent", ",", "final", "String", "msg", ")", "throws", "IOException", "{", "Commit", "branch_commit", "=", "makeCommit", "(", "repo", ",", "msg", ",", "parent", ")", ";", "updateRef", "(", "repo", ",", "\"\"", ",", "branch_commit", ".", "getCommitId", "(", ")", ",", "branch_name", ")", ";", "return", "branch_commit", ";", "}", "@", "Test", "public", "void", "getHeadRevision", "(", ")", "{", "ObjectId", "id", "=", "git", ".", "getHead", "(", "git_repo", ".", "getParentFile", "(", ")", ",", "\".git\"", ")", ";", "assertEquals", "(", "c1", ".", "getCommitId", "(", ")", ".", "name", "(", ")", ",", "id", ".", "name", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "getHeadRevisionWithMultipleBranches", "(", ")", "throws", "IOException", "{", "String", "branch_name", "=", "Constants", ".", "R_HEADS", "+", "\"test_branch\"", ";", "Commit", "branch_commit", "=", "addCommitToBranch", "(", "branch_name", ",", "c1", ".", "getCommitId", "(", ")", ")", ";", "ObjectId", "id", "=", "git", ".", "getHead", "(", "git_repo", ".", "getParentFile", "(", ")", ",", "\".git\"", ")", ";", "assertEquals", "(", "c1", ".", "getCommitId", "(", ")", ".", "name", "(", ")", ",", "id", ".", "name", "(", ")", ")", ";", "updateRef", "(", "repo", ",", "\"\"", ",", "repo", ".", "resolve", "(", "branch_name", ")", ".", "toObjectId", "(", ")", ",", "\"HEAD\"", ")", ";", "id", "=", "git", ".", "getHead", "(", "git_repo", ".", "getParentFile", "(", ")", ",", "\".git\"", ")", ";", "assertEquals", "(", "branch_commit", ".", "getCommitId", "(", ")", ",", "repo", ".", "resolve", "(", "branch_name", ")", ")", ";", "assertEquals", "(", "branch_commit", ".", "getCommitId", "(", ")", ".", "name", "(", ")", ",", "id", ".", "name", "(", ")", ")", ";", "}", "}", "</s>" ]
12,926
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ";", "import", "hudson", ".", "FilePath", ";", "import", "hudson", ".", "model", ".", "Build", ";", "import", "hudson", ".", "model", ".", "BuildListener", ";", "import", "hudson", ".", "model", ".", "Result", ";", "import", "hudson", ".", "remoting", ".", "VirtualChannel", ";", "import", "org", ".", "junit", ".", "BeforeClass", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "jvnet", ".", "hudson", ".", "test", ".", "FailureBuilder", ";", "import", "org", ".", "jvnet", ".", "hudson", ".", "test", ".", "MockBuilder", ";", "import", "org", ".", "jvnet", ".", "hudson", ".", "test", ".", "UnstableBuilder", ";", "import", "org", ".", "mockito", ".", "Mock", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "concurrent", ".", "ExecutionException", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "*", ";", "public", "class", "TestGerritNotifier", "extends", "GerritNotifierTestCase", "{", "BuildListener", "listener", "=", "null", ";", "@", "Override", "@", "BeforeClass", "public", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "listener", "=", "mock", "(", "BuildListener", ".", "class", ")", ";", "}", "@", "Test", "public", "void", "testSettings", "(", ")", "throws", "IOException", ",", "ExecutionException", ",", "InterruptedException", "{", "final", "Build", "build", "=", "doBuild", "(", "null", ")", ";", "FilePath", "ws", "=", "build", ".", "getWorkspace", "(", ")", ";", "ws", ".", "act", "(", "new", "FilePath", ".", "FileCallable", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "invoke", "(", "File", "f", ",", "VirtualChannel", "channel", ")", "throws", "IOException", ",", "InterruptedException", "{", "verify", "(", "git", ")", ".", "getHead", "(", "f", ",", "\".git\"", ")", ";", "return", "null", ";", "}", "}", ")", ";", "verify", "(", "marker", ")", ".", "connect", "(", "hostName", ",", "29418", ")", ";", "verify", "(", "marker", ")", ".", "authenticate", "(", "userName", ",", "new", "File", "(", "privateKeyFilePath", ")", ",", "passPhrase", ")", ";", "}", "@", "Test", "public", "void", "testUnstableBuild", "(", ")", "throws", "IOException", ",", "ExecutionException", ",", "InterruptedException", "{", "final", "Build", "build", "=", "doBuild", "(", "new", "UnstableBuilder", "(", ")", ")", ";", "assertEquals", "(", "Result", ".", "UNSTABLE", ",", "build", ".", "getResult", "(", ")", ")", ";", "String", "command", "=", "notifier", ".", "generateUnstableCommand", "(", "notifier", ".", "getBuildUrl", "(", "build", ",", "listener", ")", ",", "hexString", ")", ";", "verify", "(", "marker", ")", ".", "executeCommand", "(", "command", ")", ";", "}", "@", "Test", "public", "void", "testStableBuild", "(", ")", "throws", "IOException", ",", "ExecutionException", ",", "InterruptedException", "{", "final", "Build", "build", "=", "doBuild", "(", "null", ")", ";", "assertEquals", "(", "Result", ".", "SUCCESS", ",", "build", ".", "getResult", "(", ")", ")", ";", "String", "command", "=", "notifier", ".", "generateApproveCommand", "(", "notifier", ".", "getBuildUrl", "(", "build", ",", "listener", ")", ",", "hexString", ")", ";", "verify", "(", "marker", ")", ".", "executeCommand", "(", "command", ")", ";", "}", "@", "Test", "public", "void", "testFailedBuild", "(", ")", "throws", "IOException", ",", "ExecutionException", ",", "InterruptedException", "{", "final", "Build", "build", "=", "doBuild", "(", "new", "FailureBuilder", "(", ")", ")", ";", "assertEquals", "(", "Result", ".", "FAILURE", ",", "build", ".", "getResult", "(", ")", ")", ";", "String", "command", "=", "notifier", ".", "generateFailedCommand", "(", "notifier", ".", "getBuildUrl", "(", "build", ",", "listener", ")", ",", "hexString", ")", ";", "verify", "(", "marker", ")", ".", "executeCommand", "(", "command", ")", ";", "}", "@", "Test", "public", "void", "testAbortedBuild", "(", ")", "throws", "IOException", ",", "ExecutionException", ",", "InterruptedException", "{", "final", "Build", "build", "=", "doBuild", "(", "new", "MockBuilder", "(", "Result", ".", "ABORTED", ")", ")", ";", "assertEquals", "(", "Result", ".", "ABORTED", ",", "build", ".", "getResult", "(", ")", ")", ";", "String", "command", "=", "notifier", ".", "generateDidNotFinishCommand", "(", "notifier", ".", "getBuildUrl", "(", "build", ",", "listener", ")", ",", "hexString", ")", ";", "verify", "(", "marker", ")", ".", "executeCommand", "(", "command", ")", ";", "}", "}", "</s>" ]
12,927
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ";", "import", "com", ".", "gargoylesoftware", ".", "htmlunit", ".", "html", ".", "*", ";", "import", "hudson", ".", "model", ".", "FreeStyleProject", ";", "import", "org", ".", "junit", ".", "BeforeClass", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "xml", ".", "sax", ".", "SAXException", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "TestConfiguration", "extends", "GerritNotifierTestCase", "{", "static", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "TestConfiguration", ".", "class", ".", "getName", "(", ")", ")", ";", "@", "Override", "@", "BeforeClass", "public", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "}", "private", "void", "testSettingExists", "(", "String", "settingName", ",", "HtmlPage", "page", ")", "{", "HtmlElement", "e", "=", "page", ".", "getElementByName", "(", "settingName", ")", ";", "assertNotNull", "(", "e", ")", ";", "}", "private", "void", "testHelpExists", "(", "String", "settingName", ",", "HtmlPage", "page", ")", "{", "HtmlElement", "e", "=", "page", ".", "getElementByName", "(", "settingName", ")", ";", "DomNode", "parent", "=", "e", ".", "getParentNode", "(", ")", ".", "getParentNode", "(", ")", ";", "boolean", "found", "=", "false", ";", "for", "(", "HtmlElement", "element", ":", "parent", ".", "getAllHtmlChildElements", "(", ")", ")", "{", "if", "(", "element", ".", "getAttribute", "(", "\"class\"", ")", ".", "equals", "(", "\"setting-help\"", ")", ")", "{", "found", "=", "true", ";", "}", "}", "assertTrue", "(", "settingName", ",", "found", ")", ";", "}", "private", "void", "testHelpAndSetting", "(", "String", "settingName", ",", "HtmlPage", "page", ")", "{", "testSettingExists", "(", "settingName", ",", "page", ")", ";", "testHelpExists", "(", "settingName", ",", "page", ")", ";", "}", "@", "Test", "public", "void", "testConfigurationOptionsExists", "(", ")", "throws", "IOException", ",", "SAXException", "{", "FreeStyleProject", "project", "=", "createProject", "(", ")", ";", "HtmlPage", "configPage", "=", "new", "WebClient", "(", ")", ".", "goTo", "(", "\"/job/\"", "+", "project", ".", "getName", "(", ")", "+", "\"/configure\"", ")", ";", "testSettingExists", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"_.passPhrase\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"\"", ",", "configPage", ")", ";", "testHelpAndSetting", "(", "\"_.git_home\"", ",", "configPage", ")", ";", "}", "@", "Test", "public", "void", "testSetValues", "(", ")", "throws", "IOException", ",", "SAXException", "{", "FreeStyleProject", "project", "=", "createProject", "(", ")", ";", "WebClient", "wc", "=", "new", "WebClient", "(", ")", ";", "HtmlPage", "configPage", "=", "wc", ".", "goTo", "(", "\"/job/\"", "+", "project", ".", "getName", "(", ")", "+", "\"/configure\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"\"", ",", "\"example.com\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"\"", ",", "\"new_user\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"\"", ",", "\"\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"_.passPhrase\"", ",", "\"passphrase\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"\"", ",", "\"-2\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"\"", ",", "\"+2\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"\"", ",", "\"-1\"", ")", ";", "setSettingValue", "(", "configPage", ",", "\"_.git_home\"", ",", "\"/ws/.git\"", ")", ";", "HtmlForm", "form", "=", "configPage", ".", "getFormByName", "(", "\"config\"", ")", ";", "form", ".", "submit", "(", "(", "HtmlButton", ")", "last", "(", "form", ".", "getHtmlElementsByTagName", "(", "\"button\"", ")", ")", ")", ";", "GerritNotifier", "newNotifier", "=", "project", ".", "getPublishersList", "(", ")", ".", "get", "(", "GerritNotifier", ".", "class", ")", ";", "assertEquals", "(", "\"example.com\"", ",", "newNotifier", ".", "getGerrit_host", "(", ")", ")", ";", "assertEquals", "(", "\"new_user\"", ",", "newNotifier", ".", "getGerrit_username", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "newNotifier", ".", "getPrivate_key_file_path", "(", ")", ")", ";", "assertEquals", "(", "\"passphrase\"", ",", "newNotifier", ".", "getPassPhrase", "(", ")", ")", ";", "assertEquals", "(", "\"-2\"", ",", "newNotifier", ".", "getReject_value", "(", ")", ")", ";", "assertEquals", "(", "\"+2\"", ",", "newNotifier", ".", "getApprove_value", "(", ")", ")", ";", "assertEquals", "(", "\"-1\"", ",", "newNotifier", ".", "getUnstable_value", "(", ")", ")", ";", "assertEquals", "(", "\"/ws/.git\"", ",", "newNotifier", ".", "getGit_home", "(", ")", ")", ";", "}", "private", "void", "setSettingValue", "(", "HtmlPage", "configPage", ",", "final", "String", "settingName", ",", "final", "String", "settingValue", ")", "{", "HtmlElement", "e", "=", "configPage", ".", "getElementByName", "(", "settingName", ")", ";", "e", ".", "setAttribute", "(", "\"value\"", ",", "settingValue", ")", ";", "}", "}", "</s>" ]
12,928
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ";", "import", "hudson", ".", "plugins", ".", "gerrit", ".", "git", ".", "GitTools", ";", "import", "hudson", ".", "plugins", ".", "gerrit", ".", "ssh", ".", "SSHMarker", ";", "import", "hudson", ".", "model", ".", "Build", ";", "import", "hudson", ".", "model", ".", "FreeStyleProject", ";", "import", "hudson", ".", "tasks", ".", "Builder", ";", "import", "org", ".", "eclipse", ".", "jgit", ".", "lib", ".", "ObjectId", ";", "import", "org", ".", "junit", ".", "BeforeClass", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "jvnet", ".", "hudson", ".", "test", ".", "HudsonTestCase", ";", "import", "org", ".", "mockito", ".", "Matchers", ";", "import", "org", ".", "mockito", ".", "MockitoAnnotations", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "concurrent", ".", "ExecutionException", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "eq", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "public", "class", "GerritNotifierTestCase", "extends", "HudsonTestCase", "{", "SSHMarker", "marker", ";", "GitTools", "git", ";", "String", "userName", "=", "\"user\"", ";", "String", "hostName", "=", "\"localhost\"", ";", "String", "gitDir", "=", "\".git\"", ";", "final", "String", "privateKeyFilePath", "=", "\"\"", ";", "String", "passPhrase", "=", "\"\"", ";", "String", "hexString", "=", "\"\"", ";", "ObjectId", "id", "=", "ObjectId", ".", "fromString", "(", "hexString", ")", ";", "GerritNotifier", "notifier", ";", "@", "Override", "@", "BeforeClass", "public", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "MockitoAnnotations", ".", "initMocks", "(", "this", ")", ";", "marker", "=", "mock", "(", "SSHMarker", ".", "class", ")", ";", "git", "=", "mock", "(", "GitTools", ".", "class", ")", ";", "notifier", "=", "new", "GerritNotifier", "(", "gitDir", ",", "hostName", ",", "29418", ",", "userName", ",", "\"+1\"", ",", "\"-1\"", ",", "\"-1\"", ",", "privateKeyFilePath", ",", "passPhrase", ")", ";", "notifier", ".", "setGitTools", "(", "git", ")", ";", "notifier", ".", "setMarker", "(", "marker", ")", ";", "when", "(", "git", ".", "getHead", "(", "Matchers", ".", "<", "File", ">", "any", "(", ")", ",", "eq", "(", "\".git\"", ")", ")", ")", ".", "thenReturn", "(", "id", ")", ";", "}", "protected", "Build", "doBuild", "(", "Builder", "builder", ")", "throws", "IOException", ",", "ExecutionException", ",", "InterruptedException", "{", "FreeStyleProject", "project", "=", "createProject", "(", "builder", ")", ";", "return", "project", ".", "scheduleBuild2", "(", "0", ")", ".", "get", "(", ")", ";", "}", "protected", "FreeStyleProject", "createProject", "(", "Builder", "builder", ")", "throws", "IOException", "{", "FreeStyleProject", "project", "=", "createFreeStyleProject", "(", ")", ";", "if", "(", "builder", "!=", "null", ")", "{", "project", ".", "getBuildersList", "(", ")", ".", "add", "(", "builder", ")", ";", "}", "project", ".", "getPublishersList", "(", ")", ".", "add", "(", "notifier", ")", ";", "return", "project", ";", "}", "protected", "FreeStyleProject", "createProject", "(", ")", "throws", "IOException", "{", "return", "createProject", "(", "null", ")", ";", "}", "@", "Test", "public", "void", "testInitialization", "(", ")", "throws", "IOException", "{", "FreeStyleProject", "project", "=", "createProject", "(", "null", ")", ";", "assertEquals", "(", "1", ",", "project", ".", "getPublishersList", "(", ")", ".", "size", "(", ")", ")", ";", "}", "}", "</s>" ]
12,929
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ".", "buildchoosers", ";", "import", "hudson", ".", "model", ".", "Result", ";", "import", "hudson", ".", "model", ".", "TaskListener", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "GitSCM", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "IGitAPI", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "Revision", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "util", ".", "Build", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "util", ".", "BuildData", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "util", ".", "GitUtils", ";", "import", "org", ".", "joda", ".", "time", ".", "DateTime", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "spearce", ".", "jgit", ".", "lib", ".", "ObjectId", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "public", "class", "TestGerritBuildChooser", "{", "GerritBuildChooser", "chooser", ";", "GitSCM", "gitSCM", ";", "IGitAPI", "git", ";", "GitUtils", "utils", ";", "BuildData", "data", ";", "ObjectId", "id", ";", "Build", "build", ";", "TaskListener", "listener", ";", "@", "Before", "public", "void", "init", "(", ")", "{", "gitSCM", "=", "mock", "(", "GitSCM", ".", "class", ")", ";", "git", "=", "mock", "(", "IGitAPI", ".", "class", ")", ";", "utils", "=", "mock", "(", "GitUtils", ".", "class", ")", ";", "listener", "=", "mock", "(", "TaskListener", ".", "class", ")", ";", "data", "=", "mock", "(", "BuildData", ".", "class", ")", ";", "String", "hexString", "=", "\"\"", ";", "id", "=", "ObjectId", ".", "fromString", "(", "hexString", ")", ";", "build", "=", "new", "Build", "(", "new", "Revision", "(", "id", ")", ",", "1", ",", "Result", ".", "SUCCESS", ")", ";", "chooser", "=", "new", "GerritBuildChooser", "(", ")", ";", "}", "@", "Test", "public", "void", "noChangesPollCall", "(", ")", "throws", "IOException", "{", "when", "(", "data", ".", "getLastBuildOfBranch", "(", "\"timebased\"", ")", ")", ".", "thenReturn", "(", "build", ")", ";", "when", "(", "data", ".", "getLastBuiltRevision", "(", ")", ")", ".", "thenReturn", "(", "new", "Revision", "(", "id", ")", ")", ";", "DateTime", "now", "=", "new", "DateTime", "(", ")", ";", "when", "(", "git", ".", "getAllLogEntries", "(", "\"\"", ")", ")", ".", "thenReturn", "(", "\"'\"", "+", "id", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'\"", ")", ";", "Collection", "<", "Revision", ">", "results", "=", "chooser", ".", "getCandidateRevisions", "(", "true", ",", "\"\"", ",", "git", ",", "listener", ",", "data", ")", ";", "assertEquals", "(", "0", ",", "results", ".", "size", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "noChangesBuild", "(", ")", "throws", "IOException", "{", "when", "(", "data", ".", "getLastBuildOfBranch", "(", "\"timebased\"", ")", ")", ".", "thenReturn", "(", "build", ")", ";", "when", "(", "data", ".", "getLastBuiltRevision", "(", ")", ")", ".", "thenReturn", "(", "new", "Revision", "(", "id", ")", ")", ";", "DateTime", "now", "=", "new", "DateTime", "(", ")", ";", "when", "(", "git", ".", "getAllLogEntries", "(", "\"\"", ")", ")", ".", "thenReturn", "(", "\"'\"", "+", "id", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'\"", ")", ";", "Collection", "<", "Revision", ">", "results", "=", "chooser", ".", "getCandidateRevisions", "(", "false", ",", "\"\"", ",", "git", ",", "listener", ",", "data", ")", ";", "assertEquals", "(", "1", ",", "results", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Revision", ">", "iterator", "=", "results", ".", "iterator", "(", ")", ";", "assertEquals", "(", "id", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "multipleCandidatesFirstBuild", "(", ")", "throws", "IOException", "{", "when", "(", "data", ".", "getLastBuildOfBranch", "(", "\"timebased\"", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "when", "(", "data", ".", "getLastBuiltRevision", "(", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "DateTime", "now", "=", "new", "DateTime", "(", ")", ";", "String", "hexString", "=", "\"\"", ";", "ObjectId", "id2", "=", "ObjectId", ".", "fromString", "(", "hexString", ")", ";", "when", "(", "git", ".", "getAllLogEntries", "(", "\"\"", ")", ")", ".", "thenReturn", "(", "\"'\"", "+", "id", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'n\"", "+", "\"'\"", "+", "id2", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "plusMillis", "(", "5000", ")", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'\"", ")", ";", "Collection", "<", "Revision", ">", "results", "=", "chooser", ".", "getCandidateRevisions", "(", "true", ",", "\"\"", ",", "git", ",", "listener", ",", "data", ")", ";", "assertEquals", "(", "2", ",", "results", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Revision", ">", "iterator", "=", "results", ".", "iterator", "(", ")", ";", "assertEquals", "(", "id2", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "assertEquals", "(", "id", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "firstBuild", "(", ")", "throws", "IOException", "{", "when", "(", "data", ".", "getLastBuildOfBranch", "(", "\"timebased\"", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "when", "(", "data", ".", "getLastBuiltRevision", "(", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "DateTime", "now", "=", "new", "DateTime", "(", ")", ";", "when", "(", "git", ".", "getAllLogEntries", "(", "\"\"", ")", ")", ".", "thenReturn", "(", "\"'\"", "+", "id", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'\"", ")", ";", "Collection", "<", "Revision", ">", "results", "=", "chooser", ".", "getCandidateRevisions", "(", "true", ",", "\"\"", ",", "git", ",", "listener", ",", "data", ")", ";", "assertEquals", "(", "1", ",", "results", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "id", ".", "name", "(", ")", ",", "results", ".", "iterator", "(", ")", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "multipleCandidates", "(", ")", "throws", "IOException", "{", "when", "(", "data", ".", "getLastBuildOfBranch", "(", "\"timebased\"", ")", ")", ".", "thenReturn", "(", "build", ")", ";", "when", "(", "data", ".", "getLastBuiltRevision", "(", ")", ")", ".", "thenReturn", "(", "new", "Revision", "(", "id", ")", ")", ";", "DateTime", "now", "=", "new", "DateTime", "(", ")", ";", "ObjectId", "id2", "=", "ObjectId", ".", "fromString", "(", "\"\"", ")", ";", "ObjectId", "id3", "=", "ObjectId", ".", "fromString", "(", "\"\"", ")", ";", "when", "(", "git", ".", "getAllLogEntries", "(", "\"\"", ")", ")", ".", "thenReturn", "(", "\"'\"", "+", "id", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'n\"", "+", "\"'\"", "+", "id2", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "plusMillis", "(", "10000", ")", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'n\"", "+", "\"'\"", "+", "id3", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "plusMillis", "(", "5000", ")", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'\"", ")", ";", "Collection", "<", "Revision", ">", "results", "=", "chooser", ".", "getCandidateRevisions", "(", "true", ",", "\"\"", ",", "git", ",", "listener", ",", "data", ")", ";", "assertEquals", "(", "2", ",", "results", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Revision", ">", "iterator", "=", "results", ".", "iterator", "(", ")", ";", "assertEquals", "(", "id3", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "assertEquals", "(", "id2", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "multipleCandidatesPreviousWasDifferentChooser", "(", ")", "throws", "IOException", "{", "when", "(", "data", ".", "getLastBuildOfBranch", "(", "\"timebased\"", ")", ")", ".", "thenReturn", "(", "build", ")", ";", "when", "(", "data", ".", "getLastBuiltRevision", "(", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "DateTime", "now", "=", "new", "DateTime", "(", ")", ";", "ObjectId", "id2", "=", "ObjectId", ".", "fromString", "(", "\"\"", ")", ";", "ObjectId", "id3", "=", "ObjectId", ".", "fromString", "(", "\"\"", ")", ";", "when", "(", "git", ".", "getAllLogEntries", "(", "\"\"", ")", ")", ".", "thenReturn", "(", "\"'\"", "+", "id", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'n\"", "+", "\"'\"", "+", "id2", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "plusMillis", "(", "10000", ")", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'n\"", "+", "\"'\"", "+", "id3", ".", "name", "(", ")", "+", "\"#\"", "+", "now", ".", "plusMillis", "(", "5000", ")", ".", "getMillis", "(", ")", "/", "1000", "+", "\"'\"", ")", ";", "Collection", "<", "Revision", ">", "results", "=", "chooser", ".", "getCandidateRevisions", "(", "true", ",", "\"\"", ",", "git", ",", "listener", ",", "data", ")", ";", "assertEquals", "(", "3", ",", "results", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Revision", ">", "iterator", "=", "results", ".", "iterator", "(", ")", ";", "assertEquals", "(", "id2", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "assertEquals", "(", "id3", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "assertEquals", "(", "id", ".", "name", "(", ")", ",", "iterator", ".", "next", "(", ")", ".", "getSha1String", "(", ")", ")", ";", "}", "}", "</s>" ]
12,930
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ";", "import", "hudson", ".", "plugins", ".", "gerrit", ".", "git", ".", "GitTools", ";", "import", "hudson", ".", "plugins", ".", "gerrit", ".", "ssh", ".", "SSHMarker", ";", "import", "hudson", ".", "EnvVars", ";", "import", "hudson", ".", "Extension", ";", "import", "hudson", ".", "FilePath", ";", "import", "hudson", ".", "FilePath", ".", "FileCallable", ";", "import", "hudson", ".", "Launcher", ";", "import", "hudson", ".", "model", ".", "AbstractBuild", ";", "import", "hudson", ".", "model", ".", "AbstractProject", ";", "import", "hudson", ".", "model", ".", "BuildListener", ";", "import", "hudson", ".", "model", ".", "Result", ";", "import", "hudson", ".", "remoting", ".", "VirtualChannel", ";", "import", "hudson", ".", "tasks", ".", "BuildStepDescriptor", ";", "import", "hudson", ".", "tasks", ".", "BuildStepMonitor", ";", "import", "hudson", ".", "tasks", ".", "Notifier", ";", "import", "hudson", ".", "tasks", ".", "Publisher", ";", "import", "hudson", ".", "util", ".", "FormValidation", ";", "import", "org", ".", "kohsuke", ".", "stapler", ".", "DataBoundConstructor", ";", "import", "org", ".", "kohsuke", ".", "stapler", ".", "QueryParameter", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Serializable", ";", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "public", "class", "GerritNotifier", "extends", "Notifier", "implements", "Serializable", "{", "private", "final", "String", "git_home", ";", "private", "final", "String", "gerrit_host", ";", "private", "final", "int", "gerrit_port", ";", "private", "final", "String", "gerrit_username", ";", "private", "final", "String", "approve_value", ";", "private", "final", "String", "unstable_value", ";", "private", "final", "String", "reject_value", ";", "private", "final", "String", "gerrit_approve_command", "=", "\"\"", ";", "protected", "static", "final", "String", "NO_BUILD_URL", "=", "\"\"", ";", "private", "final", "String", "private_key_file_path", ";", "private", "final", "String", "passPhrase", ";", "transient", "SSHMarker", "marker", ";", "transient", "GitTools", "git", ";", "public", "void", "setMarker", "(", "SSHMarker", "marker", ")", "{", "this", ".", "marker", "=", "marker", ";", "}", "public", "void", "setGitTools", "(", "GitTools", "git", ")", "{", "this", ".", "git", "=", "git", ";", "}", "public", "String", "getGerrit_host", "(", ")", "{", "return", "gerrit_host", ";", "}", "public", "int", "getGerrit_port", "(", ")", "{", "return", "gerrit_port", ";", "}", "public", "String", "getGerrit_username", "(", ")", "{", "return", "gerrit_username", ";", "}", "public", "String", "getApprove_value", "(", ")", "{", "return", "approve_value", ";", "}", "public", "String", "getUnstable_value", "(", ")", "{", "return", "unstable_value", ";", "}", "public", "String", "getReject_value", "(", ")", "{", "return", "reject_value", ";", "}", "public", "String", "getGerrit_approve_command", "(", ")", "{", "return", "gerrit_approve_command", ";", "}", "public", "String", "getPrivate_key_file_path", "(", ")", "{", "return", "private_key_file_path", ";", "}", "public", "String", "getPassPhrase", "(", ")", "{", "return", "passPhrase", ";", "}", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "@", "DataBoundConstructor", "public", "GerritNotifier", "(", "String", "git_home", ",", "String", "gerrit_host", ",", "int", "gerrit_port", ",", "String", "gerrit_username", ",", "String", "approve_value", ",", "String", "unstable_value", ",", "String", "reject_value", ",", "String", "private_key_file_path", ",", "String", "passPhrase", ")", "{", "this", ".", "git_home", "=", "git_home", ";", "this", ".", "gerrit_host", "=", "gerrit_host", ";", "this", ".", "gerrit_port", "=", "gerrit_port", ";", "this", ".", "gerrit_username", "=", "gerrit_username", ";", "this", ".", "approve_value", "=", "approve_value", ";", "this", ".", "unstable_value", "=", "unstable_value", ";", "this", ".", "reject_value", "=", "reject_value", ";", "this", ".", "private_key_file_path", "=", "private_key_file_path", ";", "this", ".", "passPhrase", "=", "passPhrase", ";", "this", ".", "marker", "=", "new", "SSHMarker", "(", ")", ";", "this", ".", "git", "=", "new", "GitTools", "(", ")", ";", "}", "public", "String", "getGit_home", "(", ")", "{", "return", "git_home", ";", "}", "public", "String", "generateComment", "(", "String", "verify_value", ",", "String", "message", ",", "String", "revision", ")", "{", "return", "String", ".", "format", "(", "gerrit_approve_command", ",", "verify_value", ",", "message", ",", "revision", ")", ";", "}", "public", "String", "generateApproveCommand", "(", "final", "String", "jobUrl", ",", "final", "String", "revision", ")", "{", "return", "generateComment", "(", "approve_value", ",", "jobUrl", ",", "revision", ")", ";", "}", "public", "String", "generateUnstableCommand", "(", "final", "String", "jobUrl", ",", "final", "String", "revision", ")", "{", "return", "generateComment", "(", "unstable_value", ",", "\"\"", "+", "jobUrl", ",", "revision", ")", ";", "}", "public", "String", "generateFailedCommand", "(", "final", "String", "jobUrl", ",", "final", "String", "revision", ")", "{", "return", "generateComment", "(", "reject_value", ",", "\"\"", "+", "jobUrl", ",", "revision", ")", ";", "}", "public", "String", "generateDidNotFinishCommand", "(", "final", "String", "jobUrl", ",", "final", "String", "revision", ")", "{", "return", "generateComment", "(", "\"0\"", ",", "\"\"", "+", "jobUrl", ",", "revision", ")", ";", "}", "private", "void", "verifyGerrit", "(", "String", "message", ")", "throws", "IOException", ",", "InterruptedException", "{", "File", "privateKeyFile", "=", "new", "File", "(", "private_key_file_path", ")", ";", "marker", ".", "connect", "(", "gerrit_host", ",", "gerrit_port", ")", ";", "marker", ".", "authenticate", "(", "gerrit_username", ",", "privateKeyFile", ",", "passPhrase", ")", ";", "marker", ".", "executeCommand", "(", "message", ")", ";", "marker", ".", "disconnect", "(", ")", ";", "}", "@", "Override", "public", "boolean", "perform", "(", "final", "AbstractBuild", "build", ",", "Launcher", "launcher", ",", "final", "BuildListener", "listener", ")", "throws", "IOException", ",", "InterruptedException", "{", "FilePath", "ws", "=", "build", ".", "getWorkspace", "(", ")", ";", "if", "(", "marker", "==", "null", ")", "{", "marker", "=", "new", "SSHMarker", "(", ")", ";", "}", "String", "head", "=", "ws", ".", "act", "(", "new", "FileCallable", "<", "String", ">", "(", ")", "{", "public", "String", "invoke", "(", "File", "workspace", ",", "VirtualChannel", "channel", ")", "throws", "IOException", "{", "if", "(", "git", "==", "null", ")", "{", "git", "=", "new", "GitTools", "(", ")", ";", "}", "return", "git", ".", "getHead", "(", "workspace", ",", "GerritNotifier", ".", "this", ".", "git_home", ")", ".", "name", "(", ")", ";", "}", "}", ")", ";", "try", "{", "Result", "r", "=", "build", ".", "getResult", "(", ")", ";", "String", "buildUrl", "=", "getBuildUrl", "(", "build", ",", "listener", ")", ";", "if", "(", "r", "==", "Result", ".", "ABORTED", "||", "r", "==", "Result", ".", "NOT_BUILT", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "\"\"", ")", ";", "verifyGerrit", "(", "generateDidNotFinishCommand", "(", "buildUrl", ",", "head", ")", ")", ";", "}", "else", "{", "if", "(", "r", ".", "isBetterOrEqualTo", "(", "Result", ".", "SUCCESS", ")", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "\"Approving", "\"", "+", "head", ")", ";", "verifyGerrit", "(", "generateApproveCommand", "(", "buildUrl", ",", "head", ")", ")", ";", "}", "else", "if", "(", "r", ".", "isBetterOrEqualTo", "(", "Result", ".", "UNSTABLE", ")", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "\"\"", "+", "head", ")", ";", "verifyGerrit", "(", "generateUnstableCommand", "(", "buildUrl", ",", "head", ")", ")", ";", "}", "else", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "\"\"", "+", "head", ")", ";", "verifyGerrit", "(", "generateFailedCommand", "(", "buildUrl", ",", "head", ")", ")", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", "listener", ".", "getLogger", "(", ")", ")", ";", "build", ".", "setResult", "(", "Result", ".", "ABORTED", ")", ";", "return", "false", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "build", ".", "setResult", "(", "Result", ".", "ABORTED", ")", ";", "}", "return", "true", ";", "}", "String", "getBuildUrl", "(", "AbstractBuild", "build", ",", "BuildListener", "listener", ")", "throws", "IOException", "{", "EnvVars", "vars", "=", "null", ";", "try", "{", "vars", "=", "build", ".", "getEnvironment", "(", "listener", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "listener", ".", "getLogger", "(", ")", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "return", "NO_BUILD_URL", ";", "}", "String", "buildUrl", "=", "NO_BUILD_URL", ";", "if", "(", "vars", ".", "containsKey", "(", "\"BUILD_URL\"", ")", ")", "{", "buildUrl", "=", "vars", ".", "get", "(", "\"BUILD_URL\"", ")", ";", "}", "return", "buildUrl", ";", "}", "@", "Override", "public", "DescriptorImpl", "getDescriptor", "(", ")", "{", "return", "(", "DescriptorImpl", ")", "super", ".", "getDescriptor", "(", ")", ";", "}", "public", "BuildStepMonitor", "getRequiredMonitorService", "(", ")", "{", "return", "BuildStepMonitor", ".", "BUILD", ";", "}", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "@", "Extension", "public", "static", "final", "class", "DescriptorImpl", "extends", "BuildStepDescriptor", "<", "Publisher", ">", "{", "String", "path_to_private_key_file", ";", "public", "FormValidation", "doCheckGerrit_username", "(", "@", "QueryParameter", "String", "value", ")", "{", "if", "(", "value", ".", "length", "(", ")", "==", "0", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "return", "FormValidation", ".", "ok", "(", ")", ";", "}", "public", "FormValidation", "doCheckGerrit_host", "(", "@", "QueryParameter", "String", "value", ")", "{", "if", "(", "value", ".", "length", "(", ")", "==", "0", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "return", "FormValidation", ".", "ok", "(", ")", ";", "}", "public", "FormValidation", "doCheckPrivate_key_file_path", "(", "@", "QueryParameter", "String", "value", ")", "{", "if", "(", "value", ".", "length", "(", ")", "==", "0", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "File", "f", "=", "new", "File", "(", "value", ")", ";", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "if", "(", "!", "SSHMarker", ".", "IsPrivateKeyFileValid", "(", "f", ")", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "path_to_private_key_file", "=", "value", ";", "return", "FormValidation", ".", "ok", "(", ")", ";", "}", "public", "FormValidation", "doCheckPassPhrase", "(", "@", "QueryParameter", "String", "value", ")", "{", "if", "(", "path_to_private_key_file", "==", "null", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "File", "f", "=", "new", "File", "(", "path_to_private_key_file", ")", ";", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "if", "(", "!", "SSHMarker", ".", "IsPrivateKeyFileValid", "(", "f", ")", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "if", "(", "!", "SSHMarker", ".", "CheckPassPhrase", "(", "f", ",", "value", ")", ")", "{", "return", "FormValidation", ".", "error", "(", "\"\"", ")", ";", "}", "return", "FormValidation", ".", "ok", "(", ")", ";", "}", "public", "boolean", "isApplicable", "(", "Class", "<", "?", "extends", "AbstractProject", ">", "aClass", ")", "{", "return", "true", ";", "}", "public", "String", "getDisplayName", "(", ")", "{", "return", "\"\"", ";", "}", "public", "String", "guessSSHKeyFile", "(", ")", "{", "String", "user_home", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", ";", "String", "ssh_path", "=", "user_home", "+", "File", ".", "separatorChar", "+", "\".ssh\"", "+", "File", ".", "separatorChar", ";", "File", "f", "=", "new", "File", "(", "ssh_path", "+", "\"id_dsa\"", ")", ";", "if", "(", "f", ".", "exists", "(", ")", ")", "{", "return", "ssh_path", "+", "\"id_dsa\"", ";", "}", "f", "=", "new", "File", "(", "ssh_path", "+", "\"id_rsa\"", ")", ";", "if", "(", "f", ".", "exists", "(", ")", ")", "{", "return", "ssh_path", "+", "\"id_rsa\"", ";", "}", "return", "\"\"", ";", "}", "}", "}", "</s>" ]
12,931
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ".", "git", ";", "import", "org", ".", "eclipse", ".", "jgit", ".", "lib", ".", "ObjectId", ";", "import", "org", ".", "eclipse", ".", "jgit", ".", "lib", ".", "Repository", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "GitTools", "{", "public", "File", "getGitHome", "(", "File", "workspace", ",", "String", "gitHome", ")", "{", "String", "git_path", "=", "workspace", ".", "getAbsolutePath", "(", ")", "+", "File", ".", "separatorChar", "+", "gitHome", ";", "File", "git_home_directory", "=", "new", "File", "(", "git_path", ")", ";", "if", "(", "!", "git_home_directory", ".", "isDirectory", "(", ")", ")", "{", "return", "null", ";", "}", "return", "git_home_directory", ";", "}", "public", "Repository", "getRepository", "(", "File", "git_home", ")", "{", "Repository", "repo", ";", "try", "{", "repo", "=", "new", "Repository", "(", "git_home", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "return", "repo", ";", "}", "public", "ObjectId", "getHead", "(", "Repository", "repo", ")", "{", "ObjectId", "head", ";", "try", "{", "head", "=", "repo", ".", "resolve", "(", "\"HEAD\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "return", "head", ";", "}", "public", "ObjectId", "getHead", "(", "File", "workspace", ",", "String", "gitHome", ")", "{", "File", "git_home_directory", "=", "getGitHome", "(", "workspace", ",", "gitHome", ")", ";", "if", "(", "git_home_directory", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "workspace", ".", "getAbsolutePath", "(", ")", "+", "File", ".", "separatorChar", "+", "gitHome", ")", ";", "}", "Repository", "repo", "=", "getRepository", "(", "git_home_directory", ")", ";", "if", "(", "repo", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "git_home_directory", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "ObjectId", "head", "=", "getHead", "(", "repo", ")", ";", "if", "(", "head", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "repo", ".", "getDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "}", "return", "head", ";", "}", "}", "</s>" ]
12,932
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ".", "ssh", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "SshClient", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "authentication", ".", "PublicKeyAuthenticationClient", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "session", ".", "SessionChannelClient", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "transport", ".", "IgnoreHostKeyVerification", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "transport", ".", "publickey", ".", "InvalidSshKeyException", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "transport", ".", "publickey", ".", "SshPrivateKey", ";", "import", "com", ".", "sshtools", ".", "j2ssh", ".", "transport", ".", "publickey", ".", "SshPrivateKeyFile", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "SSHMarker", "{", "private", "SshClient", "client", "=", "null", ";", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "public", "SSHMarker", "(", ")", "{", "}", "public", "void", "connect", "(", "String", "host", ",", "int", "port", ")", "throws", "IOException", "{", "SshClient", "client", "=", "new", "SshClient", "(", ")", ";", "client", ".", "connect", "(", "host", ",", "port", ",", "new", "IgnoreHostKeyVerification", "(", ")", ")", ";", "this", ".", "client", "=", "client", ";", "}", "public", "void", "authenticate", "(", "String", "username", ",", "File", "private_key_file", ",", "String", "passPhrase", ")", "throws", "IOException", "{", "assert", "client", "!=", "null", ";", "PublicKeyAuthenticationClient", "pk", "=", "new", "PublicKeyAuthenticationClient", "(", ")", ";", "pk", ".", "setUsername", "(", "username", ")", ";", "SshPrivateKeyFile", "file", "=", "SshPrivateKeyFile", ".", "parse", "(", "private_key_file", ")", ";", "SshPrivateKey", "key", "=", "file", ".", "toPrivateKey", "(", "passPhrase", ")", ";", "pk", ".", "setKey", "(", "key", ")", ";", "client", ".", "authenticate", "(", "pk", ")", ";", "}", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "public", "static", "boolean", "IsPrivateKeyFileValid", "(", "File", "f", ")", "{", "SshPrivateKeyFile", "file", ";", "try", "{", "file", "=", "SshPrivateKeyFile", ".", "parse", "(", "f", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "return", "file", "!=", "null", ";", "}", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "public", "static", "boolean", "CheckPassPhrase", "(", "File", "f", ",", "String", "p", ")", "{", "SshPrivateKeyFile", "file", ";", "try", "{", "file", "=", "SshPrivateKeyFile", ".", "parse", "(", "f", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "try", "{", "@", "SuppressWarnings", "(", "{", "\"\"", "}", ")", "SshPrivateKey", "key", "=", "file", ".", "toPrivateKey", "(", "p", ")", ";", "}", "catch", "(", "InvalidSshKeyException", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "void", "executeCommand", "(", "String", "command", ")", "throws", "IOException", ",", "InterruptedException", "{", "assert", "client", "!=", "null", ";", "SessionChannelClient", "session", "=", "client", ".", "openSessionChannel", "(", ")", ";", "session", ".", "executeCommand", "(", "command", ")", ";", "session", ".", "setLocalEOF", "(", ")", ";", "while", "(", "!", "session", ".", "isRemoteEOF", "(", ")", ")", "{", "Thread", ".", "sleep", "(", "10", ")", ";", "}", "session", ".", "close", "(", ")", ";", "}", "public", "void", "disconnect", "(", ")", "{", "assert", "client", "!=", "null", ";", "client", ".", "disconnect", "(", ")", ";", "}", "}", "</s>" ]
12,933
[ "<s>", "package", "hudson", ".", "plugins", ".", "gerrit", ".", "buildchoosers", ";", "import", "hudson", ".", "Extension", ";", "import", "hudson", ".", "model", ".", "AbstractProject", ";", "import", "hudson", ".", "model", ".", "Action", ";", "import", "hudson", ".", "model", ".", "Result", ";", "import", "hudson", ".", "model", ".", "TaskListener", ";", "import", "hudson", ".", "plugins", ".", "gerrit", ".", "GerritNotifier", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "*", ";", "import", "hudson", ".", "plugins", ".", "git", ".", "util", ".", "*", ";", "import", "hudson", ".", "util", ".", "DescribableList", ";", "import", "org", ".", "joda", ".", "time", ".", "DateTime", ";", "import", "org", ".", "kohsuke", ".", "stapler", ".", "DataBoundConstructor", ";", "import", "org", ".", "spearce", ".", "jgit", ".", "lib", ".", "ObjectId", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "*", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "@", "Extension", "public", "class", "GerritBuildChooser", "extends", "BuildChooser", "{", "private", "final", "String", "separator", "=", "\"#\"", ";", "@", "DataBoundConstructor", "public", "GerritBuildChooser", "(", ")", "{", "}", "public", "Collection", "<", "Revision", ">", "getCandidateRevisions", "(", "boolean", "isPollCall", ",", "String", "singleBranch", ",", "IGitAPI", "git", ",", "TaskListener", "listener", ",", "BuildData", "data", ")", "throws", "GitException", ",", "IOException", "{", "Revision", "last", "=", "data", ".", "getLastBuiltRevision", "(", ")", ";", "String", "result", "=", "git", ".", "getAllLogEntries", "(", "singleBranch", ")", ";", "Collection", "<", "TimedCommit", ">", "commits", "=", "sortRevList", "(", "result", ")", ";", "Iterator", "<", "TimedCommit", ">", "i", "=", "commits", ".", "iterator", "(", ")", ";", "ArrayList", "<", "Revision", ">", "revs", "=", "new", "ArrayList", "<", "Revision", ">", "(", ")", ";", "DateTime", "lastBuilt", "=", "null", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "TimedCommit", "tc", "=", "i", ".", "next", "(", ")", ";", "if", "(", "last", "!=", "null", "&&", "tc", ".", "commit", ".", "name", "(", ")", ".", "equals", "(", "last", ".", "getSha1String", "(", ")", ")", ")", "{", "break", ";", "}", "addToRevs", "(", "revs", ",", "tc", ")", ";", "}", "if", "(", "last", "==", "null", ")", "{", "return", "revs", ";", "}", "if", "(", "revs", ".", "size", "(", ")", "==", "0", "&&", "!", "isPollCall", ")", "{", "return", "Collections", ".", "singletonList", "(", "last", ")", ";", "}", "ArrayList", "<", "Revision", ">", "finalRevs", "=", "new", "ArrayList", "<", "Revision", ">", "(", ")", ";", "for", "(", "int", "j", "=", "revs", ".", "size", "(", ")", "-", "1", ";", "j", ">=", "0", ";", "j", "--", ")", "{", "finalRevs", ".", "add", "(", "revs", ".", "get", "(", "j", ")", ")", ";", "}", "return", "finalRevs", ";", "}", "private", "void", "addToRevs", "(", "ArrayList", "<", "Revision", ">", "revs", ",", "TimedCommit", "tc", ")", "{", "Revision", "rev", "=", "new", "Revision", "(", "tc", ".", "commit", ")", ";", "rev", ".", "getBranches", "(", ")", ".", "add", "(", "new", "Branch", "(", "\"timebased\"", ",", "rev", ".", "getSha1", "(", ")", ")", ")", ";", "revs", ".", "add", "(", "rev", ")", ";", "}", "private", "Collection", "<", "TimedCommit", ">", "sortRevList", "(", "String", "logOutput", ")", "{", "SortedSet", "<", "TimedCommit", ">", "timedCommits", "=", "new", "TreeSet", "<", "TimedCommit", ">", "(", ")", ";", "String", "[", "]", "lines", "=", "logOutput", ".", "split", "(", "\"n\"", ")", ";", "for", "(", "String", "s", ":", "lines", ")", "{", "timedCommits", ".", "add", "(", "parseCommit", "(", "s", ")", ")", ";", "}", "return", "timedCommits", ";", "}", "private", "TimedCommit", "parseCommit", "(", "String", "line", ")", "{", "String", "[", "]", "lines", "=", "line", ".", "split", "(", "separator", ")", ";", "String", "id", "=", "lines", "[", "0", "]", ".", "substring", "(", "1", ")", ";", "if", "(", "!", "lines", "[", "0", "]", ".", "startsWith", "(", "\"'\"", ")", ")", "{", "id", "=", "lines", "[", "0", "]", ";", "}", "String", "date", "=", "lines", "[", "1", "]", ".", "substring", "(", "0", ",", "lines", "[", "1", "]", ".", "length", "(", ")", "-", "1", ")", ";", "if", "(", "!", "lines", "[", "1", "]", ".", "endsWith", "(", "\"'\"", ")", ")", "{", "date", "=", "lines", "[", "1", "]", ";", "}", "return", "new", "TimedCommit", "(", "ObjectId", ".", "fromString", "(", "id", ")", ",", "new", "DateTime", "(", "Long", ".", "parseLong", "(", "date", ")", "*", "1000", ")", ")", ";", "}", "private", "class", "TimedCommit", "implements", "Comparable", "<", "TimedCommit", ">", "{", "private", "ObjectId", "commit", ";", "public", "DateTime", "when", ";", "public", "TimedCommit", "(", "ObjectId", "c", ",", "DateTime", "when", ")", "{", "this", ".", "commit", "=", "c", ";", "this", ".", "when", "=", "when", ";", "}", "public", "ObjectId", "getCommit", "(", ")", "{", "return", "commit", ";", "}", "public", "int", "compareTo", "(", "TimedCommit", "o", ")", "{", "int", "result", "=", "-", "(", "when", ".", "compareTo", "(", "o", ".", "when", ")", ")", ";", "if", "(", "result", "==", "0", ")", "{", "return", "-", "1", ";", "}", "return", "result", ";", "}", "}", "@", "Extension", "public", "static", "final", "class", "DescriptorImpl", "extends", "BuildChooserDescriptor", "{", "@", "Override", "public", "String", "getDisplayName", "(", ")", "{", "return", "\"\"", ";", "}", "}", "}", "</s>" ]