/**
* Copyright (c) 2013/2014 Verein zur Foerderung der IT-Sicherheit in Oesterreich (SBA).
* The work has been developed in the TIMBUS Project and the above-mentioned are Members of the TIMBUS Consortium.
* TIMBUS is supported by the European Union under the 7th Framework Programme for research and technological
* development and demonstration activities (FP7/2007-2013) under grant agreement no. 269940.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including without
* limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTIBITLY, or FITNESS FOR A PARTICULAR
* PURPOSE. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law or agreed to in writing, shall any Contributor be liable for damages, including
* any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this
* License or out of the use or inability to use the Work.
* See the License for the specific language governing permissions and limitation under the License.
*/
package net.timbusproject.extractors.modules.tavernaextractor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CSVEntry {
private String ID;
private String PARENT_ID;
private String URI;
private String FILE_PATH;
private String NAME;
private String METHOD;
private String STATUS;
private String SIZE;
private String TYPE;
private String EXT;
private String LAST_MODIFIED;
private String EXTENSION_MISMATCH;
private String MD5_HASH;
private String FORMAT_COUNT;
private String PUID;
private String MIME_TYPE;
private String FORMAT_NAME;
private String FORMAT_VERSION;
public CSVEntry() {
}
public String getID() {
return ID;
}
public void setID(String iD) {
ID = iD;
}
public String getPARENT_ID() {
return PARENT_ID;
}
public void setPARENT_ID(String pARENT_ID) {
PARENT_ID = pARENT_ID;
}
public String getURI() {
return URI;
}
public void setURI(String uRI) {
URI = uRI;
}
public String getFILE_PATH() {
return FILE_PATH;
}
public void setFILE_PATH(String fILE_PATH) {
FILE_PATH = fILE_PATH;
}
public String getNAME() {
return NAME;
}
public void setNAME(String nAME) {
NAME = nAME;
// customize name
// int beginIndex = nAME.indexOf("[");
// int endIndex = nAME.indexOf("]");
//
// if (beginIndex > 0 && endIndex > beginIndex) {
// NAME = nAME.substring(beginIndex + 1, endIndex);
// } else {
// NAME = nAME;
// }
}
public String getMETHOD() {
return METHOD;
}
public void setMETHOD(String mETHOD) {
METHOD = mETHOD;
}
public String getSTATUS() {
return STATUS;
}
public void setSTATUS(String sTATUS) {
STATUS = sTATUS;
}
public String getSIZE() {
return SIZE;
}
public void setSIZE(String sIZE) {
SIZE = sIZE;
}
public String getTYPE() {
return TYPE;
}
public void setTYPE(String tYPE) {
TYPE = tYPE;
}
public String getEXT() {
return EXT;
}
public void setEXT(String eXT) {
EXT = eXT;
}
public String getLAST_MODIFIED() {
return LAST_MODIFIED;
}
public void setLAST_MODIFIED(String lAST_MODIFIED) {
LAST_MODIFIED = lAST_MODIFIED;
}
public String getEXTENSION_MISMATCH() {
return EXTENSION_MISMATCH;
}
public void setEXTENSION_MISMATCH(String eXTENSION_MISMATCH) {
EXTENSION_MISMATCH = eXTENSION_MISMATCH;
}
public String getMD5_HASH() {
return MD5_HASH;
}
public void setMD5_HASH(String mD5_HASH) {
MD5_HASH = mD5_HASH;
}
public String getFORMAT_COUNT() {
return FORMAT_COUNT;
}
public void setFORMAT_COUNT(String fORMAT_COUNT) {
FORMAT_COUNT = fORMAT_COUNT;
}
public String getPUID() {
return PUID.replace("\"", "");
}
public void setPUID(String pUID) {
PUID = pUID;
}
public String getMIME_TYPE() {
return MIME_TYPE;
}
public void setMIME_TYPE(String mIME_TYPE) {
MIME_TYPE = mIME_TYPE;
}
public String getFORMAT_NAME() {
return FORMAT_NAME.replace("\"", "");
}
public void setFORMAT_NAME(String fORMAT_NAME) {
FORMAT_NAME = fORMAT_NAME;
}
public String getFORMAT_VERSION() {
return FORMAT_VERSION.replace("\"", "");
}
public void setFORMAT_VERSION(String fORMAT_VERSION) {
FORMAT_VERSION = fORMAT_VERSION;
}
public String getNameForExtensionUsage(){
String _name = "EMPTY";
//only retrieve the port name part
// [processorName][portName]-randomNumber.file -> portName
Matcher m = Pattern.compile("\\[[^\\]]*\\]").matcher(NAME);
int group = 0;
while(m.find()) {
if(group == 1) {
_name = m.group().replaceAll("\\[", "").replaceAll("\\]","");
return _name;
}
group++;
}
return _name;
}
@Override
public String toString() {
return "CSV [NAME=" + NAME + ",PUID=" + PUID + ",FORMAT_NAME=" + FORMAT_NAME + "]";
}
@Override
public boolean equals(Object other) {
CSVEntry otherEntry = (CSVEntry) other;
if (this.getNAME().equals(otherEntry.getNAME()) && this.getPUID().equals(otherEntry.getPUID())) {
return true;
}
return false;
}
}