/*\r
* <?xml version="1.0" encoding="UTF-16"?> <ID extendedId="aaaaaaa">\r
* <KillDate>02-02-2018</KillDate> <ExtendedDescription>TEST\r
- * TEST</ExtendedDescription> <ExtendedAgency>AGENT AGENT</ExtendedAgency>\r
- * </ID>\r
+ * TEST</ExtendedDescription> <ExtendedAgency>AGENT AGENT</ExtendedAgency> </ID>\r
*/\r
\r
private static String composeKillDateFileName(String fileName, int days) {\r
Files.write(metadataPath, metadata.getBytes());\r
}\r
\r
- public static boolean createMetadataIfNotExists(String filePath, String fileName, String metadata) throws IOException {\r
+ public static boolean createMetadataIfNotExists(String filePath, String fileName, String metadata)\r
+ throws IOException {\r
boolean result = false;\r
if (!EscortFiles.isMetadataExists(filePath, fileName)) {\r
EscortFiles.createMetadata(filePath, fileName, metadata);\r
\r
Element root = xmlDocument.createElement(ID);\r
root.setAttribute(EXTENDEDID, fileName);\r
- // <ModifiedTimeStamp>07-13-2020 (19:36:52)</ModifiedTimeStamp>\r
- // <RecordTimeStamp>05-18-2013 (18:52:24)</RecordTimeStamp>\r
+ // <ModifiedTimeStamp>07-13-2020 (19:36:52)</ModifiedTimeStamp>\r
+ // <RecordTimeStamp>05-18-2013 (18:52:24)</RecordTimeStamp>\r
SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy (HH:mm:ss)");\r
- root.appendChild(xmlDocument.createElement(MODIFIEDTIMESTAMP)).appendChild(xmlDocument.createTextNode(df.format(modified)));\r
- root.appendChild(xmlDocument.createElement(RECORDTIMESTAMP)).appendChild(xmlDocument.createTextNode(df.format(recorded)));\r
+ root.appendChild(xmlDocument.createElement(MODIFIEDTIMESTAMP))\r
+ .appendChild(xmlDocument.createTextNode(df.format(modified)));\r
+ root.appendChild(xmlDocument.createElement(RECORDTIMESTAMP))\r
+ .appendChild(xmlDocument.createTextNode(df.format(recorded)));\r
xmlDocument.appendChild(root);\r
\r
return xmDocumentToString(xmlDocument);\r
}\r
\r
- public static byte[] createNEXIOKillDateFile(String fileName, Date killDate, String description, String agency) throws Exception {\r
+ public static byte[] createNEXIOKillDateFile(String fileName, Date killDate, String description, String agency)\r
+ throws Exception {\r
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r
DocumentBuilder db = dbf.newDocumentBuilder();\r
DOMImplementation impl = db.getDOMImplementation();\r
}\r
\r
if (StringUtils.isNotBlank(description))\r
- root.appendChild(xmlDocument.createElement(EXTENDEDDESCRIPTION)).appendChild(xmlDocument.createTextNode(description));\r
+ root.appendChild(xmlDocument.createElement(EXTENDEDDESCRIPTION))\r
+ .appendChild(xmlDocument.createTextNode(description));\r
if (StringUtils.isNotBlank(agency))\r
root.appendChild(xmlDocument.createElement(EXTENDEDAGENCY)).appendChild(xmlDocument.createTextNode(agency));\r
xmlDocument.appendChild(root);\r
FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);\r
Files.createDirectories(filePath, attr);\r
} catch (Exception e) {\r
- //logger.catching(e);\r
+ // logger.catching(e);\r
try {\r
Files.createDirectories(filePath);\r
} catch (Exception e1) {\r
\r
public static boolean isCatchedFileExists(Path escortFile) {\r
Path catchedFilePath = Paths.get(escortFile.toString() + DOT_CATCHED);\r
- return catchedFilePath.toFile().exists();\r
+ return Files.exists(catchedFilePath);\r
}\r
\r
/***\r
- * A media eleresi utjan alapjan a .STATUS almappaban vizsgalja .catch fajl letezeset.\r
+ * A media eleresi utjan alapjan a .STATUS almappaban vizsgalja .catch fajl\r
+ * letezeset.\r
*\r
* @param mediaFile\r
* @return\r
*/\r
public static boolean isMediaCatched(Path mediaFile) {\r
Path catchedFile = createMediaCathFilePath(mediaFile);\r
- return catchedFile.toFile().exists();\r
+ return Files.exists(catchedFile);\r
}\r
\r
public static boolean isMetadataExists(String filePath, String fileName) throws IOException {\r
boolean result = false;\r
String metadataFileName = fileName + DOT_JSON;\r
Path metadataPath = Paths.get(filePath, STATUSFOLDER, metadataFileName);\r
- result = metadataPath.toFile().exists();\r
+ result = Files.exists(metadataPath);\r
return result;\r
}\r
\r
public static void notifyRecipient(Path escortFile, Logger logger, Message msg) {\r
- if (escortFile.toFile().exists()) {\r
+ if (Files.exists(escortFile)) {\r
try {\r
BasicDBObject downloadable = EscortFiles.decode(escortFile);\r
String recipientKey = "recipient";\r
remove(catchedFile);\r
}\r
\r
- public static void setNEXIOKillDate(int killDateDays, String targetFileName, String nexioAgency, StoreUri targetUri) throws Exception {\r
+ public static void setNEXIOKillDate(int killDateDays, String targetFileName, String nexioAgency, StoreUri targetUri)\r
+ throws Exception {\r
OutputStream outStream = null;\r
try {\r
FTPClient targetFTP = ((FtpDirectoryLister) targetUri.getLister()).connect();\r
killDate.add(Calendar.DAY_OF_YEAR, killDateDays);\r
if (targetFileName.toLowerCase().contains(".mxf"))\r
targetFileName = targetFileName.substring(0, targetFileName.lastIndexOf('.'));\r
- byte[] killDateFile = EscortFiles.createNEXIOKillDateFile(targetFileName, killDate.getTime(), null, nexioAgency);\r
+ byte[] killDateFile = EscortFiles.createNEXIOKillDateFile(targetFileName, killDate.getTime(), null,\r
+ nexioAgency);\r
String xml = targetFileName + ".xml";\r
outStream = targetFTP.storeFileStream(xml);\r
if (outStream == null) {\r
- throw new NullPointerException("Can not open: " + targetFileName.substring(0, targetFileName.lastIndexOf('.')) + ".xml" + " Reply:"\r
- + targetFTP.getReplyString());\r
+ throw new NullPointerException(\r
+ "Can not open: " + targetFileName.substring(0, targetFileName.lastIndexOf('.')) + ".xml"\r
+ + " Reply:" + targetFTP.getReplyString());\r
}\r
outStream.write(killDateFile);\r
outStream.flush();\r
}\r
}\r
\r
- private static byte[] xmDocumentToString(Document xmlDocument)\r
- throws TransformerFactoryConfigurationError, TransformerConfigurationException, TransformerException, IOException, UnsupportedEncodingException {\r
+ private static byte[] xmDocumentToString(Document xmlDocument) throws TransformerFactoryConfigurationError,\r
+ TransformerConfigurationException, TransformerException, IOException, UnsupportedEncodingException {\r
DOMSource domSource = new DOMSource(xmlDocument);\r
TransformerFactory tf = TransformerFactory.newInstance();\r
Transformer transformer = tf.newTransformer();\r