repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getString | public static final String getString(InputStream is) throws IOException
{
int type = is.read();
if (type != 1)
{
throw new IllegalArgumentException("Unexpected string format");
}
Charset charset = CharsetHelper.UTF8;
int length = is.read();
if (length == 0xFF)
{
length = getShort(is);
if (length == 0xFFFE)
{
charset = CharsetHelper.UTF16LE;
length = (is.read() * 2);
}
}
String result;
if (length == 0)
{
result = null;
}
else
{
byte[] stringData = new byte[length];
is.read(stringData);
result = new String(stringData, charset);
}
return result;
} | java | public static final String getString(InputStream is) throws IOException
{
int type = is.read();
if (type != 1)
{
throw new IllegalArgumentException("Unexpected string format");
}
Charset charset = CharsetHelper.UTF8;
int length = is.read();
if (length == 0xFF)
{
length = getShort(is);
if (length == 0xFFFE)
{
charset = CharsetHelper.UTF16LE;
length = (is.read() * 2);
}
}
String result;
if (length == 0)
{
result = null;
}
else
{
byte[] stringData = new byte[length];
is.read(stringData);
result = new String(stringData, charset);
}
return result;
} | [
"public",
"static",
"final",
"String",
"getString",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"int",
"type",
"=",
"is",
".",
"read",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Read a Synchro string from an input stream.
@param is input stream
@return String instance | [
"Read",
"a",
"Synchro",
"string",
"from",
"an",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L182-L215 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getUUID | public static final UUID getUUID(InputStream is) throws IOException
{
byte[] data = new byte[16];
is.read(data);
long long1 = 0;
long1 |= ((long) (data[3] & 0xFF)) << 56;
long1 |= ((long) (data[2] & 0xFF)) << 48;
long1 |= ((long) (data[1] & 0xFF)) << 40;
long1 |= ((long) (data[0] & 0xFF)) << 32;
long1 |= ((long) (data[5] & 0xFF)) << 24;
long1 |= ((long) (data[4] & 0xFF)) << 16;
long1 |= ((long) (data[7] & 0xFF)) << 8;
long1 |= ((long) (data[6] & 0xFF)) << 0;
long long2 = 0;
long2 |= ((long) (data[8] & 0xFF)) << 56;
long2 |= ((long) (data[9] & 0xFF)) << 48;
long2 |= ((long) (data[10] & 0xFF)) << 40;
long2 |= ((long) (data[11] & 0xFF)) << 32;
long2 |= ((long) (data[12] & 0xFF)) << 24;
long2 |= ((long) (data[13] & 0xFF)) << 16;
long2 |= ((long) (data[14] & 0xFF)) << 8;
long2 |= ((long) (data[15] & 0xFF)) << 0;
return new UUID(long1, long2);
} | java | public static final UUID getUUID(InputStream is) throws IOException
{
byte[] data = new byte[16];
is.read(data);
long long1 = 0;
long1 |= ((long) (data[3] & 0xFF)) << 56;
long1 |= ((long) (data[2] & 0xFF)) << 48;
long1 |= ((long) (data[1] & 0xFF)) << 40;
long1 |= ((long) (data[0] & 0xFF)) << 32;
long1 |= ((long) (data[5] & 0xFF)) << 24;
long1 |= ((long) (data[4] & 0xFF)) << 16;
long1 |= ((long) (data[7] & 0xFF)) << 8;
long1 |= ((long) (data[6] & 0xFF)) << 0;
long long2 = 0;
long2 |= ((long) (data[8] & 0xFF)) << 56;
long2 |= ((long) (data[9] & 0xFF)) << 48;
long2 |= ((long) (data[10] & 0xFF)) << 40;
long2 |= ((long) (data[11] & 0xFF)) << 32;
long2 |= ((long) (data[12] & 0xFF)) << 24;
long2 |= ((long) (data[13] & 0xFF)) << 16;
long2 |= ((long) (data[14] & 0xFF)) << 8;
long2 |= ((long) (data[15] & 0xFF)) << 0;
return new UUID(long1, long2);
} | [
"public",
"static",
"final",
"UUID",
"getUUID",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"16",
"]",
";",
"is",
".",
"read",
"(",
"data",
")",
";",
"long",
"long1",
"=",
"0",
";"... | Retrieve a UUID from an input stream.
@param is input stream
@return UUID instance | [
"Retrieve",
"a",
"UUID",
"from",
"an",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L235-L261 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getDate | public static final Date getDate(InputStream is) throws IOException
{
long timeInSeconds = getInt(is);
if (timeInSeconds == 0x93406FFF)
{
return null;
}
timeInSeconds -= 3600;
timeInSeconds *= 1000;
return DateHelper.getDateFromLong(timeInSeconds);
} | java | public static final Date getDate(InputStream is) throws IOException
{
long timeInSeconds = getInt(is);
if (timeInSeconds == 0x93406FFF)
{
return null;
}
timeInSeconds -= 3600;
timeInSeconds *= 1000;
return DateHelper.getDateFromLong(timeInSeconds);
} | [
"public",
"static",
"final",
"Date",
"getDate",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"long",
"timeInSeconds",
"=",
"getInt",
"(",
"is",
")",
";",
"if",
"(",
"timeInSeconds",
"==",
"0x93406FFF",
")",
"{",
"return",
"null",
";",
"}",
... | Read a Synchro date from an input stream.
@param is input stream
@return Date instance | [
"Read",
"a",
"Synchro",
"date",
"from",
"an",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L269-L279 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getTime | public static final Date getTime(InputStream is) throws IOException
{
int timeValue = getInt(is);
timeValue -= 86400;
timeValue /= 60;
return DateHelper.getTimeFromMinutesPastMidnight(Integer.valueOf(timeValue));
} | java | public static final Date getTime(InputStream is) throws IOException
{
int timeValue = getInt(is);
timeValue -= 86400;
timeValue /= 60;
return DateHelper.getTimeFromMinutesPastMidnight(Integer.valueOf(timeValue));
} | [
"public",
"static",
"final",
"Date",
"getTime",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"int",
"timeValue",
"=",
"getInt",
"(",
"is",
")",
";",
"timeValue",
"-=",
"86400",
";",
"timeValue",
"/=",
"60",
";",
"return",
"DateHelper",
".",... | Read a Synchro time from an input stream.
@param is input stream
@return Date instance | [
"Read",
"a",
"Synchro",
"time",
"from",
"an",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L287-L293 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getDuration | public static final Duration getDuration(InputStream is) throws IOException
{
double durationInSeconds = getInt(is);
durationInSeconds /= (60 * 60);
return Duration.getInstance(durationInSeconds, TimeUnit.HOURS);
} | java | public static final Duration getDuration(InputStream is) throws IOException
{
double durationInSeconds = getInt(is);
durationInSeconds /= (60 * 60);
return Duration.getInstance(durationInSeconds, TimeUnit.HOURS);
} | [
"public",
"static",
"final",
"Duration",
"getDuration",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"double",
"durationInSeconds",
"=",
"getInt",
"(",
"is",
")",
";",
"durationInSeconds",
"/=",
"(",
"60",
"*",
"60",
")",
";",
"return",
"Dura... | Retrieve a Synchro Duration from an input stream.
@param is input stream
@return Duration instance | [
"Retrieve",
"a",
"Synchro",
"Duration",
"from",
"an",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L301-L306 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getDouble | public static final Double getDouble(InputStream is) throws IOException
{
double result = Double.longBitsToDouble(getLong(is));
if (Double.isNaN(result))
{
result = 0;
}
return Double.valueOf(result);
} | java | public static final Double getDouble(InputStream is) throws IOException
{
double result = Double.longBitsToDouble(getLong(is));
if (Double.isNaN(result))
{
result = 0;
}
return Double.valueOf(result);
} | [
"public",
"static",
"final",
"Double",
"getDouble",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"double",
"result",
"=",
"Double",
".",
"longBitsToDouble",
"(",
"getLong",
"(",
"is",
")",
")",
";",
"if",
"(",
"Double",
".",
"isNaN",
"(",
... | Retrieve a Double from an input stream.
@param is input stream
@return Double instance | [
"Retrieve",
"a",
"Double",
"from",
"an",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L314-L322 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/CustomFieldAliasReader.java | CustomFieldAliasReader.process | public void process()
{
if (m_data != null)
{
int index = 0;
int offset = 0;
// First the length (repeated twice)
int length = MPPUtility.getInt(m_data, offset);
offset += 8;
// Then the number of custom columns
int numberOfAliases = MPPUtility.getInt(m_data, offset);
offset += 4;
// Then the aliases themselves
while (index < numberOfAliases && offset < length)
{
// Each item consists of the Field ID (2 bytes), 40 0B marker (2 bytes), and the
// offset to the string (4 bytes)
// Get the Field ID
int fieldID = MPPUtility.getInt(m_data, offset);
offset += 4;
// Get the alias offset (offset + 4 for some reason).
int aliasOffset = MPPUtility.getInt(m_data, offset) + 4;
offset += 4;
// Read the alias itself
if (aliasOffset < m_data.length)
{
String alias = MPPUtility.getUnicodeString(m_data, aliasOffset);
m_fields.getCustomField(FieldTypeHelper.getInstance(fieldID)).setAlias(alias);
}
index++;
}
}
} | java | public void process()
{
if (m_data != null)
{
int index = 0;
int offset = 0;
// First the length (repeated twice)
int length = MPPUtility.getInt(m_data, offset);
offset += 8;
// Then the number of custom columns
int numberOfAliases = MPPUtility.getInt(m_data, offset);
offset += 4;
// Then the aliases themselves
while (index < numberOfAliases && offset < length)
{
// Each item consists of the Field ID (2 bytes), 40 0B marker (2 bytes), and the
// offset to the string (4 bytes)
// Get the Field ID
int fieldID = MPPUtility.getInt(m_data, offset);
offset += 4;
// Get the alias offset (offset + 4 for some reason).
int aliasOffset = MPPUtility.getInt(m_data, offset) + 4;
offset += 4;
// Read the alias itself
if (aliasOffset < m_data.length)
{
String alias = MPPUtility.getUnicodeString(m_data, aliasOffset);
m_fields.getCustomField(FieldTypeHelper.getInstance(fieldID)).setAlias(alias);
}
index++;
}
}
} | [
"public",
"void",
"process",
"(",
")",
"{",
"if",
"(",
"m_data",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"0",
";",
"int",
"offset",
"=",
"0",
";",
"// First the length (repeated twice)",
"int",
"length",
"=",
"MPPUtility",
".",
"getInt",
"(",
"m_dat... | Process field aliases. | [
"Process",
"field",
"aliases",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldAliasReader.java#L49-L83 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/schema/ProjectListType.java | ProjectListType.getProject | public List<ProjectListType.Project> getProject()
{
if (project == null)
{
project = new ArrayList<ProjectListType.Project>();
}
return this.project;
} | java | public List<ProjectListType.Project> getProject()
{
if (project == null)
{
project = new ArrayList<ProjectListType.Project>();
}
return this.project;
} | [
"public",
"List",
"<",
"ProjectListType",
".",
"Project",
">",
"getProject",
"(",
")",
"{",
"if",
"(",
"project",
"==",
"null",
")",
"{",
"project",
"=",
"new",
"ArrayList",
"<",
"ProjectListType",
".",
"Project",
">",
"(",
")",
";",
"}",
"return",
"th... | Gets the value of the project property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the project property.
<p>
For example, to add a new item, do as follows:
<pre>
getProject().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link ProjectListType.Project } | [
"Gets",
"the",
"value",
"of",
"the",
"project",
"property",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/schema/ProjectListType.java#L92-L99 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printExtendedAttributeCurrency | public static final String printExtendedAttributeCurrency(Number value)
{
return (value == null ? null : NUMBER_FORMAT.get().format(value.doubleValue() * 100));
} | java | public static final String printExtendedAttributeCurrency(Number value)
{
return (value == null ? null : NUMBER_FORMAT.get().format(value.doubleValue() * 100));
} | [
"public",
"static",
"final",
"String",
"printExtendedAttributeCurrency",
"(",
"Number",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"NUMBER_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
".",
"doubleValue",
"(",
... | Print an extended attribute currency value.
@param value currency value
@return string representation | [
"Print",
"an",
"extended",
"attribute",
"currency",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L71-L74 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseExtendedAttributeCurrency | public static final Number parseExtendedAttributeCurrency(String value)
{
Number result;
if (value == null)
{
result = null;
}
else
{
result = NumberHelper.getDouble(Double.parseDouble(correctNumberFormat(value)) / 100);
}
return result;
} | java | public static final Number parseExtendedAttributeCurrency(String value)
{
Number result;
if (value == null)
{
result = null;
}
else
{
result = NumberHelper.getDouble(Double.parseDouble(correctNumberFormat(value)) / 100);
}
return result;
} | [
"public",
"static",
"final",
"Number",
"parseExtendedAttributeCurrency",
"(",
"String",
"value",
")",
"{",
"Number",
"result",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"result",
"=",
"NumberHelper",
"."... | Parse an extended attribute currency value.
@param value string representation
@return currency value | [
"Parse",
"an",
"extended",
"attribute",
"currency",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L82-L95 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseExtendedAttributeBoolean | public static final Boolean parseExtendedAttributeBoolean(String value)
{
return ((value.equals("1") ? Boolean.TRUE : Boolean.FALSE));
} | java | public static final Boolean parseExtendedAttributeBoolean(String value)
{
return ((value.equals("1") ? Boolean.TRUE : Boolean.FALSE));
} | [
"public",
"static",
"final",
"Boolean",
"parseExtendedAttributeBoolean",
"(",
"String",
"value",
")",
"{",
"return",
"(",
"(",
"value",
".",
"equals",
"(",
"\"1\"",
")",
"?",
"Boolean",
".",
"TRUE",
":",
"Boolean",
".",
"FALSE",
")",
")",
";",
"}"
] | Parse an extended attribute boolean value.
@param value string representation
@return boolean value | [
"Parse",
"an",
"extended",
"attribute",
"boolean",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L136-L139 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printExtendedAttributeDate | public static final String printExtendedAttributeDate(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | java | public static final String printExtendedAttributeDate(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printExtendedAttributeDate",
"(",
"Date",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"DATE_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
")",
")",
";",
"}"
] | Print an extended attribute date value.
@param value date value
@return string representation | [
"Print",
"an",
"extended",
"attribute",
"date",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L147-L150 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseExtendedAttributeDate | public static final Date parseExtendedAttributeDate(String value)
{
Date result = null;
if (value != null)
{
try
{
result = DATE_FORMAT.get().parse(value);
}
catch (ParseException ex)
{
// ignore exceptions
}
}
return (result);
} | java | public static final Date parseExtendedAttributeDate(String value)
{
Date result = null;
if (value != null)
{
try
{
result = DATE_FORMAT.get().parse(value);
}
catch (ParseException ex)
{
// ignore exceptions
}
}
return (result);
} | [
"public",
"static",
"final",
"Date",
"parseExtendedAttributeDate",
"(",
"String",
"value",
")",
"{",
"Date",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"result",
"=",
"DATE_FORMAT",
".",
"get",
"(",
")",
".",
"p... | Parse an extended attribute date value.
@param value string representation
@return date value | [
"Parse",
"an",
"extended",
"attribute",
"date",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L158-L176 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printExtendedAttribute | public static final String printExtendedAttribute(MSPDIWriter writer, Object value, DataType type)
{
String result;
if (type == DataType.DATE)
{
result = printExtendedAttributeDate((Date) value);
}
else
{
if (value instanceof Boolean)
{
result = printExtendedAttributeBoolean((Boolean) value);
}
else
{
if (value instanceof Duration)
{
result = printDuration(writer, (Duration) value);
}
else
{
if (type == DataType.CURRENCY)
{
result = printExtendedAttributeCurrency((Number) value);
}
else
{
if (value instanceof Number)
{
result = printExtendedAttributeNumber((Number) value);
}
else
{
result = value.toString();
}
}
}
}
}
return (result);
} | java | public static final String printExtendedAttribute(MSPDIWriter writer, Object value, DataType type)
{
String result;
if (type == DataType.DATE)
{
result = printExtendedAttributeDate((Date) value);
}
else
{
if (value instanceof Boolean)
{
result = printExtendedAttributeBoolean((Boolean) value);
}
else
{
if (value instanceof Duration)
{
result = printDuration(writer, (Duration) value);
}
else
{
if (type == DataType.CURRENCY)
{
result = printExtendedAttributeCurrency((Number) value);
}
else
{
if (value instanceof Number)
{
result = printExtendedAttributeNumber((Number) value);
}
else
{
result = value.toString();
}
}
}
}
}
return (result);
} | [
"public",
"static",
"final",
"String",
"printExtendedAttribute",
"(",
"MSPDIWriter",
"writer",
",",
"Object",
"value",
",",
"DataType",
"type",
")",
"{",
"String",
"result",
";",
"if",
"(",
"type",
"==",
"DataType",
".",
"DATE",
")",
"{",
"result",
"=",
"p... | Print an extended attribute value.
@param writer parent MSPDIWriter instance
@param value attribute value
@param type type of the value being passed
@return string representation | [
"Print",
"an",
"extended",
"attribute",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L186-L228 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseExtendedAttribute | public static final void parseExtendedAttribute(ProjectFile file, FieldContainer mpx, String value, FieldType mpxFieldID, TimeUnit durationFormat)
{
if (mpxFieldID != null)
{
switch (mpxFieldID.getDataType())
{
case STRING:
{
mpx.set(mpxFieldID, value);
break;
}
case DATE:
{
mpx.set(mpxFieldID, parseExtendedAttributeDate(value));
break;
}
case CURRENCY:
{
mpx.set(mpxFieldID, parseExtendedAttributeCurrency(value));
break;
}
case BOOLEAN:
{
mpx.set(mpxFieldID, parseExtendedAttributeBoolean(value));
break;
}
case NUMERIC:
{
mpx.set(mpxFieldID, parseExtendedAttributeNumber(value));
break;
}
case DURATION:
{
mpx.set(mpxFieldID, parseDuration(file, durationFormat, value));
break;
}
default:
{
break;
}
}
}
} | java | public static final void parseExtendedAttribute(ProjectFile file, FieldContainer mpx, String value, FieldType mpxFieldID, TimeUnit durationFormat)
{
if (mpxFieldID != null)
{
switch (mpxFieldID.getDataType())
{
case STRING:
{
mpx.set(mpxFieldID, value);
break;
}
case DATE:
{
mpx.set(mpxFieldID, parseExtendedAttributeDate(value));
break;
}
case CURRENCY:
{
mpx.set(mpxFieldID, parseExtendedAttributeCurrency(value));
break;
}
case BOOLEAN:
{
mpx.set(mpxFieldID, parseExtendedAttributeBoolean(value));
break;
}
case NUMERIC:
{
mpx.set(mpxFieldID, parseExtendedAttributeNumber(value));
break;
}
case DURATION:
{
mpx.set(mpxFieldID, parseDuration(file, durationFormat, value));
break;
}
default:
{
break;
}
}
}
} | [
"public",
"static",
"final",
"void",
"parseExtendedAttribute",
"(",
"ProjectFile",
"file",
",",
"FieldContainer",
"mpx",
",",
"String",
"value",
",",
"FieldType",
"mpxFieldID",
",",
"TimeUnit",
"durationFormat",
")",
"{",
"if",
"(",
"mpxFieldID",
"!=",
"null",
"... | Parse an extended attribute value.
@param file parent file
@param mpx parent entity
@param value string value
@param mpxFieldID field ID
@param durationFormat duration format associated with the extended attribute | [
"Parse",
"an",
"extended",
"attribute",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L239-L287 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printCurrencySymbolPosition | public static final String printCurrencySymbolPosition(CurrencySymbolPosition value)
{
String result;
switch (value)
{
default:
case BEFORE:
{
result = "0";
break;
}
case AFTER:
{
result = "1";
break;
}
case BEFORE_WITH_SPACE:
{
result = "2";
break;
}
case AFTER_WITH_SPACE:
{
result = "3";
break;
}
}
return (result);
} | java | public static final String printCurrencySymbolPosition(CurrencySymbolPosition value)
{
String result;
switch (value)
{
default:
case BEFORE:
{
result = "0";
break;
}
case AFTER:
{
result = "1";
break;
}
case BEFORE_WITH_SPACE:
{
result = "2";
break;
}
case AFTER_WITH_SPACE:
{
result = "3";
break;
}
}
return (result);
} | [
"public",
"static",
"final",
"String",
"printCurrencySymbolPosition",
"(",
"CurrencySymbolPosition",
"value",
")",
"{",
"String",
"result",
";",
"switch",
"(",
"value",
")",
"{",
"default",
":",
"case",
"BEFORE",
":",
"{",
"result",
"=",
"\"0\"",
";",
"break",... | Prints a currency symbol position value.
@param value CurrencySymbolPosition instance
@return currency symbol position | [
"Prints",
"a",
"currency",
"symbol",
"position",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L295-L328 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseCurrencySymbolPosition | public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value)
{
CurrencySymbolPosition result = CurrencySymbolPosition.BEFORE;
switch (NumberHelper.getInt(value))
{
case 0:
{
result = CurrencySymbolPosition.BEFORE;
break;
}
case 1:
{
result = CurrencySymbolPosition.AFTER;
break;
}
case 2:
{
result = CurrencySymbolPosition.BEFORE_WITH_SPACE;
break;
}
case 3:
{
result = CurrencySymbolPosition.AFTER_WITH_SPACE;
break;
}
}
return (result);
} | java | public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value)
{
CurrencySymbolPosition result = CurrencySymbolPosition.BEFORE;
switch (NumberHelper.getInt(value))
{
case 0:
{
result = CurrencySymbolPosition.BEFORE;
break;
}
case 1:
{
result = CurrencySymbolPosition.AFTER;
break;
}
case 2:
{
result = CurrencySymbolPosition.BEFORE_WITH_SPACE;
break;
}
case 3:
{
result = CurrencySymbolPosition.AFTER_WITH_SPACE;
break;
}
}
return (result);
} | [
"public",
"static",
"final",
"CurrencySymbolPosition",
"parseCurrencySymbolPosition",
"(",
"String",
"value",
")",
"{",
"CurrencySymbolPosition",
"result",
"=",
"CurrencySymbolPosition",
".",
"BEFORE",
";",
"switch",
"(",
"NumberHelper",
".",
"getInt",
"(",
"value",
"... | Parse a currency symbol position value.
@param value currency symbol position
@return CurrencySymbolPosition instance | [
"Parse",
"a",
"currency",
"symbol",
"position",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L336-L368 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printAccrueType | public static final String printAccrueType(AccrueType value)
{
return (Integer.toString(value == null ? AccrueType.PRORATED.getValue() : value.getValue()));
} | java | public static final String printAccrueType(AccrueType value)
{
return (Integer.toString(value == null ? AccrueType.PRORATED.getValue() : value.getValue()));
} | [
"public",
"static",
"final",
"String",
"printAccrueType",
"(",
"AccrueType",
"value",
")",
"{",
"return",
"(",
"Integer",
".",
"toString",
"(",
"value",
"==",
"null",
"?",
"AccrueType",
".",
"PRORATED",
".",
"getValue",
"(",
")",
":",
"value",
".",
"getVal... | Print an accrue type.
@param value AccrueType instance
@return accrue type value | [
"Print",
"an",
"accrue",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L376-L379 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printResourceType | public static final String printResourceType(ResourceType value)
{
return (Integer.toString(value == null ? ResourceType.WORK.getValue() : value.getValue()));
} | java | public static final String printResourceType(ResourceType value)
{
return (Integer.toString(value == null ? ResourceType.WORK.getValue() : value.getValue()));
} | [
"public",
"static",
"final",
"String",
"printResourceType",
"(",
"ResourceType",
"value",
")",
"{",
"return",
"(",
"Integer",
".",
"toString",
"(",
"value",
"==",
"null",
"?",
"ResourceType",
".",
"WORK",
".",
"getValue",
"(",
")",
":",
"value",
".",
"getV... | Print a resource type.
@param value ResourceType instance
@return resource type value | [
"Print",
"a",
"resource",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L398-L401 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printWorkGroup | public static final String printWorkGroup(WorkGroup value)
{
return (Integer.toString(value == null ? WorkGroup.DEFAULT.getValue() : value.getValue()));
} | java | public static final String printWorkGroup(WorkGroup value)
{
return (Integer.toString(value == null ? WorkGroup.DEFAULT.getValue() : value.getValue()));
} | [
"public",
"static",
"final",
"String",
"printWorkGroup",
"(",
"WorkGroup",
"value",
")",
"{",
"return",
"(",
"Integer",
".",
"toString",
"(",
"value",
"==",
"null",
"?",
"WorkGroup",
".",
"DEFAULT",
".",
"getValue",
"(",
")",
":",
"value",
".",
"getValue",... | Print a work group.
@param value WorkGroup instance
@return work group value | [
"Print",
"a",
"work",
"group",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L420-L423 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printWorkContour | public static final String printWorkContour(WorkContour value)
{
return (Integer.toString(value == null ? WorkContour.FLAT.getValue() : value.getValue()));
} | java | public static final String printWorkContour(WorkContour value)
{
return (Integer.toString(value == null ? WorkContour.FLAT.getValue() : value.getValue()));
} | [
"public",
"static",
"final",
"String",
"printWorkContour",
"(",
"WorkContour",
"value",
")",
"{",
"return",
"(",
"Integer",
".",
"toString",
"(",
"value",
"==",
"null",
"?",
"WorkContour",
".",
"FLAT",
".",
"getValue",
"(",
")",
":",
"value",
".",
"getValu... | Print a work contour.
@param value WorkContour instance
@return work contour value | [
"Print",
"a",
"work",
"contour",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L442-L445 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printBookingType | public static final String printBookingType(BookingType value)
{
return (Integer.toString(value == null ? BookingType.COMMITTED.getValue() : value.getValue()));
} | java | public static final String printBookingType(BookingType value)
{
return (Integer.toString(value == null ? BookingType.COMMITTED.getValue() : value.getValue()));
} | [
"public",
"static",
"final",
"String",
"printBookingType",
"(",
"BookingType",
"value",
")",
"{",
"return",
"(",
"Integer",
".",
"toString",
"(",
"value",
"==",
"null",
"?",
"BookingType",
".",
"COMMITTED",
".",
"getValue",
"(",
")",
":",
"value",
".",
"ge... | Print a booking type.
@param value BookingType instance
@return booking type value | [
"Print",
"a",
"booking",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L464-L467 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printTaskType | public static final String printTaskType(TaskType value)
{
return (Integer.toString(value == null ? TaskType.FIXED_UNITS.getValue() : value.getValue()));
} | java | public static final String printTaskType(TaskType value)
{
return (Integer.toString(value == null ? TaskType.FIXED_UNITS.getValue() : value.getValue()));
} | [
"public",
"static",
"final",
"String",
"printTaskType",
"(",
"TaskType",
"value",
")",
"{",
"return",
"(",
"Integer",
".",
"toString",
"(",
"value",
"==",
"null",
"?",
"TaskType",
".",
"FIXED_UNITS",
".",
"getValue",
"(",
")",
":",
"value",
".",
"getValue"... | Print a task type.
@param value TaskType instance
@return task type value | [
"Print",
"a",
"task",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L486-L489 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printEarnedValueMethod | public static final BigInteger printEarnedValueMethod(EarnedValueMethod value)
{
return (value == null ? BigInteger.valueOf(EarnedValueMethod.PERCENT_COMPLETE.getValue()) : BigInteger.valueOf(value.getValue()));
} | java | public static final BigInteger printEarnedValueMethod(EarnedValueMethod value)
{
return (value == null ? BigInteger.valueOf(EarnedValueMethod.PERCENT_COMPLETE.getValue()) : BigInteger.valueOf(value.getValue()));
} | [
"public",
"static",
"final",
"BigInteger",
"printEarnedValueMethod",
"(",
"EarnedValueMethod",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"BigInteger",
".",
"valueOf",
"(",
"EarnedValueMethod",
".",
"PERCENT_COMPLETE",
".",
"getValue",
"(",
")",... | Print an earned value method.
@param value EarnedValueMethod instance
@return earned value method value | [
"Print",
"an",
"earned",
"value",
"method",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L508-L511 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printUnits | public static final BigDecimal printUnits(Number value)
{
return (value == null ? BIGDECIMAL_ONE : new BigDecimal(value.doubleValue() / 100));
} | java | public static final BigDecimal printUnits(Number value)
{
return (value == null ? BIGDECIMAL_ONE : new BigDecimal(value.doubleValue() / 100));
} | [
"public",
"static",
"final",
"BigDecimal",
"printUnits",
"(",
"Number",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"BIGDECIMAL_ONE",
":",
"new",
"BigDecimal",
"(",
"value",
".",
"doubleValue",
"(",
")",
"/",
"100",
")",
")",
";",
"}"
] | Print units.
@param value units value
@return units value | [
"Print",
"units",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L530-L533 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseUnits | public static final Number parseUnits(Number value)
{
return (value == null ? null : NumberHelper.getDouble(value.doubleValue() * 100));
} | java | public static final Number parseUnits(Number value)
{
return (value == null ? null : NumberHelper.getDouble(value.doubleValue() * 100));
} | [
"public",
"static",
"final",
"Number",
"parseUnits",
"(",
"Number",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"NumberHelper",
".",
"getDouble",
"(",
"value",
".",
"doubleValue",
"(",
")",
"*",
"100",
")",
")",
";",
"}"
... | Parse units.
@param value units value
@return units value | [
"Parse",
"units",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L541-L544 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printTimeUnit | public static final BigInteger printTimeUnit(TimeUnit value)
{
return (BigInteger.valueOf(value == null ? TimeUnit.DAYS.getValue() + 1 : value.getValue() + 1));
} | java | public static final BigInteger printTimeUnit(TimeUnit value)
{
return (BigInteger.valueOf(value == null ? TimeUnit.DAYS.getValue() + 1 : value.getValue() + 1));
} | [
"public",
"static",
"final",
"BigInteger",
"printTimeUnit",
"(",
"TimeUnit",
"value",
")",
"{",
"return",
"(",
"BigInteger",
".",
"valueOf",
"(",
"value",
"==",
"null",
"?",
"TimeUnit",
".",
"DAYS",
".",
"getValue",
"(",
")",
"+",
"1",
":",
"value",
".",... | Print time unit.
@param value TimeUnit instance
@return time unit value | [
"Print",
"time",
"unit",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L552-L555 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseWorkUnits | public static final TimeUnit parseWorkUnits(BigInteger value)
{
TimeUnit result = TimeUnit.HOURS;
if (value != null)
{
switch (value.intValue())
{
case 1:
{
result = TimeUnit.MINUTES;
break;
}
case 3:
{
result = TimeUnit.DAYS;
break;
}
case 4:
{
result = TimeUnit.WEEKS;
break;
}
case 5:
{
result = TimeUnit.MONTHS;
break;
}
case 7:
{
result = TimeUnit.YEARS;
break;
}
default:
case 2:
{
result = TimeUnit.HOURS;
break;
}
}
}
return (result);
} | java | public static final TimeUnit parseWorkUnits(BigInteger value)
{
TimeUnit result = TimeUnit.HOURS;
if (value != null)
{
switch (value.intValue())
{
case 1:
{
result = TimeUnit.MINUTES;
break;
}
case 3:
{
result = TimeUnit.DAYS;
break;
}
case 4:
{
result = TimeUnit.WEEKS;
break;
}
case 5:
{
result = TimeUnit.MONTHS;
break;
}
case 7:
{
result = TimeUnit.YEARS;
break;
}
default:
case 2:
{
result = TimeUnit.HOURS;
break;
}
}
}
return (result);
} | [
"public",
"static",
"final",
"TimeUnit",
"parseWorkUnits",
"(",
"BigInteger",
"value",
")",
"{",
"TimeUnit",
"result",
"=",
"TimeUnit",
".",
"HOURS",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"switch",
"(",
"value",
".",
"intValue",
"(",
")",
")",... | Parse work units.
@param value work units value
@return TimeUnit instance | [
"Parse",
"work",
"units",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L592-L640 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printWorkUnits | public static final BigInteger printWorkUnits(TimeUnit value)
{
int result;
if (value == null)
{
value = TimeUnit.HOURS;
}
switch (value)
{
case MINUTES:
{
result = 1;
break;
}
case DAYS:
{
result = 3;
break;
}
case WEEKS:
{
result = 4;
break;
}
case MONTHS:
{
result = 5;
break;
}
case YEARS:
{
result = 7;
break;
}
default:
case HOURS:
{
result = 2;
break;
}
}
return (BigInteger.valueOf(result));
} | java | public static final BigInteger printWorkUnits(TimeUnit value)
{
int result;
if (value == null)
{
value = TimeUnit.HOURS;
}
switch (value)
{
case MINUTES:
{
result = 1;
break;
}
case DAYS:
{
result = 3;
break;
}
case WEEKS:
{
result = 4;
break;
}
case MONTHS:
{
result = 5;
break;
}
case YEARS:
{
result = 7;
break;
}
default:
case HOURS:
{
result = 2;
break;
}
}
return (BigInteger.valueOf(result));
} | [
"public",
"static",
"final",
"BigInteger",
"printWorkUnits",
"(",
"TimeUnit",
"value",
")",
"{",
"int",
"result",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"TimeUnit",
".",
"HOURS",
";",
"}",
"switch",
"(",
"value",
")",
"{",
"case... | Print work units.
@param value TimeUnit instance
@return work units value | [
"Print",
"work",
"units",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L648-L698 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseCurrency | public static final Double parseCurrency(Number value)
{
return (value == null ? null : NumberHelper.getDouble(value.doubleValue() / 100));
} | java | public static final Double parseCurrency(Number value)
{
return (value == null ? null : NumberHelper.getDouble(value.doubleValue() / 100));
} | [
"public",
"static",
"final",
"Double",
"parseCurrency",
"(",
"Number",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"NumberHelper",
".",
"getDouble",
"(",
"value",
".",
"doubleValue",
"(",
")",
"/",
"100",
")",
")",
";",
"... | Parse currency.
@param value currency value
@return currency value | [
"Parse",
"currency",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1007-L1010 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printCurrency | public static final BigDecimal printCurrency(Number value)
{
return (value == null || value.doubleValue() == 0 ? null : new BigDecimal(value.doubleValue() * 100));
} | java | public static final BigDecimal printCurrency(Number value)
{
return (value == null || value.doubleValue() == 0 ? null : new BigDecimal(value.doubleValue() * 100));
} | [
"public",
"static",
"final",
"BigDecimal",
"printCurrency",
"(",
"Number",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"doubleValue",
"(",
")",
"==",
"0",
"?",
"null",
":",
"new",
"BigDecimal",
"(",
"value",
".",
"doubleV... | Print currency.
@param value currency value
@return currency value | [
"Print",
"currency",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1018-L1021 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseDurationTimeUnits | public static final TimeUnit parseDurationTimeUnits(BigInteger value, TimeUnit defaultValue)
{
TimeUnit result = defaultValue;
if (value != null)
{
switch (value.intValue())
{
case 3:
case 35:
{
result = TimeUnit.MINUTES;
break;
}
case 4:
case 36:
{
result = TimeUnit.ELAPSED_MINUTES;
break;
}
case 5:
case 37:
{
result = TimeUnit.HOURS;
break;
}
case 6:
case 38:
{
result = TimeUnit.ELAPSED_HOURS;
break;
}
case 7:
case 39:
case 53:
{
result = TimeUnit.DAYS;
break;
}
case 8:
case 40:
{
result = TimeUnit.ELAPSED_DAYS;
break;
}
case 9:
case 41:
{
result = TimeUnit.WEEKS;
break;
}
case 10:
case 42:
{
result = TimeUnit.ELAPSED_WEEKS;
break;
}
case 11:
case 43:
{
result = TimeUnit.MONTHS;
break;
}
case 12:
case 44:
{
result = TimeUnit.ELAPSED_MONTHS;
break;
}
case 19:
case 51:
{
result = TimeUnit.PERCENT;
break;
}
case 20:
case 52:
{
result = TimeUnit.ELAPSED_PERCENT;
break;
}
default:
{
result = PARENT_FILE.get().getProjectProperties().getDefaultDurationUnits();
break;
}
}
}
return (result);
} | java | public static final TimeUnit parseDurationTimeUnits(BigInteger value, TimeUnit defaultValue)
{
TimeUnit result = defaultValue;
if (value != null)
{
switch (value.intValue())
{
case 3:
case 35:
{
result = TimeUnit.MINUTES;
break;
}
case 4:
case 36:
{
result = TimeUnit.ELAPSED_MINUTES;
break;
}
case 5:
case 37:
{
result = TimeUnit.HOURS;
break;
}
case 6:
case 38:
{
result = TimeUnit.ELAPSED_HOURS;
break;
}
case 7:
case 39:
case 53:
{
result = TimeUnit.DAYS;
break;
}
case 8:
case 40:
{
result = TimeUnit.ELAPSED_DAYS;
break;
}
case 9:
case 41:
{
result = TimeUnit.WEEKS;
break;
}
case 10:
case 42:
{
result = TimeUnit.ELAPSED_WEEKS;
break;
}
case 11:
case 43:
{
result = TimeUnit.MONTHS;
break;
}
case 12:
case 44:
{
result = TimeUnit.ELAPSED_MONTHS;
break;
}
case 19:
case 51:
{
result = TimeUnit.PERCENT;
break;
}
case 20:
case 52:
{
result = TimeUnit.ELAPSED_PERCENT;
break;
}
default:
{
result = PARENT_FILE.get().getProjectProperties().getDefaultDurationUnits();
break;
}
}
}
return (result);
} | [
"public",
"static",
"final",
"TimeUnit",
"parseDurationTimeUnits",
"(",
"BigInteger",
"value",
",",
"TimeUnit",
"defaultValue",
")",
"{",
"TimeUnit",
"result",
"=",
"defaultValue",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"switch",
"(",
"value",
".",
... | Parse duration time units.
Note that we don't differentiate between confirmed and unconfirmed
durations. Unrecognised duration types are default the supplied default value.
@param value BigInteger value
@param defaultValue if value is null, use this value as the result
@return Duration units | [
"Parse",
"duration",
"time",
"units",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1047-L1149 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parsePriority | public static final Priority parsePriority(BigInteger priority)
{
return (priority == null ? null : Priority.getInstance(priority.intValue()));
} | java | public static final Priority parsePriority(BigInteger priority)
{
return (priority == null ? null : Priority.getInstance(priority.intValue()));
} | [
"public",
"static",
"final",
"Priority",
"parsePriority",
"(",
"BigInteger",
"priority",
")",
"{",
"return",
"(",
"priority",
"==",
"null",
"?",
"null",
":",
"Priority",
".",
"getInstance",
"(",
"priority",
".",
"intValue",
"(",
")",
")",
")",
";",
"}"
] | Parse priority.
@param priority priority value
@return Priority instance | [
"Parse",
"priority",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1256-L1259 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printPriority | public static final BigInteger printPriority(Priority priority)
{
int result = Priority.MEDIUM;
if (priority != null)
{
result = priority.getValue();
}
return (BigInteger.valueOf(result));
} | java | public static final BigInteger printPriority(Priority priority)
{
int result = Priority.MEDIUM;
if (priority != null)
{
result = priority.getValue();
}
return (BigInteger.valueOf(result));
} | [
"public",
"static",
"final",
"BigInteger",
"printPriority",
"(",
"Priority",
"priority",
")",
"{",
"int",
"result",
"=",
"Priority",
".",
"MEDIUM",
";",
"if",
"(",
"priority",
"!=",
"null",
")",
"{",
"result",
"=",
"priority",
".",
"getValue",
"(",
")",
... | Print priority.
@param priority Priority instance
@return priority value | [
"Print",
"priority",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1267-L1277 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseDurationInThousanthsOfMinutes | public static final Duration parseDurationInThousanthsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit)
{
return parseDurationInFractionsOfMinutes(properties, value, targetTimeUnit, 1000);
} | java | public static final Duration parseDurationInThousanthsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit)
{
return parseDurationInFractionsOfMinutes(properties, value, targetTimeUnit, 1000);
} | [
"public",
"static",
"final",
"Duration",
"parseDurationInThousanthsOfMinutes",
"(",
"ProjectProperties",
"properties",
",",
"Number",
"value",
",",
"TimeUnit",
"targetTimeUnit",
")",
"{",
"return",
"parseDurationInFractionsOfMinutes",
"(",
"properties",
",",
"value",
",",... | Parse duration represented in thousandths of minutes.
@param properties project properties
@param value duration value
@param targetTimeUnit required output time units
@return Duration instance | [
"Parse",
"duration",
"represented",
"in",
"thousandths",
"of",
"minutes",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1309-L1312 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printDurationInDecimalThousandthsOfMinutes | public static final BigDecimal printDurationInDecimalThousandthsOfMinutes(Duration duration)
{
BigDecimal result = null;
if (duration != null && duration.getDuration() != 0)
{
result = BigDecimal.valueOf(printDurationFractionsOfMinutes(duration, 1000));
}
return result;
} | java | public static final BigDecimal printDurationInDecimalThousandthsOfMinutes(Duration duration)
{
BigDecimal result = null;
if (duration != null && duration.getDuration() != 0)
{
result = BigDecimal.valueOf(printDurationFractionsOfMinutes(duration, 1000));
}
return result;
} | [
"public",
"static",
"final",
"BigDecimal",
"printDurationInDecimalThousandthsOfMinutes",
"(",
"Duration",
"duration",
")",
"{",
"BigDecimal",
"result",
"=",
"null",
";",
"if",
"(",
"duration",
"!=",
"null",
"&&",
"duration",
".",
"getDuration",
"(",
")",
"!=",
"... | Print duration in thousandths of minutes.
@param duration Duration instance
@return duration in thousandths of minutes | [
"Print",
"duration",
"in",
"thousandths",
"of",
"minutes",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1349-L1357 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printDurationInIntegerTenthsOfMinutes | public static final BigInteger printDurationInIntegerTenthsOfMinutes(Duration duration)
{
BigInteger result = null;
if (duration != null && duration.getDuration() != 0)
{
result = BigInteger.valueOf((long) printDurationFractionsOfMinutes(duration, 10));
}
return result;
} | java | public static final BigInteger printDurationInIntegerTenthsOfMinutes(Duration duration)
{
BigInteger result = null;
if (duration != null && duration.getDuration() != 0)
{
result = BigInteger.valueOf((long) printDurationFractionsOfMinutes(duration, 10));
}
return result;
} | [
"public",
"static",
"final",
"BigInteger",
"printDurationInIntegerTenthsOfMinutes",
"(",
"Duration",
"duration",
")",
"{",
"BigInteger",
"result",
"=",
"null",
";",
"if",
"(",
"duration",
"!=",
"null",
"&&",
"duration",
".",
"getDuration",
"(",
")",
"!=",
"0",
... | Print duration in tenths of minutes.
@param duration Duration instance
@return duration in tenths of minutes | [
"Print",
"duration",
"in",
"tenths",
"of",
"minutes",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1365-L1375 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseUUID | public static final UUID parseUUID(String value)
{
return value == null || value.isEmpty() ? null : UUID.fromString(value);
} | java | public static final UUID parseUUID(String value)
{
return value == null || value.isEmpty() ? null : UUID.fromString(value);
} | [
"public",
"static",
"final",
"UUID",
"parseUUID",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"||",
"value",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"UUID",
".",
"fromString",
"(",
"value",
")",
";",
"}"
] | Convert the MSPDI representation of a UUID into a Java UUID instance.
@param value MSPDI UUID
@return Java UUID instance | [
"Convert",
"the",
"MSPDI",
"representation",
"of",
"a",
"UUID",
"into",
"a",
"Java",
"UUID",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1383-L1386 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseDurationInFractionsOfMinutes | private static final Duration parseDurationInFractionsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit, int factor)
{
Duration result = null;
if (value != null)
{
result = Duration.getInstance(value.intValue() / factor, TimeUnit.MINUTES);
if (targetTimeUnit != result.getUnits())
{
result = result.convertUnits(targetTimeUnit, properties);
}
}
return (result);
} | java | private static final Duration parseDurationInFractionsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit, int factor)
{
Duration result = null;
if (value != null)
{
result = Duration.getInstance(value.intValue() / factor, TimeUnit.MINUTES);
if (targetTimeUnit != result.getUnits())
{
result = result.convertUnits(targetTimeUnit, properties);
}
}
return (result);
} | [
"private",
"static",
"final",
"Duration",
"parseDurationInFractionsOfMinutes",
"(",
"ProjectProperties",
"properties",
",",
"Number",
"value",
",",
"TimeUnit",
"targetTimeUnit",
",",
"int",
"factor",
")",
"{",
"Duration",
"result",
"=",
"null",
";",
"if",
"(",
"va... | Parse duration represented as an arbitrary fraction of minutes.
@param properties project properties
@param value duration value
@param targetTimeUnit required output time units
@param factor required fraction of a minute
@return Duration instance | [
"Parse",
"duration",
"represented",
"as",
"an",
"arbitrary",
"fraction",
"of",
"minutes",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1408-L1422 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printDurationFractionsOfMinutes | private static final double printDurationFractionsOfMinutes(Duration duration, int factor)
{
double result = 0;
if (duration != null)
{
result = duration.getDuration();
switch (duration.getUnits())
{
case HOURS:
case ELAPSED_HOURS:
{
result *= 60;
break;
}
case DAYS:
{
result *= (60 * 8);
break;
}
case ELAPSED_DAYS:
{
result *= (60 * 24);
break;
}
case WEEKS:
{
result *= (60 * 8 * 5);
break;
}
case ELAPSED_WEEKS:
{
result *= (60 * 24 * 7);
break;
}
case MONTHS:
{
result *= (60 * 8 * 5 * 4);
break;
}
case ELAPSED_MONTHS:
{
result *= (60 * 24 * 30);
break;
}
case YEARS:
{
result *= (60 * 8 * 5 * 52);
break;
}
case ELAPSED_YEARS:
{
result *= (60 * 24 * 365);
break;
}
default:
{
break;
}
}
}
result *= factor;
return (result);
} | java | private static final double printDurationFractionsOfMinutes(Duration duration, int factor)
{
double result = 0;
if (duration != null)
{
result = duration.getDuration();
switch (duration.getUnits())
{
case HOURS:
case ELAPSED_HOURS:
{
result *= 60;
break;
}
case DAYS:
{
result *= (60 * 8);
break;
}
case ELAPSED_DAYS:
{
result *= (60 * 24);
break;
}
case WEEKS:
{
result *= (60 * 8 * 5);
break;
}
case ELAPSED_WEEKS:
{
result *= (60 * 24 * 7);
break;
}
case MONTHS:
{
result *= (60 * 8 * 5 * 4);
break;
}
case ELAPSED_MONTHS:
{
result *= (60 * 24 * 30);
break;
}
case YEARS:
{
result *= (60 * 8 * 5 * 52);
break;
}
case ELAPSED_YEARS:
{
result *= (60 * 24 * 365);
break;
}
default:
{
break;
}
}
}
result *= factor;
return (result);
} | [
"private",
"static",
"final",
"double",
"printDurationFractionsOfMinutes",
"(",
"Duration",
"duration",
",",
"int",
"factor",
")",
"{",
"double",
"result",
"=",
"0",
";",
"if",
"(",
"duration",
"!=",
"null",
")",
"{",
"result",
"=",
"duration",
".",
"getDura... | Print a duration represented by an arbitrary fraction of minutes.
@param duration Duration instance
@param factor required factor
@return duration represented as an arbitrary fraction of minutes | [
"Print",
"a",
"duration",
"represented",
"by",
"an",
"arbitrary",
"fraction",
"of",
"minutes",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1431-L1506 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printRate | public static final BigDecimal printRate(Rate rate)
{
BigDecimal result = null;
if (rate != null && rate.getAmount() != 0)
{
result = new BigDecimal(rate.getAmount());
}
return result;
} | java | public static final BigDecimal printRate(Rate rate)
{
BigDecimal result = null;
if (rate != null && rate.getAmount() != 0)
{
result = new BigDecimal(rate.getAmount());
}
return result;
} | [
"public",
"static",
"final",
"BigDecimal",
"printRate",
"(",
"Rate",
"rate",
")",
"{",
"BigDecimal",
"result",
"=",
"null",
";",
"if",
"(",
"rate",
"!=",
"null",
"&&",
"rate",
".",
"getAmount",
"(",
")",
"!=",
"0",
")",
"{",
"result",
"=",
"new",
"Bi... | Print rate.
@param rate Rate instance
@return rate value | [
"Print",
"rate",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1514-L1522 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseRate | public static final Rate parseRate(BigDecimal value)
{
Rate result = null;
if (value != null)
{
result = new Rate(value, TimeUnit.HOURS);
}
return (result);
} | java | public static final Rate parseRate(BigDecimal value)
{
Rate result = null;
if (value != null)
{
result = new Rate(value, TimeUnit.HOURS);
}
return (result);
} | [
"public",
"static",
"final",
"Rate",
"parseRate",
"(",
"BigDecimal",
"value",
")",
"{",
"Rate",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"Rate",
"(",
"value",
",",
"TimeUnit",
".",
"HOURS",
")",
";... | Parse rate.
@param value rate value
@return Rate instance | [
"Parse",
"rate",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1530-L1540 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printDay | public static final BigInteger printDay(Day day)
{
return (day == null ? null : BigInteger.valueOf(day.getValue() - 1));
} | java | public static final BigInteger printDay(Day day)
{
return (day == null ? null : BigInteger.valueOf(day.getValue() - 1));
} | [
"public",
"static",
"final",
"BigInteger",
"printDay",
"(",
"Day",
"day",
")",
"{",
"return",
"(",
"day",
"==",
"null",
"?",
"null",
":",
"BigInteger",
".",
"valueOf",
"(",
"day",
".",
"getValue",
"(",
")",
"-",
"1",
")",
")",
";",
"}"
] | Print a day.
@param day Day instance
@return day value | [
"Print",
"a",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1548-L1551 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printConstraintType | public static final BigInteger printConstraintType(ConstraintType value)
{
return (value == null ? null : BigInteger.valueOf(value.getValue()));
} | java | public static final BigInteger printConstraintType(ConstraintType value)
{
return (value == null ? null : BigInteger.valueOf(value.getValue()));
} | [
"public",
"static",
"final",
"BigInteger",
"printConstraintType",
"(",
"ConstraintType",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"BigInteger",
".",
"valueOf",
"(",
"value",
".",
"getValue",
"(",
")",
")",
")",
";",
"}"
] | Print a constraint type.
@param value ConstraintType instance
@return constraint type value | [
"Print",
"a",
"constraint",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1581-L1584 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printTaskUID | public static final String printTaskUID(Integer value)
{
ProjectFile file = PARENT_FILE.get();
if (file != null)
{
file.getEventManager().fireTaskWrittenEvent(file.getTaskByUniqueID(value));
}
return (value.toString());
} | java | public static final String printTaskUID(Integer value)
{
ProjectFile file = PARENT_FILE.get();
if (file != null)
{
file.getEventManager().fireTaskWrittenEvent(file.getTaskByUniqueID(value));
}
return (value.toString());
} | [
"public",
"static",
"final",
"String",
"printTaskUID",
"(",
"Integer",
"value",
")",
"{",
"ProjectFile",
"file",
"=",
"PARENT_FILE",
".",
"get",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"file",
".",
"getEventManager",
"(",
")",
".",
"f... | Print a task UID.
@param value task UID
@return task UID string | [
"Print",
"a",
"task",
"UID",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1592-L1600 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printResourceUID | public static final String printResourceUID(Integer value)
{
ProjectFile file = PARENT_FILE.get();
if (file != null)
{
file.getEventManager().fireResourceWrittenEvent(file.getResourceByUniqueID(value));
}
return (value.toString());
} | java | public static final String printResourceUID(Integer value)
{
ProjectFile file = PARENT_FILE.get();
if (file != null)
{
file.getEventManager().fireResourceWrittenEvent(file.getResourceByUniqueID(value));
}
return (value.toString());
} | [
"public",
"static",
"final",
"String",
"printResourceUID",
"(",
"Integer",
"value",
")",
"{",
"ProjectFile",
"file",
"=",
"PARENT_FILE",
".",
"get",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"file",
".",
"getEventManager",
"(",
")",
".",
... | Print a resource UID.
@param value resource UID value
@return resource UID string | [
"Print",
"a",
"resource",
"UID",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1619-L1627 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.parseBoolean | public static final Boolean parseBoolean(String value)
{
return (value == null || value.charAt(0) != '1' ? Boolean.FALSE : Boolean.TRUE);
} | java | public static final Boolean parseBoolean(String value)
{
return (value == null || value.charAt(0) != '1' ? Boolean.FALSE : Boolean.TRUE);
} | [
"public",
"static",
"final",
"Boolean",
"parseBoolean",
"(",
"String",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"charAt",
"(",
"0",
")",
"!=",
"'",
"'",
"?",
"Boolean",
".",
"FALSE",
":",
"Boolean",
".",
"TRUE",
")... | Parse a boolean.
@param value boolean
@return Boolean value | [
"Parse",
"a",
"boolean",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1657-L1660 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printDateTime | public static final String printDateTime(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | java | public static final String printDateTime(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printDateTime",
"(",
"Date",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"DATE_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
")",
")",
";",
"}"
] | Print a date time value.
@param value date time value
@return string representation | [
"Print",
"a",
"date",
"time",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1692-L1695 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.correctNumberFormat | private static final String correctNumberFormat(String value)
{
String result;
int index = value.indexOf(',');
if (index == -1)
{
result = value;
}
else
{
char[] chars = value.toCharArray();
chars[index] = '.';
result = new String(chars);
}
return result;
} | java | private static final String correctNumberFormat(String value)
{
String result;
int index = value.indexOf(',');
if (index == -1)
{
result = value;
}
else
{
char[] chars = value.toCharArray();
chars[index] = '.';
result = new String(chars);
}
return result;
} | [
"private",
"static",
"final",
"String",
"correctNumberFormat",
"(",
"String",
"value",
")",
"{",
"String",
"result",
";",
"int",
"index",
"=",
"value",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"result",
"... | Detect numbers using comma as a decimal separator and replace with period.
@param value original numeric value
@return corrected numeric value | [
"Detect",
"numbers",
"using",
"comma",
"as",
"a",
"decimal",
"separator",
"and",
"replace",
"with",
"period",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1767-L1782 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.setProjectNameAndRead | public static final ProjectFile setProjectNameAndRead(File directory) throws MPXJException
{
List<String> projects = listProjectNames(directory);
if (!projects.isEmpty())
{
P3DatabaseReader reader = new P3DatabaseReader();
reader.setProjectName(projects.get(0));
return reader.read(directory);
}
return null;
} | java | public static final ProjectFile setProjectNameAndRead(File directory) throws MPXJException
{
List<String> projects = listProjectNames(directory);
if (!projects.isEmpty())
{
P3DatabaseReader reader = new P3DatabaseReader();
reader.setProjectName(projects.get(0));
return reader.read(directory);
}
return null;
} | [
"public",
"static",
"final",
"ProjectFile",
"setProjectNameAndRead",
"(",
"File",
"directory",
")",
"throws",
"MPXJException",
"{",
"List",
"<",
"String",
">",
"projects",
"=",
"listProjectNames",
"(",
"directory",
")",
";",
"if",
"(",
"!",
"projects",
".",
"i... | Convenience method which locates the first P3 database in a directory
and opens it.
@param directory directory containing a P3 database
@return ProjectFile instance | [
"Convenience",
"method",
"which",
"locates",
"the",
"first",
"P3",
"database",
"in",
"a",
"directory",
"and",
"opens",
"it",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L87-L99 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.listProjectNames | public static final List<String> listProjectNames(File directory)
{
List<String> result = new ArrayList<String>();
File[] files = directory.listFiles(new FilenameFilter()
{
@Override public boolean accept(File dir, String name)
{
return name.toUpperCase().endsWith("STR.P3");
}
});
if (files != null)
{
for (File file : files)
{
String fileName = file.getName();
String prefix = fileName.substring(0, fileName.length() - 6);
result.add(prefix);
}
}
Collections.sort(result);
return result;
} | java | public static final List<String> listProjectNames(File directory)
{
List<String> result = new ArrayList<String>();
File[] files = directory.listFiles(new FilenameFilter()
{
@Override public boolean accept(File dir, String name)
{
return name.toUpperCase().endsWith("STR.P3");
}
});
if (files != null)
{
for (File file : files)
{
String fileName = file.getName();
String prefix = fileName.substring(0, fileName.length() - 6);
result.add(prefix);
}
}
Collections.sort(result);
return result;
} | [
"public",
"static",
"final",
"List",
"<",
"String",
">",
"listProjectNames",
"(",
"File",
"directory",
")",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"File",
"[",
"]",
"files",
"=",
"director... | Retrieve a list of the available P3 project names from a directory.
@param directory directory containing P3 files
@return list of project names | [
"Retrieve",
"a",
"list",
"of",
"the",
"available",
"P3",
"project",
"names",
"from",
"a",
"directory",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L118-L143 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.readProjectHeader | private void readProjectHeader()
{
Table table = m_tables.get("DIR");
MapRow row = table.find("");
if (row != null)
{
setFields(PROJECT_FIELDS, row, m_projectFile.getProjectProperties());
m_wbsFormat = new P3WbsFormat(row);
}
} | java | private void readProjectHeader()
{
Table table = m_tables.get("DIR");
MapRow row = table.find("");
if (row != null)
{
setFields(PROJECT_FIELDS, row, m_projectFile.getProjectProperties());
m_wbsFormat = new P3WbsFormat(row);
}
} | [
"private",
"void",
"readProjectHeader",
"(",
")",
"{",
"Table",
"table",
"=",
"m_tables",
".",
"get",
"(",
"\"DIR\"",
")",
";",
"MapRow",
"row",
"=",
"table",
".",
"find",
"(",
"\"\"",
")",
";",
"if",
"(",
"row",
"!=",
"null",
")",
"{",
"setFields",
... | Read general project properties. | [
"Read",
"general",
"project",
"properties",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L253-L262 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.readWBS | private void readWBS()
{
Map<Integer, List<MapRow>> levelMap = new HashMap<Integer, List<MapRow>>();
for (MapRow row : m_tables.get("STR"))
{
Integer level = row.getInteger("LEVEL_NUMBER");
List<MapRow> items = levelMap.get(level);
if (items == null)
{
items = new ArrayList<MapRow>();
levelMap.put(level, items);
}
items.add(row);
}
int level = 1;
while (true)
{
List<MapRow> items = levelMap.get(Integer.valueOf(level++));
if (items == null)
{
break;
}
for (MapRow row : items)
{
m_wbsFormat.parseRawValue(row.getString("CODE_VALUE"));
String parentWbsValue = m_wbsFormat.getFormattedParentValue();
String wbsValue = m_wbsFormat.getFormattedValue();
row.setObject("WBS", wbsValue);
row.setObject("PARENT_WBS", parentWbsValue);
}
final AlphanumComparator comparator = new AlphanumComparator();
Collections.sort(items, new Comparator<MapRow>()
{
@Override public int compare(MapRow o1, MapRow o2)
{
return comparator.compare(o1.getString("WBS"), o2.getString("WBS"));
}
});
for (MapRow row : items)
{
String wbs = row.getString("WBS");
if (wbs != null && !wbs.isEmpty())
{
ChildTaskContainer parent = m_wbsMap.get(row.getString("PARENT_WBS"));
if (parent == null)
{
parent = m_projectFile;
}
Task task = parent.addTask();
String name = row.getString("CODE_TITLE");
if (name == null || name.isEmpty())
{
name = wbs;
}
task.setName(name);
task.setWBS(wbs);
task.setSummary(true);
m_wbsMap.put(wbs, task);
}
}
}
} | java | private void readWBS()
{
Map<Integer, List<MapRow>> levelMap = new HashMap<Integer, List<MapRow>>();
for (MapRow row : m_tables.get("STR"))
{
Integer level = row.getInteger("LEVEL_NUMBER");
List<MapRow> items = levelMap.get(level);
if (items == null)
{
items = new ArrayList<MapRow>();
levelMap.put(level, items);
}
items.add(row);
}
int level = 1;
while (true)
{
List<MapRow> items = levelMap.get(Integer.valueOf(level++));
if (items == null)
{
break;
}
for (MapRow row : items)
{
m_wbsFormat.parseRawValue(row.getString("CODE_VALUE"));
String parentWbsValue = m_wbsFormat.getFormattedParentValue();
String wbsValue = m_wbsFormat.getFormattedValue();
row.setObject("WBS", wbsValue);
row.setObject("PARENT_WBS", parentWbsValue);
}
final AlphanumComparator comparator = new AlphanumComparator();
Collections.sort(items, new Comparator<MapRow>()
{
@Override public int compare(MapRow o1, MapRow o2)
{
return comparator.compare(o1.getString("WBS"), o2.getString("WBS"));
}
});
for (MapRow row : items)
{
String wbs = row.getString("WBS");
if (wbs != null && !wbs.isEmpty())
{
ChildTaskContainer parent = m_wbsMap.get(row.getString("PARENT_WBS"));
if (parent == null)
{
parent = m_projectFile;
}
Task task = parent.addTask();
String name = row.getString("CODE_TITLE");
if (name == null || name.isEmpty())
{
name = wbs;
}
task.setName(name);
task.setWBS(wbs);
task.setSummary(true);
m_wbsMap.put(wbs, task);
}
}
}
} | [
"private",
"void",
"readWBS",
"(",
")",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"MapRow",
">",
">",
"levelMap",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"MapRow",
">",
">",
"(",
")",
";",
"for",
"(",
"MapRow",
"row",
":",
"m... | Read tasks representing the WBS. | [
"Read",
"tasks",
"representing",
"the",
"WBS",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L298-L364 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.readRelationships | private void readRelationships()
{
for (MapRow row : m_tables.get("REL"))
{
Task predecessor = m_activityMap.get(row.getString("PREDECESSOR_ACTIVITY_ID"));
Task successor = m_activityMap.get(row.getString("SUCCESSOR_ACTIVITY_ID"));
if (predecessor != null && successor != null)
{
Duration lag = row.getDuration("LAG_VALUE");
RelationType type = row.getRelationType("LAG_TYPE");
successor.addPredecessor(predecessor, type, lag);
}
}
} | java | private void readRelationships()
{
for (MapRow row : m_tables.get("REL"))
{
Task predecessor = m_activityMap.get(row.getString("PREDECESSOR_ACTIVITY_ID"));
Task successor = m_activityMap.get(row.getString("SUCCESSOR_ACTIVITY_ID"));
if (predecessor != null && successor != null)
{
Duration lag = row.getDuration("LAG_VALUE");
RelationType type = row.getRelationType("LAG_TYPE");
successor.addPredecessor(predecessor, type, lag);
}
}
} | [
"private",
"void",
"readRelationships",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"m_tables",
".",
"get",
"(",
"\"REL\"",
")",
")",
"{",
"Task",
"predecessor",
"=",
"m_activityMap",
".",
"get",
"(",
"row",
".",
"getString",
"(",
"\"PREDECESSOR_ACTIV... | Read task relationships. | [
"Read",
"task",
"relationships",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L480-L494 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.setFields | private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container)
{
if (row != null)
{
for (Map.Entry<String, FieldType> entry : map.entrySet())
{
container.set(entry.getValue(), row.getObject(entry.getKey()));
}
}
} | java | private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container)
{
if (row != null)
{
for (Map.Entry<String, FieldType> entry : map.entrySet())
{
container.set(entry.getValue(), row.getObject(entry.getKey()));
}
}
} | [
"private",
"void",
"setFields",
"(",
"Map",
"<",
"String",
",",
"FieldType",
">",
"map",
",",
"MapRow",
"row",
",",
"FieldContainer",
"container",
")",
"{",
"if",
"(",
"row",
"!=",
"null",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
","... | Set the value of one or more fields based on the contents of a database row.
@param map column to field map
@param row database row
@param container field container | [
"Set",
"the",
"value",
"of",
"one",
"or",
"more",
"fields",
"based",
"on",
"the",
"contents",
"of",
"a",
"database",
"row",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L587-L596 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java | P3DatabaseReader.defineField | private static void defineField(Map<String, FieldType> container, String name, FieldType type)
{
defineField(container, name, type, null);
} | java | private static void defineField(Map<String, FieldType> container, String name, FieldType type)
{
defineField(container, name, type, null);
} | [
"private",
"static",
"void",
"defineField",
"(",
"Map",
"<",
"String",
",",
"FieldType",
">",
"container",
",",
"String",
"name",
",",
"FieldType",
"type",
")",
"{",
"defineField",
"(",
"container",
",",
"name",
",",
"type",
",",
"null",
")",
";",
"}"
] | Configure the mapping between a database column and a field.
@param container column to field map
@param name column name
@param type field type | [
"Configure",
"the",
"mapping",
"between",
"a",
"database",
"column",
"and",
"a",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L605-L608 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sample/MppDump.java | MppDump.dumpTree | private static void dumpTree(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception
{
long byteCount;
for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();)
{
Entry entry = iter.next();
if (entry instanceof DirectoryEntry)
{
String childIndent = indent;
if (childIndent != null)
{
childIndent += " ";
}
String childPrefix = prefix + "[" + entry.getName() + "].";
pw.println("start dir: " + prefix + entry.getName());
dumpTree(pw, (DirectoryEntry) entry, childPrefix, showData, hex, childIndent);
pw.println("end dir: " + prefix + entry.getName());
}
else
if (entry instanceof DocumentEntry)
{
if (showData)
{
pw.println("start doc: " + prefix + entry.getName());
if (hex == true)
{
byteCount = hexdump(new DocumentInputStream((DocumentEntry) entry), pw);
}
else
{
byteCount = asciidump(new DocumentInputStream((DocumentEntry) entry), pw);
}
pw.println("end doc: " + prefix + entry.getName() + " (" + byteCount + " bytes read)");
}
else
{
if (indent != null)
{
pw.print(indent);
}
pw.println("doc: " + prefix + entry.getName());
}
}
else
{
pw.println("found unknown: " + prefix + entry.getName());
}
}
} | java | private static void dumpTree(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception
{
long byteCount;
for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();)
{
Entry entry = iter.next();
if (entry instanceof DirectoryEntry)
{
String childIndent = indent;
if (childIndent != null)
{
childIndent += " ";
}
String childPrefix = prefix + "[" + entry.getName() + "].";
pw.println("start dir: " + prefix + entry.getName());
dumpTree(pw, (DirectoryEntry) entry, childPrefix, showData, hex, childIndent);
pw.println("end dir: " + prefix + entry.getName());
}
else
if (entry instanceof DocumentEntry)
{
if (showData)
{
pw.println("start doc: " + prefix + entry.getName());
if (hex == true)
{
byteCount = hexdump(new DocumentInputStream((DocumentEntry) entry), pw);
}
else
{
byteCount = asciidump(new DocumentInputStream((DocumentEntry) entry), pw);
}
pw.println("end doc: " + prefix + entry.getName() + " (" + byteCount + " bytes read)");
}
else
{
if (indent != null)
{
pw.print(indent);
}
pw.println("doc: " + prefix + entry.getName());
}
}
else
{
pw.println("found unknown: " + prefix + entry.getName());
}
}
} | [
"private",
"static",
"void",
"dumpTree",
"(",
"PrintWriter",
"pw",
",",
"DirectoryEntry",
"dir",
",",
"String",
"prefix",
",",
"boolean",
"showData",
",",
"boolean",
"hex",
",",
"String",
"indent",
")",
"throws",
"Exception",
"{",
"long",
"byteCount",
";",
"... | This method recursively descends the directory structure, dumping
details of any files it finds to the output file.
@param pw Output PrintWriter
@param dir DirectoryEntry to dump
@param prefix prefix used to identify path to this object
@param showData flag indicating if data is dumped, or just structure
@param hex set to true if hex output is required
@param indent indent used if displaying structure only
@throws Exception Thrown on file read errors | [
"This",
"method",
"recursively",
"descends",
"the",
"directory",
"structure",
"dumping",
"details",
"of",
"any",
"files",
"it",
"finds",
"to",
"the",
"output",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MppDump.java#L109-L159 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sample/MppDump.java | MppDump.hexdump | private static long hexdump(InputStream is, PrintWriter pw) throws Exception
{
byte[] buffer = new byte[BUFFER_SIZE];
long byteCount = 0;
char c;
int loop;
int count;
StringBuilder sb = new StringBuilder();
while (true)
{
count = is.read(buffer);
if (count == -1)
{
break;
}
byteCount += count;
sb.setLength(0);
for (loop = 0; loop < count; loop++)
{
sb.append(" ");
sb.append(HEX_DIGITS[(buffer[loop] & 0xF0) >> 4]);
sb.append(HEX_DIGITS[buffer[loop] & 0x0F]);
}
while (loop < BUFFER_SIZE)
{
sb.append(" ");
++loop;
}
sb.append(" ");
for (loop = 0; loop < count; loop++)
{
c = (char) buffer[loop];
if (c > 200 || c < 27)
{
c = ' ';
}
sb.append(c);
}
pw.println(sb.toString());
}
return (byteCount);
} | java | private static long hexdump(InputStream is, PrintWriter pw) throws Exception
{
byte[] buffer = new byte[BUFFER_SIZE];
long byteCount = 0;
char c;
int loop;
int count;
StringBuilder sb = new StringBuilder();
while (true)
{
count = is.read(buffer);
if (count == -1)
{
break;
}
byteCount += count;
sb.setLength(0);
for (loop = 0; loop < count; loop++)
{
sb.append(" ");
sb.append(HEX_DIGITS[(buffer[loop] & 0xF0) >> 4]);
sb.append(HEX_DIGITS[buffer[loop] & 0x0F]);
}
while (loop < BUFFER_SIZE)
{
sb.append(" ");
++loop;
}
sb.append(" ");
for (loop = 0; loop < count; loop++)
{
c = (char) buffer[loop];
if (c > 200 || c < 27)
{
c = ' ';
}
sb.append(c);
}
pw.println(sb.toString());
}
return (byteCount);
} | [
"private",
"static",
"long",
"hexdump",
"(",
"InputStream",
"is",
",",
"PrintWriter",
"pw",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"long",
"byteCount",
"=",
"0",
";",
"char",
"c",
... | This method dumps the entire contents of a file to an output
print writer as hex and ASCII data.
@param is Input Stream
@param pw Output PrintWriter
@return number of bytes read
@throws Exception Thrown on file read errors | [
"This",
"method",
"dumps",
"the",
"entire",
"contents",
"of",
"a",
"file",
"to",
"an",
"output",
"print",
"writer",
"as",
"hex",
"and",
"ASCII",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MppDump.java#L170-L222 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sample/MppDump.java | MppDump.asciidump | private static long asciidump(InputStream is, PrintWriter pw) throws Exception
{
byte[] buffer = new byte[BUFFER_SIZE];
long byteCount = 0;
char c;
int loop;
int count;
StringBuilder sb = new StringBuilder();
while (true)
{
count = is.read(buffer);
if (count == -1)
{
break;
}
byteCount += count;
sb.setLength(0);
for (loop = 0; loop < count; loop++)
{
c = (char) buffer[loop];
if (c > 200 || c < 27)
{
c = ' ';
}
sb.append(c);
}
pw.print(sb.toString());
}
return (byteCount);
} | java | private static long asciidump(InputStream is, PrintWriter pw) throws Exception
{
byte[] buffer = new byte[BUFFER_SIZE];
long byteCount = 0;
char c;
int loop;
int count;
StringBuilder sb = new StringBuilder();
while (true)
{
count = is.read(buffer);
if (count == -1)
{
break;
}
byteCount += count;
sb.setLength(0);
for (loop = 0; loop < count; loop++)
{
c = (char) buffer[loop];
if (c > 200 || c < 27)
{
c = ' ';
}
sb.append(c);
}
pw.print(sb.toString());
}
return (byteCount);
} | [
"private",
"static",
"long",
"asciidump",
"(",
"InputStream",
"is",
",",
"PrintWriter",
"pw",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"long",
"byteCount",
"=",
"0",
";",
"char",
"c",
... | This method dumps the entire contents of a file to an output
print writer as ascii data.
@param is Input Stream
@param pw Output PrintWriter
@return number of bytes read
@throws Exception Thrown on file read errors | [
"This",
"method",
"dumps",
"the",
"entire",
"contents",
"of",
"a",
"file",
"to",
"an",
"output",
"print",
"writer",
"as",
"ascii",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MppDump.java#L233-L269 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPTimephasedBaselineCostNormaliser.java | MPPTimephasedBaselineCostNormaliser.mergeSameCost | protected void mergeSameCost(LinkedList<TimephasedCost> list)
{
LinkedList<TimephasedCost> result = new LinkedList<TimephasedCost>();
TimephasedCost previousAssignment = null;
for (TimephasedCost assignment : list)
{
if (previousAssignment == null)
{
assignment.setAmountPerDay(assignment.getTotalAmount());
result.add(assignment);
}
else
{
Number previousAssignmentCost = previousAssignment.getAmountPerDay();
Number assignmentCost = assignment.getTotalAmount();
if (NumberHelper.equals(previousAssignmentCost.doubleValue(), assignmentCost.doubleValue(), 0.01))
{
Date assignmentStart = previousAssignment.getStart();
Date assignmentFinish = assignment.getFinish();
double total = previousAssignment.getTotalAmount().doubleValue();
total += assignmentCost.doubleValue();
TimephasedCost merged = new TimephasedCost();
merged.setStart(assignmentStart);
merged.setFinish(assignmentFinish);
merged.setAmountPerDay(assignmentCost);
merged.setTotalAmount(Double.valueOf(total));
result.removeLast();
assignment = merged;
}
else
{
assignment.setAmountPerDay(assignment.getTotalAmount());
}
result.add(assignment);
}
previousAssignment = assignment;
}
list.clear();
list.addAll(result);
} | java | protected void mergeSameCost(LinkedList<TimephasedCost> list)
{
LinkedList<TimephasedCost> result = new LinkedList<TimephasedCost>();
TimephasedCost previousAssignment = null;
for (TimephasedCost assignment : list)
{
if (previousAssignment == null)
{
assignment.setAmountPerDay(assignment.getTotalAmount());
result.add(assignment);
}
else
{
Number previousAssignmentCost = previousAssignment.getAmountPerDay();
Number assignmentCost = assignment.getTotalAmount();
if (NumberHelper.equals(previousAssignmentCost.doubleValue(), assignmentCost.doubleValue(), 0.01))
{
Date assignmentStart = previousAssignment.getStart();
Date assignmentFinish = assignment.getFinish();
double total = previousAssignment.getTotalAmount().doubleValue();
total += assignmentCost.doubleValue();
TimephasedCost merged = new TimephasedCost();
merged.setStart(assignmentStart);
merged.setFinish(assignmentFinish);
merged.setAmountPerDay(assignmentCost);
merged.setTotalAmount(Double.valueOf(total));
result.removeLast();
assignment = merged;
}
else
{
assignment.setAmountPerDay(assignment.getTotalAmount());
}
result.add(assignment);
}
previousAssignment = assignment;
}
list.clear();
list.addAll(result);
} | [
"protected",
"void",
"mergeSameCost",
"(",
"LinkedList",
"<",
"TimephasedCost",
">",
"list",
")",
"{",
"LinkedList",
"<",
"TimephasedCost",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"TimephasedCost",
">",
"(",
")",
";",
"TimephasedCost",
"previousAssignment",
... | This method merges together assignment data for the same cost.
@param list assignment data | [
"This",
"method",
"merges",
"together",
"assignment",
"data",
"for",
"the",
"same",
"cost",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPTimephasedBaselineCostNormaliser.java#L245-L290 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sdef/SDEFWriter.java | SDEFWriter.write | @Override public void write(ProjectFile projectFile, OutputStream out) throws IOException
{
m_projectFile = projectFile;
m_eventManager = projectFile.getEventManager();
m_writer = new PrintStream(out); // the print stream class is the easiest way to create a text file
m_buffer = new StringBuilder();
try
{
write(); // method call a method, this is how MPXJ is structured, so I followed the lead?
}
// catch (Exception e)
// { // used during console debugging
// System.out.println("Caught Exception in SDEFWriter.java");
// System.out.println(" " + e.toString());
// }
finally
{ // keeps things cool after we're done
m_writer = null;
m_projectFile = null;
m_buffer = null;
}
} | java | @Override public void write(ProjectFile projectFile, OutputStream out) throws IOException
{
m_projectFile = projectFile;
m_eventManager = projectFile.getEventManager();
m_writer = new PrintStream(out); // the print stream class is the easiest way to create a text file
m_buffer = new StringBuilder();
try
{
write(); // method call a method, this is how MPXJ is structured, so I followed the lead?
}
// catch (Exception e)
// { // used during console debugging
// System.out.println("Caught Exception in SDEFWriter.java");
// System.out.println(" " + e.toString());
// }
finally
{ // keeps things cool after we're done
m_writer = null;
m_projectFile = null;
m_buffer = null;
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"ProjectFile",
"projectFile",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"m_projectFile",
"=",
"projectFile",
";",
"m_eventManager",
"=",
"projectFile",
".",
"getEventManager",
"(",
")",
";",
"... | Write a project file in SDEF format to an output stream.
@param projectFile ProjectFile instance
@param out output stream | [
"Write",
"a",
"project",
"file",
"in",
"SDEF",
"format",
"to",
"an",
"output",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sdef/SDEFWriter.java#L80-L105 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sdef/SDEFWriter.java | SDEFWriter.writeProjectProperties | private void writeProjectProperties(ProjectProperties record) throws IOException
{
// the ProjectProperties class from MPXJ has the details of how many days per week etc....
// so I've assigned these variables in here, but actually use them in other methods
// see the write task method, that's where they're used, but that method only has a Task object
m_minutesPerDay = record.getMinutesPerDay().doubleValue();
m_minutesPerWeek = record.getMinutesPerWeek().doubleValue();
m_daysPerMonth = record.getDaysPerMonth().doubleValue();
// reset buffer to be empty, then concatenate data as required by USACE
m_buffer.setLength(0);
m_buffer.append("PROJ ");
m_buffer.append(m_formatter.format(record.getStartDate()).toUpperCase() + " "); // DataDate
m_buffer.append(SDEFmethods.lset(record.getManager(), 4) + " "); // ProjIdent
m_buffer.append(SDEFmethods.lset(record.getProjectTitle(), 48) + " "); // ProjName
m_buffer.append(SDEFmethods.lset(record.getSubject(), 36) + " "); // ContrName
m_buffer.append("P "); // ArrowP
m_buffer.append(SDEFmethods.lset(record.getKeywords(), 7)); // ContractNum
m_buffer.append(m_formatter.format(record.getStartDate()).toUpperCase() + " "); // ProjStart
m_buffer.append(m_formatter.format(record.getFinishDate()).toUpperCase()); // ProjEnd
m_writer.println(m_buffer);
} | java | private void writeProjectProperties(ProjectProperties record) throws IOException
{
// the ProjectProperties class from MPXJ has the details of how many days per week etc....
// so I've assigned these variables in here, but actually use them in other methods
// see the write task method, that's where they're used, but that method only has a Task object
m_minutesPerDay = record.getMinutesPerDay().doubleValue();
m_minutesPerWeek = record.getMinutesPerWeek().doubleValue();
m_daysPerMonth = record.getDaysPerMonth().doubleValue();
// reset buffer to be empty, then concatenate data as required by USACE
m_buffer.setLength(0);
m_buffer.append("PROJ ");
m_buffer.append(m_formatter.format(record.getStartDate()).toUpperCase() + " "); // DataDate
m_buffer.append(SDEFmethods.lset(record.getManager(), 4) + " "); // ProjIdent
m_buffer.append(SDEFmethods.lset(record.getProjectTitle(), 48) + " "); // ProjName
m_buffer.append(SDEFmethods.lset(record.getSubject(), 36) + " "); // ContrName
m_buffer.append("P "); // ArrowP
m_buffer.append(SDEFmethods.lset(record.getKeywords(), 7)); // ContractNum
m_buffer.append(m_formatter.format(record.getStartDate()).toUpperCase() + " "); // ProjStart
m_buffer.append(m_formatter.format(record.getFinishDate()).toUpperCase()); // ProjEnd
m_writer.println(m_buffer);
} | [
"private",
"void",
"writeProjectProperties",
"(",
"ProjectProperties",
"record",
")",
"throws",
"IOException",
"{",
"// the ProjectProperties class from MPXJ has the details of how many days per week etc....",
"// so I've assigned these variables in here, but actually use them in other methods... | Write project properties.
@param record project properties
@throws IOException | [
"Write",
"project",
"properties",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sdef/SDEFWriter.java#L143-L164 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sdef/SDEFWriter.java | SDEFWriter.writeCalendars | private void writeCalendars(List<ProjectCalendar> records)
{
//
// Write project calendars
//
for (ProjectCalendar record : records)
{
m_buffer.setLength(0);
m_buffer.append("CLDR ");
m_buffer.append(SDEFmethods.lset(record.getUniqueID().toString(), 2)); // 2 character used, USACE allows 1
String workDays = SDEFmethods.workDays(record); // custom line, like NYYYYYN for a week
m_buffer.append(SDEFmethods.lset(workDays, 8));
m_buffer.append(SDEFmethods.lset(record.getName(), 30));
m_writer.println(m_buffer);
}
} | java | private void writeCalendars(List<ProjectCalendar> records)
{
//
// Write project calendars
//
for (ProjectCalendar record : records)
{
m_buffer.setLength(0);
m_buffer.append("CLDR ");
m_buffer.append(SDEFmethods.lset(record.getUniqueID().toString(), 2)); // 2 character used, USACE allows 1
String workDays = SDEFmethods.workDays(record); // custom line, like NYYYYYN for a week
m_buffer.append(SDEFmethods.lset(workDays, 8));
m_buffer.append(SDEFmethods.lset(record.getName(), 30));
m_writer.println(m_buffer);
}
} | [
"private",
"void",
"writeCalendars",
"(",
"List",
"<",
"ProjectCalendar",
">",
"records",
")",
"{",
"//",
"// Write project calendars",
"//",
"for",
"(",
"ProjectCalendar",
"record",
":",
"records",
")",
"{",
"m_buffer",
".",
"setLength",
"(",
"0",
")",
";",
... | This will create a line in the SDEF file for each calendar
if there are more than 9 calendars, you'll have a big error,
as USACE numbers them 0-9.
@param records list of ProjectCalendar instances | [
"This",
"will",
"create",
"a",
"line",
"in",
"the",
"SDEF",
"file",
"for",
"each",
"calendar",
"if",
"there",
"are",
"more",
"than",
"9",
"calendars",
"you",
"ll",
"have",
"a",
"big",
"error",
"as",
"USACE",
"numbers",
"them",
"0",
"-",
"9",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sdef/SDEFWriter.java#L173-L189 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sdef/SDEFWriter.java | SDEFWriter.writeExceptions | private void writeExceptions(List<ProjectCalendar> records) throws IOException
{
for (ProjectCalendar record : records)
{
if (!record.getCalendarExceptions().isEmpty())
{
// Need to move HOLI up here and get 15 exceptions per line as per USACE spec.
// for now, we'll write one line for each calendar exception, hope there aren't too many
//
// changing this would be a serious upgrade, too much coding to do today....
for (ProjectCalendarException ex : record.getCalendarExceptions())
{
writeCalendarException(record, ex);
}
}
m_eventManager.fireCalendarWrittenEvent(record); // left here from MPX template, maybe not needed???
}
} | java | private void writeExceptions(List<ProjectCalendar> records) throws IOException
{
for (ProjectCalendar record : records)
{
if (!record.getCalendarExceptions().isEmpty())
{
// Need to move HOLI up here and get 15 exceptions per line as per USACE spec.
// for now, we'll write one line for each calendar exception, hope there aren't too many
//
// changing this would be a serious upgrade, too much coding to do today....
for (ProjectCalendarException ex : record.getCalendarExceptions())
{
writeCalendarException(record, ex);
}
}
m_eventManager.fireCalendarWrittenEvent(record); // left here from MPX template, maybe not needed???
}
} | [
"private",
"void",
"writeExceptions",
"(",
"List",
"<",
"ProjectCalendar",
">",
"records",
")",
"throws",
"IOException",
"{",
"for",
"(",
"ProjectCalendar",
"record",
":",
"records",
")",
"{",
"if",
"(",
"!",
"record",
".",
"getCalendarExceptions",
"(",
")",
... | Write calendar exceptions.
@param records list of ProjectCalendars
@throws IOException | [
"Write",
"calendar",
"exceptions",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sdef/SDEFWriter.java#L197-L214 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/sdef/SDEFWriter.java | SDEFWriter.writeTaskPredecessors | private void writeTaskPredecessors(Task record)
{
m_buffer.setLength(0);
//
// Write the task predecessor
//
if (!record.getSummary() && !record.getPredecessors().isEmpty())
{ // I don't use summary tasks for SDEF
m_buffer.append("PRED ");
List<Relation> predecessors = record.getPredecessors();
for (Relation pred : predecessors)
{
m_buffer.append(SDEFmethods.rset(pred.getSourceTask().getUniqueID().toString(), 10) + " ");
m_buffer.append(SDEFmethods.rset(pred.getTargetTask().getUniqueID().toString(), 10) + " ");
String type = "C"; // default finish-to-start
if (!pred.getType().toString().equals("FS"))
{
type = pred.getType().toString().substring(0, 1);
}
m_buffer.append(type + " ");
Duration dd = pred.getLag();
double duration = dd.getDuration();
if (dd.getUnits() != TimeUnit.DAYS)
{
dd = Duration.convertUnits(duration, dd.getUnits(), TimeUnit.DAYS, m_minutesPerDay, m_minutesPerWeek, m_daysPerMonth);
}
Double days = Double.valueOf(dd.getDuration() + 0.5); // Add 0.5 so half day rounds up upon truncation
Integer est = Integer.valueOf(days.intValue());
m_buffer.append(SDEFmethods.rset(est.toString(), 4) + " "); // task duration in days required by USACE
}
m_writer.println(m_buffer.toString());
}
} | java | private void writeTaskPredecessors(Task record)
{
m_buffer.setLength(0);
//
// Write the task predecessor
//
if (!record.getSummary() && !record.getPredecessors().isEmpty())
{ // I don't use summary tasks for SDEF
m_buffer.append("PRED ");
List<Relation> predecessors = record.getPredecessors();
for (Relation pred : predecessors)
{
m_buffer.append(SDEFmethods.rset(pred.getSourceTask().getUniqueID().toString(), 10) + " ");
m_buffer.append(SDEFmethods.rset(pred.getTargetTask().getUniqueID().toString(), 10) + " ");
String type = "C"; // default finish-to-start
if (!pred.getType().toString().equals("FS"))
{
type = pred.getType().toString().substring(0, 1);
}
m_buffer.append(type + " ");
Duration dd = pred.getLag();
double duration = dd.getDuration();
if (dd.getUnits() != TimeUnit.DAYS)
{
dd = Duration.convertUnits(duration, dd.getUnits(), TimeUnit.DAYS, m_minutesPerDay, m_minutesPerWeek, m_daysPerMonth);
}
Double days = Double.valueOf(dd.getDuration() + 0.5); // Add 0.5 so half day rounds up upon truncation
Integer est = Integer.valueOf(days.intValue());
m_buffer.append(SDEFmethods.rset(est.toString(), 4) + " "); // task duration in days required by USACE
}
m_writer.println(m_buffer.toString());
}
} | [
"private",
"void",
"writeTaskPredecessors",
"(",
"Task",
"record",
")",
"{",
"m_buffer",
".",
"setLength",
"(",
"0",
")",
";",
"//",
"// Write the task predecessor",
"//",
"if",
"(",
"!",
"record",
".",
"getSummary",
"(",
")",
"&&",
"!",
"record",
".",
"ge... | Write each predecessor for a task.
@param record Task instance | [
"Write",
"each",
"predecessor",
"for",
"a",
"task",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sdef/SDEFWriter.java#L335-L369 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPAbstractTimephasedWorkNormaliser.java | MPPAbstractTimephasedWorkNormaliser.getAssignmentWork | private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment)
{
Date assignmentStart = assignment.getStart();
Date splitStart = assignmentStart;
Date splitFinishTime = calendar.getFinishTime(splitStart);
Date splitFinish = DateHelper.setTime(splitStart, splitFinishTime);
Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES);
Duration assignmentWorkPerDay = assignment.getAmountPerDay();
Duration splitWork;
double splitMinutes = assignmentWorkPerDay.getDuration();
splitMinutes *= calendarSplitWork.getDuration();
splitMinutes /= (8 * 60); // this appears to be a fixed value
splitWork = Duration.getInstance(splitMinutes, TimeUnit.MINUTES);
return splitWork;
} | java | private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment)
{
Date assignmentStart = assignment.getStart();
Date splitStart = assignmentStart;
Date splitFinishTime = calendar.getFinishTime(splitStart);
Date splitFinish = DateHelper.setTime(splitStart, splitFinishTime);
Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES);
Duration assignmentWorkPerDay = assignment.getAmountPerDay();
Duration splitWork;
double splitMinutes = assignmentWorkPerDay.getDuration();
splitMinutes *= calendarSplitWork.getDuration();
splitMinutes /= (8 * 60); // this appears to be a fixed value
splitWork = Duration.getInstance(splitMinutes, TimeUnit.MINUTES);
return splitWork;
} | [
"private",
"Duration",
"getAssignmentWork",
"(",
"ProjectCalendar",
"calendar",
",",
"TimephasedWork",
"assignment",
")",
"{",
"Date",
"assignmentStart",
"=",
"assignment",
".",
"getStart",
"(",
")",
";",
"Date",
"splitStart",
"=",
"assignmentStart",
";",
"Date",
... | Retrieves the pro-rata work carried out on a given day.
@param calendar current calendar
@param assignment current assignment.
@return assignment work duration | [
"Retrieves",
"the",
"pro",
"-",
"rata",
"work",
"carried",
"out",
"on",
"a",
"given",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPAbstractTimephasedWorkNormaliser.java#L260-L277 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java | AstaDatabaseFileReader.createWorkPatternAssignmentMap | private Map<Integer, List<Row>> createWorkPatternAssignmentMap(List<Row> rows) throws ParseException
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer calendarID = row.getInteger("ID");
String workPatterns = row.getString("WORK_PATTERNS");
map.put(calendarID, createWorkPatternAssignmentRowList(workPatterns));
}
return map;
} | java | private Map<Integer, List<Row>> createWorkPatternAssignmentMap(List<Row> rows) throws ParseException
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer calendarID = row.getInteger("ID");
String workPatterns = row.getString("WORK_PATTERNS");
map.put(calendarID, createWorkPatternAssignmentRowList(workPatterns));
}
return map;
} | [
"private",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"createWorkPatternAssignmentMap",
"(",
"List",
"<",
"Row",
">",
"rows",
")",
"throws",
"ParseException",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"map",
"=",
"ne... | Create the work pattern assignment map.
@param rows calendar rows
@return work pattern assignment map | [
"Create",
"the",
"work",
"pattern",
"assignment",
"map",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java#L384-L394 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java | AstaDatabaseFileReader.createWorkPatternAssignmentRowList | private List<Row> createWorkPatternAssignmentRowList(String workPatterns) throws ParseException
{
List<Row> list = new ArrayList<Row>();
String[] patterns = workPatterns.split(",|:");
int index = 1;
while (index < patterns.length)
{
Integer workPattern = Integer.valueOf(patterns[index + 1]);
Date startDate = DatatypeConverter.parseBasicTimestamp(patterns[index + 3]);
Date endDate = DatatypeConverter.parseBasicTimestamp(patterns[index + 4]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("WORK_PATTERN", workPattern);
map.put("START_DATE", startDate);
map.put("END_DATE", endDate);
list.add(new MapRow(map));
index += 5;
}
return list;
} | java | private List<Row> createWorkPatternAssignmentRowList(String workPatterns) throws ParseException
{
List<Row> list = new ArrayList<Row>();
String[] patterns = workPatterns.split(",|:");
int index = 1;
while (index < patterns.length)
{
Integer workPattern = Integer.valueOf(patterns[index + 1]);
Date startDate = DatatypeConverter.parseBasicTimestamp(patterns[index + 3]);
Date endDate = DatatypeConverter.parseBasicTimestamp(patterns[index + 4]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("WORK_PATTERN", workPattern);
map.put("START_DATE", startDate);
map.put("END_DATE", endDate);
list.add(new MapRow(map));
index += 5;
}
return list;
} | [
"private",
"List",
"<",
"Row",
">",
"createWorkPatternAssignmentRowList",
"(",
"String",
"workPatterns",
")",
"throws",
"ParseException",
"{",
"List",
"<",
"Row",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Row",
">",
"(",
")",
";",
"String",
"[",
"]",
"pa... | Extract a list of work pattern assignments.
@param workPatterns string representation of work pattern assignments
@return list of work pattern assignment rows | [
"Extract",
"a",
"list",
"of",
"work",
"pattern",
"assignments",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java#L402-L424 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java | AstaDatabaseFileReader.createExceptionAssignmentMap | private Map<Integer, List<Row>> createExceptionAssignmentMap(List<Row> rows)
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer calendarID = row.getInteger("ID");
String exceptions = row.getString("EXCEPTIONS");
map.put(calendarID, createExceptionAssignmentRowList(exceptions));
}
return map;
} | java | private Map<Integer, List<Row>> createExceptionAssignmentMap(List<Row> rows)
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer calendarID = row.getInteger("ID");
String exceptions = row.getString("EXCEPTIONS");
map.put(calendarID, createExceptionAssignmentRowList(exceptions));
}
return map;
} | [
"private",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"createExceptionAssignmentMap",
"(",
"List",
"<",
"Row",
">",
"rows",
")",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Integer... | Create the exception assignment map.
@param rows calendar rows
@return exception assignment map | [
"Create",
"the",
"exception",
"assignment",
"map",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java#L432-L442 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java | AstaDatabaseFileReader.createExceptionAssignmentRowList | private List<Row> createExceptionAssignmentRowList(String exceptionData)
{
List<Row> list = new ArrayList<Row>();
String[] exceptions = exceptionData.split(",|:");
int index = 1;
while (index < exceptions.length)
{
Date startDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 0]);
Date endDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 1]);
//Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("STARU_DATE", startDate);
map.put("ENE_DATE", endDate);
list.add(new MapRow(map));
index += 3;
}
return list;
} | java | private List<Row> createExceptionAssignmentRowList(String exceptionData)
{
List<Row> list = new ArrayList<Row>();
String[] exceptions = exceptionData.split(",|:");
int index = 1;
while (index < exceptions.length)
{
Date startDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 0]);
Date endDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 1]);
//Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("STARU_DATE", startDate);
map.put("ENE_DATE", endDate);
list.add(new MapRow(map));
index += 3;
}
return list;
} | [
"private",
"List",
"<",
"Row",
">",
"createExceptionAssignmentRowList",
"(",
"String",
"exceptionData",
")",
"{",
"List",
"<",
"Row",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Row",
">",
"(",
")",
";",
"String",
"[",
"]",
"exceptions",
"=",
"exceptionDat... | Extract a list of exception assignments.
@param exceptionData string representation of exception assignments
@return list of exception assignment rows | [
"Extract",
"a",
"list",
"of",
"exception",
"assignments",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java#L450-L471 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java | AstaDatabaseFileReader.createTimeEntryMap | private Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows) throws ParseException
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer workPatternID = row.getInteger("ID");
String shifts = row.getString("SHIFTS");
map.put(workPatternID, createTimeEntryRowList(shifts));
}
return map;
} | java | private Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows) throws ParseException
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer workPatternID = row.getInteger("ID");
String shifts = row.getString("SHIFTS");
map.put(workPatternID, createTimeEntryRowList(shifts));
}
return map;
} | [
"private",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"createTimeEntryMap",
"(",
"List",
"<",
"Row",
">",
"rows",
")",
"throws",
"ParseException",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"map",
"=",
"new",
"HashM... | Create the time entry map.
@param rows work pattern rows
@return time entry map | [
"Create",
"the",
"time",
"entry",
"map",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java#L479-L489 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java | AstaDatabaseFileReader.createTimeEntryRowList | private List<Row> createTimeEntryRowList(String shiftData) throws ParseException
{
List<Row> list = new ArrayList<Row>();
String[] shifts = shiftData.split(",|:");
int index = 1;
while (index < shifts.length)
{
index += 2;
int entryCount = Integer.parseInt(shifts[index]);
index++;
for (int entryIndex = 0; entryIndex < entryCount; entryIndex++)
{
Integer exceptionTypeID = Integer.valueOf(shifts[index + 0]);
Date startTime = DatatypeConverter.parseBasicTime(shifts[index + 1]);
Date endTime = DatatypeConverter.parseBasicTime(shifts[index + 2]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("START_TIME", startTime);
map.put("END_TIME", endTime);
map.put("EXCEPTIOP", exceptionTypeID);
list.add(new MapRow(map));
index += 3;
}
}
return list;
} | java | private List<Row> createTimeEntryRowList(String shiftData) throws ParseException
{
List<Row> list = new ArrayList<Row>();
String[] shifts = shiftData.split(",|:");
int index = 1;
while (index < shifts.length)
{
index += 2;
int entryCount = Integer.parseInt(shifts[index]);
index++;
for (int entryIndex = 0; entryIndex < entryCount; entryIndex++)
{
Integer exceptionTypeID = Integer.valueOf(shifts[index + 0]);
Date startTime = DatatypeConverter.parseBasicTime(shifts[index + 1]);
Date endTime = DatatypeConverter.parseBasicTime(shifts[index + 2]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("START_TIME", startTime);
map.put("END_TIME", endTime);
map.put("EXCEPTIOP", exceptionTypeID);
list.add(new MapRow(map));
index += 3;
}
}
return list;
} | [
"private",
"List",
"<",
"Row",
">",
"createTimeEntryRowList",
"(",
"String",
"shiftData",
")",
"throws",
"ParseException",
"{",
"List",
"<",
"Row",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Row",
">",
"(",
")",
";",
"String",
"[",
"]",
"shifts",
"=",
... | Extract a list of time entries.
@param shiftData string representation of time entries
@return list of time entry rows | [
"Extract",
"a",
"list",
"of",
"time",
"entries",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseFileReader.java#L497-L526 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AbstractFileFormat.java | AbstractFileFormat.tableDefinitions | public Map<Integer, TableDefinition> tableDefinitions()
{
Map<Integer, TableDefinition> result = new HashMap<Integer, TableDefinition>();
result.put(Integer.valueOf(2), new TableDefinition("PROJECT_SUMMARY", columnDefinitions(PROJECT_SUMMARY_COLUMNS, projectSummaryColumnsOrder())));
result.put(Integer.valueOf(7), new TableDefinition("BAR", columnDefinitions(BAR_COLUMNS, barColumnsOrder())));
result.put(Integer.valueOf(11), new TableDefinition("CALENDAR", columnDefinitions(CALENDAR_COLUMNS, calendarColumnsOrder())));
result.put(Integer.valueOf(12), new TableDefinition("EXCEPTIONN", columnDefinitions(EXCEPTIONN_COLUMNS, exceptionColumnsOrder())));
result.put(Integer.valueOf(14), new TableDefinition("EXCEPTION_ASSIGNMENT", columnDefinitions(EXCEPTION_ASSIGNMENT_COLUMNS, exceptionAssignmentColumnsOrder())));
result.put(Integer.valueOf(15), new TableDefinition("TIME_ENTRY", columnDefinitions(TIME_ENTRY_COLUMNS, timeEntryColumnsOrder())));
result.put(Integer.valueOf(17), new TableDefinition("WORK_PATTERN", columnDefinitions(WORK_PATTERN_COLUMNS, workPatternColumnsOrder())));
result.put(Integer.valueOf(18), new TableDefinition("TASK_COMPLETED_SECTION", columnDefinitions(TASK_COMPLETED_SECTION_COLUMNS, taskCompletedSectionColumnsOrder())));
result.put(Integer.valueOf(21), new TableDefinition("TASK", columnDefinitions(TASK_COLUMNS, taskColumnsOrder())));
result.put(Integer.valueOf(22), new TableDefinition("MILESTONE", columnDefinitions(MILESTONE_COLUMNS, milestoneColumnsOrder())));
result.put(Integer.valueOf(23), new TableDefinition("EXPANDED_TASK", columnDefinitions(EXPANDED_TASK_COLUMNS, expandedTaskColumnsOrder())));
result.put(Integer.valueOf(25), new TableDefinition("LINK", columnDefinitions(LINK_COLUMNS, linkColumnsOrder())));
result.put(Integer.valueOf(61), new TableDefinition("CONSUMABLE_RESOURCE", columnDefinitions(CONSUMABLE_RESOURCE_COLUMNS, consumableResourceColumnsOrder())));
result.put(Integer.valueOf(62), new TableDefinition("PERMANENT_RESOURCE", columnDefinitions(PERMANENT_RESOURCE_COLUMNS, permanentResourceColumnsOrder())));
result.put(Integer.valueOf(63), new TableDefinition("PERM_RESOURCE_SKILL", columnDefinitions(PERMANENT_RESOURCE_SKILL_COLUMNS, permanentResourceSkillColumnsOrder())));
result.put(Integer.valueOf(67), new TableDefinition("PERMANENT_SCHEDUL_ALLOCATION", columnDefinitions(PERMANENT_SCHEDULE_ALLOCATION_COLUMNS, permanentScheduleAllocationColumnsOrder())));
result.put(Integer.valueOf(190), new TableDefinition("WBS_ENTRY", columnDefinitions(WBS_ENTRY_COLUMNS, wbsEntryColumnsOrder())));
return result;
} | java | public Map<Integer, TableDefinition> tableDefinitions()
{
Map<Integer, TableDefinition> result = new HashMap<Integer, TableDefinition>();
result.put(Integer.valueOf(2), new TableDefinition("PROJECT_SUMMARY", columnDefinitions(PROJECT_SUMMARY_COLUMNS, projectSummaryColumnsOrder())));
result.put(Integer.valueOf(7), new TableDefinition("BAR", columnDefinitions(BAR_COLUMNS, barColumnsOrder())));
result.put(Integer.valueOf(11), new TableDefinition("CALENDAR", columnDefinitions(CALENDAR_COLUMNS, calendarColumnsOrder())));
result.put(Integer.valueOf(12), new TableDefinition("EXCEPTIONN", columnDefinitions(EXCEPTIONN_COLUMNS, exceptionColumnsOrder())));
result.put(Integer.valueOf(14), new TableDefinition("EXCEPTION_ASSIGNMENT", columnDefinitions(EXCEPTION_ASSIGNMENT_COLUMNS, exceptionAssignmentColumnsOrder())));
result.put(Integer.valueOf(15), new TableDefinition("TIME_ENTRY", columnDefinitions(TIME_ENTRY_COLUMNS, timeEntryColumnsOrder())));
result.put(Integer.valueOf(17), new TableDefinition("WORK_PATTERN", columnDefinitions(WORK_PATTERN_COLUMNS, workPatternColumnsOrder())));
result.put(Integer.valueOf(18), new TableDefinition("TASK_COMPLETED_SECTION", columnDefinitions(TASK_COMPLETED_SECTION_COLUMNS, taskCompletedSectionColumnsOrder())));
result.put(Integer.valueOf(21), new TableDefinition("TASK", columnDefinitions(TASK_COLUMNS, taskColumnsOrder())));
result.put(Integer.valueOf(22), new TableDefinition("MILESTONE", columnDefinitions(MILESTONE_COLUMNS, milestoneColumnsOrder())));
result.put(Integer.valueOf(23), new TableDefinition("EXPANDED_TASK", columnDefinitions(EXPANDED_TASK_COLUMNS, expandedTaskColumnsOrder())));
result.put(Integer.valueOf(25), new TableDefinition("LINK", columnDefinitions(LINK_COLUMNS, linkColumnsOrder())));
result.put(Integer.valueOf(61), new TableDefinition("CONSUMABLE_RESOURCE", columnDefinitions(CONSUMABLE_RESOURCE_COLUMNS, consumableResourceColumnsOrder())));
result.put(Integer.valueOf(62), new TableDefinition("PERMANENT_RESOURCE", columnDefinitions(PERMANENT_RESOURCE_COLUMNS, permanentResourceColumnsOrder())));
result.put(Integer.valueOf(63), new TableDefinition("PERM_RESOURCE_SKILL", columnDefinitions(PERMANENT_RESOURCE_SKILL_COLUMNS, permanentResourceSkillColumnsOrder())));
result.put(Integer.valueOf(67), new TableDefinition("PERMANENT_SCHEDUL_ALLOCATION", columnDefinitions(PERMANENT_SCHEDULE_ALLOCATION_COLUMNS, permanentScheduleAllocationColumnsOrder())));
result.put(Integer.valueOf(190), new TableDefinition("WBS_ENTRY", columnDefinitions(WBS_ENTRY_COLUMNS, wbsEntryColumnsOrder())));
return result;
} | [
"public",
"Map",
"<",
"Integer",
",",
"TableDefinition",
">",
"tableDefinitions",
"(",
")",
"{",
"Map",
"<",
"Integer",
",",
"TableDefinition",
">",
"result",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"TableDefinition",
">",
"(",
")",
";",
"result",
".",... | Retrieves the table structure for an Asta PP file. Subclasses determine the exact contents of the structure
for a specific version of the Asta PP file.
@return PP file table structure | [
"Retrieves",
"the",
"table",
"structure",
"for",
"an",
"Asta",
"PP",
"file",
".",
"Subclasses",
"determine",
"the",
"exact",
"contents",
"of",
"the",
"structure",
"for",
"a",
"specific",
"version",
"of",
"the",
"Asta",
"PP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AbstractFileFormat.java#L41-L64 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AbstractFileFormat.java | AbstractFileFormat.columnDefinitions | private ColumnDefinition[] columnDefinitions(ColumnDefinition[] columns, String[] order)
{
Map<String, ColumnDefinition> map = makeColumnMap(columns);
ColumnDefinition[] result = new ColumnDefinition[order.length];
for (int index = 0; index < order.length; index++)
{
result[index] = map.get(order[index]);
}
return result;
} | java | private ColumnDefinition[] columnDefinitions(ColumnDefinition[] columns, String[] order)
{
Map<String, ColumnDefinition> map = makeColumnMap(columns);
ColumnDefinition[] result = new ColumnDefinition[order.length];
for (int index = 0; index < order.length; index++)
{
result[index] = map.get(order[index]);
}
return result;
} | [
"private",
"ColumnDefinition",
"[",
"]",
"columnDefinitions",
"(",
"ColumnDefinition",
"[",
"]",
"columns",
",",
"String",
"[",
"]",
"order",
")",
"{",
"Map",
"<",
"String",
",",
"ColumnDefinition",
">",
"map",
"=",
"makeColumnMap",
"(",
"columns",
")",
";",... | Generate an ordered set of column definitions from an ordered set of column names.
@param columns column definitions
@param order column names
@return ordered set of column definitions | [
"Generate",
"an",
"ordered",
"set",
"of",
"column",
"definitions",
"from",
"an",
"ordered",
"set",
"of",
"column",
"names",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AbstractFileFormat.java#L200-L209 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AbstractFileFormat.java | AbstractFileFormat.makeColumnMap | private Map<String, ColumnDefinition> makeColumnMap(ColumnDefinition[] columns)
{
Map<String, ColumnDefinition> map = new HashMap<String, ColumnDefinition>();
for (ColumnDefinition def : columns)
{
map.put(def.getName(), def);
}
return map;
} | java | private Map<String, ColumnDefinition> makeColumnMap(ColumnDefinition[] columns)
{
Map<String, ColumnDefinition> map = new HashMap<String, ColumnDefinition>();
for (ColumnDefinition def : columns)
{
map.put(def.getName(), def);
}
return map;
} | [
"private",
"Map",
"<",
"String",
",",
"ColumnDefinition",
">",
"makeColumnMap",
"(",
"ColumnDefinition",
"[",
"]",
"columns",
")",
"{",
"Map",
"<",
"String",
",",
"ColumnDefinition",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ColumnDefinition",
... | Convert an array of column definitions into a map keyed by column name.
@param columns array of column definitions
@return map of column definitions | [
"Convert",
"an",
"array",
"of",
"column",
"definitions",
"into",
"a",
"map",
"keyed",
"by",
"column",
"name",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AbstractFileFormat.java#L217-L225 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeProjectExtendedAttributes | private void writeProjectExtendedAttributes(Project project)
{
Project.ExtendedAttributes attributes = m_factory.createProjectExtendedAttributes();
project.setExtendedAttributes(attributes);
List<Project.ExtendedAttributes.ExtendedAttribute> list = attributes.getExtendedAttribute();
Set<FieldType> customFields = new HashSet<FieldType>();
for (CustomField customField : m_projectFile.getCustomFields())
{
FieldType fieldType = customField.getFieldType();
if (fieldType != null)
{
customFields.add(fieldType);
}
}
customFields.addAll(m_extendedAttributesInUse);
List<FieldType> customFieldsList = new ArrayList<FieldType>();
customFieldsList.addAll(customFields);
// Sort to ensure consistent order in file
final CustomFieldContainer customFieldContainer = m_projectFile.getCustomFields();
Collections.sort(customFieldsList, new Comparator<FieldType>()
{
@Override public int compare(FieldType o1, FieldType o2)
{
CustomField customField1 = customFieldContainer.getCustomField(o1);
CustomField customField2 = customFieldContainer.getCustomField(o2);
String name1 = o1.getClass().getSimpleName() + "." + o1.getName() + " " + customField1.getAlias();
String name2 = o2.getClass().getSimpleName() + "." + o2.getName() + " " + customField2.getAlias();
return name1.compareTo(name2);
}
});
for (FieldType fieldType : customFieldsList)
{
Project.ExtendedAttributes.ExtendedAttribute attribute = m_factory.createProjectExtendedAttributesExtendedAttribute();
list.add(attribute);
attribute.setFieldID(String.valueOf(FieldTypeHelper.getFieldID(fieldType)));
attribute.setFieldName(fieldType.getName());
CustomField customField = customFieldContainer.getCustomField(fieldType);
attribute.setAlias(customField.getAlias());
}
} | java | private void writeProjectExtendedAttributes(Project project)
{
Project.ExtendedAttributes attributes = m_factory.createProjectExtendedAttributes();
project.setExtendedAttributes(attributes);
List<Project.ExtendedAttributes.ExtendedAttribute> list = attributes.getExtendedAttribute();
Set<FieldType> customFields = new HashSet<FieldType>();
for (CustomField customField : m_projectFile.getCustomFields())
{
FieldType fieldType = customField.getFieldType();
if (fieldType != null)
{
customFields.add(fieldType);
}
}
customFields.addAll(m_extendedAttributesInUse);
List<FieldType> customFieldsList = new ArrayList<FieldType>();
customFieldsList.addAll(customFields);
// Sort to ensure consistent order in file
final CustomFieldContainer customFieldContainer = m_projectFile.getCustomFields();
Collections.sort(customFieldsList, new Comparator<FieldType>()
{
@Override public int compare(FieldType o1, FieldType o2)
{
CustomField customField1 = customFieldContainer.getCustomField(o1);
CustomField customField2 = customFieldContainer.getCustomField(o2);
String name1 = o1.getClass().getSimpleName() + "." + o1.getName() + " " + customField1.getAlias();
String name2 = o2.getClass().getSimpleName() + "." + o2.getName() + " " + customField2.getAlias();
return name1.compareTo(name2);
}
});
for (FieldType fieldType : customFieldsList)
{
Project.ExtendedAttributes.ExtendedAttribute attribute = m_factory.createProjectExtendedAttributesExtendedAttribute();
list.add(attribute);
attribute.setFieldID(String.valueOf(FieldTypeHelper.getFieldID(fieldType)));
attribute.setFieldName(fieldType.getName());
CustomField customField = customFieldContainer.getCustomField(fieldType);
attribute.setAlias(customField.getAlias());
}
} | [
"private",
"void",
"writeProjectExtendedAttributes",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"ExtendedAttributes",
"attributes",
"=",
"m_factory",
".",
"createProjectExtendedAttributes",
"(",
")",
";",
"project",
".",
"setExtendedAttributes",
"(",
"attribut... | This method writes project extended attribute data into an MSPDI file.
@param project Root node of the MSPDI file | [
"This",
"method",
"writes",
"project",
"extended",
"attribute",
"data",
"into",
"an",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L295-L341 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeCalendars | private void writeCalendars(Project project)
{
//
// Create the new MSPDI calendar list
//
Project.Calendars calendars = m_factory.createProjectCalendars();
project.setCalendars(calendars);
List<Project.Calendars.Calendar> calendar = calendars.getCalendar();
//
// Process each calendar in turn
//
for (ProjectCalendar cal : m_projectFile.getCalendars())
{
calendar.add(writeCalendar(cal));
}
} | java | private void writeCalendars(Project project)
{
//
// Create the new MSPDI calendar list
//
Project.Calendars calendars = m_factory.createProjectCalendars();
project.setCalendars(calendars);
List<Project.Calendars.Calendar> calendar = calendars.getCalendar();
//
// Process each calendar in turn
//
for (ProjectCalendar cal : m_projectFile.getCalendars())
{
calendar.add(writeCalendar(cal));
}
} | [
"private",
"void",
"writeCalendars",
"(",
"Project",
"project",
")",
"{",
"//",
"// Create the new MSPDI calendar list",
"//",
"Project",
".",
"Calendars",
"calendars",
"=",
"m_factory",
".",
"createProjectCalendars",
"(",
")",
";",
"project",
".",
"setCalendars",
"... | This method writes calendar data to an MSPDI file.
@param project Root node of the MSPDI file | [
"This",
"method",
"writes",
"calendar",
"data",
"to",
"an",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L348-L364 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeCalendar | private Project.Calendars.Calendar writeCalendar(ProjectCalendar bc)
{
//
// Create a calendar
//
Project.Calendars.Calendar calendar = m_factory.createProjectCalendarsCalendar();
calendar.setUID(NumberHelper.getBigInteger(bc.getUniqueID()));
calendar.setIsBaseCalendar(Boolean.valueOf(!bc.isDerived()));
ProjectCalendar base = bc.getParent();
// SF-329: null default required to keep Powerproject happy when importing MSPDI files
calendar.setBaseCalendarUID(base == null ? NULL_CALENDAR_ID : NumberHelper.getBigInteger(base.getUniqueID()));
calendar.setName(bc.getName());
//
// Create a list of normal days
//
Project.Calendars.Calendar.WeekDays days = m_factory.createProjectCalendarsCalendarWeekDays();
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time;
ProjectCalendarHours bch;
List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList = days.getWeekDay();
for (int loop = 1; loop < 8; loop++)
{
DayType workingFlag = bc.getWorkingDay(Day.getInstance(loop));
if (workingFlag != DayType.DEFAULT)
{
Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BigInteger.valueOf(loop));
day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));
if (workingFlag == DayType.WORKING)
{
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
bch = bc.getCalendarHours(Day.getInstance(loop));
if (bch != null)
{
for (DateRange range : bch)
{
if (range != null)
{
time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
}
}
}
//
// Create a list of exceptions
//
// A quirk of MS Project is that these exceptions must be
// in date order in the file, otherwise they are ignored
//
List<ProjectCalendarException> exceptions = new ArrayList<ProjectCalendarException>(bc.getCalendarExceptions());
if (!exceptions.isEmpty())
{
Collections.sort(exceptions);
writeExceptions(calendar, dayList, exceptions);
}
//
// Do not add a weekdays tag to the calendar unless it
// has valid entries.
// Fixes SourceForge bug 1854747: MPXJ and MSP 2007 XML formats
//
if (!dayList.isEmpty())
{
calendar.setWeekDays(days);
}
writeWorkWeeks(calendar, bc);
m_eventManager.fireCalendarWrittenEvent(bc);
return (calendar);
} | java | private Project.Calendars.Calendar writeCalendar(ProjectCalendar bc)
{
//
// Create a calendar
//
Project.Calendars.Calendar calendar = m_factory.createProjectCalendarsCalendar();
calendar.setUID(NumberHelper.getBigInteger(bc.getUniqueID()));
calendar.setIsBaseCalendar(Boolean.valueOf(!bc.isDerived()));
ProjectCalendar base = bc.getParent();
// SF-329: null default required to keep Powerproject happy when importing MSPDI files
calendar.setBaseCalendarUID(base == null ? NULL_CALENDAR_ID : NumberHelper.getBigInteger(base.getUniqueID()));
calendar.setName(bc.getName());
//
// Create a list of normal days
//
Project.Calendars.Calendar.WeekDays days = m_factory.createProjectCalendarsCalendarWeekDays();
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time;
ProjectCalendarHours bch;
List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList = days.getWeekDay();
for (int loop = 1; loop < 8; loop++)
{
DayType workingFlag = bc.getWorkingDay(Day.getInstance(loop));
if (workingFlag != DayType.DEFAULT)
{
Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BigInteger.valueOf(loop));
day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));
if (workingFlag == DayType.WORKING)
{
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
bch = bc.getCalendarHours(Day.getInstance(loop));
if (bch != null)
{
for (DateRange range : bch)
{
if (range != null)
{
time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
}
}
}
//
// Create a list of exceptions
//
// A quirk of MS Project is that these exceptions must be
// in date order in the file, otherwise they are ignored
//
List<ProjectCalendarException> exceptions = new ArrayList<ProjectCalendarException>(bc.getCalendarExceptions());
if (!exceptions.isEmpty())
{
Collections.sort(exceptions);
writeExceptions(calendar, dayList, exceptions);
}
//
// Do not add a weekdays tag to the calendar unless it
// has valid entries.
// Fixes SourceForge bug 1854747: MPXJ and MSP 2007 XML formats
//
if (!dayList.isEmpty())
{
calendar.setWeekDays(days);
}
writeWorkWeeks(calendar, bc);
m_eventManager.fireCalendarWrittenEvent(bc);
return (calendar);
} | [
"private",
"Project",
".",
"Calendars",
".",
"Calendar",
"writeCalendar",
"(",
"ProjectCalendar",
"bc",
")",
"{",
"//",
"// Create a calendar",
"//",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
"=",
"m_factory",
".",
"createProjectCalendarsCalendar",
"... | This method writes data for a single calendar to an MSPDI file.
@param bc Base calendar data
@return New MSPDI calendar instance | [
"This",
"method",
"writes",
"data",
"for",
"a",
"single",
"calendar",
"to",
"an",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L372-L459 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeExceptions | private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
{
// Always write legacy exception data:
// Powerproject appears not to recognise new format data at all,
// and legacy data is ignored in preference to new data post MSP 2003
writeExceptions9(dayList, exceptions);
if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue())
{
writeExceptions12(calendar, exceptions);
}
} | java | private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
{
// Always write legacy exception data:
// Powerproject appears not to recognise new format data at all,
// and legacy data is ignored in preference to new data post MSP 2003
writeExceptions9(dayList, exceptions);
if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue())
{
writeExceptions12(calendar, exceptions);
}
} | [
"private",
"void",
"writeExceptions",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"List",
"<",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
">",
"dayList",
",",
"List",
"<",
"ProjectCalendarException",
... | Main entry point used to determine the format used to write
calendar exceptions.
@param calendar parent calendar
@param dayList list of calendar days
@param exceptions list of exceptions | [
"Main",
"entry",
"point",
"used",
"to",
"determine",
"the",
"format",
"used",
"to",
"write",
"calendar",
"exceptions",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L469-L480 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeExceptions9 | private void writeExceptions9(List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
{
for (ProjectCalendarException exception : exceptions)
{
boolean working = exception.getWorking();
Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BIGINTEGER_ZERO);
day.setDayWorking(Boolean.valueOf(working));
Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod period = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayTimePeriod();
day.setTimePeriod(period);
period.setFromDate(exception.getFromDate());
period.setToDate(exception.getToDate());
if (working)
{
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
for (DateRange range : exception)
{
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
} | java | private void writeExceptions9(List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
{
for (ProjectCalendarException exception : exceptions)
{
boolean working = exception.getWorking();
Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BIGINTEGER_ZERO);
day.setDayWorking(Boolean.valueOf(working));
Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod period = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayTimePeriod();
day.setTimePeriod(period);
period.setFromDate(exception.getFromDate());
period.setToDate(exception.getToDate());
if (working)
{
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
for (DateRange range : exception)
{
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
} | [
"private",
"void",
"writeExceptions9",
"(",
"List",
"<",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
">",
"dayList",
",",
"List",
"<",
"ProjectCalendarException",
">",
"exceptions",
")",
"{",
"for",
"(",
"ProjectCalendarExcepti... | Write exceptions in the format used by MSPDI files prior to Project 2007.
@param dayList list of calendar days
@param exceptions list of exceptions | [
"Write",
"exceptions",
"in",
"the",
"format",
"used",
"by",
"MSPDI",
"files",
"prior",
"to",
"Project",
"2007",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L488-L520 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeExceptions12 | private void writeExceptions12(Project.Calendars.Calendar calendar, List<ProjectCalendarException> exceptions)
{
Exceptions ce = m_factory.createProjectCalendarsCalendarExceptions();
calendar.setExceptions(ce);
List<Exceptions.Exception> el = ce.getException();
for (ProjectCalendarException exception : exceptions)
{
Exceptions.Exception ex = m_factory.createProjectCalendarsCalendarExceptionsException();
el.add(ex);
ex.setName(exception.getName());
boolean working = exception.getWorking();
ex.setDayWorking(Boolean.valueOf(working));
if (exception.getRecurring() == null)
{
ex.setEnteredByOccurrences(Boolean.FALSE);
ex.setOccurrences(BigInteger.ONE);
ex.setType(BigInteger.ONE);
}
else
{
populateRecurringException(exception, ex);
}
Project.Calendars.Calendar.Exceptions.Exception.TimePeriod period = m_factory.createProjectCalendarsCalendarExceptionsExceptionTimePeriod();
ex.setTimePeriod(period);
period.setFromDate(exception.getFromDate());
period.setToDate(exception.getToDate());
if (working)
{
Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimes();
ex.setWorkingTimes(times);
List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
for (DateRange range : exception)
{
Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
} | java | private void writeExceptions12(Project.Calendars.Calendar calendar, List<ProjectCalendarException> exceptions)
{
Exceptions ce = m_factory.createProjectCalendarsCalendarExceptions();
calendar.setExceptions(ce);
List<Exceptions.Exception> el = ce.getException();
for (ProjectCalendarException exception : exceptions)
{
Exceptions.Exception ex = m_factory.createProjectCalendarsCalendarExceptionsException();
el.add(ex);
ex.setName(exception.getName());
boolean working = exception.getWorking();
ex.setDayWorking(Boolean.valueOf(working));
if (exception.getRecurring() == null)
{
ex.setEnteredByOccurrences(Boolean.FALSE);
ex.setOccurrences(BigInteger.ONE);
ex.setType(BigInteger.ONE);
}
else
{
populateRecurringException(exception, ex);
}
Project.Calendars.Calendar.Exceptions.Exception.TimePeriod period = m_factory.createProjectCalendarsCalendarExceptionsExceptionTimePeriod();
ex.setTimePeriod(period);
period.setFromDate(exception.getFromDate());
period.setToDate(exception.getToDate());
if (working)
{
Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimes();
ex.setWorkingTimes(times);
List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
for (DateRange range : exception)
{
Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
} | [
"private",
"void",
"writeExceptions12",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"List",
"<",
"ProjectCalendarException",
">",
"exceptions",
")",
"{",
"Exceptions",
"ce",
"=",
"m_factory",
".",
"createProjectCalendarsCalendarExceptions",
"("... | Write exceptions into the format used by MSPDI files from
Project 2007 onwards.
@param calendar parent calendar
@param exceptions list of exceptions | [
"Write",
"exceptions",
"into",
"the",
"format",
"used",
"by",
"MSPDI",
"files",
"from",
"Project",
"2007",
"onwards",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L529-L576 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.populateRecurringException | private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException)
{
RecurringData data = mpxjException.getRecurring();
xmlException.setEnteredByOccurrences(Boolean.TRUE);
xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences()));
switch (data.getRecurrenceType())
{
case DAILY:
{
xmlException.setType(BigInteger.valueOf(7));
xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
break;
}
case WEEKLY:
{
xmlException.setType(BigInteger.valueOf(6));
xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
xmlException.setDaysOfWeek(getDaysOfTheWeek(data));
break;
}
case MONTHLY:
{
xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
if (data.getRelative())
{
xmlException.setType(BigInteger.valueOf(5));
xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2));
xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1));
}
else
{
xmlException.setType(BigInteger.valueOf(4));
xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber()));
}
break;
}
case YEARLY:
{
xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1));
if (data.getRelative())
{
xmlException.setType(BigInteger.valueOf(3));
xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2));
xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1));
}
else
{
xmlException.setType(BigInteger.valueOf(2));
xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber()));
}
}
}
} | java | private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException)
{
RecurringData data = mpxjException.getRecurring();
xmlException.setEnteredByOccurrences(Boolean.TRUE);
xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences()));
switch (data.getRecurrenceType())
{
case DAILY:
{
xmlException.setType(BigInteger.valueOf(7));
xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
break;
}
case WEEKLY:
{
xmlException.setType(BigInteger.valueOf(6));
xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
xmlException.setDaysOfWeek(getDaysOfTheWeek(data));
break;
}
case MONTHLY:
{
xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
if (data.getRelative())
{
xmlException.setType(BigInteger.valueOf(5));
xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2));
xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1));
}
else
{
xmlException.setType(BigInteger.valueOf(4));
xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber()));
}
break;
}
case YEARLY:
{
xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1));
if (data.getRelative())
{
xmlException.setType(BigInteger.valueOf(3));
xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2));
xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1));
}
else
{
xmlException.setType(BigInteger.valueOf(2));
xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber()));
}
}
}
} | [
"private",
"void",
"populateRecurringException",
"(",
"ProjectCalendarException",
"mpxjException",
",",
"Exceptions",
".",
"Exception",
"xmlException",
")",
"{",
"RecurringData",
"data",
"=",
"mpxjException",
".",
"getRecurring",
"(",
")",
";",
"xmlException",
".",
"s... | Writes the details of a recurring exception.
@param mpxjException source MPXJ calendar exception
@param xmlException target MSPDI exception | [
"Writes",
"the",
"details",
"of",
"a",
"recurring",
"exception",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L584-L640 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.getDaysOfTheWeek | private BigInteger getDaysOfTheWeek(RecurringData data)
{
int value = 0;
for (Day day : Day.values())
{
if (data.getWeeklyDay(day))
{
value = value | DAY_MASKS[day.getValue()];
}
}
return BigInteger.valueOf(value);
} | java | private BigInteger getDaysOfTheWeek(RecurringData data)
{
int value = 0;
for (Day day : Day.values())
{
if (data.getWeeklyDay(day))
{
value = value | DAY_MASKS[day.getValue()];
}
}
return BigInteger.valueOf(value);
} | [
"private",
"BigInteger",
"getDaysOfTheWeek",
"(",
"RecurringData",
"data",
")",
"{",
"int",
"value",
"=",
"0",
";",
"for",
"(",
"Day",
"day",
":",
"Day",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"data",
".",
"getWeeklyDay",
"(",
"day",
")",
")",... | Converts days of the week into a bit field.
@param data recurring data
@return bit field | [
"Converts",
"days",
"of",
"the",
"week",
"into",
"a",
"bit",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L648-L659 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeWorkWeeks | private void writeWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)
{
List<ProjectCalendarWeek> weeks = mpxjCalendar.getWorkWeeks();
if (!weeks.isEmpty())
{
WorkWeeks xmlWorkWeeks = m_factory.createProjectCalendarsCalendarWorkWeeks();
xmlCalendar.setWorkWeeks(xmlWorkWeeks);
List<WorkWeek> xmlWorkWeekList = xmlWorkWeeks.getWorkWeek();
for (ProjectCalendarWeek week : weeks)
{
WorkWeek xmlWeek = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeek();
xmlWorkWeekList.add(xmlWeek);
xmlWeek.setName(week.getName());
TimePeriod xmlTimePeriod = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekTimePeriod();
xmlWeek.setTimePeriod(xmlTimePeriod);
xmlTimePeriod.setFromDate(week.getDateRange().getStart());
xmlTimePeriod.setToDate(week.getDateRange().getEnd());
WeekDays xmlWeekDays = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDays();
xmlWeek.setWeekDays(xmlWeekDays);
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay> dayList = xmlWeekDays.getWeekDay();
for (int loop = 1; loop < 8; loop++)
{
DayType workingFlag = week.getWorkingDay(Day.getInstance(loop));
if (workingFlag != DayType.DEFAULT)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BigInteger.valueOf(loop));
day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));
if (workingFlag == DayType.WORKING)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
ProjectCalendarHours bch = week.getCalendarHours(Day.getInstance(loop));
if (bch != null)
{
for (DateRange range : bch)
{
if (range != null)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
}
}
}
}
}
} | java | private void writeWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)
{
List<ProjectCalendarWeek> weeks = mpxjCalendar.getWorkWeeks();
if (!weeks.isEmpty())
{
WorkWeeks xmlWorkWeeks = m_factory.createProjectCalendarsCalendarWorkWeeks();
xmlCalendar.setWorkWeeks(xmlWorkWeeks);
List<WorkWeek> xmlWorkWeekList = xmlWorkWeeks.getWorkWeek();
for (ProjectCalendarWeek week : weeks)
{
WorkWeek xmlWeek = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeek();
xmlWorkWeekList.add(xmlWeek);
xmlWeek.setName(week.getName());
TimePeriod xmlTimePeriod = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekTimePeriod();
xmlWeek.setTimePeriod(xmlTimePeriod);
xmlTimePeriod.setFromDate(week.getDateRange().getStart());
xmlTimePeriod.setToDate(week.getDateRange().getEnd());
WeekDays xmlWeekDays = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDays();
xmlWeek.setWeekDays(xmlWeekDays);
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay> dayList = xmlWeekDays.getWeekDay();
for (int loop = 1; loop < 8; loop++)
{
DayType workingFlag = week.getWorkingDay(Day.getInstance(loop));
if (workingFlag != DayType.DEFAULT)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BigInteger.valueOf(loop));
day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));
if (workingFlag == DayType.WORKING)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
ProjectCalendarHours bch = week.getCalendarHours(Day.getInstance(loop));
if (bch != null)
{
for (DateRange range : bch)
{
if (range != null)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
}
}
}
}
}
} | [
"private",
"void",
"writeWorkWeeks",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"xmlCalendar",
",",
"ProjectCalendar",
"mpxjCalendar",
")",
"{",
"List",
"<",
"ProjectCalendarWeek",
">",
"weeks",
"=",
"mpxjCalendar",
".",
"getWorkWeeks",
"(",
")",
";",
"i... | Write the work weeks associated with this calendar.
@param xmlCalendar XML calendar instance
@param mpxjCalendar MPXJ calendar instance | [
"Write",
"the",
"work",
"weeks",
"associated",
"with",
"this",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L667-L729 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeResources | private void writeResources(Project project)
{
Project.Resources resources = m_factory.createProjectResources();
project.setResources(resources);
List<Project.Resources.Resource> list = resources.getResource();
for (Resource resource : m_projectFile.getResources())
{
list.add(writeResource(resource));
}
} | java | private void writeResources(Project project)
{
Project.Resources resources = m_factory.createProjectResources();
project.setResources(resources);
List<Project.Resources.Resource> list = resources.getResource();
for (Resource resource : m_projectFile.getResources())
{
list.add(writeResource(resource));
}
} | [
"private",
"void",
"writeResources",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"Resources",
"resources",
"=",
"m_factory",
".",
"createProjectResources",
"(",
")",
";",
"project",
".",
"setResources",
"(",
"resources",
")",
";",
"List",
"<",
"Projec... | This method writes resource data to an MSPDI file.
@param project Root node of the MSPDI file | [
"This",
"method",
"writes",
"resource",
"data",
"to",
"an",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L736-L746 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeResourceBaselines | private void writeResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource)
{
Project.Resources.Resource.Baseline baseline = m_factory.createProjectResourcesResourceBaseline();
boolean populated = false;
Number cost = mpxjResource.getBaselineCost();
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
Duration work = mpxjResource.getBaselineWork();
if (work != null && work.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, work));
}
if (populated)
{
xmlResource.getBaseline().add(baseline);
baseline.setNumber(BigInteger.ZERO);
}
for (int loop = 1; loop <= 10; loop++)
{
baseline = m_factory.createProjectResourcesResourceBaseline();
populated = false;
cost = mpxjResource.getBaselineCost(loop);
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
work = mpxjResource.getBaselineWork(loop);
if (work != null && work.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, work));
}
if (populated)
{
xmlResource.getBaseline().add(baseline);
baseline.setNumber(BigInteger.valueOf(loop));
}
}
} | java | private void writeResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource)
{
Project.Resources.Resource.Baseline baseline = m_factory.createProjectResourcesResourceBaseline();
boolean populated = false;
Number cost = mpxjResource.getBaselineCost();
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
Duration work = mpxjResource.getBaselineWork();
if (work != null && work.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, work));
}
if (populated)
{
xmlResource.getBaseline().add(baseline);
baseline.setNumber(BigInteger.ZERO);
}
for (int loop = 1; loop <= 10; loop++)
{
baseline = m_factory.createProjectResourcesResourceBaseline();
populated = false;
cost = mpxjResource.getBaselineCost(loop);
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
work = mpxjResource.getBaselineWork(loop);
if (work != null && work.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, work));
}
if (populated)
{
xmlResource.getBaseline().add(baseline);
baseline.setNumber(BigInteger.valueOf(loop));
}
}
} | [
"private",
"void",
"writeResourceBaselines",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"xmlResource",
",",
"Resource",
"mpxjResource",
")",
"{",
"Project",
".",
"Resources",
".",
"Resource",
".",
"Baseline",
"baseline",
"=",
"m_factory",
".",
"createProje... | Writes resource baseline data.
@param xmlResource MSPDI resource
@param mpxjResource MPXJ resource | [
"Writes",
"resource",
"baseline",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L857-L907 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeResourceExtendedAttributes | private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
{
Project.Resources.Resource.ExtendedAttribute attrib;
List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (ResourceField mpxFieldID : getAllResourceExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPResourceField.getID(mpxFieldID) | MPPResourceField.RESOURCE_FIELD_BASE);
attrib = m_factory.createProjectResourcesResourceExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | java | private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
{
Project.Resources.Resource.ExtendedAttribute attrib;
List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (ResourceField mpxFieldID : getAllResourceExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPResourceField.getID(mpxFieldID) | MPPResourceField.RESOURCE_FIELD_BASE);
attrib = m_factory.createProjectResourcesResourceExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | [
"private",
"void",
"writeResourceExtendedAttributes",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"xml",
",",
"Resource",
"mpx",
")",
"{",
"Project",
".",
"Resources",
".",
"Resource",
".",
"ExtendedAttribute",
"attrib",
";",
"List",
"<",
"Project",
".",
... | This method writes extended attribute data for a resource.
@param xml MSPDI resource
@param mpx MPXJ resource | [
"This",
"method",
"writes",
"extended",
"attribute",
"data",
"for",
"a",
"resource",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L915-L937 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeCostRateTables | private void writeCostRateTables(Project.Resources.Resource xml, Resource mpx)
{
//Rates rates = m_factory.createProjectResourcesResourceRates();
//xml.setRates(rates);
//List<Project.Resources.Resource.Rates.Rate> ratesList = rates.getRate();
List<Project.Resources.Resource.Rates.Rate> ratesList = null;
for (int tableIndex = 0; tableIndex < 5; tableIndex++)
{
CostRateTable table = mpx.getCostRateTable(tableIndex);
if (table != null)
{
Date from = DateHelper.FIRST_DATE;
for (CostRateTableEntry entry : table)
{
if (costRateTableWriteRequired(entry, from))
{
if (ratesList == null)
{
Rates rates = m_factory.createProjectResourcesResourceRates();
xml.setRates(rates);
ratesList = rates.getRate();
}
Project.Resources.Resource.Rates.Rate rate = m_factory.createProjectResourcesResourceRatesRate();
ratesList.add(rate);
rate.setCostPerUse(DatatypeConverter.printCurrency(entry.getCostPerUse()));
rate.setOvertimeRate(DatatypeConverter.printRate(entry.getOvertimeRate()));
rate.setOvertimeRateFormat(DatatypeConverter.printTimeUnit(entry.getOvertimeRateFormat()));
rate.setRatesFrom(from);
from = entry.getEndDate();
rate.setRatesTo(from);
rate.setRateTable(BigInteger.valueOf(tableIndex));
rate.setStandardRate(DatatypeConverter.printRate(entry.getStandardRate()));
rate.setStandardRateFormat(DatatypeConverter.printTimeUnit(entry.getStandardRateFormat()));
}
}
}
}
} | java | private void writeCostRateTables(Project.Resources.Resource xml, Resource mpx)
{
//Rates rates = m_factory.createProjectResourcesResourceRates();
//xml.setRates(rates);
//List<Project.Resources.Resource.Rates.Rate> ratesList = rates.getRate();
List<Project.Resources.Resource.Rates.Rate> ratesList = null;
for (int tableIndex = 0; tableIndex < 5; tableIndex++)
{
CostRateTable table = mpx.getCostRateTable(tableIndex);
if (table != null)
{
Date from = DateHelper.FIRST_DATE;
for (CostRateTableEntry entry : table)
{
if (costRateTableWriteRequired(entry, from))
{
if (ratesList == null)
{
Rates rates = m_factory.createProjectResourcesResourceRates();
xml.setRates(rates);
ratesList = rates.getRate();
}
Project.Resources.Resource.Rates.Rate rate = m_factory.createProjectResourcesResourceRatesRate();
ratesList.add(rate);
rate.setCostPerUse(DatatypeConverter.printCurrency(entry.getCostPerUse()));
rate.setOvertimeRate(DatatypeConverter.printRate(entry.getOvertimeRate()));
rate.setOvertimeRateFormat(DatatypeConverter.printTimeUnit(entry.getOvertimeRateFormat()));
rate.setRatesFrom(from);
from = entry.getEndDate();
rate.setRatesTo(from);
rate.setRateTable(BigInteger.valueOf(tableIndex));
rate.setStandardRate(DatatypeConverter.printRate(entry.getStandardRate()));
rate.setStandardRateFormat(DatatypeConverter.printTimeUnit(entry.getStandardRateFormat()));
}
}
}
}
} | [
"private",
"void",
"writeCostRateTables",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"xml",
",",
"Resource",
"mpx",
")",
"{",
"//Rates rates = m_factory.createProjectResourcesResourceRates();",
"//xml.setRates(rates);",
"//List<Project.Resources.Resource.Rates.Rate> ratesLi... | Writes a resource's cost rate tables.
@param xml MSPDI resource
@param mpx MPXJ resource | [
"Writes",
"a",
"resource",
"s",
"cost",
"rate",
"tables",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L945-L986 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.costRateTableWriteRequired | private boolean costRateTableWriteRequired(CostRateTableEntry entry, Date from)
{
boolean fromDate = (DateHelper.compare(from, DateHelper.FIRST_DATE) > 0);
boolean toDate = (DateHelper.compare(entry.getEndDate(), DateHelper.LAST_DATE) > 0);
boolean costPerUse = (NumberHelper.getDouble(entry.getCostPerUse()) != 0);
boolean overtimeRate = (entry.getOvertimeRate() != null && entry.getOvertimeRate().getAmount() != 0);
boolean standardRate = (entry.getStandardRate() != null && entry.getStandardRate().getAmount() != 0);
return (fromDate || toDate || costPerUse || overtimeRate || standardRate);
} | java | private boolean costRateTableWriteRequired(CostRateTableEntry entry, Date from)
{
boolean fromDate = (DateHelper.compare(from, DateHelper.FIRST_DATE) > 0);
boolean toDate = (DateHelper.compare(entry.getEndDate(), DateHelper.LAST_DATE) > 0);
boolean costPerUse = (NumberHelper.getDouble(entry.getCostPerUse()) != 0);
boolean overtimeRate = (entry.getOvertimeRate() != null && entry.getOvertimeRate().getAmount() != 0);
boolean standardRate = (entry.getStandardRate() != null && entry.getStandardRate().getAmount() != 0);
return (fromDate || toDate || costPerUse || overtimeRate || standardRate);
} | [
"private",
"boolean",
"costRateTableWriteRequired",
"(",
"CostRateTableEntry",
"entry",
",",
"Date",
"from",
")",
"{",
"boolean",
"fromDate",
"=",
"(",
"DateHelper",
".",
"compare",
"(",
"from",
",",
"DateHelper",
".",
"FIRST_DATE",
")",
">",
"0",
")",
";",
... | This method determines whether the cost rate table should be written.
A default cost rate table should not be written to the file.
@param entry cost rate table entry
@param from from date
@return boolean flag | [
"This",
"method",
"determines",
"whether",
"the",
"cost",
"rate",
"table",
"should",
"be",
"written",
".",
"A",
"default",
"cost",
"rate",
"table",
"should",
"not",
"be",
"written",
"to",
"the",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L996-L1004 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeAvailability | private void writeAvailability(Project.Resources.Resource xml, Resource mpx)
{
AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods();
xml.setAvailabilityPeriods(periods);
List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
for (Availability availability : mpx.getAvailability())
{
AvailabilityPeriod period = m_factory.createProjectResourcesResourceAvailabilityPeriodsAvailabilityPeriod();
list.add(period);
DateRange range = availability.getRange();
period.setAvailableFrom(range.getStart());
period.setAvailableTo(range.getEnd());
period.setAvailableUnits(DatatypeConverter.printUnits(availability.getUnits()));
}
} | java | private void writeAvailability(Project.Resources.Resource xml, Resource mpx)
{
AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods();
xml.setAvailabilityPeriods(periods);
List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
for (Availability availability : mpx.getAvailability())
{
AvailabilityPeriod period = m_factory.createProjectResourcesResourceAvailabilityPeriodsAvailabilityPeriod();
list.add(period);
DateRange range = availability.getRange();
period.setAvailableFrom(range.getStart());
period.setAvailableTo(range.getEnd());
period.setAvailableUnits(DatatypeConverter.printUnits(availability.getUnits()));
}
} | [
"private",
"void",
"writeAvailability",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"xml",
",",
"Resource",
"mpx",
")",
"{",
"AvailabilityPeriods",
"periods",
"=",
"m_factory",
".",
"createProjectResourcesResourceAvailabilityPeriods",
"(",
")",
";",
"xml",
".... | This method writes a resource's availability table.
@param xml MSPDI resource
@param mpx MPXJ resource | [
"This",
"method",
"writes",
"a",
"resource",
"s",
"availability",
"table",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1012-L1027 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeTasks | private void writeTasks(Project project)
{
Project.Tasks tasks = m_factory.createProjectTasks();
project.setTasks(tasks);
List<Project.Tasks.Task> list = tasks.getTask();
for (Task task : m_projectFile.getTasks())
{
list.add(writeTask(task));
}
} | java | private void writeTasks(Project project)
{
Project.Tasks tasks = m_factory.createProjectTasks();
project.setTasks(tasks);
List<Project.Tasks.Task> list = tasks.getTask();
for (Task task : m_projectFile.getTasks())
{
list.add(writeTask(task));
}
} | [
"private",
"void",
"writeTasks",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"Tasks",
"tasks",
"=",
"m_factory",
".",
"createProjectTasks",
"(",
")",
";",
"project",
".",
"setTasks",
"(",
"tasks",
")",
";",
"List",
"<",
"Project",
".",
"Tasks",
... | This method writes task data to an MSPDI file.
@param project Root node of the MSPDI file | [
"This",
"method",
"writes",
"task",
"data",
"to",
"an",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1034-L1044 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeTaskBaselines | private void writeTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask)
{
Project.Tasks.Task.Baseline baseline = m_factory.createProjectTasksTaskBaseline();
boolean populated = false;
Number cost = mpxjTask.getBaselineCost();
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
Duration duration = mpxjTask.getBaselineDuration();
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setDuration(DatatypeConverter.printDuration(this, duration));
baseline.setDurationFormat(DatatypeConverter.printDurationTimeUnits(duration, false));
}
Date date = mpxjTask.getBaselineFinish();
if (date != null)
{
populated = true;
baseline.setFinish(date);
}
date = mpxjTask.getBaselineStart();
if (date != null)
{
populated = true;
baseline.setStart(date);
}
duration = mpxjTask.getBaselineWork();
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber(BigInteger.ZERO);
xmlTask.getBaseline().add(baseline);
}
for (int loop = 1; loop <= 10; loop++)
{
baseline = m_factory.createProjectTasksTaskBaseline();
populated = false;
cost = mpxjTask.getBaselineCost(loop);
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
duration = mpxjTask.getBaselineDuration(loop);
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setDuration(DatatypeConverter.printDuration(this, duration));
baseline.setDurationFormat(DatatypeConverter.printDurationTimeUnits(duration, false));
}
date = mpxjTask.getBaselineFinish(loop);
if (date != null)
{
populated = true;
baseline.setFinish(date);
}
date = mpxjTask.getBaselineStart(loop);
if (date != null)
{
populated = true;
baseline.setStart(date);
}
duration = mpxjTask.getBaselineWork(loop);
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber(BigInteger.valueOf(loop));
xmlTask.getBaseline().add(baseline);
}
}
} | java | private void writeTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask)
{
Project.Tasks.Task.Baseline baseline = m_factory.createProjectTasksTaskBaseline();
boolean populated = false;
Number cost = mpxjTask.getBaselineCost();
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
Duration duration = mpxjTask.getBaselineDuration();
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setDuration(DatatypeConverter.printDuration(this, duration));
baseline.setDurationFormat(DatatypeConverter.printDurationTimeUnits(duration, false));
}
Date date = mpxjTask.getBaselineFinish();
if (date != null)
{
populated = true;
baseline.setFinish(date);
}
date = mpxjTask.getBaselineStart();
if (date != null)
{
populated = true;
baseline.setStart(date);
}
duration = mpxjTask.getBaselineWork();
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber(BigInteger.ZERO);
xmlTask.getBaseline().add(baseline);
}
for (int loop = 1; loop <= 10; loop++)
{
baseline = m_factory.createProjectTasksTaskBaseline();
populated = false;
cost = mpxjTask.getBaselineCost(loop);
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printCurrency(cost));
}
duration = mpxjTask.getBaselineDuration(loop);
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setDuration(DatatypeConverter.printDuration(this, duration));
baseline.setDurationFormat(DatatypeConverter.printDurationTimeUnits(duration, false));
}
date = mpxjTask.getBaselineFinish(loop);
if (date != null)
{
populated = true;
baseline.setFinish(date);
}
date = mpxjTask.getBaselineStart(loop);
if (date != null)
{
populated = true;
baseline.setStart(date);
}
duration = mpxjTask.getBaselineWork(loop);
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber(BigInteger.valueOf(loop));
xmlTask.getBaseline().add(baseline);
}
}
} | [
"private",
"void",
"writeTaskBaselines",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"xmlTask",
",",
"Task",
"mpxjTask",
")",
"{",
"Project",
".",
"Tasks",
".",
"Task",
".",
"Baseline",
"baseline",
"=",
"m_factory",
".",
"createProjectTasksTaskBaseline",
"(",
"... | Writes task baseline data.
@param xmlTask MSPDI task
@param mpxjTask MPXJ task | [
"Writes",
"task",
"baseline",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1211-L1305 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeTaskExtendedAttributes | private void writeTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)
{
Project.Tasks.Task.ExtendedAttribute attrib;
List<Project.Tasks.Task.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (TaskField mpxFieldID : getAllTaskExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPTaskField.getID(mpxFieldID) | MPPTaskField.TASK_FIELD_BASE);
attrib = m_factory.createProjectTasksTaskExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | java | private void writeTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)
{
Project.Tasks.Task.ExtendedAttribute attrib;
List<Project.Tasks.Task.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (TaskField mpxFieldID : getAllTaskExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPTaskField.getID(mpxFieldID) | MPPTaskField.TASK_FIELD_BASE);
attrib = m_factory.createProjectTasksTaskExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | [
"private",
"void",
"writeTaskExtendedAttributes",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"xml",
",",
"Task",
"mpx",
")",
"{",
"Project",
".",
"Tasks",
".",
"Task",
".",
"ExtendedAttribute",
"attrib",
";",
"List",
"<",
"Project",
".",
"Tasks",
".",
"Tas... | This method writes extended attribute data for a task.
@param xml MSPDI task
@param mpx MPXJ task | [
"This",
"method",
"writes",
"extended",
"attribute",
"data",
"for",
"a",
"task",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1313-L1335 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.printExtendedAttributeDurationFormat | private BigInteger printExtendedAttributeDurationFormat(Object value)
{
BigInteger result = null;
if (value instanceof Duration)
{
result = DatatypeConverter.printDurationTimeUnits(((Duration) value).getUnits(), false);
}
return (result);
} | java | private BigInteger printExtendedAttributeDurationFormat(Object value)
{
BigInteger result = null;
if (value instanceof Duration)
{
result = DatatypeConverter.printDurationTimeUnits(((Duration) value).getUnits(), false);
}
return (result);
} | [
"private",
"BigInteger",
"printExtendedAttributeDurationFormat",
"(",
"Object",
"value",
")",
"{",
"BigInteger",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"instanceof",
"Duration",
")",
"{",
"result",
"=",
"DatatypeConverter",
".",
"printDurationTimeUnits",
"(... | Converts a duration to duration time units.
@param value duration value
@return duration time units | [
"Converts",
"a",
"duration",
"to",
"duration",
"time",
"units",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1343-L1351 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.getTaskCalendarID | private BigInteger getTaskCalendarID(Task mpx)
{
BigInteger result = null;
ProjectCalendar cal = mpx.getCalendar();
if (cal != null)
{
result = NumberHelper.getBigInteger(cal.getUniqueID());
}
else
{
result = NULL_CALENDAR_ID;
}
return (result);
} | java | private BigInteger getTaskCalendarID(Task mpx)
{
BigInteger result = null;
ProjectCalendar cal = mpx.getCalendar();
if (cal != null)
{
result = NumberHelper.getBigInteger(cal.getUniqueID());
}
else
{
result = NULL_CALENDAR_ID;
}
return (result);
} | [
"private",
"BigInteger",
"getTaskCalendarID",
"(",
"Task",
"mpx",
")",
"{",
"BigInteger",
"result",
"=",
"null",
";",
"ProjectCalendar",
"cal",
"=",
"mpx",
".",
"getCalendar",
"(",
")",
";",
"if",
"(",
"cal",
"!=",
"null",
")",
"{",
"result",
"=",
"Numbe... | This method retrieves the UID for a calendar associated with a task.
@param mpx MPX Task instance
@return calendar UID | [
"This",
"method",
"retrieves",
"the",
"UID",
"for",
"a",
"calendar",
"associated",
"with",
"a",
"task",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1359-L1372 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writePredecessors | private void writePredecessors(Project.Tasks.Task xml, Task mpx)
{
List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink();
List<Relation> predecessors = mpx.getPredecessors();
for (Relation rel : predecessors)
{
Integer taskUniqueID = rel.getTargetTask().getUniqueID();
list.add(writePredecessor(taskUniqueID, rel.getType(), rel.getLag()));
m_eventManager.fireRelationWrittenEvent(rel);
}
} | java | private void writePredecessors(Project.Tasks.Task xml, Task mpx)
{
List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink();
List<Relation> predecessors = mpx.getPredecessors();
for (Relation rel : predecessors)
{
Integer taskUniqueID = rel.getTargetTask().getUniqueID();
list.add(writePredecessor(taskUniqueID, rel.getType(), rel.getLag()));
m_eventManager.fireRelationWrittenEvent(rel);
}
} | [
"private",
"void",
"writePredecessors",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"xml",
",",
"Task",
"mpx",
")",
"{",
"List",
"<",
"Project",
".",
"Tasks",
".",
"Task",
".",
"PredecessorLink",
">",
"list",
"=",
"xml",
".",
"getPredecessorLink",
"(",
")... | This method writes predecessor data to an MSPDI file.
We have to deal with a slight anomaly in this method that is introduced
by the MPX file format. It would be possible for someone to create an
MPX file with both the predecessor list and the unique ID predecessor
list populated... which means that we must process both and avoid adding
duplicate predecessors. Also interesting to note is that MSP98 populates
the predecessor list, not the unique ID predecessor list, as you might
expect.
@param xml MSPDI task data
@param mpx MPX task data | [
"This",
"method",
"writes",
"predecessor",
"data",
"to",
"an",
"MSPDI",
"file",
".",
"We",
"have",
"to",
"deal",
"with",
"a",
"slight",
"anomaly",
"in",
"this",
"method",
"that",
"is",
"introduced",
"by",
"the",
"MPX",
"file",
"format",
".",
"It",
"would... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1387-L1398 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writePredecessor | private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag)
{
Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink();
link.setPredecessorUID(NumberHelper.getBigInteger(taskID));
link.setType(BigInteger.valueOf(type.getValue()));
link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files
if (lag != null && lag.getDuration() != 0)
{
double linkLag = lag.getDuration();
if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT)
{
linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration();
}
link.setLinkLag(BigInteger.valueOf((long) linkLag));
link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false));
}
else
{
// SF-329: default required to keep Powerproject happy when importing MSPDI files
link.setLinkLag(BIGINTEGER_ZERO);
link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false));
}
return (link);
} | java | private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag)
{
Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink();
link.setPredecessorUID(NumberHelper.getBigInteger(taskID));
link.setType(BigInteger.valueOf(type.getValue()));
link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files
if (lag != null && lag.getDuration() != 0)
{
double linkLag = lag.getDuration();
if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT)
{
linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration();
}
link.setLinkLag(BigInteger.valueOf((long) linkLag));
link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false));
}
else
{
// SF-329: default required to keep Powerproject happy when importing MSPDI files
link.setLinkLag(BIGINTEGER_ZERO);
link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false));
}
return (link);
} | [
"private",
"Project",
".",
"Tasks",
".",
"Task",
".",
"PredecessorLink",
"writePredecessor",
"(",
"Integer",
"taskID",
",",
"RelationType",
"type",
",",
"Duration",
"lag",
")",
"{",
"Project",
".",
"Tasks",
".",
"Task",
".",
"PredecessorLink",
"link",
"=",
"... | This method writes a single predecessor link to the MSPDI file.
@param taskID The task UID
@param type The predecessor type
@param lag The lag duration
@return A new link to be added to the MSPDI file | [
"This",
"method",
"writes",
"a",
"single",
"predecessor",
"link",
"to",
"the",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1408-L1434 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeAssignments | private void writeAssignments(Project project)
{
Project.Assignments assignments = m_factory.createProjectAssignments();
project.setAssignments(assignments);
List<Project.Assignments.Assignment> list = assignments.getAssignment();
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
list.add(writeAssignment(assignment));
}
//
// Check to see if we have any tasks that have a percent complete value
// but do not have resource assignments. If any exist, then we must
// write a dummy resource assignment record to ensure that the MSPDI
// file shows the correct percent complete amount for the task.
//
ProjectConfig config = m_projectFile.getProjectConfig();
boolean autoUniqueID = config.getAutoAssignmentUniqueID();
if (!autoUniqueID)
{
config.setAutoAssignmentUniqueID(true);
}
for (Task task : m_projectFile.getTasks())
{
double percentComplete = NumberHelper.getDouble(task.getPercentageComplete());
if (percentComplete != 0 && task.getResourceAssignments().isEmpty() == true)
{
ResourceAssignment dummy = new ResourceAssignment(m_projectFile, task);
Duration duration = task.getDuration();
if (duration == null)
{
duration = Duration.getInstance(0, TimeUnit.HOURS);
}
double durationValue = duration.getDuration();
TimeUnit durationUnits = duration.getUnits();
double actualWork = (durationValue * percentComplete) / 100;
double remainingWork = durationValue - actualWork;
dummy.setResourceUniqueID(NULL_RESOURCE_ID);
dummy.setWork(duration);
dummy.setActualWork(Duration.getInstance(actualWork, durationUnits));
dummy.setRemainingWork(Duration.getInstance(remainingWork, durationUnits));
// Without this, MS Project will mark a 100% complete milestone as 99% complete
if (percentComplete == 100 && duration.getDuration() == 0)
{
dummy.setActualFinish(task.getActualStart());
}
list.add(writeAssignment(dummy));
}
}
config.setAutoAssignmentUniqueID(autoUniqueID);
} | java | private void writeAssignments(Project project)
{
Project.Assignments assignments = m_factory.createProjectAssignments();
project.setAssignments(assignments);
List<Project.Assignments.Assignment> list = assignments.getAssignment();
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
list.add(writeAssignment(assignment));
}
//
// Check to see if we have any tasks that have a percent complete value
// but do not have resource assignments. If any exist, then we must
// write a dummy resource assignment record to ensure that the MSPDI
// file shows the correct percent complete amount for the task.
//
ProjectConfig config = m_projectFile.getProjectConfig();
boolean autoUniqueID = config.getAutoAssignmentUniqueID();
if (!autoUniqueID)
{
config.setAutoAssignmentUniqueID(true);
}
for (Task task : m_projectFile.getTasks())
{
double percentComplete = NumberHelper.getDouble(task.getPercentageComplete());
if (percentComplete != 0 && task.getResourceAssignments().isEmpty() == true)
{
ResourceAssignment dummy = new ResourceAssignment(m_projectFile, task);
Duration duration = task.getDuration();
if (duration == null)
{
duration = Duration.getInstance(0, TimeUnit.HOURS);
}
double durationValue = duration.getDuration();
TimeUnit durationUnits = duration.getUnits();
double actualWork = (durationValue * percentComplete) / 100;
double remainingWork = durationValue - actualWork;
dummy.setResourceUniqueID(NULL_RESOURCE_ID);
dummy.setWork(duration);
dummy.setActualWork(Duration.getInstance(actualWork, durationUnits));
dummy.setRemainingWork(Duration.getInstance(remainingWork, durationUnits));
// Without this, MS Project will mark a 100% complete milestone as 99% complete
if (percentComplete == 100 && duration.getDuration() == 0)
{
dummy.setActualFinish(task.getActualStart());
}
list.add(writeAssignment(dummy));
}
}
config.setAutoAssignmentUniqueID(autoUniqueID);
} | [
"private",
"void",
"writeAssignments",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"Assignments",
"assignments",
"=",
"m_factory",
".",
"createProjectAssignments",
"(",
")",
";",
"project",
".",
"setAssignments",
"(",
"assignments",
")",
";",
"List",
"<... | This method writes assignment data to an MSPDI file.
@param project Root node of the MSPDI file | [
"This",
"method",
"writes",
"assignment",
"data",
"to",
"an",
"MSPDI",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1441-L1497 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeAssignmentBaselines | private void writeAssignmentBaselines(Project.Assignments.Assignment xml, ResourceAssignment mpxj)
{
Project.Assignments.Assignment.Baseline baseline = m_factory.createProjectAssignmentsAssignmentBaseline();
boolean populated = false;
Number cost = mpxj.getBaselineCost();
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printExtendedAttributeCurrency(cost));
}
Date date = mpxj.getBaselineFinish();
if (date != null)
{
populated = true;
baseline.setFinish(DatatypeConverter.printExtendedAttributeDate(date));
}
date = mpxj.getBaselineStart();
if (date != null)
{
populated = true;
baseline.setStart(DatatypeConverter.printExtendedAttributeDate(date));
}
Duration duration = mpxj.getBaselineWork();
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber("0");
xml.getBaseline().add(baseline);
}
for (int loop = 1; loop <= 10; loop++)
{
baseline = m_factory.createProjectAssignmentsAssignmentBaseline();
populated = false;
cost = mpxj.getBaselineCost(loop);
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printExtendedAttributeCurrency(cost));
}
date = mpxj.getBaselineFinish(loop);
if (date != null)
{
populated = true;
baseline.setFinish(DatatypeConverter.printExtendedAttributeDate(date));
}
date = mpxj.getBaselineStart(loop);
if (date != null)
{
populated = true;
baseline.setStart(DatatypeConverter.printExtendedAttributeDate(date));
}
duration = mpxj.getBaselineWork(loop);
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber(Integer.toString(loop));
xml.getBaseline().add(baseline);
}
}
} | java | private void writeAssignmentBaselines(Project.Assignments.Assignment xml, ResourceAssignment mpxj)
{
Project.Assignments.Assignment.Baseline baseline = m_factory.createProjectAssignmentsAssignmentBaseline();
boolean populated = false;
Number cost = mpxj.getBaselineCost();
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printExtendedAttributeCurrency(cost));
}
Date date = mpxj.getBaselineFinish();
if (date != null)
{
populated = true;
baseline.setFinish(DatatypeConverter.printExtendedAttributeDate(date));
}
date = mpxj.getBaselineStart();
if (date != null)
{
populated = true;
baseline.setStart(DatatypeConverter.printExtendedAttributeDate(date));
}
Duration duration = mpxj.getBaselineWork();
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber("0");
xml.getBaseline().add(baseline);
}
for (int loop = 1; loop <= 10; loop++)
{
baseline = m_factory.createProjectAssignmentsAssignmentBaseline();
populated = false;
cost = mpxj.getBaselineCost(loop);
if (cost != null && cost.intValue() != 0)
{
populated = true;
baseline.setCost(DatatypeConverter.printExtendedAttributeCurrency(cost));
}
date = mpxj.getBaselineFinish(loop);
if (date != null)
{
populated = true;
baseline.setFinish(DatatypeConverter.printExtendedAttributeDate(date));
}
date = mpxj.getBaselineStart(loop);
if (date != null)
{
populated = true;
baseline.setStart(DatatypeConverter.printExtendedAttributeDate(date));
}
duration = mpxj.getBaselineWork(loop);
if (duration != null && duration.getDuration() != 0)
{
populated = true;
baseline.setWork(DatatypeConverter.printDuration(this, duration));
}
if (populated)
{
baseline.setNumber(Integer.toString(loop));
xml.getBaseline().add(baseline);
}
}
} | [
"private",
"void",
"writeAssignmentBaselines",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"xml",
",",
"ResourceAssignment",
"mpxj",
")",
"{",
"Project",
".",
"Assignments",
".",
"Assignment",
".",
"Baseline",
"baseline",
"=",
"m_factory",
".",
"createP... | Writes assignment baseline data.
@param xml MSPDI assignment
@param mpxj MPXJ assignment | [
"Writes",
"assignment",
"baseline",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1588-L1666 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeAssignmentExtendedAttributes | private void writeAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
Project.Assignments.Assignment.ExtendedAttribute attrib;
List<Project.Assignments.Assignment.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (AssignmentField mpxFieldID : getAllAssignmentExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPAssignmentField.getID(mpxFieldID) | MPPAssignmentField.ASSIGNMENT_FIELD_BASE);
attrib = m_factory.createProjectAssignmentsAssignmentExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | java | private void writeAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
Project.Assignments.Assignment.ExtendedAttribute attrib;
List<Project.Assignments.Assignment.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (AssignmentField mpxFieldID : getAllAssignmentExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPAssignmentField.getID(mpxFieldID) | MPPAssignmentField.ASSIGNMENT_FIELD_BASE);
attrib = m_factory.createProjectAssignmentsAssignmentExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | [
"private",
"void",
"writeAssignmentExtendedAttributes",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"xml",
",",
"ResourceAssignment",
"mpx",
")",
"{",
"Project",
".",
"Assignments",
".",
"Assignment",
".",
"ExtendedAttribute",
"attrib",
";",
"List",
"<",
... | This method writes extended attribute data for an assignment.
@param xml MSPDI assignment
@param mpx MPXJ assignment | [
"This",
"method",
"writes",
"extended",
"attribute",
"data",
"for",
"an",
"assignment",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1674-L1696 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.